dartfmt Project
This commit is contained in:
parent
ba76f934a8
commit
5c2efd2fd9
8 changed files with 31 additions and 30 deletions
|
|
@ -9,10 +9,14 @@ import 'package:browserloop/src/05_DirtyFlagRendering.dart';
|
|||
CanvasElement baseCanvas = new CanvasElement(width: 480, height: 480);
|
||||
|
||||
List<Example> examples = [
|
||||
Example("While Loop Example", "#while_loop", new WhileLoop(new Game(baseCanvas))),
|
||||
Example("Variable Timestep", "#variable_timestep", new VariableTimestep(new Game(baseCanvas))),
|
||||
Example("Fixed Update, Variable Render", "#fixed_variable", new FixedLoopVariableRender(new Game(baseCanvas))),
|
||||
Example("Variable Render with Dirty Flag", "#dirty_flag", new DirtyFlagRender(new Game(baseCanvas)))
|
||||
Example(
|
||||
"While Loop Example", "#while_loop", new WhileLoop(new Game(baseCanvas))),
|
||||
Example("Variable Timestep", "#variable_timestep",
|
||||
new VariableTimestep(new Game(baseCanvas))),
|
||||
Example("Fixed Update, Variable Render", "#fixed_variable",
|
||||
new FixedLoopVariableRender(new Game(baseCanvas))),
|
||||
Example("Variable Render with Dirty Flag", "#dirty_flag",
|
||||
new DirtyFlagRender(new Game(baseCanvas)))
|
||||
];
|
||||
LoopExample active;
|
||||
|
||||
|
|
@ -24,11 +28,12 @@ class Example {
|
|||
Example(this.name, this.query, this.loop);
|
||||
|
||||
CanvasElement get canvas {
|
||||
if(loop != null) return loop.game.canvas;
|
||||
if (loop != null) return loop.game.canvas;
|
||||
return new CanvasElement(width: 480, height: 480);
|
||||
}
|
||||
|
||||
set canvas(CanvasElement canvas) {
|
||||
if(loop != null) loop.game.canvas = canvas;
|
||||
if (loop != null) loop.game.canvas = canvas;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -144,9 +149,10 @@ void addControls(Example ex) {
|
|||
..max = "50"
|
||||
..value = "3"
|
||||
..step = "1"
|
||||
..onInput.listen((Event e) {
|
||||
loop.MS_PER_UPDATE = (1000 / int.parse((e.target as InputElement).value));
|
||||
}));
|
||||
..onInput.listen((Event e) {
|
||||
loop.MS_PER_UPDATE =
|
||||
(1000 / int.parse((e.target as InputElement).value));
|
||||
}));
|
||||
// querySelector('#reset').onClick.listen((e) => ex.loop.game.reset());
|
||||
// querySelector('#plus').onClick.listen((e) => _changeGrid(-5));
|
||||
// querySelector('#minus').onClick.listen((e) => _changeGrid(5));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue