From 787abc1e02c4f07f34817874902ea80e5b8db114 Mon Sep 17 00:00:00 2001 From: photonstorm Date: Fri, 1 Nov 2013 04:58:08 +0000 Subject: [PATCH] Updated debug header and added more info to the project template. --- package.json | 2 +- resources/Project Templates/Basic/Game.js | 21 ++++++++- resources/wip/sprites/orbit/1 logo.png | Bin 0 -> 5070 bytes resources/wip/sprites/orbit/2 menu.png | Bin 0 -> 3466 bytes resources/wip/sprites/orbit/3 bg.png | Bin 0 -> 1161 bytes src/Phaser.js | 1 + src/core/Game.js | 51 ++++++++++++++++++---- src/gameobjects/Sprite.js | 6 +++ 8 files changed, 71 insertions(+), 10 deletions(-) create mode 100644 resources/wip/sprites/orbit/1 logo.png create mode 100644 resources/wip/sprites/orbit/2 menu.png create mode 100644 resources/wip/sprites/orbit/3 bg.png diff --git a/package.json b/package.json index d50339e98..e301619cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Phaser", - "version": "1.1.1", + "version": "1.1.2", "description": "HTML5 game framework", "repository": { "type": "git", diff --git a/resources/Project Templates/Basic/Game.js b/resources/Project Templates/Basic/Game.js index 0339e7a8d..6190533de 100644 --- a/resources/Project Templates/Basic/Game.js +++ b/resources/Project Templates/Basic/Game.js @@ -1,7 +1,26 @@ 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. }; diff --git a/resources/wip/sprites/orbit/1 logo.png b/resources/wip/sprites/orbit/1 logo.png new file mode 100644 index 0000000000000000000000000000000000000000..879ba4ee3689247f9332abf8998156af9639f6fb GIT binary patch literal 5070 zcmb_eXHe7av;Cn+Z%Ppal#YZFq=<9~y-NT?m7dT82qI!4O^PT;Zw637dT-K;^cITr zE+7O1{!$DraP!`;cjkV$?>#g7?D?>>JI|Jx6aCmwiBSrr?4?VuG3C1wh=C47yR=pJthjJ8o)dkh1sXL|u=K z4SvULEJE{^YKDBB`*UpAm#DV`=c_?q+^3rHzlJYsr0p{d z$laSOVZB{FtLtJaAyjU;^Zj0(OIr4r{<;QNT{{^{)va7;};y zL;_ePaWj+T!~Fv$t^0~Pf^`v?Pd6+l4) zh#N<}5duhq0J}b3-WNc4I>4lP08{uQT*j~oB6cdhN}+*IRwKlULez&G1{1q`e?;fD zFw;Z(YxWr`Vx58MY!V?-^ecx$#JR*X6MuV1crij(HZt-swvNtLbi0l0ipRlW?Q#QK z?5zR-tA6OQOA&DOonU#gV9(3X{ClJ>PpNbK@iFi!dX-ur2R8>h^!}$e8lOHi%+7AC zug~aqL9FZtV5mz(r)@io;BkspxWFH;wEpA^k+2ETB0X8@96Hj^($ z0QH;@P=zY{Q3tC?I~hmEjfD>C3%iHm5WcQX2m^%5DVW38PN*alazA3Yf)iv1{-MGt z)o$z(k?2h))@k;QPSKnG%$_2v<9>4pC8=s31*1LpToj4JTXWu6ireXLPPjX?NpHpQ zarH+r8T07HOKU%XzBT1C)8;%-^t~nBseB|tndmrJ z$x}j8+;gYmNy+u5=wnB0WdP}|5RG=qhok`zF8jNx+UEM^hBMj)TpWB-H|Hp2D6fYb zcM9?(7UzMWL>yqp2>)Z!cR2T;ppWG9ZpZB2yZn|t6 z3>#7#WX@?4s%Bp@po;~cOm9lZSwc!b)j`XRBMTU%{4->S!&r3m@=8A^Puy|2?SgkL z-|}m`xtM&{Fm)6*K8VxWO5M7C6hK28!5r2bg}Bd_$x6-wO3crT2KoSH*y2B zX) z%*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+fjfX-=CdpQ*ZjW~g zwul|T(g;e8PrdO*G$|$49oFnfE9HY4FSgj!M=4TGvb>`kJ3FIu-X}_|8HyYKNNxZ69T}+1u4LrbW^p>82?jt Nps#JBRjcV7^&cU9{fGbn literal 0 HcmV?d00001 diff --git a/resources/wip/sprites/orbit/3 bg.png b/resources/wip/sprites/orbit/3 bg.png new file mode 100644 index 0000000000000000000000000000000000000000..982fe1ff114c371b29d708706890c9e98e5c52f7 GIT binary patch literal 1161 zcmeAS@N?(olHy`uVBq!ia0vp^3xN0o2Q!e|Fn|6F1_ow^0G|+76;V;3h>gBUnU!){ zVR8G+IV+By|NsC0x6L!p)MihN_E>&Gb>d9zs!YRz>yLdG%ylm=`+qq0!35SlF%17J zE8lt;ZM7G>HZOK}rNyK~-IFaJx24~k7uc6!qiMvzpv1rsYN+by6Co)ndG+xN1_3z+ z13d-?!%;LE0s|NVpFUk)uw-^=ToEwk&)B9e1Ely%Tq8}1>Gc1Cr6pWTh@HD@=LKiZqc@Zj}< zon`0u3cvp;zlO1)!SuoJ1G|c?I3k!C7+;@zsgS_Sz_P}Ad2@p)gTRJ&bNHC9F*pn# d1wX1EFsr1e%kb*-z6FLSgQu&X%Q~loCIDKT@1p', + DEV_VERSION: '1.1.2', GAMES: [], AUTO: 0, CANVAS: 1, diff --git a/src/core/Game.js b/src/core/Game.js index 61c43260f..ca1a06353 100644 --- a/src/core/Game.js +++ b/src/core/Game.js @@ -306,14 +306,7 @@ Phaser.Game.prototype = { this.load.onLoadComplete.add(this.loadComplete, this); - if (this.renderType == Phaser.CANVAS) - { - console.log('%cPhaser initialized. Rendering to Canvas.', 'color: #ffff33; background: #000000'); - } - else - { - console.log('%cPhaser initialized. Rendering to WebGL.', 'color: #ffff33; background: #000000'); - } + this.showDebugHeader(); this.isRunning = true; 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. * diff --git a/src/gameobjects/Sprite.js b/src/gameobjects/Sprite.js index 6126606e9..252308b45 100644 --- a/src/gameobjects/Sprite.js +++ b/src/gameobjects/Sprite.js @@ -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 default is 0,0 this means the textures origin is the top left