mirror of
https://github.com/wassname/phaser.git
synced 2026-09-09 11:28:47 +08:00
More work on the Invaders game.
This commit is contained in:
+8
-8
@@ -11,16 +11,16 @@
|
||||
* @class Phaser.Game
|
||||
* @classdesc This is where the magic happens. The Game object is the heart of your game,
|
||||
* providing quick access to common functions and handling the boot process.
|
||||
* <p>"Hell, there are no rules here - we're trying to accomplish something."</p><br>
|
||||
* "Hell, there are no rules here - we're trying to accomplish something."
|
||||
* Thomas A. Edison
|
||||
* @constructor
|
||||
* @param {number} width - The width of your game in game pixels.
|
||||
* @param {number} height - The height of your game in game pixels.
|
||||
* @param {number} renderer -Which renderer to use (canvas or webgl)
|
||||
* @param {HTMLElement} parent -The Games DOM parent.
|
||||
* @param {Description} state - Description.
|
||||
* @param {boolean} transparent - Use a transparent canvas background or not.
|
||||
* @param {boolean} antialias - Anti-alias graphics.
|
||||
* @param {number} [width=800] - The width of your game in game pixels.
|
||||
* @param {number} [height=600] - The height of your game in game pixels.
|
||||
* @param {number} [renderer=Phaser.AUTO] - Which renderer to use (canvas or webgl)
|
||||
* @param {HTMLElement} [parent=''] - The Games DOM parent.
|
||||
* @param {any} [state=null] - Description.
|
||||
* @param {boolean} [transparent=false] - Use a transparent canvas background or not.
|
||||
* @param {boolean} [antialias=true] - Anti-alias graphics.
|
||||
*/
|
||||
Phaser.Game = function (width, height, renderer, parent, state, transparent, antialias) {
|
||||
|
||||
|
||||
+12
-4
@@ -152,7 +152,7 @@ Phaser.Stage.prototype = {
|
||||
|
||||
/**
|
||||
* @name Phaser.Stage#backgroundColor
|
||||
* @property {number|string} paused - Gets and sets the background color of the stage. The color can be given as a number: 0xff0000 or a hex string: '#ff0000'
|
||||
* @property {number|string} backgroundColor - Gets and sets the background color of the stage. The color can be given as a number: 0xff0000 or a hex string: '#ff0000'
|
||||
*/
|
||||
Object.defineProperty(Phaser.Stage.prototype, "backgroundColor", {
|
||||
|
||||
@@ -164,12 +164,20 @@ Object.defineProperty(Phaser.Stage.prototype, "backgroundColor", {
|
||||
|
||||
this._backgroundColor = color;
|
||||
|
||||
if (typeof color === 'string')
|
||||
if (this.game.renderType == Phaser.CANVAS)
|
||||
{
|
||||
color = Phaser.Color.hexToRGB(color);
|
||||
// Set it directly, this allows us to use rgb alpha values in Canvas mode.
|
||||
this._stage.backgroundColorString = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (typeof color === 'string')
|
||||
{
|
||||
color = Phaser.Color.hexToRGB(color);
|
||||
}
|
||||
|
||||
this._stage.setBackgroundColor(color);
|
||||
this._stage.setBackgroundColor(color);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user