Updated debug header and added more info to the project template.

This commit is contained in:
photonstorm 2013-11-01 04:58:08 +00:00
parent 581d637663
commit 787abc1e02
8 changed files with 71 additions and 10 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "Phaser", "name": "Phaser",
"version": "1.1.1", "version": "1.1.2",
"description": "HTML5 game framework", "description": "HTML5 game framework",
"repository": { "repository": {
"type": "git", "type": "git",

View file

@ -1,7 +1,26 @@
BasicGame.Game = function (game) { BasicGame.Game = function (game) {
// Honestly, just about anything could go here. // When a State is added to Phaser it automatically has the following properties set on it, even if they already exist:
this.game; // a reference to the currently running game
this.add; // used to add sprites, text, groups, etc
this.camera; // a reference to the game camera
this.cache; // the game cache
this.input; // the global input manager (you can access this.input.keyboard, this.input.mouse, as well from it)
this.load; // for preloading assets
this.math; // lots of useful common math operations
this.sound; // the sound manager - add a sound, play one, set-up markers, etc
this.stage; // the game stage
this.time; // the clock
this.tweens; // the tween manager
this.world; // the game world
this.particles; // the particle manager
this.physics; // the physics manager
this.rnd; // the repeatable random number generator
// You can use any of these from any function within this State.
// But do consider them as being 'reserved words', i.e. don't create a property for your own game called "world" or you'll over-write the world reference.
}; };

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -10,6 +10,7 @@
var Phaser = Phaser || { var Phaser = Phaser || {
VERSION: '<%= version %>', VERSION: '<%= version %>',
DEV_VERSION: '1.1.2',
GAMES: [], GAMES: [],
AUTO: 0, AUTO: 0,
CANVAS: 1, CANVAS: 1,

View file

@ -306,14 +306,7 @@ Phaser.Game.prototype = {
this.load.onLoadComplete.add(this.loadComplete, this); this.load.onLoadComplete.add(this.loadComplete, this);
if (this.renderType == Phaser.CANVAS) this.showDebugHeader();
{
console.log('%cPhaser initialized. Rendering to Canvas.', 'color: #ffff33; background: #000000');
}
else
{
console.log('%cPhaser initialized. Rendering to WebGL.', 'color: #ffff33; background: #000000');
}
this.isRunning = true; this.isRunning = true;
this._loadComplete = false; this._loadComplete = false;
@ -325,6 +318,48 @@ Phaser.Game.prototype = {
}, },
/**
* Displays a Phaser version debug header in the console.
*
* @method Phaser.Game#showDebugHeader
* @protected
*/
showDebugHeader: function () {
var v = Phaser.DEV_VERSION;
var r = 'Canvas';
var a = 'HTML Audio';
if (this.renderType == Phaser.WEBGL)
{
r = 'WebGL';
}
if (this.device.webAudio)
{
a = 'WebAudio';
}
if (this.device.chrome)
{
var args = [
'%c %c %c Phaser v' + v + ' - Renderer: ' + r + ' - Audio: ' + a + ' %c %c ',
'background: #00bff3',
'background: #0072bc',
'color: #ffffff; background: #003471',
'background: #0072bc',
'background: #00bff3'
];
console.log.apply(console, args);
}
else
{
console.log('Phaser v' + v + ' - Renderer: ' + r + ' - Audio: ' + a);
}
},
/** /**
* Checks if the device is capable of using the requested renderer and sets it up or an alternative if not. * Checks if the device is capable of using the requested renderer and sets it up or an alternative if not.
* *

View file

@ -142,6 +142,12 @@ Phaser.Sprite = function (game, x, y, key, frame) {
} }
} }
/**
* The rectangular area from the texture that will be rendered.
* @property {Phaser.Rectangle} textureRegion
*/
this.textureRegion = new Phaser.Rectangle(this.texture.frame.x, this.texture.frame.y, this.texture.frame.width, this.texture.frame.height);
/** /**
* The anchor sets the origin point of the texture. * The anchor sets the origin point of the texture.
* The default is 0,0 this means the textures origin is the top left * The default is 0,0 this means the textures origin is the top left