Examples - Add Dirty Flag Rendering

This commit is contained in:
Marty Oehme 2018-07-20 18:01:49 +02:00
parent fbb3e01b4a
commit 8284e82dcf
4 changed files with 65 additions and 7 deletions

View file

@ -14,11 +14,7 @@
<div id="while_loop"></div>
<div id="variable_timestep"></div>
<div id="fixed_variable"></div>
<!--<button id="basic_start">start</button>-->
<!--<button id="basic_stop">stop</button>-->
<!--<button id="basic_reset">reset</button>-->
<!--<button id="basic_plus">+</button>-->
<!--<button id="basic_minus">-</button>-->
<div id="dirty_flag"></div>
</body>
</html>

View file

@ -4,11 +4,13 @@ import 'package:browserloop/game/LoopExample.dart';
import 'package:browserloop/src/03-VariableTimestep.dart';
import 'package:browserloop/src/04-FixedLoopVariableRender.dart';
import 'package:browserloop/src/02-AnimationFrameWhile.dart';
import 'package:browserloop/src/05_DirtyFlagRendering.dart';
List<Example> examples = [
Example("While Loop Example", "#while_loop"),
Example("Fixed Update, Variable Render", "#fixed_variable"),
Example("Variable Timestep", "#variable_timestep")
Example("Variable Timestep", "#variable_timestep"),
Example("Variable Render with Dirty Flag", "#dirty_flag")
];
LoopExample active;
@ -91,6 +93,9 @@ void activate(MouseEvent e) {
case "#variable_timestep":
ex.loop = new VariableTimestep(new Game(ex.canvas));
break;
case "#dirty_flag":
ex.loop = new DirtyFlagRender(new Game(ex.canvas));
break;
}
if (ex.canvas != ex.loop.game.canvas) ex.loop.game.canvas = ex.canvas;
querySelector(ex.query).append(new ButtonElement()