Skip to content

Commit e6d520f

Browse files
committed
Removed the coreUpdate Game loop stuff and reverted to previous method.
1 parent 274fd4a commit e6d520f

2 files changed

Lines changed: 32 additions & 96 deletions

File tree

examples/p2 physics/body click.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var bunny;
1717
var block;
1818
var wizball;
1919

20-
var result = '';
20+
var result = 'Click a body';
2121

2222
function create() {
2323

src/core/Game.js

Lines changed: 31 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -211,16 +211,6 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
211211
*/
212212
this.particles = null;
213213

214-
/**
215-
* @property {function} update - The current update method being called.
216-
*/
217-
this.update = this.coreUpdate;
218-
219-
/**
220-
* @property {function} render - The current render method being called.
221-
*/
222-
this.render = this.coreRender;
223-
224214
/**
225215
* @property {boolean} stepping - Enable core loop stepping with Game.enableStep().
226216
* @default
@@ -544,11 +534,7 @@ Phaser.Game.prototype = {
544534
this.context = null;
545535
}
546536

547-
if (this.renderType === Phaser.HEADLESS)
548-
{
549-
this.render = this.headlessRender;
550-
}
551-
else
537+
if (this.renderType !== Phaser.HEADLESS)
552538
{
553539
this.stage.smoothed = this.antialias;
554540

@@ -558,96 +544,54 @@ Phaser.Game.prototype = {
558544

559545
},
560546

561-
/**
562-
* The core game loop.
563-
*
564-
* @method Phaser.Game#coreUpdate
565-
* @protected
566-
* @param {number} time - The current time as provided by RequestAnimationFrame.
567-
*/
568-
coreUpdate: function (time) {
569-
570-
this.time.update(time);
571-
572-
this.debug.preUpdate();
573-
this.state.preUpdate();
574-
this.plugins.preUpdate();
575-
this.stage.preUpdate();
576-
577-
this.stage.update();
578-
this.tweens.update();
579-
this.sound.update();
580-
this.input.update();
581-
this.state.update();
582-
this.physics.update();
583-
this.particles.update();
584-
this.plugins.update();
585-
586-
this.stage.postUpdate();
587-
this.plugins.postUpdate();
588-
589-
this.render();
590-
591-
},
592-
593547
/**
594548
* The core game loop when in a paused state.
595549
*
596-
* @method Phaser.Game#pausedUpdate
550+
* @method Phaser.Game#update
597551
* @protected
598552
* @param {number} time - The current time as provided by RequestAnimationFrame.
599553
*/
600-
pausedUpdate: function (time) {
601-
602-
this.debug.preUpdate();
603-
604-
this.render();
605-
606-
},
554+
update: function (time) {
607555

608-
/**
609-
* The core game loop when in a Stepped state.
610-
*
611-
* @method Phaser.Game#steppedUpdate
612-
* @protected
613-
* @param {number} time - The current time as provided by RequestAnimationFrame.
614-
*/
615-
steppedUpdate: function (time) {
616-
617-
if (!this.pendingStep)
556+
if (!this._paused && !this.pendingStep)
618557
{
619558
if (this.stepping)
620559
{
621560
this.pendingStep = true;
622561
}
623562

624-
this.coreUpdate();
625-
}
563+
this.time.update(time);
626564

627-
},
565+
this.debug.preUpdate();
566+
this.state.preUpdate();
567+
this.plugins.preUpdate();
568+
this.stage.preUpdate();
628569

629-
/**
630-
* The core render loop.
631-
*
632-
* @method Phaser.Game#coreRender
633-
* @protected
634-
*/
635-
coreRender: function () {
570+
this.stage.update();
571+
this.tweens.update();
572+
this.sound.update();
573+
this.input.update();
574+
this.state.update();
575+
this.physics.update();
576+
this.particles.update();
577+
this.plugins.update();
636578

637-
this.renderer.render(this.stage);
638-
this.plugins.render();
639-
this.state.render();
640-
this.plugins.postRender();
579+
this.stage.postUpdate();
580+
this.plugins.postUpdate();
581+
}
582+
else
583+
{
584+
this.debug.preUpdate();
585+
}
641586

642-
},
587+
if (this.renderType != Phaser.HEADLESS)
588+
{
589+
this.renderer.render(this.stage);
590+
this.plugins.render();
591+
this.state.render();
592+
this.plugins.postRender();
593+
}
643594

644-
/**
645-
* The empty headless render loop.
646-
*
647-
* @method Phaser.Game#headlessRender
648-
* @protected
649-
*/
650-
headlessRender: function () {
651595
},
652596

653597
/**
@@ -662,8 +606,6 @@ Phaser.Game.prototype = {
662606
this.pendingStep = false;
663607
this.stepCount = 0;
664608

665-
this.update = this.steppedUpdate;
666-
667609
},
668610

669611
/**
@@ -676,8 +618,6 @@ Phaser.Game.prototype = {
676618
this.stepping = false;
677619
this.pendingStep = false;
678620

679-
this.update = this.coreUpdate;
680-
681621
},
682622

683623
/**
@@ -733,7 +673,6 @@ Phaser.Game.prototype = {
733673
this.time.gamePaused(time);
734674
this.sound.setMute();
735675
this.onPause.dispatch(this);
736-
this.update = this.pausedUpdate;
737676
}
738677

739678
},
@@ -754,7 +693,6 @@ Phaser.Game.prototype = {
754693
this.input.reset();
755694
this.sound.unsetMute();
756695
this.onResume.dispatch(this);
757-
this.update = this.coreUpdate;
758696
}
759697

760698
}
@@ -786,7 +724,6 @@ Object.defineProperty(Phaser.Game.prototype, "paused", {
786724
this.sound.mute = true;
787725
this.time.gamePaused();
788726
this.onPause.dispatch(this);
789-
this.update = this.pausedUpdate;
790727
}
791728
}
792729
else
@@ -799,7 +736,6 @@ Object.defineProperty(Phaser.Game.prototype, "paused", {
799736
this.sound.mute = false;
800737
this.time.gameResumed();
801738
this.onResume.dispatch(this);
802-
this.update = this.coreUpdate;
803739
}
804740
}
805741

0 commit comments

Comments
 (0)