mirror of
https://github.com/wassname/phaser.git
synced 2026-08-11 11:23:06 +08:00
DebugUtils converted, re-name spaced the Input classes and started on Camera culling.
This commit is contained in:
+30
-1
@@ -231,6 +231,30 @@ Phaser.Game.prototype = {
|
||||
*/
|
||||
device: null,
|
||||
|
||||
/**
|
||||
* A handy reference to world.camera
|
||||
* @type {Phaser.Camera}
|
||||
*/
|
||||
camera: null,
|
||||
|
||||
/**
|
||||
* A handy reference to renderer.view
|
||||
* @type {HTMLCanvasElement}
|
||||
*/
|
||||
canvas: null,
|
||||
|
||||
/**
|
||||
* A handy reference to renderer.context (only set for CANVAS games)
|
||||
* @type {Context}
|
||||
*/
|
||||
context: null,
|
||||
|
||||
/**
|
||||
* A set of useful debug utilities
|
||||
* @type {Phaser.Utils.Debug}
|
||||
*/
|
||||
debug: null,
|
||||
|
||||
/**
|
||||
* Initialize engine sub modules and start the game.
|
||||
* @param parent {string} ID of parent Dom element.
|
||||
@@ -275,12 +299,12 @@ Phaser.Game.prototype = {
|
||||
// this.physics = new Phaser.Physics.PhysicsManager(this);
|
||||
this.plugins = new Phaser.PluginManager(this, this);
|
||||
this.net = new Phaser.Net(this);
|
||||
this.debug = new Phaser.Utils.Debug(this);
|
||||
|
||||
this.load.onLoadComplete.add(this.loadComplete, this);
|
||||
|
||||
this.world.boot();
|
||||
this.state.boot();
|
||||
// this.stage.boot();
|
||||
this.input.boot();
|
||||
|
||||
if (this.renderType == Phaser.CANVAS)
|
||||
@@ -311,6 +335,8 @@ Phaser.Game.prototype = {
|
||||
this.renderType = Phaser.CANVAS;
|
||||
this.renderer = new PIXI.CanvasRenderer(this.width, this.height, null, this.transparent);
|
||||
Phaser.Canvas.setSmoothingEnabled(this.renderer.context, this.antialias);
|
||||
this.canvas = this.renderer.view;
|
||||
this.context = this.renderer.context;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -321,6 +347,8 @@ Phaser.Game.prototype = {
|
||||
{
|
||||
// They must have requested WebGL and their browser supports it
|
||||
this.renderer = new PIXI.WebGLRenderer(this.width, this.height, null, this.transparent, this.antialias);
|
||||
this.canvas = this.renderer.view;
|
||||
this.context = null;
|
||||
}
|
||||
|
||||
Phaser.Canvas.addToDOM(this.renderer.view, this.parent, true);
|
||||
@@ -358,6 +386,7 @@ Phaser.Game.prototype = {
|
||||
this.plugins.update();
|
||||
|
||||
this.renderer.render(this.world._stage);
|
||||
this.state.render();
|
||||
|
||||
this.plugins.postRender();
|
||||
|
||||
|
||||
+10
-12
@@ -365,15 +365,6 @@ Phaser.StateManager.prototype = {
|
||||
|
||||
},
|
||||
|
||||
loadRender: function () {
|
||||
|
||||
if (this.onLoadRenderCallback)
|
||||
{
|
||||
this.onLoadRenderCallback.call(this.callbackContext);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
update: function () {
|
||||
|
||||
if (this._created && this.onUpdateCallback)
|
||||
@@ -401,9 +392,16 @@ Phaser.StateManager.prototype = {
|
||||
|
||||
render: function () {
|
||||
|
||||
if (this.onRenderCallback)
|
||||
{
|
||||
this.onRenderCallback.call(this.callbackContext);
|
||||
if (this._created && this.onRenderCallback)
|
||||
{
|
||||
this.onRenderCallback.call(this.callbackContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.onLoadRenderCallback)
|
||||
{
|
||||
this.onLoadRenderCallback.call(this.callbackContext);
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
@@ -24,6 +24,7 @@ Phaser.World.prototype = {
|
||||
boot: function () {
|
||||
|
||||
this.camera = new Phaser.Camera(this.game, 0, 0, 0, this.game.width, this.game.height);
|
||||
this.game.camera = this.camera;
|
||||
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user