Skip to content

Commit e49d45e

Browse files
committed
Experimenting with new MainLoop + position interpolation.
1 parent 265501b commit e49d45e

8 files changed

Lines changed: 431 additions & 6 deletions

File tree

build/config.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@
134134
<script src="$path/src/core/FlexGrid.js"></script>
135135
<script src="$path/src/core/FlexLayer.js"></script>
136136
<script src="$path/src/core/ScaleManager.js"></script>
137+
<script src="$path/src/core/MainLoop.js"></script>
137138
<script src="$path/src/core/Game.js"></script>
138139
139140
<script src="$path/src/input/Input.js"></script>
@@ -296,10 +297,10 @@
296297
}
297298

298299
echo <<<EOL
299-
<script src="$path/src/system/Device.js"></script>
300-
<script src="$path/src/system/DOM.js"></script>
301-
<script src="$path/src/system/Canvas.js"></script>
302-
<script src="$path/src/system/RequestAnimationFrame.js"></script>
300+
<script src="$path/src/utils/Device.js"></script>
301+
<script src="$path/src/utils/DOM.js"></script>
302+
<script src="$path/src/utils/Canvas.js"></script>
303+
<script src="$path/src/utils/RequestAnimationFrame.js"></script>
303304
304305
<script src="$path/src/math/Math.js"></script>
305306
<script src="$path/src/math/RandomDataGenerator.js"></script>

src/core/Game.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,17 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
144144
*/
145145
this.isRunning = false;
146146

147+
/**
148+
* @property {Phaser.MainLoop} mainloop - Automatically handles the core game loop via requestAnimationFrame or setTimeout.
149+
* @protected
150+
*/
151+
this.mainloop = null;
152+
147153
/**
148154
* @property {Phaser.RequestAnimationFrame} raf - Automatically handles the core game loop via requestAnimationFrame or setTimeout
149155
* @protected
150156
*/
151-
this.raf = null;
157+
// this.raf = null;
152158

153159
/**
154160
* @property {Phaser.GameObjectFactory} add - Reference to the Phaser.GameObjectFactory.
@@ -583,6 +589,7 @@ Phaser.Game.prototype = {
583589

584590
this.isRunning = true;
585591

592+
/*
586593
if (this.config && this.config['forceSetTimeOut'])
587594
{
588595
this.raf = new Phaser.RequestAnimationFrame(this, this.config['forceSetTimeOut']);
@@ -593,6 +600,7 @@ Phaser.Game.prototype = {
593600
}
594601
595602
this._kickstart = true;
603+
*/
596604

597605
if (window['focus'])
598606
{
@@ -602,7 +610,11 @@ Phaser.Game.prototype = {
602610
}
603611
}
604612

605-
this.raf.start();
613+
this.mainloop = new Phaser.MainLoop(this);
614+
615+
this.mainloop.start();
616+
617+
// this.raf.start();
606618

607619
},
608620

0 commit comments

Comments
 (0)