Examples - Fix Variable Timestep not Starting

This commit is contained in:
Marty Oehme 2018-07-20 17:46:18 +02:00
parent 5c4e3a55b7
commit 8d6f1d8812

View file

@ -1,15 +1,3 @@
//void main() {
// double lastTime = performance.now();
// while(true) {
// double currentTime = performance.now();
// double delta = currentTime - lastTime;
//
// update(delta);
//
// lastTime = currentTime;
// }
//}
import 'dart:html'; import 'dart:html';
import 'package:browserloop/game/Game.dart'; import 'package:browserloop/game/Game.dart';
import 'package:browserloop/game/LoopExample.dart'; import 'package:browserloop/game/LoopExample.dart';
@ -25,6 +13,7 @@ class VariableTimestep implements LoopExample {
Stopwatch elapsed = new Stopwatch(); Stopwatch elapsed = new Stopwatch();
VariableTimestep(Game this.game) { VariableTimestep(Game this.game) {
window.requestAnimationFrame(eventloop);
} }
void eventloop(num time) { void eventloop(num time) {