mirror of
https://github.com/photonstorm/phaser
synced 2024-11-10 15:14:47 +00:00
Updating for TypeScript 0.9.1, part 1.
This commit is contained in:
parent
73745e5720
commit
df32190db8
86 changed files with 583 additions and 587 deletions
|
@ -58,7 +58,7 @@ module Phaser {
|
|||
* @param renderCallback {function} Render callback invoked when render default screen.
|
||||
* @param destroyCallback {function} Destroy callback invoked when state is destroyed.
|
||||
*/
|
||||
constructor(callbackContext, parent?: string = '', width?: number = 800, height?: number = 600, preloadCallback = null, createCallback = null, updateCallback = null, renderCallback = null, destroyCallback = null) {
|
||||
constructor(callbackContext, parent: string = '', width: number = 800, height: number = 600, preloadCallback = null, createCallback = null, updateCallback = null, renderCallback = null, destroyCallback = null) {
|
||||
|
||||
this.id = Phaser.GAMES.push(this) - 1;
|
||||
|
||||
|
@ -86,19 +86,19 @@ module Phaser {
|
|||
/**
|
||||
* Game loop trigger wrapper.
|
||||
*/
|
||||
public _raf: RequestAnimationFrame;
|
||||
public _raf: Phaser.RequestAnimationFrame;
|
||||
|
||||
/**
|
||||
* Whether load complete loading or not.
|
||||
* @type {boolean}
|
||||
*/
|
||||
private _loadComplete: bool = false;
|
||||
private _loadComplete: boolean = false;
|
||||
|
||||
/**
|
||||
* Game is paused?
|
||||
* @type {boolean}
|
||||
*/
|
||||
private _paused: bool = false;
|
||||
private _paused: boolean = false;
|
||||
|
||||
/**
|
||||
* The state to be switched to in the next frame.
|
||||
|
@ -110,7 +110,7 @@ module Phaser {
|
|||
* The PluginManager for the Game
|
||||
* @type {PluginManager}
|
||||
*/
|
||||
public plugins: PluginManager;
|
||||
public plugins: Phaser.PluginManager;
|
||||
|
||||
/**
|
||||
* The current State object (defaults to null)
|
||||
|
@ -193,103 +193,103 @@ module Phaser {
|
|||
* Reference to the GameObject Factory.
|
||||
* @type {GameObjectFactory}
|
||||
*/
|
||||
public add: GameObjectFactory;
|
||||
public add: Phaser.GameObjectFactory;
|
||||
|
||||
/**
|
||||
* Reference to the assets cache.
|
||||
* @type {Cache}
|
||||
*/
|
||||
public cache: Cache;
|
||||
public cache: Phaser.Cache;
|
||||
|
||||
/**
|
||||
* Reference to the input manager
|
||||
* @type {Input}
|
||||
*/
|
||||
public input: InputManager;
|
||||
public input: Phaser.InputManager;
|
||||
|
||||
/**
|
||||
* Reference to the assets loader.
|
||||
* @type {Loader}
|
||||
*/
|
||||
public load: Loader;
|
||||
public load: Phaser.Loader;
|
||||
|
||||
/**
|
||||
* Reference to the math helper.
|
||||
* @type {GameMath}
|
||||
*/
|
||||
public math: GameMath;
|
||||
public math: Phaser.GameMath;
|
||||
|
||||
/**
|
||||
* Reference to the network class.
|
||||
* @type {Net}
|
||||
*/
|
||||
public net: Net;
|
||||
public net: Phaser.Net;
|
||||
|
||||
/**
|
||||
* Reference to the sound manager.
|
||||
* @type {SoundManager}
|
||||
*/
|
||||
public sound: SoundManager;
|
||||
public sound: Phaser.SoundManager;
|
||||
|
||||
/**
|
||||
* Reference to the stage.
|
||||
* @type {Stage}
|
||||
*/
|
||||
public stage: Stage;
|
||||
public stage: Phaser.Stage;
|
||||
|
||||
/**
|
||||
* Reference to game clock.
|
||||
* @type {Time}
|
||||
*/
|
||||
public time: TimeManager;
|
||||
public time: Phaser.TimeManager;
|
||||
|
||||
/**
|
||||
* Reference to the tween manager.
|
||||
* @type {TweenManager}
|
||||
*/
|
||||
public tweens: TweenManager;
|
||||
public tweens: Phaser.TweenManager;
|
||||
|
||||
/**
|
||||
* Reference to the world.
|
||||
* @type {World}
|
||||
*/
|
||||
public world: World;
|
||||
public world: Phaser.World;
|
||||
|
||||
/**
|
||||
* Reference to the physics manager.
|
||||
* @type {Physics.Manager}
|
||||
*/
|
||||
public physics: Physics.Manager;
|
||||
public physics: Phaser.Physics.Manager;
|
||||
|
||||
/**
|
||||
* Instance of repeatable random data generator helper.
|
||||
* @type {RandomDataGenerator}
|
||||
*/
|
||||
public rnd: RandomDataGenerator;
|
||||
public rnd: Phaser.RandomDataGenerator;
|
||||
|
||||
/**
|
||||
* Contains device information and capabilities.
|
||||
* @type {Device}
|
||||
*/
|
||||
public device: Device;
|
||||
public device: Phaser.Device;
|
||||
|
||||
/**
|
||||
* Reference to the render manager
|
||||
* @type {RenderManager}
|
||||
*/
|
||||
public renderer: IRenderer;
|
||||
public renderer: Phaser.IRenderer;
|
||||
|
||||
/**
|
||||
* Whether the game engine is booted, aka available.
|
||||
* @type {boolean}
|
||||
*/
|
||||
public isBooted: bool = false;
|
||||
public isBooted: boolean = false;
|
||||
|
||||
/**
|
||||
* Is game running or paused?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public isRunning: bool = false;
|
||||
public isRunning: boolean = false;
|
||||
|
||||
/**
|
||||
* Initialize engine sub modules and start the game.
|
||||
|
@ -316,21 +316,21 @@ module Phaser {
|
|||
this.onPause = new Phaser.Signal;
|
||||
this.onResume = new Phaser.Signal;
|
||||
|
||||
this.device = new Device();
|
||||
this.net = new Net(this);
|
||||
this.math = new GameMath(this);
|
||||
this.stage = new Stage(this, parent, width, height);
|
||||
this.world = new World(this, width, height);
|
||||
this.add = new GameObjectFactory(this);
|
||||
this.cache = new Cache(this);
|
||||
this.load = new Loader(this);
|
||||
this.time = new TimeManager(this);
|
||||
this.tweens = new TweenManager(this);
|
||||
this.input = new InputManager(this);
|
||||
this.sound = new SoundManager(this);
|
||||
this.rnd = new RandomDataGenerator([(Date.now() * Math.random()).toString()]);
|
||||
this.physics = new Physics.Manager(this);
|
||||
this.plugins = new PluginManager(this, this);
|
||||
this.device = new Phaser.Device();
|
||||
this.net = new Phaser.Net(this);
|
||||
this.math = new Phaser.GameMath(this);
|
||||
this.stage = new Phaser.Stage(this, parent, width, height);
|
||||
this.world = new Phaser.World(this, width, height);
|
||||
this.add = new Phaser.GameObjectFactory(this);
|
||||
this.cache = new Phaser.Cache(this);
|
||||
this.load = new Phaser.Loader(this);
|
||||
this.time = new Phaser.TimeManager(this);
|
||||
this.tweens = new Phaser.TweenManager(this);
|
||||
this.input = new Phaser.InputManager(this);
|
||||
this.sound = new Phaser.SoundManager(this);
|
||||
this.rnd = new Phaser.RandomDataGenerator([(Date.now() * Math.random()).toString()]);
|
||||
this.physics = new Phaser.Physics.Manager(this);
|
||||
this.plugins = new Phaser.PluginManager(this, this);
|
||||
|
||||
this.load.onLoadComplete.addOnce(this.loadComplete, this);
|
||||
|
||||
|
@ -343,9 +343,9 @@ module Phaser {
|
|||
this.isBooted = true;
|
||||
|
||||
// Set-up some static helper references
|
||||
DebugUtils.game = this;
|
||||
ColorUtils.game = this;
|
||||
DebugUtils.context = this.stage.context;
|
||||
Phaser.DebugUtils.game = this;
|
||||
Phaser.ColorUtils.game = this;
|
||||
Phaser.DebugUtils.context = this.stage.context;
|
||||
|
||||
// Display the default game screen?
|
||||
if (this.onPreloadCallback == null && this.onCreateCallback == null && this.onUpdateCallback == null && this.onRenderCallback == null && this._pendingState == null)
|
||||
|
@ -504,9 +504,9 @@ module Phaser {
|
|||
|
||||
}
|
||||
|
||||
public setRenderer(type: number) {
|
||||
public setRenderer(renderer: number) {
|
||||
|
||||
switch (type)
|
||||
switch (renderer)
|
||||
{
|
||||
case Phaser.Types.RENDERER_AUTO_DETECT:
|
||||
this.renderer = new Phaser.Renderer.Headless.HeadlessRenderer(this);
|
||||
|
@ -546,7 +546,7 @@ module Phaser {
|
|||
* @param [clearWorld] {boolean} clear everything in the world? (Default to true)
|
||||
* @param [clearCache] {boolean} clear asset cache? (Default to false and ONLY available when clearWorld=true)
|
||||
*/
|
||||
public switchState(state, clearWorld: bool = true, clearCache: bool = false) {
|
||||
public switchState(state, clearWorld: boolean = true, clearCache: boolean = false) {
|
||||
|
||||
if (this.isBooted == false)
|
||||
{
|
||||
|
@ -675,11 +675,11 @@ module Phaser {
|
|||
|
||||
}
|
||||
|
||||
public get paused(): bool {
|
||||
public get paused(): boolean {
|
||||
return this._paused;
|
||||
}
|
||||
|
||||
public set paused(value: bool) {
|
||||
public set paused(value: boolean) {
|
||||
|
||||
if (value == true && this._paused == false)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
|
@ -47,14 +47,14 @@
|
|||
<TypeScriptIncludeComments>true</TypeScriptIncludeComments>
|
||||
<TypeScriptSourceMap>false</TypeScriptSourceMap>
|
||||
<TypeScriptOutFile>../build/phaser.js</TypeScriptOutFile>
|
||||
<TypeScriptGeneratesDeclarations>true</TypeScriptGeneratesDeclarations>
|
||||
<TypeScriptGeneratesDeclarations>false</TypeScriptGeneratesDeclarations>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
|
||||
<TypeScriptTarget>ES5</TypeScriptTarget>
|
||||
<TypeScriptIncludeComments>false</TypeScriptIncludeComments>
|
||||
<TypeScriptSourceMap>false</TypeScriptSourceMap>
|
||||
<TypeScriptOutFile>../build/phaser.js</TypeScriptOutFile>
|
||||
<TypeScriptGeneratesDeclarations>true</TypeScriptGeneratesDeclarations>
|
||||
<TypeScriptGeneratesDeclarations>false</TypeScriptGeneratesDeclarations>
|
||||
</PropertyGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
|
@ -83,12 +83,12 @@
|
|||
<Content Include="core\PluginManager.js">
|
||||
<DependentUpon>PluginManager.ts</DependentUpon>
|
||||
</Content>
|
||||
<TypeScriptCompile Include="display\Texture.ts" />
|
||||
<TypeScriptCompile Include="display\DynamicTexture.ts" />
|
||||
<TypeScriptCompile Include="display\CSS3Filters.ts" />
|
||||
<Content Include="display\CSS3Filters.js">
|
||||
<DependentUpon>CSS3Filters.ts</DependentUpon>
|
||||
</Content>
|
||||
<TypeScriptCompile Include="display\Texture.ts" />
|
||||
<TypeScriptCompile Include="display\DynamicTexture.ts" />
|
||||
<Content Include="display\DynamicTexture.js">
|
||||
<DependentUpon>DynamicTexture.ts</DependentUpon>
|
||||
</Content>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/**
|
||||
* Phaser
|
||||
* www.phaser.io
|
||||
*
|
||||
* v1.0.0 - August 12th 2013
|
||||
*
|
||||
|
|
|
@ -122,7 +122,7 @@ module Phaser {
|
|||
* Clear the whole stage every frame? (Default to true)
|
||||
* @type {boolean}
|
||||
*/
|
||||
public clear: bool = true;
|
||||
public clear: boolean = true;
|
||||
|
||||
/**
|
||||
* Canvas element used by engine.
|
||||
|
@ -141,14 +141,14 @@ module Phaser {
|
|||
* (Default to false, aka always use PauseScreen)
|
||||
* @type {boolean}
|
||||
*/
|
||||
public disablePauseScreen: bool = false;
|
||||
public disablePauseScreen: boolean = false;
|
||||
|
||||
/**
|
||||
* Do not use boot screen when engine starts?
|
||||
* (Default to false, aka always use BootScreen)
|
||||
* @type {boolean}
|
||||
*/
|
||||
public disableBootScreen: bool = false;
|
||||
public disableBootScreen: boolean = false;
|
||||
|
||||
/**
|
||||
* Offset from this stage to the canvas element.
|
||||
|
@ -173,7 +173,7 @@ module Phaser {
|
|||
* If set to true the game will never pause when the browser or browser tab loses focuses
|
||||
* @type {boolean}
|
||||
*/
|
||||
public disableVisibilityChange: bool = false;
|
||||
public disableVisibilityChange: boolean = false;
|
||||
|
||||
/**
|
||||
* Stage boot
|
||||
|
@ -259,7 +259,7 @@ module Phaser {
|
|||
|
||||
}
|
||||
|
||||
public enableOrientationCheck(forceLandscape: bool, forcePortrait: bool, imageKey?: string = '') {
|
||||
public enableOrientationCheck(forceLandscape: boolean, forcePortrait: boolean, imageKey: string = '') {
|
||||
|
||||
this.scale.forceLandscape = forceLandscape;
|
||||
this.scale.forcePortrait = forcePortrait;
|
||||
|
@ -317,7 +317,7 @@ module Phaser {
|
|||
/**
|
||||
* Get the DOM offset values of the given element
|
||||
*/
|
||||
public getOffset(element, populateOffset: bool = true): Point {
|
||||
public getOffset(element, populateOffset: boolean = true): Point {
|
||||
|
||||
var box = element.getBoundingClientRect();
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ module Phaser {
|
|||
* @param context The context in which the callbacks will be called
|
||||
* @returns {boolean} true if the objects overlap, otherwise false.
|
||||
*/
|
||||
//public collide(objectOrGroup1 = null, objectOrGroup2 = null, notifyCallback = null, context? = this.game.callbackContext): bool {
|
||||
//public collide(objectOrGroup1 = null, objectOrGroup2 = null, notifyCallback = null, context? = this.game.callbackContext): boolean {
|
||||
// return this.collision.overlap(objectOrGroup1, objectOrGroup2, notifyCallback, Collision.separate, context);
|
||||
//}
|
||||
|
||||
|
|
|
@ -95,25 +95,25 @@ module Phaser {
|
|||
* Flag used to allow GameObjects to collide with a ceiling
|
||||
* @type {number}
|
||||
*/
|
||||
static CEILING: number = Types.UP;
|
||||
static CEILING: number = Phaser.Types.UP;
|
||||
|
||||
/**
|
||||
* Flag used to allow GameObjects to collide with a floor
|
||||
* @type {number}
|
||||
*/
|
||||
static FLOOR: number = Types.DOWN;
|
||||
static FLOOR: number = Phaser.Types.DOWN;
|
||||
|
||||
/**
|
||||
* Flag used to allow GameObjects to collide with a wall (same as LEFT+RIGHT)
|
||||
* @type {number}
|
||||
*/
|
||||
static WALL: number = Types.LEFT | Types.RIGHT;
|
||||
static WALL: number = Phaser.Types.LEFT | Phaser.Types.RIGHT;
|
||||
|
||||
/**
|
||||
* Flag used to allow GameObjects to collide on any face
|
||||
* @type {number}
|
||||
*/
|
||||
static ANY: number = Types.LEFT | Types.RIGHT | Types.UP | Types.DOWN;
|
||||
static ANY: number = Phaser.Types.LEFT | Phaser.Types.RIGHT | Phaser.Types.UP | Phaser.Types.DOWN;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ module Phaser {
|
|||
* @param height {number} New height of the world.
|
||||
* @param [updateCameraBounds] {boolean} Update camera bounds automatically or not. Default to true.
|
||||
*/
|
||||
public setSize(width: number, height: number, updateCameraBounds: bool = true) {
|
||||
public setSize(width: number, height: number, updateCameraBounds: boolean = true) {
|
||||
|
||||
this.bounds.width = width;
|
||||
this.bounds.height = height;
|
||||
|
|
|
@ -21,7 +21,7 @@ module Phaser {
|
|||
* @param delay {number} Time between frames in ms.
|
||||
* @param looped {boolean} Whether or not the animation is looped or just plays once.
|
||||
*/
|
||||
constructor(game: Game, parent: Sprite, frameData: FrameData, name: string, frames, delay: number, looped: bool) {
|
||||
constructor(game: Game, parent: Sprite, frameData: FrameData, name: string, frames, delay: number, looped: boolean) {
|
||||
|
||||
this.game = game;
|
||||
this._parent = parent;
|
||||
|
@ -97,19 +97,19 @@ module Phaser {
|
|||
* Whether or not this animation finished playing.
|
||||
* @type {boolean}
|
||||
*/
|
||||
public isFinished: bool;
|
||||
public isFinished: boolean;
|
||||
|
||||
/**
|
||||
* Whethor or not this animation is currently playing.
|
||||
* @type {boolean}
|
||||
*/
|
||||
public isPlaying: bool;
|
||||
public isPlaying: boolean;
|
||||
|
||||
/**
|
||||
* Whether or not the animation is looped.
|
||||
* @type {boolean}
|
||||
*/
|
||||
public looped: bool;
|
||||
public looped: boolean;
|
||||
|
||||
/**
|
||||
* Time between frames in ms.
|
||||
|
@ -152,18 +152,14 @@ module Phaser {
|
|||
* @param frameRate {number} FrameRate you want to specify instead of using default.
|
||||
* @param loop {boolean} Whether or not the animation is looped or just plays once.
|
||||
*/
|
||||
public play(frameRate?: number = null, loop?: bool) {
|
||||
public play(frameRate: number = null, loop: boolean = false) {
|
||||
|
||||
if (frameRate !== null)
|
||||
{
|
||||
this.delay = 1000 / frameRate;
|
||||
}
|
||||
|
||||
if (loop !== undefined)
|
||||
{
|
||||
this.looped = loop;
|
||||
}
|
||||
|
||||
this.looped = loop;
|
||||
this.isPlaying = true;
|
||||
this.isFinished = false;
|
||||
|
||||
|
@ -209,7 +205,7 @@ module Phaser {
|
|||
/**
|
||||
* Update animation frames.
|
||||
*/
|
||||
public update(): bool {
|
||||
public update(): boolean {
|
||||
|
||||
if (this.isPlaying == true && this.game.time.now >= this._timeNextFrame)
|
||||
{
|
||||
|
|
|
@ -63,7 +63,7 @@ module Phaser.Components {
|
|||
* animation then set this to false, otherwise leave it set to true.
|
||||
* @type {boolean}
|
||||
*/
|
||||
public autoUpdateBounds: bool = true;
|
||||
public autoUpdateBounds: boolean = true;
|
||||
|
||||
/**
|
||||
* Keeps track of the current animation being played.
|
||||
|
@ -96,7 +96,7 @@ module Phaser.Components {
|
|||
* @param useNumericIndex {boolean} Use number indexes instead of string indexes?
|
||||
* @return {Animation} The Animation that was created
|
||||
*/
|
||||
public add(name: string, frames: any[] = null, frameRate: number = 60, loop: bool = false, useNumericIndex: bool = true): Animation {
|
||||
public add(name: string, frames: any[] = null, frameRate: number = 60, loop: boolean = false, useNumericIndex: boolean = true): Animation {
|
||||
|
||||
if (this._frameData == null)
|
||||
{
|
||||
|
@ -144,7 +144,7 @@ module Phaser.Components {
|
|||
* @param useNumericIndex {boolean} Does these frames use number indexes or string indexes?
|
||||
* @return {boolean} True if they're valid, otherwise return false.
|
||||
*/
|
||||
private validateFrames(frames: any[], useNumericIndex: bool): bool {
|
||||
private validateFrames(frames: any[], useNumericIndex: boolean): boolean {
|
||||
|
||||
for (var i = 0; i < frames.length; i++)
|
||||
{
|
||||
|
@ -174,7 +174,7 @@ module Phaser.Components {
|
|||
* @param frameRate {number} FrameRate you want to specify instead of using default.
|
||||
* @param loop {boolean} Whether or not the animation is looped or just plays once.
|
||||
*/
|
||||
public play(name: string, frameRate?: number = null, loop?: bool): Animation {
|
||||
public play(name: string, frameRate: number = null, loop: boolean = false): Animation {
|
||||
|
||||
if (this._anims[name])
|
||||
{
|
||||
|
|
|
@ -22,8 +22,6 @@ module Phaser {
|
|||
*/
|
||||
constructor(x: number, y: number, width: number, height: number, name: string) {
|
||||
|
||||
//console.log('Creating Frame', name, 'x', x, 'y', y, 'width', width, 'height', height);
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
|
@ -73,7 +71,7 @@ module Phaser {
|
|||
/**
|
||||
* Rotated? (not yet implemented)
|
||||
*/
|
||||
public rotated: bool = false;
|
||||
public rotated: boolean = false;
|
||||
|
||||
/**
|
||||
* Either cw or ccw, rotation is always 90 degrees.
|
||||
|
@ -84,7 +82,7 @@ module Phaser {
|
|||
* Was it trimmed when packed?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public trimmed: bool;
|
||||
public trimmed: boolean;
|
||||
|
||||
// The coordinates of the trimmed sprite inside the original sprite
|
||||
|
||||
|
@ -127,7 +125,7 @@ module Phaser {
|
|||
/**
|
||||
* Set rotation of this frame. (Not yet supported!)
|
||||
*/
|
||||
public setRotation(rotated: bool, rotationDirection: string) {
|
||||
public setRotation(rotated: boolean, rotationDirection: string) {
|
||||
// Not yet supported
|
||||
}
|
||||
|
||||
|
@ -141,7 +139,7 @@ module Phaser {
|
|||
* @param destWidth {number} Destination draw width.
|
||||
* @param destHeight {number} Destination draw height.
|
||||
*/
|
||||
public setTrim(trimmed: bool, actualWidth: number, actualHeight: number, destX: number, destY: number, destWidth: number, destHeight: number) {
|
||||
public setTrim(trimmed: boolean, actualWidth: number, actualHeight: number, destX: number, destY: number, destWidth: number, destHeight: number) {
|
||||
|
||||
//console.log('setTrim', trimmed, 'aw', actualWidth, 'ah', actualHeight, 'dx', destX, 'dy', destY, 'dw', destWidth, 'dh', destHeight);
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ module Phaser {
|
|||
* @param name {string} Name of the frame you want to check.
|
||||
* @return {boolean} True if frame with given name found, otherwise return false.
|
||||
*/
|
||||
public checkFrameName(name: string): bool {
|
||||
public checkFrameName(name: string): boolean {
|
||||
|
||||
|
||||
if (this._frameNames[name] == null)
|
||||
|
@ -110,7 +110,7 @@ module Phaser {
|
|||
* @param [output] {Frame[]} result will be added into this array.
|
||||
* @return {Frame[]} Ranges of specific frames in an array.
|
||||
*/
|
||||
public getFrameRange(start: number, end: number, output?: Frame[] = []): Frame[] {
|
||||
public getFrameRange(start: number, end: number, output: Frame[] = []): Frame[] {
|
||||
|
||||
for (var i = start; i <= end; i++)
|
||||
{
|
||||
|
@ -126,7 +126,7 @@ module Phaser {
|
|||
* @param [output] {number[]} result will be added into this array.
|
||||
* @return {number[]} Indexes of specific frames in an array.
|
||||
*/
|
||||
public getFrameIndexes(output?: number[] = []): number[] {
|
||||
public getFrameIndexes(output: number[] = []): number[] {
|
||||
|
||||
output.length = 0;
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ module Phaser {
|
|||
/**
|
||||
* A boolean representing if the Camera has been modified in any way via a scale, rotate, flip or skew.
|
||||
*/
|
||||
public modified: bool = false;
|
||||
public modified: boolean = false;
|
||||
|
||||
/**
|
||||
* Sprite moving inside this Rectangle will not cause camera moving.
|
||||
|
@ -160,7 +160,7 @@ module Phaser {
|
|||
* Whether this camera is visible or not. (default is true)
|
||||
* @type {boolean}
|
||||
*/
|
||||
public visible: bool = true;
|
||||
public visible: boolean = true;
|
||||
|
||||
/**
|
||||
* The z value of this Camera. Cameras are rendered in z-index order by the Renderer.
|
||||
|
@ -184,7 +184,7 @@ module Phaser {
|
|||
*
|
||||
* @param object {Sprite/Group} The object to check.
|
||||
*/
|
||||
public isHidden(object): bool {
|
||||
public isHidden(object): boolean {
|
||||
return object.texture.isHidden(this);
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ module Phaser {
|
|||
* @param target {Sprite} The object you want the camera to track. Set to null to not follow anything.
|
||||
* @param [style] {number} Leverage one of the existing "deadzone" presets. If you use a custom deadzone, ignore this parameter and manually specify the deadzone after calling follow().
|
||||
*/
|
||||
public follow(target: Sprite, style?: number = Phaser.Types.CAMERA_FOLLOW_LOCKON) {
|
||||
public follow(target: Sprite, style: number = Phaser.Types.CAMERA_FOLLOW_LOCKON) {
|
||||
|
||||
this._target = target;
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ module Phaser {
|
|||
* @param id {number} ID of the camera you want to remove.
|
||||
* @returns {boolean} True if successfully removed the camera, otherwise return false.
|
||||
*/
|
||||
public removeCamera(id: number): bool {
|
||||
public removeCamera(id: number): boolean {
|
||||
|
||||
for (var c = 0; c < this._cameras.length; c++)
|
||||
{
|
||||
|
@ -148,7 +148,7 @@ module Phaser {
|
|||
|
||||
}
|
||||
|
||||
public swap(camera1: Camera, camera2: Camera, sort?: bool = true): bool {
|
||||
public swap(camera1: Camera, camera2: Camera, sort: boolean = true): boolean {
|
||||
|
||||
if (camera1.ID == camera2.ID)
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@ module Phaser {
|
|||
|
||||
export class Group {
|
||||
|
||||
constructor(game: Game, maxSize?: number = 0) {
|
||||
constructor(game: Game, maxSize: number = 0) {
|
||||
|
||||
this.game = game;
|
||||
this.type = Phaser.Types.GROUP;
|
||||
|
@ -108,17 +108,17 @@ module Phaser {
|
|||
/**
|
||||
* A boolean representing if the Group has been modified in any way via a scale, rotate, flip or skew.
|
||||
*/
|
||||
public modified: bool = false;
|
||||
public modified: boolean = false;
|
||||
|
||||
/**
|
||||
* If this Group exists or not. Can be set to false to skip certain loop checks.
|
||||
*/
|
||||
public exists: bool;
|
||||
public exists: boolean;
|
||||
|
||||
/**
|
||||
* Controls if this Group (and all of its contents) are rendered or skipped during the core game loop.
|
||||
*/
|
||||
public visible: bool;
|
||||
public visible: boolean;
|
||||
|
||||
/**
|
||||
* Use with <code>sort()</code> to sort in ascending order.
|
||||
|
@ -419,7 +419,7 @@ module Phaser {
|
|||
* @param [frame] {string|number} If the sprite uses an image from a texture atlas or sprite sheet you can pass the frame here. Either a number for a frame ID or a string for a frame name.
|
||||
* @returns {Sprite} The newly created sprite object.
|
||||
*/
|
||||
public addNewSprite(x: number, y: number, key?: string = '', frame? = null): Sprite {
|
||||
public addNewSprite(x: number, y: number, key: string = '', frame = null): Sprite {
|
||||
return <Sprite> this.add(new Sprite(this.game, x, y, key, frame));
|
||||
}
|
||||
|
||||
|
@ -524,7 +524,7 @@ module Phaser {
|
|||
*
|
||||
* @return {Basic} The removed object.
|
||||
*/
|
||||
public remove(object, splice: bool = false) {
|
||||
public remove(object, splice: boolean = false) {
|
||||
|
||||
//console.log('removing from group: ', object.name);
|
||||
|
||||
|
@ -594,7 +594,7 @@ module Phaser {
|
|||
*
|
||||
* @return {Basic} True if the two objects successfully swapped position.
|
||||
*/
|
||||
public swap(child1, child2, sort?: bool = true): bool {
|
||||
public swap(child1, child2, sort: boolean = true): boolean {
|
||||
|
||||
if (child1.group.ID != this.ID || child2.group.ID != this.ID || child1 === child2)
|
||||
{
|
||||
|
@ -615,7 +615,7 @@ module Phaser {
|
|||
|
||||
}
|
||||
|
||||
public bringToTop(child): bool {
|
||||
public bringToTop(child): boolean {
|
||||
|
||||
//console.log('bringToTop', child.name,'current z', child.z);
|
||||
var oldZ = child.z;
|
||||
|
@ -753,7 +753,7 @@ module Phaser {
|
|||
* @param {Object} Value The value you want to assign to that variable.
|
||||
* @param {boolean} Recurse Default value is true, meaning if <code>setAll()</code> encounters a member that is a group, it will call <code>setAll()</code> on that group rather than modifying its variable.
|
||||
*/
|
||||
public setAll(variableName: string, value: Object, recurse: bool = true) {
|
||||
public setAll(variableName: string, value: Object, recurse: boolean = true) {
|
||||
|
||||
this._i = 0;
|
||||
|
||||
|
@ -782,7 +782,7 @@ module Phaser {
|
|||
* @param {string} FunctionName The string representation of the function you want to call on each object, for example "kill()" or "init()".
|
||||
* @param {boolean} Recurse Default value is true, meaning if <code>callAll()</code> encounters a member that is a group, it will call <code>callAll()</code> on that group rather than calling the group's function.
|
||||
*/
|
||||
public callAll(functionName: string, recurse: bool = true) {
|
||||
public callAll(functionName: string, recurse: boolean = true) {
|
||||
|
||||
this._i = 0;
|
||||
|
||||
|
@ -808,7 +808,7 @@ module Phaser {
|
|||
* @param {function} callback
|
||||
* @param {boolean} recursive
|
||||
*/
|
||||
public forEach(callback, recursive: bool = false) {
|
||||
public forEach(callback, recursive: boolean = false) {
|
||||
|
||||
this._i = 0;
|
||||
|
||||
|
@ -836,7 +836,7 @@ module Phaser {
|
|||
* @param {function} callback
|
||||
* @param {boolean} recursive
|
||||
*/
|
||||
public forEachAlive(context, callback, recursive: bool = false) {
|
||||
public forEachAlive(context, callback, recursive: boolean = false) {
|
||||
|
||||
this._i = 0;
|
||||
|
||||
|
|
|
@ -39,23 +39,23 @@ module Phaser {
|
|||
/**
|
||||
* Controls whether preUpdate, update or postUpdate are called
|
||||
*/
|
||||
public active: bool;
|
||||
public active: boolean;
|
||||
|
||||
/**
|
||||
* Controls whether preRender, render or postRender are called
|
||||
*/
|
||||
public visible: bool;
|
||||
public visible: boolean;
|
||||
|
||||
/**
|
||||
* Quick access booleans to avoid having to do a function existence check during tight inner loops
|
||||
*/
|
||||
public hasPreUpdate: bool;
|
||||
public hasUpdate: bool;
|
||||
public hasPostUpdate: bool;
|
||||
public hasPreUpdate: boolean;
|
||||
public hasUpdate: boolean;
|
||||
public hasPostUpdate: boolean;
|
||||
|
||||
public hasPreRender: bool;
|
||||
public hasRender: bool;
|
||||
public hasPostRender: bool;
|
||||
public hasPreRender: boolean;
|
||||
public hasRender: boolean;
|
||||
public hasPostRender: boolean;
|
||||
|
||||
/**
|
||||
* Pre-update is called at the start of the update cycle, before any other updates have taken place.
|
||||
|
|
|
@ -54,7 +54,7 @@ module Phaser {
|
|||
*/
|
||||
public add(plugin):any {
|
||||
|
||||
var result: bool = false;
|
||||
var result: boolean = false;
|
||||
|
||||
// Prototype?
|
||||
if (typeof plugin === 'function')
|
||||
|
|
|
@ -43,20 +43,20 @@ module Phaser {
|
|||
* already dispatched before.
|
||||
* @type boolean
|
||||
*/
|
||||
public memorize: bool = false;
|
||||
public memorize: boolean = false;
|
||||
|
||||
/**
|
||||
* @type boolean
|
||||
* @private
|
||||
*/
|
||||
private _shouldPropagate: bool = true;
|
||||
private _shouldPropagate: boolean = true;
|
||||
|
||||
/**
|
||||
* If Signal is active and should broadcast events.
|
||||
* <p><strong>IMPORTANT:</strong> Setting this property during a dispatch will only affect the next dispatch, if you want to stop the propagation of a signal use `halt()` instead.</p>
|
||||
* @type boolean
|
||||
*/
|
||||
public active: bool = true;
|
||||
public active: boolean = true;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -81,7 +81,7 @@ module Phaser {
|
|||
* @return {SignalBinding}
|
||||
* @private
|
||||
*/
|
||||
private _registerListener(listener, isOnce: bool, listenerContext, priority: number): SignalBinding {
|
||||
private _registerListener(listener, isOnce: boolean, listenerContext, priority: number): SignalBinding {
|
||||
|
||||
var prevIndex: number = this._indexOfListener(listener, listenerContext);
|
||||
var binding: SignalBinding;
|
||||
|
@ -161,7 +161,7 @@ module Phaser {
|
|||
* @param {Object} [context]
|
||||
* @return {boolean} if Signal has the specified listener.
|
||||
*/
|
||||
public has(listener, context?: any = null): bool {
|
||||
public has(listener, context: any = null): boolean {
|
||||
|
||||
return this._indexOfListener(listener, context) !== -1;
|
||||
|
||||
|
@ -174,7 +174,7 @@ module Phaser {
|
|||
* @param {Number} [priority] The priority level of the event listener. Listeners with higher priority will be executed before listeners with lower priority. Listeners with same priority level will be executed at the same order as they were added. (default = 0)
|
||||
* @return {SignalBinding} An Object representing the binding between the Signal and listener.
|
||||
*/
|
||||
public add(listener, listenerContext?: any = null, priority?: number = 0): SignalBinding {
|
||||
public add(listener, listenerContext: any = null, priority: number = 0): SignalBinding {
|
||||
|
||||
this.validateListener(listener, 'add');
|
||||
|
||||
|
@ -189,7 +189,7 @@ module Phaser {
|
|||
* @param {Number} [priority] The priority level of the event listener. Listeners with higher priority will be executed before listeners with lower priority. Listeners with same priority level will be executed at the same order as they were added. (default = 0)
|
||||
* @return {SignalBinding} An Object representing the binding between the Signal and listener.
|
||||
*/
|
||||
public addOnce(listener, listenerContext?: any = null, priority?: number = 0): SignalBinding {
|
||||
public addOnce(listener, listenerContext: any = null, priority: number = 0): SignalBinding {
|
||||
|
||||
this.validateListener(listener, 'addOnce');
|
||||
|
||||
|
@ -203,7 +203,7 @@ module Phaser {
|
|||
* @param {Object} [context] Execution context (since you can add the same handler multiple times if executing in a different context).
|
||||
* @return {Function} Listener handler function.
|
||||
*/
|
||||
public remove(listener, context?: any = null) {
|
||||
public remove(listener, context: any = null) {
|
||||
|
||||
this.validateListener(listener, 'remove');
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ module Phaser {
|
|||
* @param {Object} [listenerContext] Context on which listener will be executed (object that should represent the `this` variable inside listener function).
|
||||
* @param {Number} [priority] The priority level of the event listener. (default = 0).
|
||||
*/
|
||||
constructor(signal: Signal, listener, isOnce: bool, listenerContext, priority?: number = 0) {
|
||||
constructor(signal: Signal, listener, isOnce: boolean, listenerContext, priority: number = 0) {
|
||||
|
||||
this._listener = listener;
|
||||
this._isOnce = isOnce;
|
||||
|
@ -49,7 +49,7 @@ module Phaser {
|
|||
* @type boolean
|
||||
* @private
|
||||
*/
|
||||
private _isOnce: bool;
|
||||
private _isOnce: boolean;
|
||||
|
||||
/**
|
||||
* Context on which listener will be executed (object that should represent the `this` variable inside listener function).
|
||||
|
@ -76,7 +76,7 @@ module Phaser {
|
|||
* If binding is active and should be executed.
|
||||
* @type boolean
|
||||
*/
|
||||
public active: bool = true;
|
||||
public active: boolean = true;
|
||||
|
||||
/**
|
||||
* Default parameters passed to listener during `Signal.dispatch` and `SignalBinding.execute`. (curried parameters)
|
||||
|
@ -90,7 +90,7 @@ module Phaser {
|
|||
* @param {Array} [paramsArr] Array of parameters that should be passed to the listener
|
||||
* @return {*} Value returned by the listener.
|
||||
*/
|
||||
public execute(paramsArr?: any[]) {
|
||||
public execute(paramsArr: any[]) {
|
||||
|
||||
var handlerReturn;
|
||||
var params;
|
||||
|
@ -125,7 +125,7 @@ module Phaser {
|
|||
/**
|
||||
* @return {Boolean} `true` if binding is still bound to the signal and have a listener.
|
||||
*/
|
||||
public isBound(): bool {
|
||||
public isBound(): boolean {
|
||||
|
||||
return (!!this._signal && !!this._listener);
|
||||
|
||||
|
@ -134,7 +134,7 @@ module Phaser {
|
|||
/**
|
||||
* @return {boolean} If SignalBinding will only be executed once.
|
||||
*/
|
||||
public isOnce(): bool {
|
||||
public isOnce(): boolean {
|
||||
|
||||
return this._isOnce;
|
||||
|
||||
|
|
|
@ -45,11 +45,11 @@ module Phaser.Display {
|
|||
}
|
||||
|
||||
/**
|
||||
* Applies a Gaussian blur to the DOM element. The value of ‘radius’ defines the value of the standard deviation to the Gaussian function,
|
||||
* Applies a Gaussian blur to the DOM element. The value of 'radius' defines the value of the standard deviation to the Gaussian function,
|
||||
* or how many pixels on the screen blend into each other, so a larger value will create more blur.
|
||||
* If no parameter is provided, then a value 0 is used. The parameter is specified as a CSS length, but does not accept percentage values.
|
||||
*/
|
||||
public set blur(radius?: number = 0) {
|
||||
public set blur(radius: number) {
|
||||
this.setFilter('_blur', 'blur', radius, 'px');
|
||||
}
|
||||
|
||||
|
@ -58,11 +58,11 @@ module Phaser.Display {
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts the input image to grayscale. The value of ‘amount’ defines the proportion of the conversion.
|
||||
* Converts the input image to grayscale. The value of 'amount' defines the proportion of the conversion.
|
||||
* A value of 100% is completely grayscale. A value of 0% leaves the input unchanged.
|
||||
* Values between 0% and 100% are linear multipliers on the effect. If the ‘amount’ parameter is missing, a value of 100% is used.
|
||||
* Values between 0% and 100% are linear multipliers on the effect. If the 'amount' parameter is missing, a value of 100% is used.
|
||||
*/
|
||||
public set grayscale(amount?: number = 100) {
|
||||
public set grayscale(amount: number) {
|
||||
this.setFilter('_grayscale', 'grayscale', amount, '%');
|
||||
}
|
||||
|
||||
|
@ -71,11 +71,11 @@ module Phaser.Display {
|
|||
}
|
||||
|
||||
/**
|
||||
* Converts the input image to sepia. The value of ‘amount’ defines the proportion of the conversion.
|
||||
* Converts the input image to sepia. The value of 'amount' defines the proportion of the conversion.
|
||||
* A value of 100% is completely sepia. A value of 0 leaves the input unchanged.
|
||||
* Values between 0% and 100% are linear multipliers on the effect. If the ‘amount’ parameter is missing, a value of 100% is used.
|
||||
* Values between 0% and 100% are linear multipliers on the effect. If the 'amount' parameter is missing, a value of 100% is used.
|
||||
*/
|
||||
public set sepia(amount?: number = 100) {
|
||||
public set sepia(amount: number) {
|
||||
this.setFilter('_sepia', 'sepia', amount, '%');
|
||||
}
|
||||
|
||||
|
@ -87,9 +87,9 @@ module Phaser.Display {
|
|||
* Applies a linear multiplier to input image, making it appear more or less bright.
|
||||
* A value of 0% will create an image that is completely black. A value of 100% leaves the input unchanged.
|
||||
* Other values are linear multipliers on the effect. Values of an amount over 100% are allowed, providing brighter results.
|
||||
* If the ‘amount’ parameter is missing, a value of 100% is used.
|
||||
* If the 'amount' parameter is missing, a value of 100% is used.
|
||||
*/
|
||||
public set brightness(amount?: number = 100) {
|
||||
public set brightness(amount: number) {
|
||||
this.setFilter('_brightness', 'brightness', amount, '%');
|
||||
}
|
||||
|
||||
|
@ -100,9 +100,9 @@ module Phaser.Display {
|
|||
/**
|
||||
* Adjusts the contrast of the input. A value of 0% will create an image that is completely black.
|
||||
* A value of 100% leaves the input unchanged. Values of amount over 100% are allowed, providing results with less contrast.
|
||||
* If the ‘amount’ parameter is missing, a value of 100% is used.
|
||||
* If the 'amount' parameter is missing, a value of 100% is used.
|
||||
*/
|
||||
public set contrast(amount?: number = 100) {
|
||||
public set contrast(amount: number) {
|
||||
this.setFilter('_contrast', 'contrast', amount, '%');
|
||||
}
|
||||
|
||||
|
@ -111,11 +111,11 @@ module Phaser.Display {
|
|||
}
|
||||
|
||||
/**
|
||||
* Applies a hue rotation on the input image. The value of ‘angle’ defines the number of degrees around the color circle
|
||||
* the input samples will be adjusted. A value of 0deg leaves the input unchanged. If the ‘angle’ parameter is missing,
|
||||
* Applies a hue rotation on the input image. The value of 'angle' defines the number of degrees around the color circle
|
||||
* the input samples will be adjusted. A value of 0deg leaves the input unchanged. If the 'angle' parameter is missing,
|
||||
* a value of 0deg is used. Maximum value is 360deg.
|
||||
*/
|
||||
public set hueRotate(angle?: number = 0) {
|
||||
public set hueRotate(angle: number) {
|
||||
this.setFilter('_hueRotate', 'hue-rotate', angle, 'deg');
|
||||
}
|
||||
|
||||
|
@ -124,11 +124,11 @@ module Phaser.Display {
|
|||
}
|
||||
|
||||
/**
|
||||
* Inverts the samples in the input image. The value of ‘amount’ defines the proportion of the conversion.
|
||||
* Inverts the samples in the input image. The value of 'amount' defines the proportion of the conversion.
|
||||
* A value of 100% is completely inverted. A value of 0% leaves the input unchanged.
|
||||
* Values between 0% and 100% are linear multipliers on the effect. If the ‘amount’ parameter is missing, a value of 100% is used.
|
||||
* Values between 0% and 100% are linear multipliers on the effect. If the 'amount' parameter is missing, a value of 100% is used.
|
||||
*/
|
||||
public set invert(value?: number = 100) {
|
||||
public set invert(value: number) {
|
||||
this.setFilter('_invert', 'invert', value, '%');
|
||||
}
|
||||
|
||||
|
@ -137,13 +137,13 @@ module Phaser.Display {
|
|||
}
|
||||
|
||||
/**
|
||||
* Applies transparency to the samples in the input image. The value of ‘amount’ defines the proportion of the conversion.
|
||||
* Applies transparency to the samples in the input image. The value of 'amount' defines the proportion of the conversion.
|
||||
* A value of 0% is completely transparent. A value of 100% leaves the input unchanged.
|
||||
* Values between 0% and 100% are linear multipliers on the effect. This is equivalent to multiplying the input image samples by amount.
|
||||
* If the ‘amount’ parameter is missing, a value of 100% is used.
|
||||
* If the 'amount' parameter is missing, a value of 100% is used.
|
||||
* This function is similar to the more established opacity property; the difference is that with filters, some browsers provide hardware acceleration for better performance.
|
||||
*/
|
||||
public set opacity(value?: number = 100) {
|
||||
public set opacity(value: number) {
|
||||
this.setFilter('_opacity', 'opacity', value, '%');
|
||||
}
|
||||
|
||||
|
@ -152,12 +152,12 @@ module Phaser.Display {
|
|||
}
|
||||
|
||||
/**
|
||||
* Saturates the input image. The value of ‘amount’ defines the proportion of the conversion.
|
||||
* Saturates the input image. The value of 'amount' defines the proportion of the conversion.
|
||||
* A value of 0% is completely un-saturated. A value of 100% leaves the input unchanged.
|
||||
* Other values are linear multipliers on the effect. Values of amount over 100% are allowed, providing super-saturated results.
|
||||
* If the ‘amount’ parameter is missing, a value of 100% is used.
|
||||
* If the 'amount' parameter is missing, a value of 100% is used.
|
||||
*/
|
||||
public set saturate(value?: number = 100) {
|
||||
public set saturate(value: number) {
|
||||
this.setFilter('_saturate', 'saturate', value, '%');
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ module Phaser {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public pasteImage(key: string, frame?: number = -1, destX?: number = 0, destY?: number = 0, destWidth?: number = null, destHeight?: number = null) {
|
||||
public pasteImage(key: string, frame: number = -1, destX: number = 0, destY: number = 0, destWidth: number = null, destHeight: number = null) {
|
||||
|
||||
var texture = null;
|
||||
var frameData;
|
||||
|
@ -243,7 +243,7 @@ module Phaser {
|
|||
|
||||
}
|
||||
|
||||
// TODO - Add in support for: alphaBitmapData: BitmapData = null, alphaPoint: Point = null, mergeAlpha: bool = false
|
||||
// TODO - Add in support for: alphaBitmapData: BitmapData = null, alphaPoint: Point = null, mergeAlpha: boolean = false
|
||||
/**
|
||||
* Copy pixel from another DynamicTexture to this texture.
|
||||
* @param sourceTexture {DynamicTexture} Source texture object.
|
||||
|
@ -303,7 +303,7 @@ module Phaser {
|
|||
* @param x {number} The X coordinate to render on the stage to (given in screen coordinates, not world)
|
||||
* @param y {number} The Y coordinate to render on the stage to (given in screen coordinates, not world)
|
||||
*/
|
||||
public render(x?: number = 0, y?: number = 0) {
|
||||
public render(x: number = 0, y: number = 0) {
|
||||
|
||||
if (this.globalCompositeOperation)
|
||||
{
|
||||
|
|
|
@ -76,7 +76,7 @@ module Phaser.Display {
|
|||
* The load status of the texture image.
|
||||
* @type {boolean}
|
||||
*/
|
||||
public loaded: bool = false;
|
||||
public loaded: boolean = false;
|
||||
|
||||
/**
|
||||
* An Array of Cameras to which this texture won't render
|
||||
|
@ -90,7 +90,7 @@ module Phaser.Display {
|
|||
* for some effects it can be handy.
|
||||
* @type {boolean}
|
||||
*/
|
||||
public opaque: bool = false;
|
||||
public opaque: boolean = false;
|
||||
|
||||
/**
|
||||
* Opacity of the Sprite texture where 1 is opaque (default) and 0 is fully transparent.
|
||||
|
@ -140,7 +140,7 @@ module Phaser.Display {
|
|||
* If renderRotation is false then the object can still rotate but it will never be rendered rotated.
|
||||
* @type {boolean}
|
||||
*/
|
||||
public renderRotation: bool = true;
|
||||
public renderRotation: boolean = true;
|
||||
|
||||
/**
|
||||
* The direction the animation frame is facing (can be Phaser.Types.RIGHT, LEFT, UP, DOWN).
|
||||
|
@ -152,19 +152,19 @@ module Phaser.Display {
|
|||
* Flip the graphic horizontally (defaults to false)
|
||||
* @type {boolean}
|
||||
*/
|
||||
public flippedX: bool = false;
|
||||
public flippedX: boolean = false;
|
||||
|
||||
/**
|
||||
* Flip the graphic vertically (defaults to false)
|
||||
* @type {boolean}
|
||||
*/
|
||||
public flippedY: bool = false;
|
||||
public flippedY: boolean = false;
|
||||
|
||||
/**
|
||||
* Is the texture a DynamicTexture?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public isDynamic: bool = false;
|
||||
public isDynamic: boolean = false;
|
||||
|
||||
/**
|
||||
* The crop rectangle allows you to control which part of the sprite texture is rendered without distorting it.
|
||||
|
@ -191,7 +191,7 @@ module Phaser.Display {
|
|||
/**
|
||||
* Returns true if this texture is hidden from rendering to the given camera, otherwise false.
|
||||
*/
|
||||
public isHidden(camera: Camera): bool {
|
||||
public isHidden(camera: Camera): boolean {
|
||||
|
||||
if (this._blacklist && this.cameraBlacklist.indexOf(camera.ID) !== -1)
|
||||
{
|
||||
|
@ -222,7 +222,7 @@ module Phaser.Display {
|
|||
* Updates the texture being used to render the Sprite.
|
||||
* Called automatically by SpriteUtils.loadTexture and SpriteUtils.loadDynamicTexture.
|
||||
*/
|
||||
public setTo(image = null, dynamic?: DynamicTexture = null) {
|
||||
public setTo(image = null, dynamic: DynamicTexture = null) {
|
||||
|
||||
if (dynamic)
|
||||
{
|
||||
|
@ -252,7 +252,7 @@ module Phaser.Display {
|
|||
* @param clearAnimations {boolean} If this Sprite has a set of animation data already loaded you can choose to keep or clear it with this boolean
|
||||
* @param updateBody {boolean} Update the physics body dimensions to match the newly loaded texture/frame?
|
||||
*/
|
||||
public loadImage(key: string, clearAnimations?: bool = true, updateBody?: bool = true) {
|
||||
public loadImage(key: string, clearAnimations: boolean = true, updateBody: boolean = true) {
|
||||
|
||||
if (clearAnimations && this.parent['animations'] && this.parent['animations'].frameData !== null)
|
||||
{
|
||||
|
|
|
@ -76,7 +76,7 @@ module Phaser {
|
|||
* @param [downFrame] {string|number} This is the frame or frameName that will be set when this button is in a down state. Give either a number to use a frame ID or a string for a frame name.
|
||||
* @returns {Button} The newly created button object.
|
||||
*/
|
||||
public button(x?: number = 0, y?: number = 0, key?: string = null, callback? = null, callbackContext? = null, overFrame? = null, outFrame? = null, downFrame? = null): UI.Button {
|
||||
public button(x: number = 0, y: number = 0, key: string = null, callback = null, callbackContext = null, overFrame = null, outFrame = null, downFrame = null): UI.Button {
|
||||
return <UI.Button> this._world.group.add(new UI.Button(this.game, x, y, key, callback, callbackContext, overFrame, outFrame, downFrame));
|
||||
}
|
||||
|
||||
|
@ -89,11 +89,11 @@ module Phaser {
|
|||
* @param [frame] {string|number} If the sprite uses an image from a texture atlas or sprite sheet you can pass the frame here. Either a number for a frame ID or a string for a frame name.
|
||||
* @returns {Sprite} The newly created sprite object.
|
||||
*/
|
||||
public sprite(x: number, y: number, key?: string = '', frame? = null): Sprite {
|
||||
public sprite(x: number, y: number, key: string = '', frame = null): Sprite {
|
||||
return <Sprite> this._world.group.add(new Sprite(this.game, x, y, key, frame));
|
||||
}
|
||||
|
||||
public audio(key: string, volume?: number = 1, loop?: bool = false) {
|
||||
public audio(key: string, volume: number = 1, loop: boolean = false) {
|
||||
return <Sound> this.game.sound.add(key, volume, loop);
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ module Phaser {
|
|||
* @param [shapeType] The default body shape is either 0 for a Box or 1 for a Circle. See Sprite.body.addShape for custom shapes (polygons, etc)
|
||||
* @returns {Sprite} The newly created sprite object.
|
||||
*/
|
||||
//public physicsSprite(x: number, y: number, key?: string = '', frame? = null, bodyType?: number = Phaser.Types.BODY_DYNAMIC, shapeType?:number = 0): Sprite {
|
||||
//public physicsSprite(x: number, y: number, key: string = '', frame? = null, bodyType: number = Phaser.Types.BODY_DYNAMIC, shapeType:number = 0): Sprite {
|
||||
// return <Sprite> this._world.group.add(new Sprite(this.game, x, y, key, frame, bodyType, shapeType));
|
||||
//}
|
||||
|
||||
|
@ -129,7 +129,7 @@ module Phaser {
|
|||
* @param maxSize {number} Optional, capacity of this group.
|
||||
* @returns {Group} The newly created group.
|
||||
*/
|
||||
public group(maxSize?: number = 0): Group {
|
||||
public group(maxSize: number = 0): Group {
|
||||
return <Group> this._world.group.add(new Group(this.game, maxSize));
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ module Phaser {
|
|||
* @param size {number} Optional, size of this emitter.
|
||||
* @return {Emitter} The newly created emitter object.
|
||||
*/
|
||||
public emitter(x?: number = 0, y?: number = 0, size?: number = 0): ArcadeEmitter {
|
||||
public emitter(x: number = 0, y: number = 0, size: number = 0): ArcadeEmitter {
|
||||
return <ArcadeEmitter> this._world.group.add(new ArcadeEmitter(this.game, x, y, size));
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,7 @@ module Phaser {
|
|||
* @param height {number} Height of this object.
|
||||
* @returns {ScrollZone} The newly created scroll zone object.
|
||||
*/
|
||||
public scrollZone(key: string, x?: number = 0, y?: number = 0, width?: number = 0, height?: number = 0): ScrollZone {
|
||||
public scrollZone(key: string, x: number = 0, y: number = 0, width: number = 0, height: number = 0): ScrollZone {
|
||||
return <ScrollZone> this._world.group.add(new ScrollZone(this.game, key, x, y, width, height));
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ module Phaser {
|
|||
* @param [tileHeight] {number} height of each tile.
|
||||
* @return {Tilemap} The newly created tilemap object.
|
||||
*/
|
||||
public tilemap(key: string, mapData: string, format: number, resizeWorld: bool = true, tileWidth?: number = 0, tileHeight?: number = 0): Tilemap {
|
||||
public tilemap(key: string, mapData: string, format: number, resizeWorld: boolean = true, tileWidth: number = 0, tileHeight: number = 0): Tilemap {
|
||||
return <Tilemap> this._world.group.add(new Tilemap(this.game, key, mapData, format, resizeWorld, tileWidth, tileHeight));
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ module Phaser {
|
|||
* @param [localReference] {bool} If true the tween will be stored in the object.tween property so long as it exists. If already set it'll be over-written.
|
||||
* @return {Phaser.Tween} The newly created tween object.
|
||||
*/
|
||||
public tween(obj, localReference?:bool = false): Tween {
|
||||
public tween(obj, localReference:boolean = false): Tween {
|
||||
return this.game.tweens.create(obj, localReference);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,17 +42,17 @@ module Phaser {
|
|||
/**
|
||||
* Controls if both <code>update</code> and render are called by the core game loop.
|
||||
*/
|
||||
exists: bool;
|
||||
exists: boolean;
|
||||
|
||||
/**
|
||||
* Controls if <code>update()</code> is automatically called by the core game loop.
|
||||
*/
|
||||
active: bool;
|
||||
active: boolean;
|
||||
|
||||
/**
|
||||
* Controls if this is rendered or skipped during the core game loop.
|
||||
*/
|
||||
visible: bool;
|
||||
visible: boolean;
|
||||
|
||||
/**
|
||||
* The animation manager component
|
||||
|
|
|
@ -54,7 +54,7 @@ module Phaser {
|
|||
* Will this region be rendered? (default to true)
|
||||
* @type {boolean}
|
||||
*/
|
||||
public visible: bool = true;
|
||||
public visible: boolean = true;
|
||||
|
||||
/**
|
||||
* Region scrolling speed.
|
||||
|
|
|
@ -26,7 +26,7 @@ module Phaser {
|
|||
* @param [width] {number} width of this object.
|
||||
* @param [height] {number} height of this object.
|
||||
*/
|
||||
constructor(game: Game, key:string, x: number = 0, y: number = 0, width?: number = 0, height?: number = 0) {
|
||||
constructor(game: Game, key:string, x: number = 0, y: number = 0, width: number = 0, height: number = 0) {
|
||||
|
||||
super(game, x, y, key);
|
||||
|
||||
|
@ -80,7 +80,7 @@ module Phaser {
|
|||
* @param [speedY] {number} y-axis scrolling speed.
|
||||
* @return {ScrollRegion} The newly added region.
|
||||
*/
|
||||
public addRegion(x: number, y: number, width: number, height: number, speedX?:number = 0, speedY?:number = 0):ScrollRegion {
|
||||
public addRegion(x: number, y: number, width: number, height: number, speedX:number = 0, speedY:number = 0):ScrollRegion {
|
||||
|
||||
if (x > this.width || y > this.height || x < 0 || y < 0 || (x + width) > this.width || (y + height) > this.height)
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ module Phaser {
|
|||
* @param [y] {number} the initial y position of the sprite.
|
||||
* @param [key] {string} Key of the graphic you want to load for this sprite.
|
||||
*/
|
||||
constructor(game: Game, x?: number = 0, y?: number = 0, key?: string = null, frame? = null) {
|
||||
constructor(game: Game, x: number = 0, y: number = 0, key: string = null, frame = null) {
|
||||
|
||||
this.game = game;
|
||||
this.type = Phaser.Types.SPRITE;
|
||||
|
@ -106,27 +106,27 @@ module Phaser {
|
|||
/**
|
||||
* Controls if both <code>update</code> and render are called by the core game loop.
|
||||
*/
|
||||
public exists: bool;
|
||||
public exists: boolean;
|
||||
|
||||
/**
|
||||
* Controls if <code>update()</code> is automatically called by the core game loop.
|
||||
*/
|
||||
public active: bool;
|
||||
public active: boolean;
|
||||
|
||||
/**
|
||||
* Controls if this Sprite is rendered or skipped during the core game loop.
|
||||
*/
|
||||
public visible: bool;
|
||||
public visible: boolean;
|
||||
|
||||
/**
|
||||
* A useful state for many game objects. Kill and revive both flip this switch.
|
||||
*/
|
||||
public alive: bool;
|
||||
public alive: boolean;
|
||||
|
||||
/**
|
||||
* Is the Sprite out of the world bounds or not?
|
||||
*/
|
||||
public outOfBounds: bool;
|
||||
public outOfBounds: boolean;
|
||||
|
||||
/**
|
||||
* The action to be taken when the sprite is fully out of the world bounds
|
||||
|
@ -185,7 +185,7 @@ module Phaser {
|
|||
/**
|
||||
* A boolean representing if the Sprite has been modified in any way via a scale, rotate, flip or skew.
|
||||
*/
|
||||
public modified: bool = false;
|
||||
public modified: boolean = false;
|
||||
|
||||
/**
|
||||
* x value of the object.
|
||||
|
@ -419,7 +419,7 @@ module Phaser {
|
|||
* like to animate an effect or whatever, you should override this,
|
||||
* setting only alive to false, and leaving exists true.
|
||||
*/
|
||||
public kill(removeFromGroup:bool = false) {
|
||||
public kill(removeFromGroup:boolean = false) {
|
||||
|
||||
this.alive = false;
|
||||
this.exists = false;
|
||||
|
|
|
@ -45,7 +45,7 @@ module Phaser.Components {
|
|||
|
||||
private _rotation: number;
|
||||
|
||||
private _dirty: bool = false;
|
||||
private _dirty: boolean = false;
|
||||
|
||||
// Cache vars
|
||||
private _pos: Phaser.Point;
|
||||
|
|
|
@ -263,7 +263,7 @@ module Phaser {
|
|||
* @method empty
|
||||
* @return {Boolean} A value of true if the Circle objects diameter is less than or equal to 0; otherwise false.
|
||||
**/
|
||||
get empty(): bool {
|
||||
get empty(): boolean {
|
||||
return (this._diameter == 0);
|
||||
}
|
||||
|
||||
|
@ -272,8 +272,8 @@ module Phaser {
|
|||
* @method setEmpty
|
||||
* @return {Circle} This Circle object
|
||||
**/
|
||||
set empty(value: bool) {
|
||||
return this.setTo(0, 0, 0);
|
||||
set empty(value: boolean) {
|
||||
this.setTo(0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -59,7 +59,7 @@ module Phaser {
|
|||
* @param {Phaser.Line} [output]
|
||||
* @return {Phaser.Line}
|
||||
*/
|
||||
public clone(output?: Line = new Line): Line {
|
||||
public clone(output: Line = new Line): Line {
|
||||
|
||||
return output.setTo(this.x1, this.y1, this.x2, this.y2);
|
||||
|
||||
|
@ -195,7 +195,7 @@ module Phaser {
|
|||
* @param {Number} y
|
||||
* @return {Boolean}
|
||||
*/
|
||||
public isPointOnLine(x: number, y: number): bool {
|
||||
public isPointOnLine(x: number, y: number): boolean {
|
||||
|
||||
if ((x - this.x1) * (this.y2 - this.y1) === (this.x2 - this.x1) * (y - this.y1))
|
||||
{
|
||||
|
@ -215,7 +215,7 @@ module Phaser {
|
|||
* @param {Number} y
|
||||
* @return {Boolean}
|
||||
*/
|
||||
public isPointOnLineSegment(x: number, y: number): bool {
|
||||
public isPointOnLineSegment(x: number, y: number): boolean {
|
||||
|
||||
var xMin = Math.min(this.x1, this.x2);
|
||||
var xMax = Math.max(this.x1, this.x2);
|
||||
|
@ -251,7 +251,7 @@ module Phaser {
|
|||
* @param {Phaser.Line} [output]
|
||||
* @return {Phaser.Line}
|
||||
*/
|
||||
public perp(x: number, y: number, output?: Line): Line {
|
||||
public perp(x: number, y: number, output: Line): Line {
|
||||
|
||||
if (this.y1 === this.y2)
|
||||
{
|
||||
|
|
|
@ -241,7 +241,7 @@ module Phaser {
|
|||
* @method isEmpty
|
||||
* @return {Boolean} A value of true if the Rectangle objects width or height is less than or equal to 0; otherwise false.
|
||||
**/
|
||||
get empty(): bool {
|
||||
get empty(): boolean {
|
||||
return (!this.width || !this.height);
|
||||
}
|
||||
|
||||
|
@ -250,8 +250,8 @@ module Phaser {
|
|||
* @method setEmpty
|
||||
* @return {Rectangle} This Rectangle object
|
||||
**/
|
||||
set empty(value: bool) {
|
||||
return this.setTo(0, 0, 0, 0);
|
||||
set empty(value: boolean) {
|
||||
this.setTo(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,7 +40,7 @@ module Phaser.Components {
|
|||
* If enabled the Input component will be updated by the parent Sprite
|
||||
* @type {Boolean}
|
||||
*/
|
||||
public enabled: bool;
|
||||
public enabled: boolean;
|
||||
|
||||
/**
|
||||
* The PriorityID controls which Sprite receives an Input event first if they should overlap.
|
||||
|
@ -55,17 +55,17 @@ module Phaser.Components {
|
|||
private _dragPoint: Point;
|
||||
private _draggedPointerID: number;
|
||||
public dragOffset: Point;
|
||||
public isDragged: bool = false;
|
||||
public dragFromCenter: bool;
|
||||
public dragPixelPerfect: bool = false;
|
||||
public isDragged: boolean = false;
|
||||
public dragFromCenter: boolean;
|
||||
public dragPixelPerfect: boolean = false;
|
||||
public dragPixelPerfectAlpha: number;
|
||||
|
||||
public allowHorizontalDrag: bool = true;
|
||||
public allowVerticalDrag: bool = true;
|
||||
public bringToTop: bool = false;
|
||||
public allowHorizontalDrag: boolean = true;
|
||||
public allowVerticalDrag: boolean = true;
|
||||
public bringToTop: boolean = false;
|
||||
|
||||
public snapOnDrag: bool = false;
|
||||
public snapOnRelease: bool = false;
|
||||
public snapOnDrag: boolean = false;
|
||||
public snapOnRelease: boolean = false;
|
||||
public snapOffset: Point;
|
||||
public snapX: number = 0;
|
||||
public snapY: number = 0;
|
||||
|
@ -75,7 +75,7 @@ module Phaser.Components {
|
|||
* Is this sprite allowed to be dragged by the mouse? true = yes, false = no
|
||||
* @default false
|
||||
*/
|
||||
public draggable: bool = false;
|
||||
public draggable: boolean = false;
|
||||
|
||||
/**
|
||||
* A region of the game world within which the sprite is restricted during drag
|
||||
|
@ -94,21 +94,21 @@ module Phaser.Components {
|
|||
* If checkBody is set to true it will monitor the bounds of the physics body.
|
||||
* @type {Boolean}
|
||||
*/
|
||||
public checkBody: bool;
|
||||
public checkBody: boolean;
|
||||
|
||||
/**
|
||||
* Turn the mouse pointer into a hand image by temporarily setting the CSS style of the Game canvas
|
||||
* on Input over. Only works on desktop browsers or browsers with a visible input pointer.
|
||||
* @type {Boolean}
|
||||
*/
|
||||
public useHandCursor: bool;
|
||||
public useHandCursor: boolean;
|
||||
|
||||
/**
|
||||
* If this object is set to consume the pointer event then it will stop all propogation from this object on.
|
||||
* For example if you had a stack of 6 sprites with the same priority IDs and one consumed the event, none of the others would receive it.
|
||||
* @type {Boolean}
|
||||
*/
|
||||
public consumePointerEvent: bool = false;
|
||||
public consumePointerEvent: boolean = false;
|
||||
|
||||
/**
|
||||
* The x coordinate of the Input pointer, relative to the top-left of the parent Sprite.
|
||||
|
@ -133,7 +133,7 @@ module Phaser.Components {
|
|||
* @property isDown
|
||||
* @type {Boolean}
|
||||
**/
|
||||
public pointerDown(pointer: number = 0): bool {
|
||||
public pointerDown(pointer: number = 0): boolean {
|
||||
return this._pointerData[pointer].isDown;
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ module Phaser.Components {
|
|||
* @property isUp
|
||||
* @type {Boolean}
|
||||
**/
|
||||
public pointerUp(pointer: number = 0): bool {
|
||||
public pointerUp(pointer: number = 0): boolean {
|
||||
return this._pointerData[pointer].isUp;
|
||||
}
|
||||
|
||||
|
@ -151,7 +151,7 @@ module Phaser.Components {
|
|||
* @property timeDown
|
||||
* @type {Number}
|
||||
**/
|
||||
public pointerTimeDown(pointer: number = 0): bool {
|
||||
public pointerTimeDown(pointer: number = 0): boolean {
|
||||
return this._pointerData[pointer].timeDown;
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ module Phaser.Components {
|
|||
* @property timeUp
|
||||
* @type {Number}
|
||||
**/
|
||||
public pointerTimeUp(pointer: number = 0): bool {
|
||||
public pointerTimeUp(pointer: number = 0): boolean {
|
||||
return this._pointerData[pointer].timeUp;
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ module Phaser.Components {
|
|||
* @property isOver
|
||||
* @type {Boolean}
|
||||
**/
|
||||
public pointerOver(pointer: number = 0): bool {
|
||||
public pointerOver(pointer: number = 0): boolean {
|
||||
return this._pointerData[pointer].isOver;
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ module Phaser.Components {
|
|||
* @property isOut
|
||||
* @type {Boolean}
|
||||
**/
|
||||
public pointerOut(pointer: number = 0): bool {
|
||||
public pointerOut(pointer: number = 0): boolean {
|
||||
return this._pointerData[pointer].isOut;
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ module Phaser.Components {
|
|||
* @property timeDown
|
||||
* @type {Number}
|
||||
**/
|
||||
public pointerTimeOver(pointer: number = 0): bool {
|
||||
public pointerTimeOver(pointer: number = 0): boolean {
|
||||
return this._pointerData[pointer].timeOver;
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ module Phaser.Components {
|
|||
* @property timeUp
|
||||
* @type {Number}
|
||||
**/
|
||||
public pointerTimeOut(pointer: number = 0): bool {
|
||||
public pointerTimeOut(pointer: number = 0): boolean {
|
||||
return this._pointerData[pointer].timeOut;
|
||||
}
|
||||
|
||||
|
@ -204,11 +204,11 @@ module Phaser.Components {
|
|||
* Is this sprite being dragged by the mouse or not?
|
||||
* @default false
|
||||
*/
|
||||
public pointerDragged(pointer: number = 0): bool {
|
||||
public pointerDragged(pointer: number = 0): boolean {
|
||||
return this._pointerData[pointer].isDragged;
|
||||
}
|
||||
|
||||
public start(priority: number = 0, checkBody?: bool = false, useHandCursor?: bool = false): Phaser.Sprite {
|
||||
public start(priority: number = 0, checkBody: boolean = false, useHandCursor: boolean = false): Phaser.Sprite {
|
||||
|
||||
// Turning on
|
||||
if (this.enabled == false)
|
||||
|
@ -289,7 +289,7 @@ module Phaser.Components {
|
|||
/**
|
||||
* Checks if the given pointer is over this Sprite. All checks are done in world coordinates.
|
||||
*/
|
||||
public checkPointerOver(pointer: Phaser.Pointer): bool {
|
||||
public checkPointerOver(pointer: Phaser.Pointer): boolean {
|
||||
|
||||
if (this.enabled == false || this._parent.visible == false)
|
||||
{
|
||||
|
@ -305,7 +305,7 @@ module Phaser.Components {
|
|||
/**
|
||||
* Update
|
||||
*/
|
||||
public update(pointer: Phaser.Pointer): bool {
|
||||
public update(pointer: Phaser.Pointer): boolean {
|
||||
|
||||
if (this.enabled == false || this._parent.visible == false)
|
||||
{
|
||||
|
@ -369,7 +369,7 @@ module Phaser.Components {
|
|||
|
||||
}
|
||||
|
||||
public _touchedHandler(pointer: Pointer): bool {
|
||||
public _touchedHandler(pointer: Pointer): boolean {
|
||||
|
||||
if (this._pointerData[pointer.id].isDown == false && this._pointerData[pointer.id].isOver == true)
|
||||
{
|
||||
|
@ -438,7 +438,7 @@ module Phaser.Components {
|
|||
/**
|
||||
* Updates the Pointer drag on this Sprite.
|
||||
*/
|
||||
private updateDrag(pointer: Pointer): bool {
|
||||
private updateDrag(pointer: Pointer): boolean {
|
||||
|
||||
if (pointer.isUp)
|
||||
{
|
||||
|
@ -480,7 +480,7 @@ module Phaser.Components {
|
|||
* @param delay The time below which the pointer is considered as just over.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
public justOver(pointer: number = 0, delay?: number = 500): bool {
|
||||
public justOver(pointer: number = 0, delay: number = 500): boolean {
|
||||
return (this._pointerData[pointer].isOver && this.overDuration(pointer) < delay);
|
||||
}
|
||||
|
||||
|
@ -489,7 +489,7 @@ module Phaser.Components {
|
|||
* @param delay The time below which the pointer is considered as just out.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
public justOut(pointer: number = 0, delay?: number = 500): bool {
|
||||
public justOut(pointer: number = 0, delay: number = 500): boolean {
|
||||
return (this._pointerData[pointer].isOut && (this.game.time.now - this._pointerData[pointer].timeOut < delay));
|
||||
}
|
||||
|
||||
|
@ -498,7 +498,7 @@ module Phaser.Components {
|
|||
* @param delay The time below which the pointer is considered as just over.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
public justPressed(pointer: number = 0, delay?: number = 500): bool {
|
||||
public justPressed(pointer: number = 0, delay: number = 500): boolean {
|
||||
return (this._pointerData[pointer].isDown && this.downDuration(pointer) < delay);
|
||||
}
|
||||
|
||||
|
@ -507,7 +507,7 @@ module Phaser.Components {
|
|||
* @param delay The time below which the pointer is considered as just out.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
public justReleased(pointer: number = 0, delay?: number = 500): bool {
|
||||
public justReleased(pointer: number = 0, delay: number = 500): boolean {
|
||||
return (this._pointerData[pointer].isUp && (this.game.time.now - this._pointerData[pointer].timeUp < delay));
|
||||
}
|
||||
|
||||
|
@ -551,7 +551,7 @@ module Phaser.Components {
|
|||
* @param boundsRect If you want to restrict the drag of this sprite to a specific FlxRect, pass the FlxRect here, otherwise it's free to drag anywhere
|
||||
* @param boundsSprite If you want to restrict the drag of this sprite to within the bounding box of another sprite, pass it here
|
||||
*/
|
||||
public enableDrag(lockCenter: bool = false, bringToTop: bool = false, pixelPerfect: bool = false, alphaThreshold: number = 255, boundsRect: Rectangle = null, boundsSprite: Phaser.Sprite = null): void {
|
||||
public enableDrag(lockCenter: boolean = false, bringToTop: boolean = false, pixelPerfect: boolean = false, alphaThreshold: number = 255, boundsRect: Rectangle = null, boundsSprite: Phaser.Sprite = null): void {
|
||||
this._dragPoint = new Point;
|
||||
|
||||
this.draggable = true;
|
||||
|
@ -648,7 +648,7 @@ module Phaser.Components {
|
|||
* @param allowHorizontal To enable the sprite to be dragged horizontally set to true, otherwise false
|
||||
* @param allowVertical To enable the sprite to be dragged vertically set to true, otherwise false
|
||||
*/
|
||||
public setDragLock(allowHorizontal: bool = true, allowVertical: bool = true): void {
|
||||
public setDragLock(allowHorizontal: boolean = true, allowVertical: boolean = true): void {
|
||||
this.allowHorizontalDrag = allowHorizontal;
|
||||
this.allowVerticalDrag = allowVertical;
|
||||
}
|
||||
|
@ -662,7 +662,7 @@ module Phaser.Components {
|
|||
* @param onDrag If true the sprite will snap to the grid while being dragged
|
||||
* @param onRelease If true the sprite will snap to the grid when released
|
||||
*/
|
||||
public enableSnap(snapX: number, snapY: number, onDrag: bool = true, onRelease: bool = false): void {
|
||||
public enableSnap(snapX: number, snapY: number, onDrag: boolean = true, onRelease: boolean = false): void {
|
||||
this.snapOnDrag = onDrag;
|
||||
this.snapOnRelease = onRelease;
|
||||
this.snapX = snapX;
|
||||
|
|
|
@ -107,7 +107,7 @@ module Phaser {
|
|||
* If you need to disable just one type of input, for example mouse, use Input.mouse.disabled = true instead
|
||||
* @type {Boolean}
|
||||
*/
|
||||
public disabled: bool = false;
|
||||
public disabled: boolean = false;
|
||||
|
||||
/**
|
||||
* Controls the expected behaviour when using a mouse and touch together on a multi-input device
|
||||
|
@ -283,7 +283,7 @@ module Phaser {
|
|||
* @property recordPointerHistory
|
||||
* @type {Boolean}
|
||||
**/
|
||||
public recordPointerHistory: bool = false;
|
||||
public recordPointerHistory: boolean = false;
|
||||
|
||||
/**
|
||||
* The rate in milliseconds at which the Pointer objects should update their tracking history
|
||||
|
@ -504,7 +504,7 @@ module Phaser {
|
|||
|
||||
}
|
||||
|
||||
public get pollLocked(): bool {
|
||||
public get pollLocked(): boolean {
|
||||
return (this.pollRate > 0 && this._pollCounter < this.pollRate);
|
||||
}
|
||||
|
||||
|
@ -547,7 +547,7 @@ module Phaser {
|
|||
* @method reset
|
||||
* @param hard {Boolean} A soft reset (hard = false) won't reset any signals that might be bound. A hard reset will.
|
||||
**/
|
||||
public reset(hard?: bool = false) {
|
||||
public reset(hard: boolean = false) {
|
||||
|
||||
this.keyboard.reset();
|
||||
|
||||
|
@ -737,7 +737,7 @@ module Phaser {
|
|||
* @param {Boolean} state The state the Pointer should be in (false for inactive, true for active)
|
||||
* @return {Pointer} A Pointer object or null if no Pointer object matches the requested state.
|
||||
**/
|
||||
public getPointer(state: bool = false): Pointer {
|
||||
public getPointer(state: boolean = false): Pointer {
|
||||
|
||||
// Unrolled for speed
|
||||
if (this.pointer1.active == state)
|
||||
|
@ -836,7 +836,7 @@ module Phaser {
|
|||
return Vec2Utils.angle(pointer1.position, pointer2.position);
|
||||
}
|
||||
|
||||
public pixelPerfectCheck(sprite: Phaser.Sprite, pointer: Phaser.Pointer, alpha: number = 255): bool {
|
||||
public pixelPerfectCheck(sprite: Phaser.Sprite, pointer: Phaser.Pointer, alpha: number = 255): boolean {
|
||||
|
||||
this.hitContext.clearRect(0, 0, 1, 1);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ module Phaser {
|
|||
* You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
|
||||
* @type {Boolean}
|
||||
*/
|
||||
public disabled: bool = false;
|
||||
public disabled: boolean = false;
|
||||
|
||||
/**
|
||||
* A reference to the event handlers to allow removeEventListener support
|
||||
|
@ -163,7 +163,7 @@ module Phaser {
|
|||
* @param {Number} [duration]
|
||||
* @return {Boolean}
|
||||
*/
|
||||
public justPressed(keycode: number, duration?: number = 250): bool {
|
||||
public justPressed(keycode: number, duration: number = 250): boolean {
|
||||
|
||||
if (this._keys[keycode] && this._keys[keycode].isDown === true && (this.game.time.now - this._keys[keycode].timeDown < duration))
|
||||
{
|
||||
|
@ -181,7 +181,7 @@ module Phaser {
|
|||
* @param {Number} [duration]
|
||||
* @return {Boolean}
|
||||
*/
|
||||
public justReleased(keycode: number, duration?: number = 250): bool {
|
||||
public justReleased(keycode: number, duration: number = 250): boolean {
|
||||
|
||||
if (this._keys[keycode] && this._keys[keycode].isDown === false && (this.game.time.now - this._keys[keycode].timeUp < duration))
|
||||
{
|
||||
|
@ -198,7 +198,7 @@ module Phaser {
|
|||
* @param {Number} keycode
|
||||
* @return {Boolean}
|
||||
*/
|
||||
public isDown(keycode: number): bool {
|
||||
public isDown(keycode: number): boolean {
|
||||
|
||||
if (this._keys[keycode])
|
||||
{
|
||||
|
|
|
@ -35,7 +35,7 @@ module Phaser {
|
|||
* You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
|
||||
* @type {Boolean}
|
||||
*/
|
||||
public disabled: bool = false;
|
||||
public disabled: boolean = false;
|
||||
|
||||
/**
|
||||
* A reference to the event handlers to allow removeEventListener support
|
||||
|
|
|
@ -32,7 +32,7 @@ module Phaser {
|
|||
* You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
|
||||
* @type {Boolean}
|
||||
*/
|
||||
public disabled: bool = false;
|
||||
public disabled: boolean = false;
|
||||
|
||||
/**
|
||||
* Custom callback useful for hooking into a 3rd party library. Will be passed the mouse event as the only parameter.
|
||||
|
|
|
@ -51,7 +51,7 @@ module Phaser {
|
|||
* @type {Boolean}
|
||||
* @private
|
||||
*/
|
||||
private _holdSent: bool = false;
|
||||
private _holdSent: boolean = false;
|
||||
|
||||
/**
|
||||
* Local private variable storing the short-term history of pointer movements
|
||||
|
@ -70,7 +70,7 @@ module Phaser {
|
|||
private _nextDrop: number = 0;
|
||||
|
||||
// Monitor events outside of a state reset loop
|
||||
private _stateReset: bool = false;
|
||||
private _stateReset: boolean = false;
|
||||
|
||||
/**
|
||||
* The Pointer ID (a number between 1 and 10, 0 is reserved for the mouse pointer specifically)
|
||||
|
@ -93,7 +93,7 @@ module Phaser {
|
|||
* @property active
|
||||
* @type {Boolean}
|
||||
*/
|
||||
public active: bool;
|
||||
public active: boolean;
|
||||
|
||||
/**
|
||||
* A Vector object containing the initial position when the Pointer was engaged with the screen.
|
||||
|
@ -122,7 +122,7 @@ module Phaser {
|
|||
* @property withinGame
|
||||
* @type {Boolean}
|
||||
*/
|
||||
public withinGame: bool = false;
|
||||
public withinGame: boolean = false;
|
||||
|
||||
/**
|
||||
* If this Pointer is a mouse the button property holds the value of which mouse button was pressed down
|
||||
|
@ -199,21 +199,21 @@ module Phaser {
|
|||
* @property isMouse
|
||||
* @type {Boolean}
|
||||
**/
|
||||
public isMouse: bool = false;
|
||||
public isMouse: boolean = false;
|
||||
|
||||
/**
|
||||
* If the Pointer is touching the touchscreen, or the mouse button is held down, isDown is set to true
|
||||
* @property isDown
|
||||
* @type {Boolean}
|
||||
**/
|
||||
public isDown: bool = false;
|
||||
public isDown: boolean = false;
|
||||
|
||||
/**
|
||||
* If the Pointer is not touching the touchscreen, or the mouse button is up, isUp is set to true
|
||||
* @property isUp
|
||||
* @type {Boolean}
|
||||
**/
|
||||
public isUp: bool = true;
|
||||
public isUp: boolean = true;
|
||||
|
||||
/**
|
||||
* A timestamp representing when the Pointer first touched the touchscreen.
|
||||
|
@ -623,7 +623,7 @@ module Phaser {
|
|||
* @param {Number} [duration].
|
||||
* @return {Boolean}
|
||||
*/
|
||||
public justPressed(duration?: number = this.game.input.justPressedRate): bool {
|
||||
public justPressed(duration: number = this.game.input.justPressedRate): boolean {
|
||||
|
||||
if (this.isDown === true && (this.timeDown + duration) > this.game.time.now)
|
||||
{
|
||||
|
@ -642,7 +642,7 @@ module Phaser {
|
|||
* @param {Number} [duration].
|
||||
* @return {Boolean}
|
||||
*/
|
||||
public justReleased(duration?: number = this.game.input.justReleasedRate): bool {
|
||||
public justReleased(duration: number = this.game.input.justReleasedRate): boolean {
|
||||
|
||||
if (this.isUp === true && (this.timeUp + duration) > this.game.time.now)
|
||||
{
|
||||
|
|
|
@ -38,7 +38,7 @@ module Phaser {
|
|||
* You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
|
||||
* @type {Boolean}
|
||||
*/
|
||||
public disabled: bool = false;
|
||||
public disabled: boolean = false;
|
||||
|
||||
/**
|
||||
* Custom callback useful for hooking into a 3rd party library. Will be passed the touch event as the only parameter.
|
||||
|
|
|
@ -122,10 +122,10 @@ module Phaser {
|
|||
* @param url {string} URL of this sound file.
|
||||
* @param data {object} Extra sound data.
|
||||
*/
|
||||
public addSound(key: string, url: string, data, webAudio: bool = true, audioTag: bool = false) {
|
||||
public addSound(key: string, url: string, data, webAudio: boolean = true, audioTag: boolean = false) {
|
||||
|
||||
var locked: bool = this.game.sound.touchLocked;
|
||||
var decoded: bool = false;
|
||||
var locked: boolean = this.game.sound.touchLocked;
|
||||
var decoded: boolean = false;
|
||||
|
||||
if (audioTag) {
|
||||
decoded = true;
|
||||
|
@ -277,7 +277,7 @@ module Phaser {
|
|||
* @param key Asset key of the sound you want.
|
||||
* @return {object} The sound data you want.
|
||||
*/
|
||||
public isSoundDecoded(key: string): bool {
|
||||
public isSoundDecoded(key: string): boolean {
|
||||
|
||||
if (this._sounds[key])
|
||||
{
|
||||
|
@ -291,7 +291,7 @@ module Phaser {
|
|||
* @param key Asset key of the sound you want.
|
||||
* @return {object} The sound data you want.
|
||||
*/
|
||||
public isSoundReady(key: string): bool {
|
||||
public isSoundReady(key: string): boolean {
|
||||
|
||||
if (this._sounds[key] && this._sounds[key].decoded == true && this._sounds[key].locked == false)
|
||||
{
|
||||
|
@ -307,7 +307,7 @@ module Phaser {
|
|||
* @param key Asset key of the sprite sheet you want.
|
||||
* @return {object} The sprite sheet data you want.
|
||||
*/
|
||||
public isSpriteSheet(key: string): bool {
|
||||
public isSpriteSheet(key: string): boolean {
|
||||
|
||||
if (this._images[key])
|
||||
{
|
||||
|
|
|
@ -66,13 +66,13 @@ module Phaser {
|
|||
* True if the Loader is in the process of loading a queue.
|
||||
* @type {boolean}
|
||||
*/
|
||||
public isLoading: bool;
|
||||
public isLoading: boolean;
|
||||
|
||||
/**
|
||||
* True if game is completely loaded.
|
||||
* @type {boolean}
|
||||
*/
|
||||
public hasLoaded: bool;
|
||||
public hasLoaded: boolean;
|
||||
|
||||
/**
|
||||
* Loading progress (from 0 to 100)
|
||||
|
@ -115,7 +115,7 @@ module Phaser {
|
|||
* @param key {string} Unique asset key of this image file.
|
||||
* @param url {string} URL of image file.
|
||||
*/
|
||||
public image(key: string, url: string, overwrite: bool = false) {
|
||||
public image(key: string, url: string, overwrite: boolean = false) {
|
||||
|
||||
if (overwrite == true || this.checkKeyExists(key) == false)
|
||||
{
|
||||
|
@ -134,7 +134,7 @@ module Phaser {
|
|||
* @param frameHeight {number} Height of each single frame.
|
||||
* @param frameMax {number} How many frames in this sprite sheet.
|
||||
*/
|
||||
public spritesheet(key: string, url: string, frameWidth: number, frameHeight: number, frameMax?: number = -1) {
|
||||
public spritesheet(key: string, url: string, frameWidth: number, frameHeight: number, frameMax: number = -1) {
|
||||
|
||||
if (this.checkKeyExists(key) === false)
|
||||
{
|
||||
|
@ -153,7 +153,7 @@ module Phaser {
|
|||
* @param [atlasData] {object} A JSON or XML data object.
|
||||
* @param [format] {number} A value describing the format of the data.
|
||||
*/
|
||||
public atlas(key: string, textureURL: string, atlasURL?: string = null, atlasData? = null, format?:number = Loader.TEXTURE_ATLAS_JSON_ARRAY) {
|
||||
public atlas(key: string, textureURL: string, atlasURL: string = null, atlasData = null, format:number = Loader.TEXTURE_ATLAS_JSON_ARRAY) {
|
||||
|
||||
if (this.checkKeyExists(key) === false)
|
||||
{
|
||||
|
@ -231,7 +231,7 @@ module Phaser {
|
|||
* @param urls {Array} An array containing the URLs of the audio files, i.e.: [ 'jump.mp3', 'jump.ogg', 'jump.m4a' ]
|
||||
* @param autoDecode {boolean} When using Web Audio the audio files can either be decoded at load time or run-time. They can't be played until they are decoded, but this let's you control when that happens. Decoding is a non-blocking async process.
|
||||
*/
|
||||
public audio(key: string, urls: string[], autoDecode: bool = true) {
|
||||
public audio(key: string, urls: string[], autoDecode: boolean = true) {
|
||||
|
||||
if (this.checkKeyExists(key) === false)
|
||||
{
|
||||
|
@ -433,7 +433,7 @@ module Phaser {
|
|||
this._fileList[key].loaded = true;
|
||||
|
||||
var file = this._fileList[key];
|
||||
var loadNext: bool = true;
|
||||
var loadNext: boolean = true;
|
||||
|
||||
switch (file.type)
|
||||
{
|
||||
|
@ -586,7 +586,7 @@ module Phaser {
|
|||
* @param previousKey {string} Key of previous loaded asset.
|
||||
* @param success {boolean} Whether the previous asset loaded successfully or not.
|
||||
*/
|
||||
private nextFile(previousKey: string, success: bool) {
|
||||
private nextFile(previousKey: string, success: boolean) {
|
||||
|
||||
this.progress = Math.round(this.progress + this._progressChunk);
|
||||
|
||||
|
@ -618,7 +618,7 @@ module Phaser {
|
|||
* @param key {string} Key of the asset you want to check.
|
||||
* @return {boolean} Return true if exists, otherwise return false.
|
||||
*/
|
||||
private checkKeyExists(key: string): bool {
|
||||
private checkKeyExists(key: string): boolean {
|
||||
|
||||
if (this._fileList[key])
|
||||
{
|
||||
|
|
|
@ -65,8 +65,8 @@ module Phaser {
|
|||
|
||||
static CIRCLE_ALPHA: number = 0.5522847498307933984022516322796; //4*(Math.sqrt(2)-1)/3.0;
|
||||
|
||||
static ON: bool = true;
|
||||
static OFF: bool = false;
|
||||
static ON: boolean = true;
|
||||
static OFF: boolean = false;
|
||||
|
||||
static SHORT_EPSILON: number = 0.1;//round integer epsilon
|
||||
static PERC_EPSILON: number = 0.001;//percentage epsilon
|
||||
|
@ -76,15 +76,15 @@ module Phaser {
|
|||
public cosTable = [];
|
||||
public sinTable = [];
|
||||
|
||||
public fuzzyEqual(a: number, b: number, epsilon: number = 0.0001): bool {
|
||||
public fuzzyEqual(a: number, b: number, epsilon: number = 0.0001): boolean {
|
||||
return Math.abs(a - b) < epsilon;
|
||||
}
|
||||
|
||||
public fuzzyLessThan(a: number, b: number, epsilon: number = 0.0001): bool {
|
||||
public fuzzyLessThan(a: number, b: number, epsilon: number = 0.0001): boolean {
|
||||
return a < b + epsilon;
|
||||
}
|
||||
|
||||
public fuzzyGreaterThan(a: number, b: number, epsilon: number = 0.0001): bool {
|
||||
public fuzzyGreaterThan(a: number, b: number, epsilon: number = 0.0001): boolean {
|
||||
return a > b - epsilon;
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ module Phaser {
|
|||
/**
|
||||
* Snaps a value to the nearest value in an array.
|
||||
*/
|
||||
public snapToInArray(input: number, arr: number[], sort?: bool = true): number {
|
||||
public snapToInArray(input: number, arr: number[], sort: boolean = true): number {
|
||||
|
||||
if (sort) arr.sort();
|
||||
if (input < arr[0]) return arr[0];
|
||||
|
@ -325,7 +325,7 @@ module Phaser {
|
|||
/**
|
||||
* set an angle within the bounds of -PI to PI
|
||||
*/
|
||||
public normalizeAngle(angle: number, radians: bool = true): number {
|
||||
public normalizeAngle(angle: number, radians: boolean = true): number {
|
||||
var rd: number = (radians) ? GameMath.PI : 180;
|
||||
return this.wrap(angle, rd, -rd);
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ module Phaser {
|
|||
* closest angle between two angles from a1 to a2
|
||||
* absolute value the return for exact angle
|
||||
*/
|
||||
public nearestAngleBetween(a1: number, a2: number, radians: bool = true): number {
|
||||
public nearestAngleBetween(a1: number, a2: number, radians: boolean = true): number {
|
||||
|
||||
var rd: number = (radians) ? GameMath.PI : 180;
|
||||
|
||||
|
@ -352,7 +352,7 @@ module Phaser {
|
|||
*
|
||||
* for instance if dep=-170 and ind=170 then 190 will be returned as an alternative to -170
|
||||
*/
|
||||
public normalizeAngleToAnother(dep: number, ind: number, radians: bool = true): number {
|
||||
public normalizeAngleToAnother(dep: number, ind: number, radians: boolean = true): number {
|
||||
return ind + this.nearestAngleBetween(ind, dep, radians);
|
||||
}
|
||||
|
||||
|
@ -361,7 +361,7 @@ module Phaser {
|
|||
*
|
||||
* for instance dep=-170 and ind=170, then 190 will be reutrned as alternative to -170
|
||||
*/
|
||||
public normalizeAngleAfterAnother(dep: number, ind: number, radians: bool = true): number {
|
||||
public normalizeAngleAfterAnother(dep: number, ind: number, radians: boolean = true): number {
|
||||
|
||||
dep = this.normalizeAngle(dep - ind, radians);
|
||||
return ind + dep;
|
||||
|
@ -372,7 +372,7 @@ module Phaser {
|
|||
*
|
||||
* for instance dep = 190 and ind = 170, then -170 will be returned as an alternative to 190
|
||||
*/
|
||||
public normalizeAngleBeforeAnother(dep: number, ind: number, radians: bool = true): number {
|
||||
public normalizeAngleBeforeAnother(dep: number, ind: number, radians: boolean = true): number {
|
||||
|
||||
dep = this.normalizeAngle(ind - dep, radians);
|
||||
return ind - dep;
|
||||
|
@ -381,7 +381,7 @@ module Phaser {
|
|||
/**
|
||||
* interpolate across the shortest arc between two angles
|
||||
*/
|
||||
public interpolateAngles(a1: number, a2: number, weight: number, radians: bool = true, ease = null): number {
|
||||
public interpolateAngles(a1: number, a2: number, weight: number, radians: boolean = true, ease = null): number {
|
||||
|
||||
a1 = this.normalizeAngle(a1, radians);
|
||||
a2 = this.normalizeAngleToAnother(a2, a1, radians);
|
||||
|
@ -529,7 +529,7 @@ module Phaser {
|
|||
* @param chance The chance of receiving the value. A number between 0 and 100 (effectively 0% to 100%)
|
||||
* @return true if the roll passed, or false
|
||||
*/
|
||||
public chanceRoll(chance: number = 50): bool {
|
||||
public chanceRoll(chance: number = 50): boolean {
|
||||
|
||||
if (chance <= 0)
|
||||
{
|
||||
|
@ -633,7 +633,7 @@ module Phaser {
|
|||
*
|
||||
* @return True if the given number is odd. False if the given number is even.
|
||||
*/
|
||||
public isOdd(n: number): bool {
|
||||
public isOdd(n: number): boolean {
|
||||
|
||||
if (n & 1)
|
||||
{
|
||||
|
@ -653,7 +653,7 @@ module Phaser {
|
|||
*
|
||||
* @return True if the given number is even. False if the given number is odd.
|
||||
*/
|
||||
public isEven(n: number): bool {
|
||||
public isEven(n: number): boolean {
|
||||
|
||||
if (n & 1)
|
||||
{
|
||||
|
@ -906,7 +906,7 @@ module Phaser {
|
|||
* @see getSinTable
|
||||
* @see getCosTable
|
||||
*/
|
||||
public sinCosGenerator(length: number, sinAmplitude?: number = 1.0, cosAmplitude?: number = 1.0, frequency?: number = 1.0) {
|
||||
public sinCosGenerator(length: number, sinAmplitude: number = 1.0, cosAmplitude: number = 1.0, frequency: number = 1.0) {
|
||||
|
||||
var sin: number = sinAmplitude;
|
||||
var cos: number = cosAmplitude;
|
||||
|
|
|
@ -152,7 +152,7 @@ module Phaser {
|
|||
* @param {Mat3} out The output Mat3, if none is given a new Mat3 object will be created.
|
||||
* @return {Mat3} The new Mat3
|
||||
**/
|
||||
public clone(out?:Mat3 = new Phaser.Mat3): Mat3 {
|
||||
public clone(out:Mat3 = new Phaser.Mat3): Mat3 {
|
||||
|
||||
out[0] = this.data[0];
|
||||
out[1] = this.data[1];
|
||||
|
|
|
@ -16,7 +16,7 @@ module Phaser {
|
|||
/**
|
||||
* Transpose the values of a Mat3
|
||||
**/
|
||||
static transpose(source:Phaser.Mat3, dest?:Phaser.Mat3 = null): Mat3 {
|
||||
static transpose(source:Phaser.Mat3, dest:Phaser.Mat3 = null): Mat3 {
|
||||
|
||||
if (dest === null)
|
||||
{
|
||||
|
|
|
@ -101,7 +101,7 @@ module Phaser {
|
|||
private _basic;
|
||||
private _members;
|
||||
private _l: number;
|
||||
private _overlapProcessed: bool;
|
||||
private _overlapProcessed: boolean;
|
||||
private _checkObject;
|
||||
|
||||
public static physics: Phaser.Physics.Manager;
|
||||
|
@ -124,7 +124,7 @@ module Phaser {
|
|||
/**
|
||||
* Whether this branch of the tree can be subdivided or not.
|
||||
*/
|
||||
private _canSubdivide: bool;
|
||||
private _canSubdivide: boolean;
|
||||
|
||||
/**
|
||||
* Refers to the internal A and B linked lists,
|
||||
|
@ -228,7 +228,7 @@ module Phaser {
|
|||
/**
|
||||
* Internal, used during tree processing and overlap checks.
|
||||
*/
|
||||
private static _useBothLists: bool;
|
||||
private static _useBothLists: boolean;
|
||||
|
||||
/**
|
||||
* Internal, used during tree processing and overlap checks.
|
||||
|
@ -544,7 +544,7 @@ module Phaser {
|
|||
*
|
||||
* @return {Boolean} Whether or not any overlaps were found.
|
||||
*/
|
||||
public execute(): bool {
|
||||
public execute(): boolean {
|
||||
|
||||
this._overlapProcessed = false;
|
||||
|
||||
|
@ -605,7 +605,7 @@ module Phaser {
|
|||
*
|
||||
* @return {Boolean} Whether or not any overlaps were found.
|
||||
*/
|
||||
private overlapNode(): bool {
|
||||
private overlapNode(): boolean {
|
||||
|
||||
//Walk the list and check for overlaps
|
||||
this._overlapProcessed = false;
|
||||
|
|
|
@ -17,7 +17,7 @@ module Phaser {
|
|||
* @param {Array} seeds
|
||||
* @return {Phaser.RandomDataGenerator}
|
||||
*/
|
||||
constructor(seeds?: string[] = []) {
|
||||
constructor(seeds: string[] = []) {
|
||||
|
||||
this.sow(seeds);
|
||||
|
||||
|
@ -122,7 +122,7 @@ module Phaser {
|
|||
* @method sow
|
||||
* @param {Array} seeds
|
||||
*/
|
||||
public sow(seeds?: string[] = []) {
|
||||
public sow(seeds: string[] = []) {
|
||||
|
||||
this.s0 = this.hash(' ');
|
||||
this.s1 = this.hash(this.s0);
|
||||
|
@ -263,7 +263,7 @@ module Phaser {
|
|||
* @param {Number} min
|
||||
* @param {Number} max
|
||||
*/
|
||||
public timestamp(min?: number = 946684800000, max?: number = 1577862000000): number {
|
||||
public timestamp(min: number = 946684800000, max: number = 1577862000000): number {
|
||||
|
||||
return this.realInRange(min, max);
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ module Phaser {
|
|||
* @param {?number=} y The scaling factor in the y direction. If this is not specified, the x scaling factor will be used.
|
||||
* @return {Vec2} This for chaining.
|
||||
*/
|
||||
public scale(x: number, y?:number): Vec2 {
|
||||
public scale(x: number, y:number): Vec2 {
|
||||
|
||||
this.x *= x;
|
||||
this.y *= y || x;
|
||||
|
@ -280,7 +280,7 @@ module Phaser {
|
|||
*
|
||||
* @return {Boolean}
|
||||
*/
|
||||
public equals(value): bool {
|
||||
public equals(value): boolean {
|
||||
return (this.x == value && this.y == value);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ module Phaser {
|
|||
* @param {Vec2} out The output Vec2 that is the result of the operation.
|
||||
* @return {Vec2} A Vec2 that is the sum of the two vectors.
|
||||
*/
|
||||
static add(a: Vec2, b: Vec2, out?: Vec2 = new Vec2): Vec2 {
|
||||
static add(a: Vec2, b: Vec2, out: Vec2 = new Vec2): Vec2 {
|
||||
return out.setTo(a.x + b.x, a.y + b.y);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ module Phaser {
|
|||
* @param {Vec2} out The output Vec2 that is the result of the operation.
|
||||
* @return {Vec2} A Vec2 that is the difference of the two vectors.
|
||||
*/
|
||||
static subtract(a: Vec2, b: Vec2, out?: Vec2 = new Vec2): Vec2 {
|
||||
static subtract(a: Vec2, b: Vec2, out: Vec2 = new Vec2): Vec2 {
|
||||
return out.setTo(a.x - b.x, a.y - b.y);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ module Phaser {
|
|||
* @param {Vec2} out The output Vec2 that is the result of the operation.
|
||||
* @return {Vec2} A Vec2 that is the sum of the two vectors multiplied.
|
||||
*/
|
||||
static multiply(a: Vec2, b: Vec2, out?: Vec2 = new Vec2): Vec2 {
|
||||
static multiply(a: Vec2, b: Vec2, out: Vec2 = new Vec2): Vec2 {
|
||||
return out.setTo(a.x * b.x, a.y * b.y);
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ module Phaser {
|
|||
* @param {Vec2} out The output Vec2 that is the result of the operation.
|
||||
* @return {Vec2} A Vec2 that is the sum of the two vectors divided.
|
||||
*/
|
||||
static divide(a: Vec2, b: Vec2, out?: Vec2 = new Vec2): Vec2 {
|
||||
static divide(a: Vec2, b: Vec2, out: Vec2 = new Vec2): Vec2 {
|
||||
return out.setTo(a.x / b.x, a.y / b.y);
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ module Phaser {
|
|||
* @param {Vec2} out The output Vec2 that is the result of the operation.
|
||||
* @return {Vec2} A Vec2 that is the scaled vector.
|
||||
*/
|
||||
static scale(a: Phaser.Vec2, s: number, out?: Phaser.Vec2 = new Phaser.Vec2): Phaser.Vec2 {
|
||||
static scale(a: Phaser.Vec2, s: number, out: Phaser.Vec2 = new Phaser.Vec2): Phaser.Vec2 {
|
||||
return out.setTo(a.x * s, a.y * s);
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ module Phaser {
|
|||
* @param {Vec2} out The output Vec2 that is the result of the operation.
|
||||
* @return {Vec2} A Vec2 that is the sum of the two vectors added and multiplied.
|
||||
*/
|
||||
static multiplyAdd(a: Vec2, b: Vec2, s: number, out?: Vec2 = new Vec2): Vec2 {
|
||||
static multiplyAdd(a: Vec2, b: Vec2, s: number, out: Vec2 = new Vec2): Vec2 {
|
||||
return out.setTo(a.x + b.x * s, a.y + b.y * s);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ module Phaser {
|
|||
* @param {Vec2} out The output Vec2 that is the result of the operation.
|
||||
* @return {Vec2} A Vec2 that is the negative vector.
|
||||
*/
|
||||
static negative(a: Vec2, out?: Vec2 = new Vec2): Vec2 {
|
||||
static negative(a: Vec2, out: Vec2 = new Vec2): Vec2 {
|
||||
return out.setTo(-a.x, -a.y);
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ module Phaser {
|
|||
* @param {Vec2} out The output Vec2 that is the result of the operation.
|
||||
* @return {Vec2} A Vec2 that is the scaled vector.
|
||||
*/
|
||||
static perp(a: Vec2, out?: Vec2 = new Vec2): Vec2 {
|
||||
static perp(a: Vec2, out: Vec2 = new Vec2): Vec2 {
|
||||
return out.setTo(-a.y, a.x);
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ module Phaser {
|
|||
* @param {Vec2} out The output Vec2 that is the result of the operation.
|
||||
* @return {Vec2} A Vec2 that is the scaled vector.
|
||||
*/
|
||||
static rperp(a: Vec2, out?: Vec2 = new Vec2): Vec2 {
|
||||
static rperp(a: Vec2, out: Vec2 = new Vec2): Vec2 {
|
||||
return out.setTo(a.y, -a.x);
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ module Phaser {
|
|||
* @param {Vec2} b Reference to a source Vec2 object.
|
||||
* @return {Boolean}
|
||||
*/
|
||||
static equals(a: Vec2, b: Vec2): bool {
|
||||
static equals(a: Vec2, b: Vec2): boolean {
|
||||
return a.x == b.x && a.y == b.y;
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ module Phaser {
|
|||
* @param {Vec2} epsilon
|
||||
* @return {Boolean}
|
||||
*/
|
||||
static epsilonEquals(a: Vec2, b: Vec2, epsilon: number): bool {
|
||||
static epsilonEquals(a: Vec2, b: Vec2, epsilon: number): boolean {
|
||||
return Math.abs(a.x - b.x) <= epsilon && Math.abs(a.y - b.y) <= epsilon;
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ module Phaser {
|
|||
* @param {Vec2} out The output Vec2 that is the result of the operation.
|
||||
* @return {Vec2} A Vec2.
|
||||
*/
|
||||
static project(a: Vec2, b: Vec2, out?: Vec2 = new Vec2): Vec2 {
|
||||
static project(a: Vec2, b: Vec2, out: Vec2 = new Vec2): Vec2 {
|
||||
|
||||
var amt = a.dot(b) / b.lengthSq();
|
||||
|
||||
|
@ -192,7 +192,7 @@ module Phaser {
|
|||
* @param {Vec2} out The output Vec2 that is the result of the operation.
|
||||
* @return {Vec2} A Vec2.
|
||||
*/
|
||||
static projectUnit(a: Vec2, b: Vec2, out?: Vec2 = new Vec2): Vec2 {
|
||||
static projectUnit(a: Vec2, b: Vec2, out: Vec2 = new Vec2): Vec2 {
|
||||
|
||||
var amt = a.dot(b);
|
||||
|
||||
|
@ -212,7 +212,7 @@ module Phaser {
|
|||
* @param {Vec2} out The output Vec2 that is the result of the operation.
|
||||
* @return {Vec2} A Vec2.
|
||||
*/
|
||||
static normalRightHand(a: Vec2, out?: Vec2 = new Vec2): Vec2 {
|
||||
static normalRightHand(a: Vec2, out: Vec2 = new Vec2): Vec2 {
|
||||
return out.setTo(a.y * -1, a.x);
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ module Phaser {
|
|||
* @param {Vec2} out The output Vec2 that is the result of the operation.
|
||||
* @return {Vec2} A Vec2.
|
||||
*/
|
||||
static normalize(a: Vec2, out?: Vec2 = new Vec2): Vec2 {
|
||||
static normalize(a: Vec2, out: Vec2 = new Vec2): Vec2 {
|
||||
|
||||
var m = a.length();
|
||||
|
||||
|
@ -288,7 +288,7 @@ module Phaser {
|
|||
* @param {Vec2} out The output Vec2 that is the result of the operation.
|
||||
* @return {Vec2} A Vec2.
|
||||
*/
|
||||
static rotateAroundOrigin(a: Vec2, b: Vec2, theta: number, out?: Vec2 = new Vec2): Vec2 {
|
||||
static rotateAroundOrigin(a: Vec2, b: Vec2, theta: number, out: Vec2 = new Vec2): Vec2 {
|
||||
var x = a.x - b.x;
|
||||
var y = a.y - b.y;
|
||||
return out.setTo(x * Math.cos(theta) - y * Math.sin(theta) + b.x, x * Math.sin(theta) + y * Math.cos(theta) + b.y);
|
||||
|
@ -303,7 +303,7 @@ module Phaser {
|
|||
* @param {Vec2} out The output Vec2 that is the result of the operation.
|
||||
* @return {Vec2} A Vec2.
|
||||
*/
|
||||
static rotate(a: Vec2, theta: number, out?: Vec2 = new Vec2): Vec2 {
|
||||
static rotate(a: Vec2, theta: number, out: Vec2 = new Vec2): Vec2 {
|
||||
|
||||
var c = Math.cos(theta);
|
||||
var s = Math.sin(theta);
|
||||
|
@ -319,7 +319,7 @@ module Phaser {
|
|||
* @param {Vec2} out The output Vec2 that is the result of the operation.
|
||||
* @return {Vec2} A Vec2 that is a copy of the source Vec2.
|
||||
*/
|
||||
static clone(a: Vec2, out?: Vec2 = new Vec2): Vec2 {
|
||||
static clone(a: Vec2, out: Vec2 = new Vec2): Vec2 {
|
||||
return out.setTo(a.x, a.y);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ module Phaser {
|
|||
* You can specify a part of a domain, for example 'google' would match 'google.com', 'google.co.uk', etc.
|
||||
* Do not include 'http://' at the start.
|
||||
*/
|
||||
public checkDomainName(domain: string): bool {
|
||||
public checkDomainName(domain: string): boolean {
|
||||
return window.location.hostname.indexOf(domain) !== -1;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ module Phaser {
|
|||
* If the value exists it is replaced with the new value given. If you don't provide a new value it is removed from the query string.
|
||||
* Optionally you can redirect to the new url, or just return it as a string.
|
||||
*/
|
||||
public updateQueryString(key: string, value: string, redirect?:bool = false, url?: string = ''):string {
|
||||
public updateQueryString(key: string, value: string, redirect:boolean = false, url: string = ''):string {
|
||||
|
||||
if (url == '')
|
||||
{
|
||||
|
@ -99,7 +99,7 @@ module Phaser {
|
|||
* Returns the Query String as an object.
|
||||
* If you specify a parameter it will return just the value of that parameter, should it exist.
|
||||
*/
|
||||
public getQueryString(parameter?: string = '') {
|
||||
public getQueryString(parameter: string = '') {
|
||||
|
||||
var output = {};
|
||||
var keyValues = location.search.substring(1).split('&');
|
||||
|
|
|
@ -75,12 +75,12 @@ module Phaser {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public alive: bool;
|
||||
public alive: boolean;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public active: bool;
|
||||
public active: boolean;
|
||||
|
||||
/**
|
||||
* The minimum possible velocity of a particle.
|
||||
|
@ -120,7 +120,7 @@ module Phaser {
|
|||
* Determines whether the emitter is currently emitting particles.
|
||||
* It is totally safe to directly toggle this.
|
||||
*/
|
||||
public on: bool;
|
||||
public on: boolean;
|
||||
|
||||
/**
|
||||
* How often a particle is emitted (if emitter is started with Explode == false).
|
||||
|
@ -152,7 +152,7 @@ module Phaser {
|
|||
/**
|
||||
* Internal helper for the style of particle emission (all at once, or one at a time).
|
||||
*/
|
||||
private _explode: bool;
|
||||
private _explode: boolean;
|
||||
|
||||
/**
|
||||
* Internal helper for deciding when to launch particles or kill them.
|
||||
|
@ -191,7 +191,7 @@ module Phaser {
|
|||
*
|
||||
* @return This Emitter instance (nice for chaining stuff together, if you're into that).
|
||||
*/
|
||||
public makeParticles(graphics, quantity: number = 50, multiple: bool = false, collide: number = 0): ArcadeEmitter {
|
||||
public makeParticles(graphics, quantity: number = 50, multiple: boolean = false, collide: number = 0): ArcadeEmitter {
|
||||
|
||||
this.maxSize = quantity;
|
||||
|
||||
|
@ -338,7 +338,7 @@ module Phaser {
|
|||
* @param frequency {number} Ignored if Explode is set to true. Frequency is how often to emit a particle. 0 = never emit, 0.1 = 1 particle every 0.1 seconds, 5 = 1 particle every 5 seconds.
|
||||
* @param quantity {number} How many particles to launch. 0 = "all of the particles".
|
||||
*/
|
||||
public start(explode: bool = true, lifespan: number = 0, frequency: number = 0.1, quantity: number = 0) {
|
||||
public start(explode: boolean = true, lifespan: number = 0, frequency: number = 0.1, quantity: number = 0) {
|
||||
|
||||
this.revive();
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/**
|
||||
* Phaser
|
||||
* www.phaser.io
|
||||
*
|
||||
* v1.0.0 - August 12th 2013
|
||||
*
|
||||
|
@ -17,5 +18,6 @@
|
|||
var Phaser;
|
||||
(function (Phaser) {
|
||||
Phaser.VERSION = 'Phaser version 1.0.0';
|
||||
|
||||
Phaser.GAMES = [];
|
||||
})(Phaser || (Phaser = {}));
|
||||
|
|
|
@ -48,8 +48,8 @@ module Phaser.Physics {
|
|||
private _length: number = 0;
|
||||
private _distance: Vec2;
|
||||
private _tangent: Vec2;
|
||||
private _separatedX: bool;
|
||||
private _separatedY: bool;
|
||||
private _separatedX: boolean;
|
||||
private _separatedY: boolean;
|
||||
private _overlap: number;
|
||||
private _maxOverlap: number;
|
||||
private _obj1Velocity: number;
|
||||
|
@ -58,7 +58,7 @@ module Phaser.Physics {
|
|||
private _obj2NewVelocity: number;
|
||||
private _average: number;
|
||||
private _quadTree: QuadTree;
|
||||
private _quadTreeResult: bool;
|
||||
private _quadTreeResult: boolean;
|
||||
|
||||
public bounds: Rectangle;
|
||||
|
||||
|
@ -77,7 +77,7 @@ module Phaser.Physics {
|
|||
* The overlap bias is used when calculating hull overlap before separation - change it if you have especially small or large GameObjects
|
||||
* @type {number}
|
||||
*/
|
||||
static TILE_OVERLAP: bool = false;
|
||||
static TILE_OVERLAP: boolean = false;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
|
@ -213,7 +213,7 @@ module Phaser.Physics {
|
|||
* @param body2 The second Physics.Body to separate
|
||||
* @returns {boolean} Returns true if the bodies were separated, otherwise false.
|
||||
*/
|
||||
public separate(body1: Body, body2: Body): bool {
|
||||
public separate(body1: Body, body2: Body): boolean {
|
||||
|
||||
this._separatedX = this.separateBodyX(body1, body2);
|
||||
this._separatedY = this.separateBodyY(body1, body2);
|
||||
|
@ -222,7 +222,7 @@ module Phaser.Physics {
|
|||
|
||||
}
|
||||
|
||||
public checkHullIntersection(body1: Body, body2:Body): bool {
|
||||
public checkHullIntersection(body1: Body, body2:Body): boolean {
|
||||
return ((body1.hullX + body1.hullWidth > body2.hullX) && (body1.hullX < body2.hullX + body2.hullWidth) && (body1.hullY + body1.hullHeight > body2.hullY) && (body1.hullY < body2.hullY + body2.hullHeight));
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ module Phaser.Physics {
|
|||
* @param object2 The second GameObject to separate
|
||||
* @returns {boolean} Whether the objects in fact touched and were separated along the X axis.
|
||||
*/
|
||||
public separateBodyX(body1: Body, body2: Body): bool {
|
||||
public separateBodyX(body1: Body, body2: Body): boolean {
|
||||
|
||||
// Can't separate two disabled or static objects
|
||||
if ((body1.type == Types.BODY_DISABLED || body1.type == Types.BODY_STATIC) && (body2.type == Types.BODY_DISABLED || body2.type == Types.BODY_STATIC))
|
||||
|
@ -338,7 +338,7 @@ module Phaser.Physics {
|
|||
* @param object2 The second GameObject to separate
|
||||
* @returns {boolean} Whether the objects in fact touched and were separated along the Y axis.
|
||||
*/
|
||||
public separateBodyY(body1: Body, body2: Body): bool {
|
||||
public separateBodyY(body1: Body, body2: Body): boolean {
|
||||
|
||||
// Can't separate two immovable objects
|
||||
if ((body1.type == Types.BODY_DISABLED || body1.type == Types.BODY_STATIC) && (body2.type == Types.BODY_DISABLED || body2.type == Types.BODY_STATIC))
|
||||
|
@ -725,7 +725,7 @@ module Phaser.Physics {
|
|||
* @param context The context in which the callbacks will be called
|
||||
* @returns {boolean} true if the objects overlap, otherwise false.
|
||||
*/
|
||||
public overlap(object1 = null, object2 = null, notifyCallback = null, processCallback = null, context = null): bool {
|
||||
public overlap(object1 = null, object2 = null, notifyCallback = null, processCallback = null, context = null): boolean {
|
||||
|
||||
/*
|
||||
if (object1 == null)
|
||||
|
@ -770,10 +770,10 @@ module Phaser.Physics {
|
|||
* @param tile The Tile to separate
|
||||
* @returns {boolean} Whether the objects in fact touched and were separated
|
||||
*/
|
||||
public separateTile(object:Sprite, x: number, y: number, width: number, height: number, mass: number, collideLeft: bool, collideRight: bool, collideUp: bool, collideDown: bool, separateX: bool, separateY: bool): bool {
|
||||
public separateTile(object:Sprite, x: number, y: number, width: number, height: number, mass: number, collideLeft: boolean, collideRight: boolean, collideUp: boolean, collideDown: boolean, separateX: boolean, separateY: boolean): boolean {
|
||||
|
||||
//var separatedX: bool = this.separateTileX(object, x, y, width, height, mass, collideLeft, collideRight, separateX);
|
||||
//var separatedY: bool = this.separateTileY(object, x, y, width, height, mass, collideUp, collideDown, separateY);
|
||||
//var separatedX: boolean = this.separateTileX(object, x, y, width, height, mass, collideLeft, collideRight, separateX);
|
||||
//var separatedY: boolean = this.separateTileY(object, x, y, width, height, mass, collideUp, collideDown, separateY);
|
||||
|
||||
//return separatedX || separatedY;
|
||||
|
||||
|
@ -788,7 +788,7 @@ module Phaser.Physics {
|
|||
* @returns {boolean} Whether the objects in fact touched and were separated along the X axis.
|
||||
*/
|
||||
/*
|
||||
public separateTileX(object:Sprite, x: number, y: number, width: number, height: number, mass: number, collideLeft: bool, collideRight: bool, separate: bool): bool {
|
||||
public separateTileX(object:Sprite, x: number, y: number, width: number, height: number, mass: number, collideLeft: boolean, collideRight: boolean, separate: boolean): boolean {
|
||||
|
||||
// Can't separate two immovable objects (tiles are always immovable)
|
||||
if (object.immovable)
|
||||
|
@ -872,7 +872,7 @@ module Phaser.Physics {
|
|||
* @returns {boolean} Whether the objects in fact touched and were separated along the Y axis.
|
||||
*/
|
||||
/*
|
||||
public separateTileY(object: Sprite, x: number, y: number, width: number, height: number, mass: number, collideUp: bool, collideDown: bool, separate: bool): bool {
|
||||
public separateTileY(object: Sprite, x: number, y: number, width: number, height: number, mass: number, collideUp: boolean, collideDown: boolean, separate: boolean): boolean {
|
||||
|
||||
// Can't separate two immovable objects (tiles are always immovable)
|
||||
if (object.immovable)
|
||||
|
@ -953,7 +953,7 @@ module Phaser.Physics {
|
|||
* @returns {boolean} Whether the objects in fact touched and were separated along the X axis.
|
||||
*/
|
||||
/*
|
||||
public static NEWseparateTileX(object:Sprite, x: number, y: number, width: number, height: number, mass: number, collideLeft: bool, collideRight: bool, separate: bool): bool {
|
||||
public static NEWseparateTileX(object:Sprite, x: number, y: number, width: number, height: number, mass: number, collideLeft: boolean, collideRight: boolean, separate: boolean): boolean {
|
||||
|
||||
// Can't separate two immovable objects (tiles are always immovable)
|
||||
if (object.immovable)
|
||||
|
@ -1036,7 +1036,7 @@ module Phaser.Physics {
|
|||
* @returns {boolean} Whether the objects in fact touched and were separated along the Y axis.
|
||||
*/
|
||||
/*
|
||||
public NEWseparateTileY(object: Sprite, x: number, y: number, width: number, height: number, mass: number, collideUp: bool, collideDown: bool, separate: bool): bool {
|
||||
public NEWseparateTileY(object: Sprite, x: number, y: number, width: number, height: number, mass: number, collideUp: boolean, collideDown: boolean, separate: boolean): boolean {
|
||||
|
||||
// Can't separate two immovable objects (tiles are always immovable)
|
||||
if (object.immovable)
|
||||
|
|
|
@ -293,7 +293,7 @@ module Phaser.Physics {
|
|||
* @param y {number} Y position of the debug info to be rendered.
|
||||
* @param [color] {number} color of the debug info to be rendered. (format is css color string)
|
||||
*/
|
||||
public renderDebugInfo(x: number, y: number, color?: string = 'rgb(255,255,255)') {
|
||||
public renderDebugInfo(x: number, y: number, color: string = 'rgb(255,255,255)') {
|
||||
|
||||
this.sprite.texture.context.fillStyle = color;
|
||||
this.sprite.texture.context.fillText('Sprite: (' + this.sprite.width + ' x ' + this.sprite.height + ')', x, y);
|
||||
|
|
|
@ -253,7 +253,7 @@ module Phaser {
|
|||
*
|
||||
* @return {number} The angle (in radians unless asDegrees is true)
|
||||
*/
|
||||
public angleBetweenPoint(a: Sprite, target: Point, asDegrees: bool = false): number {
|
||||
public angleBetweenPoint(a: Sprite, target: Point, asDegrees: boolean = false): number {
|
||||
|
||||
var dx: number = (target.x) - (a.x + a.transform.origin.x);
|
||||
var dy: number = (target.y) - (a.y + a.transform.origin.y);
|
||||
|
@ -279,7 +279,7 @@ module Phaser {
|
|||
*
|
||||
* @return {number} The angle (in radians unless asDegrees is true)
|
||||
*/
|
||||
public angleBetween(a: Sprite, b: Sprite, asDegrees: bool = false): number {
|
||||
public angleBetween(a: Sprite, b: Sprite, asDegrees: boolean = false): number {
|
||||
|
||||
var dx: number = (b.x + b.transform.origin.x) - (a.x + a.transform.origin.x);
|
||||
var dy: number = (b.y + b.transform.origin.y) - (a.y + a.transform.origin.y);
|
||||
|
@ -340,7 +340,7 @@ module Phaser {
|
|||
*
|
||||
* @return {number} The angle (in radians unless asDegrees is true)
|
||||
*/
|
||||
public angleBetweenMouse(a: Sprite, asDegrees: bool = false): number {
|
||||
public angleBetweenMouse(a: Sprite, asDegrees: boolean = false): number {
|
||||
|
||||
// In order to get the angle between the object and mouse, we need the objects screen coordinates (rather than world coordinates)
|
||||
var p: Point = SpriteUtils.getScreenXY(a);
|
||||
|
|
|
@ -19,7 +19,7 @@ module Phaser.Renderer.Headless {
|
|||
|
||||
public renderGameObject(camera, object) {
|
||||
// Nothing, headless remember?
|
||||
};
|
||||
}
|
||||
|
||||
public cameraRenderer;
|
||||
public groupRenderer;
|
||||
|
|
|
@ -32,7 +32,7 @@ module Phaser.Renderer.Canvas {
|
|||
private _sin: number = 0;
|
||||
private _cos: number = 1;
|
||||
|
||||
public preRender(camera: Camera): bool {
|
||||
public preRender(camera: Camera): boolean {
|
||||
|
||||
if (camera.visible == false || camera.transform.scale.x == 0 || camera.transform.scale.y == 0 || camera.texture.alpha < 0.1)
|
||||
{
|
||||
|
|
|
@ -30,7 +30,7 @@ module Phaser.Renderer.Canvas {
|
|||
private _sin: number = 0;
|
||||
private _cos: number = 1;
|
||||
|
||||
public renderCircle(camera: Camera, circle: Circle, context, outline?: bool = false, fill?: bool = true, lineColor?: string = 'rgb(0,255,0)', fillColor?: string = 'rgba(0,100,0.0.3)', lineWidth?: number = 1): bool {
|
||||
public renderCircle(camera: Camera, circle: Circle, context, outline: boolean = false, fill: boolean = true, lineColor: string = 'rgb(0,255,0)', fillColor: string = 'rgba(0,100,0.0.3)', lineWidth: number = 1): boolean {
|
||||
|
||||
// Reset our temp vars
|
||||
this._sx = 0;
|
||||
|
|
|
@ -35,7 +35,7 @@ module Phaser.Renderer.Canvas {
|
|||
* @param camera {Rectangle} The Rectangle you want to check.
|
||||
* @return {boolean} Return true if bounds of this sprite intersects the given Rectangle, otherwise return false.
|
||||
*/
|
||||
public inCamera(camera: Camera, scrollZone: ScrollZone): bool {
|
||||
public inCamera(camera: Camera, scrollZone: ScrollZone): boolean {
|
||||
|
||||
// Object fixed in place regardless of the camera scrolling? Then it's always visible
|
||||
if (scrollZone.transform.scrollFactor.equals(0))
|
||||
|
@ -48,7 +48,7 @@ module Phaser.Renderer.Canvas {
|
|||
|
||||
}
|
||||
|
||||
public render(camera: Camera, scrollZone: ScrollZone): bool {
|
||||
public render(camera: Camera, scrollZone: ScrollZone): boolean {
|
||||
|
||||
if (scrollZone.transform.scale.x == 0 || scrollZone.transform.scale.y == 0 || scrollZone.texture.alpha < 0.1 || this.inCamera(camera, scrollZone) == false)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ module Phaser.Renderer.Canvas {
|
|||
* @param camera {Rectangle} The Rectangle you want to check.
|
||||
* @return {boolean} Return true if bounds of this sprite intersects the given Rectangle, otherwise return false.
|
||||
*/
|
||||
public inCamera(camera: Camera, sprite: Sprite): bool {
|
||||
public inCamera(camera: Camera, sprite: Sprite): boolean {
|
||||
|
||||
// Object fixed in place regardless of the camera scrolling? Then it's always visible
|
||||
if (sprite.transform.scrollFactor.equals(0))
|
||||
|
@ -50,7 +50,7 @@ module Phaser.Renderer.Canvas {
|
|||
* @param camera {Camera} Camera this sprite will be rendered to.
|
||||
* @return {boolean} Return false if not rendered, otherwise return true.
|
||||
*/
|
||||
public render(camera: Camera, sprite: Sprite): bool {
|
||||
public render(camera: Camera, sprite: Sprite): boolean {
|
||||
|
||||
Phaser.SpriteUtils.updateCameraView(camera, sprite);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ module Phaser.Renderer.Canvas {
|
|||
* Render a tilemap to a specific camera.
|
||||
* @param camera {Camera} The camera this tilemap will be rendered to.
|
||||
*/
|
||||
public render(camera: Camera, tilemap: Tilemap): bool {
|
||||
public render(camera: Camera, tilemap: Tilemap): boolean {
|
||||
|
||||
// Loop through the layers
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ module Phaser {
|
|||
* @param [volume] {number} volume of this sound when playing.
|
||||
* @param [loop] {boolean} loop this sound when playing? (Default to false)
|
||||
*/
|
||||
constructor(game: Phaser.Game, key: string, volume?: number = 1, loop?: bool = false) {
|
||||
constructor(game: Phaser.Game, key: string, volume: number = 1, loop: boolean = false) {
|
||||
|
||||
this.game = game;
|
||||
|
||||
|
@ -116,27 +116,27 @@ module Phaser {
|
|||
private _sound;
|
||||
|
||||
private _muteVolume: number;
|
||||
private _muted: bool = false;
|
||||
private _muted: boolean = false;
|
||||
private _tempPosition: number;
|
||||
private _tempVolume: number;
|
||||
private _tempLoop: bool;
|
||||
private _tempLoop: boolean;
|
||||
private _tempMarker: string;
|
||||
|
||||
public usingWebAudio: bool = false;
|
||||
public usingAudioTag: bool = false;
|
||||
public usingWebAudio: boolean = false;
|
||||
public usingAudioTag: boolean = false;
|
||||
|
||||
public name: string = '';
|
||||
|
||||
autoplay: bool = false;
|
||||
autoplay: boolean = false;
|
||||
totalDuration: number = 0;
|
||||
startTime: number = 0;
|
||||
currentTime: number = 0;
|
||||
duration: number = 0;
|
||||
stopTime: number = 0;
|
||||
position: number;
|
||||
paused: bool = false;
|
||||
loop: bool = false;
|
||||
isPlaying: bool = false;
|
||||
paused: boolean = false;
|
||||
loop: boolean = false;
|
||||
isPlaying: boolean = false;
|
||||
key: string;
|
||||
markers;
|
||||
currentMarker: string = '';
|
||||
|
@ -151,17 +151,17 @@ module Phaser {
|
|||
public onMute: Phaser.Signal;
|
||||
public onMarkerComplete: Phaser.Signal;
|
||||
|
||||
public pendingPlayback: bool = false;
|
||||
public pendingPlayback: boolean = false;
|
||||
|
||||
public get isDecoding(): bool {
|
||||
public get isDecoding(): boolean {
|
||||
return this.game.cache.getSound(this.key).isDecoding;
|
||||
}
|
||||
|
||||
public get isDecoded(): bool {
|
||||
public get isDecoded(): boolean {
|
||||
return this.game.cache.isSoundDecoded(this.key);
|
||||
}
|
||||
|
||||
public addMarker(name: string, start: number, stop: number, volume: number = 1, loop: bool = false) {
|
||||
public addMarker(name: string, start: number, stop: number, volume: number = 1, loop: boolean = false) {
|
||||
this.markers[name] = { name: name, start: start, stop: stop, volume: volume, duration: stop - start, loop: loop };
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ module Phaser {
|
|||
|
||||
}
|
||||
|
||||
public override: bool = false;
|
||||
public override: boolean = false;
|
||||
|
||||
/**
|
||||
* Play this sound, or a marked section of it.
|
||||
|
@ -239,7 +239,7 @@ module Phaser {
|
|||
* @param [loop] {boolean} loop when it finished playing? (Default to false)
|
||||
* @return {Sound} The playing sound object.
|
||||
*/
|
||||
public play(marker: string = '', position?: number = 0, volume?: number = 1, loop?: bool = false, forceRestart: bool = false) {
|
||||
public play(marker: string = '', position: number = 0, volume: number = 1, loop: boolean = false, forceRestart: boolean = false) {
|
||||
|
||||
//console.log('play', marker, 'current is', this.currentMarker);
|
||||
|
||||
|
@ -409,7 +409,7 @@ module Phaser {
|
|||
|
||||
}
|
||||
|
||||
public restart(marker: string = '', position?: number = 0, volume?: number = 1, loop?: bool = false) {
|
||||
public restart(marker: string = '', position: number = 0, volume: number = 1, loop: boolean = false) {
|
||||
this.play(marker, position, volume, loop, true);
|
||||
}
|
||||
|
||||
|
@ -491,11 +491,11 @@ module Phaser {
|
|||
/**
|
||||
* Mute sounds.
|
||||
*/
|
||||
public get mute(): bool {
|
||||
public get mute(): boolean {
|
||||
return this._muted;
|
||||
}
|
||||
|
||||
public set mute(value: bool) {
|
||||
public set mute(value: boolean) {
|
||||
|
||||
if (value)
|
||||
{
|
||||
|
|
|
@ -102,9 +102,9 @@ module Phaser {
|
|||
|
||||
}
|
||||
|
||||
public usingWebAudio: bool = false;
|
||||
public usingAudioTag: bool = false;
|
||||
public noAudio: bool = false;
|
||||
public usingWebAudio: boolean = false;
|
||||
public usingAudioTag: boolean = false;
|
||||
public noAudio: boolean = false;
|
||||
|
||||
/**
|
||||
* Local reference to the current Phaser.Game.
|
||||
|
@ -130,11 +130,11 @@ module Phaser {
|
|||
private _sounds: Phaser.Sound[];
|
||||
|
||||
private _muteVolume: number;
|
||||
private _muted: bool = false;
|
||||
private _muted: boolean = false;
|
||||
|
||||
public channels: number;
|
||||
|
||||
public touchLocked: bool = false;
|
||||
public touchLocked: boolean = false;
|
||||
|
||||
private _unlockSource = null;
|
||||
|
||||
|
@ -174,11 +174,11 @@ module Phaser {
|
|||
/**
|
||||
* A global audio mute toggle.
|
||||
*/
|
||||
public get mute():bool {
|
||||
public get mute():boolean {
|
||||
return this._muted;
|
||||
}
|
||||
|
||||
public set mute(value: bool) {
|
||||
public set mute(value: boolean) {
|
||||
|
||||
console.log('SoundManager mute', value);
|
||||
|
||||
|
@ -311,7 +311,7 @@ module Phaser {
|
|||
* @param key {string} Assets key of the sound to be decoded.
|
||||
* @param [sound] {Sound} its bufer will be set to decoded data.
|
||||
*/
|
||||
public decode(key: string, sound?: Sound = null) {
|
||||
public decode(key: string, sound: Sound = null) {
|
||||
|
||||
var soundData = this.game.cache.getSoundData(key);
|
||||
|
||||
|
@ -362,7 +362,7 @@ module Phaser {
|
|||
|
||||
}
|
||||
|
||||
public add(key: string, volume?: number = 1, loop?: bool = false): Sound {
|
||||
public add(key: string, volume: number = 1, loop: boolean = false): Sound {
|
||||
|
||||
var sound: Phaser.Sound = new Sound(this.game, key, volume, loop);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ module Phaser {
|
|||
* https://code.google.com/p/android/issues/detail?id=39247
|
||||
* @type {boolean}
|
||||
*/
|
||||
public patchAndroidClearRectBug: bool = false;
|
||||
public patchAndroidClearRectBug: boolean = false;
|
||||
|
||||
// Operating System
|
||||
|
||||
|
@ -40,43 +40,43 @@ module Phaser {
|
|||
* Is running desktop?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public desktop: bool = false;
|
||||
public desktop: boolean = false;
|
||||
|
||||
/**
|
||||
* Is running on iOS?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public iOS: bool = false;
|
||||
public iOS: boolean = false;
|
||||
|
||||
/**
|
||||
* Is running on android?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public android: bool = false;
|
||||
public android: boolean = false;
|
||||
|
||||
/**
|
||||
* Is running on chromeOS?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public chromeOS: bool = false;
|
||||
public chromeOS: boolean = false;
|
||||
|
||||
/**
|
||||
* Is running on linux?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public linux: bool = false;
|
||||
public linux: boolean = false;
|
||||
|
||||
/**
|
||||
* Is running on maxOS?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public macOS: bool = false;
|
||||
public macOS: boolean = false;
|
||||
|
||||
/**
|
||||
* Is running on windows?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public windows: bool = false;
|
||||
public windows: boolean = false;
|
||||
|
||||
// Features
|
||||
|
||||
|
@ -84,55 +84,55 @@ module Phaser {
|
|||
* Is canvas available?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public canvas: bool = false;
|
||||
public canvas: boolean = false;
|
||||
|
||||
/**
|
||||
* Is file available?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public file: bool = false;
|
||||
public file: boolean = false;
|
||||
|
||||
/**
|
||||
* Is fileSystem available?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public fileSystem: bool = false;
|
||||
public fileSystem: boolean = false;
|
||||
|
||||
/**
|
||||
* Is localStorage available?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public localStorage: bool = false;
|
||||
public localStorage: boolean = false;
|
||||
|
||||
/**
|
||||
* Is webGL available?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public webGL: bool = false;
|
||||
public webGL: boolean = false;
|
||||
|
||||
/**
|
||||
* Is worker available?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public worker: bool = false;
|
||||
public worker: boolean = false;
|
||||
|
||||
/**
|
||||
* Is touch available?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public touch: bool = false;
|
||||
public touch: boolean = false;
|
||||
|
||||
/**
|
||||
* Is mspointer available?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public mspointer: bool = false;
|
||||
public mspointer: boolean = false;
|
||||
|
||||
/**
|
||||
* Is css3D available?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public css3D: bool = false;
|
||||
public css3D: boolean = false;
|
||||
|
||||
// Browser
|
||||
|
||||
|
@ -140,31 +140,31 @@ module Phaser {
|
|||
* Is running in arora?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public arora: bool = false;
|
||||
public arora: boolean = false;
|
||||
|
||||
/**
|
||||
* Is running in chrome?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public chrome: bool = false;
|
||||
public chrome: boolean = false;
|
||||
|
||||
/**
|
||||
* Is running in epiphany?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public epiphany: bool = false;
|
||||
public epiphany: boolean = false;
|
||||
|
||||
/**
|
||||
* Is running in firefox?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public firefox: bool = false;
|
||||
public firefox: boolean = false;
|
||||
|
||||
/**
|
||||
* Is running in ie?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public ie: bool = false;
|
||||
public ie: boolean = false;
|
||||
|
||||
/**
|
||||
* Version of ie?
|
||||
|
@ -176,26 +176,26 @@ module Phaser {
|
|||
* Is running in mobileSafari?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public mobileSafari: bool = false;
|
||||
public mobileSafari: boolean = false;
|
||||
|
||||
/**
|
||||
* Is running in midori?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public midori: bool = false;
|
||||
public midori: boolean = false;
|
||||
|
||||
/**
|
||||
* Is running in opera?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public opera: bool = false;
|
||||
public opera: boolean = false;
|
||||
|
||||
/**
|
||||
* Is running in safari?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public safari: bool = false;
|
||||
public webApp: bool = false;
|
||||
public safari: boolean = false;
|
||||
public webApp: boolean = false;
|
||||
|
||||
// Audio
|
||||
|
||||
|
@ -203,49 +203,49 @@ module Phaser {
|
|||
* Are Audio tags available?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public audioData: bool = false;
|
||||
public audioData: boolean = false;
|
||||
|
||||
/**
|
||||
* Is the WebAudio API available?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public webAudio: bool = false;
|
||||
public webAudio: boolean = false;
|
||||
|
||||
/**
|
||||
* Can this device play ogg files?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public ogg: bool = false;
|
||||
public ogg: boolean = false;
|
||||
|
||||
/**
|
||||
* Can this device play opus files?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public opus: bool = false;
|
||||
public opus: boolean = false;
|
||||
|
||||
/**
|
||||
* Can this device play mp3 files?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public mp3: bool = false;
|
||||
public mp3: boolean = false;
|
||||
|
||||
/**
|
||||
* Can this device play wav files?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public wav: bool = false;
|
||||
public wav: boolean = false;
|
||||
|
||||
/**
|
||||
* Can this device play m4a files?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public m4a: bool = false;
|
||||
public m4a: boolean = false;
|
||||
|
||||
/**
|
||||
* Can this device play webm files?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public webm: bool = false;
|
||||
public webm: boolean = false;
|
||||
|
||||
// Device
|
||||
|
||||
|
@ -253,19 +253,19 @@ module Phaser {
|
|||
* Is running on iPhone?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public iPhone: bool = false;
|
||||
public iPhone: boolean = false;
|
||||
|
||||
/**
|
||||
* Is running on iPhone4?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public iPhone4: bool = false;
|
||||
public iPhone4: boolean = false;
|
||||
|
||||
/**
|
||||
* Is running on iPad?
|
||||
* @type {boolean}
|
||||
*/
|
||||
public iPad: bool = false;
|
||||
public iPad: boolean = false;
|
||||
|
||||
/**
|
||||
* PixelRatio of the host device?
|
||||
|
@ -401,7 +401,7 @@ module Phaser {
|
|||
|
||||
}
|
||||
|
||||
public canPlayAudio(type: string): bool {
|
||||
public canPlayAudio(type: string): boolean {
|
||||
|
||||
if (type == 'mp3' && this.mp3)
|
||||
{
|
||||
|
@ -528,7 +528,7 @@ module Phaser {
|
|||
|
||||
}
|
||||
|
||||
public isConsoleOpen(): bool {
|
||||
public isConsoleOpen(): boolean {
|
||||
|
||||
if (window.console && window.console['firebug'])
|
||||
{
|
||||
|
|
|
@ -58,14 +58,14 @@ module Phaser {
|
|||
* @type Boolean
|
||||
* @private
|
||||
**/
|
||||
private _isSetTimeOut: bool = false;
|
||||
private _isSetTimeOut: boolean = false;
|
||||
|
||||
/**
|
||||
*
|
||||
* @method usingSetTimeOut
|
||||
* @return Boolean
|
||||
**/
|
||||
public isUsingSetTimeOut(): bool {
|
||||
public isUsingSetTimeOut(): boolean {
|
||||
|
||||
return this._isSetTimeOut;
|
||||
|
||||
|
@ -76,7 +76,7 @@ module Phaser {
|
|||
* @method usingRAF
|
||||
* @return Boolean
|
||||
**/
|
||||
public isUsingRAF(): bool {
|
||||
public isUsingRAF(): boolean {
|
||||
|
||||
return this._isSetTimeOut === true;
|
||||
|
||||
|
@ -87,7 +87,7 @@ module Phaser {
|
|||
* @property isRunning
|
||||
* @type Boolean
|
||||
**/
|
||||
public isRunning: bool = false;
|
||||
public isRunning: boolean = false;
|
||||
|
||||
/**
|
||||
* A reference to the RAF/setTimeout to avoid constant anonymous function creation
|
||||
|
@ -99,7 +99,7 @@ module Phaser {
|
|||
* @method start
|
||||
* @param {Any} [callback]
|
||||
**/
|
||||
public start(callback? = null) {
|
||||
public start(callback = null) {
|
||||
|
||||
if (callback)
|
||||
{
|
||||
|
|
|
@ -85,19 +85,19 @@ module Phaser {
|
|||
* If the game should be forced to use Landscape mode, this is set to true by Game.Stage
|
||||
* @type {Boolean}
|
||||
*/
|
||||
public forceLandscape: bool = false;
|
||||
public forceLandscape: boolean = false;
|
||||
|
||||
/**
|
||||
* If the game should be forced to use Portrait mode, this is set to true by Game.Stage
|
||||
* @type {Boolean}
|
||||
*/
|
||||
public forcePortrait: bool = false;
|
||||
public forcePortrait: boolean = false;
|
||||
|
||||
/**
|
||||
* If the game should be forced to use a specific orientation and the device currently isn't in that orientation this is set to true.
|
||||
* @type {Boolean}
|
||||
*/
|
||||
public incorrectOrientation: bool = false;
|
||||
public incorrectOrientation: boolean = false;
|
||||
|
||||
/**
|
||||
* If you wish to align your game in the middle of the page then you can set this value to true.
|
||||
|
@ -105,7 +105,7 @@ module Phaser {
|
|||
* It doesn't care about any other DOM element that may be on the page, it literally just sets the margin.
|
||||
* @type {Boolean}
|
||||
*/
|
||||
public pageAlignHorizontally: bool = false;
|
||||
public pageAlignHorizontally: boolean = false;
|
||||
|
||||
/**
|
||||
* If you wish to align your game in the middle of the page then you can set this value to true.
|
||||
|
@ -113,7 +113,7 @@ module Phaser {
|
|||
* It doesn't care about any other DOM element that may be on the page, it literally just sets the margin.
|
||||
* @type {Boolean}
|
||||
*/
|
||||
public pageAlignVeritcally: bool = false;
|
||||
public pageAlignVeritcally: boolean = false;
|
||||
|
||||
/**
|
||||
* Minimum width the canvas should be scaled to (in pixels)
|
||||
|
@ -190,7 +190,7 @@ module Phaser {
|
|||
public enterPortrait: Phaser.Signal;
|
||||
|
||||
// Full Screen API calls
|
||||
public get isFullScreen(): bool {
|
||||
public get isFullScreen(): boolean {
|
||||
|
||||
if (document['fullscreenElement'] === null|| document['mozFullScreenElement'] === null|| document['webkitFullscreenElement'] === null)
|
||||
{
|
||||
|
@ -285,11 +285,11 @@ module Phaser {
|
|||
|
||||
}
|
||||
|
||||
public get isPortrait(): bool {
|
||||
public get isPortrait(): boolean {
|
||||
return this.orientation == 0 || this.orientation == 180;
|
||||
}
|
||||
|
||||
public get isLandscape(): bool {
|
||||
public get isLandscape(): boolean {
|
||||
return this.orientation === 90 || this.orientation === -90;
|
||||
}
|
||||
|
||||
|
@ -354,7 +354,7 @@ module Phaser {
|
|||
// We can't do anything about the status bars in iPads, web apps or desktops
|
||||
if (this.game.device.iPad == false && this.game.device.webApp == false && this.game.device.desktop == false)
|
||||
{
|
||||
document.documentElement.style.minHeight = '2000px';
|
||||
document.documentElement['style'].minHeight = '2000px';
|
||||
|
||||
this._startHeight = window.innerHeight;
|
||||
|
||||
|
@ -380,7 +380,7 @@ module Phaser {
|
|||
/**
|
||||
* Set screen size automatically based on the scaleMode.
|
||||
*/
|
||||
public setScreenSize(force: bool = false) {
|
||||
public setScreenSize(force: boolean = false) {
|
||||
|
||||
if (this.game.device.iPad == false && this.game.device.webApp == false && this.game.device.desktop == false)
|
||||
{
|
||||
|
@ -399,7 +399,7 @@ module Phaser {
|
|||
if (force || window.innerHeight > this._startHeight || this._iterations < 0)
|
||||
{
|
||||
// Set minimum height of content to new window height
|
||||
document.documentElement.style.minHeight = window.innerHeight + 'px';
|
||||
document.documentElement['style'].minHeight = window.innerHeight + 'px';
|
||||
|
||||
if (this.incorrectOrientation == true)
|
||||
{
|
||||
|
|
|
@ -26,8 +26,8 @@ module Phaser {
|
|||
*/
|
||||
public game: Game;
|
||||
|
||||
private _showOnLandscape: bool = false;
|
||||
private _showOnPortrait: bool = false;
|
||||
private _showOnLandscape: boolean = false;
|
||||
private _showOnPortrait: boolean = false;
|
||||
|
||||
/**
|
||||
* Landscape Image. If you only want your game to work in Portrait mode, and display an image when in Landscape,
|
||||
|
@ -43,7 +43,7 @@ module Phaser {
|
|||
*/
|
||||
public portraitImage;
|
||||
|
||||
public enable(onLandscape: bool, onPortrait: bool, imageKey: string) {
|
||||
public enable(onLandscape: boolean, onPortrait: boolean, imageKey: string) {
|
||||
|
||||
this._showOnLandscape = onLandscape;
|
||||
this._showOnPortrait = onPortrait;
|
||||
|
|
|
@ -70,37 +70,37 @@ module Phaser {
|
|||
* Indicating collide with any object on the left.
|
||||
* @type {boolean}
|
||||
*/
|
||||
public collideLeft: bool = false;
|
||||
public collideLeft: boolean = false;
|
||||
|
||||
/**
|
||||
* Indicating collide with any object on the right.
|
||||
* @type {boolean}
|
||||
*/
|
||||
public collideRight: bool = false;
|
||||
public collideRight: boolean = false;
|
||||
|
||||
/**
|
||||
* Indicating collide with any object on the top.
|
||||
* @type {boolean}
|
||||
*/
|
||||
public collideUp: bool = false;
|
||||
public collideUp: boolean = false;
|
||||
|
||||
/**
|
||||
* Indicating collide with any object on the bottom.
|
||||
* @type {boolean}
|
||||
*/
|
||||
public collideDown: bool = false;
|
||||
public collideDown: boolean = false;
|
||||
|
||||
/**
|
||||
* Enable separation at x-axis.
|
||||
* @type {boolean}
|
||||
*/
|
||||
public separateX: bool = true;
|
||||
public separateX: boolean = true;
|
||||
|
||||
/**
|
||||
* Enable separation at y-axis.
|
||||
* @type {boolean}
|
||||
*/
|
||||
public separateY: bool = true;
|
||||
public separateY: boolean = true;
|
||||
|
||||
/**
|
||||
* A reference to the tilemap this tile object belongs to.
|
||||
|
@ -132,7 +132,7 @@ module Phaser {
|
|||
* @param separateX {boolean} Enable seprate at x-axis.
|
||||
* @param separateY {boolean} Enable seprate at y-axis.
|
||||
*/
|
||||
public setCollision(collision: number, resetCollisions: bool, separateX: bool, separateY: bool) {
|
||||
public setCollision(collision: number, resetCollisions: boolean, separateX: boolean, separateY: boolean) {
|
||||
|
||||
if (resetCollisions)
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@ module Phaser {
|
|||
* @param tileWidth {number} Width of tiles in this map.
|
||||
* @param tileHeight {number} Height of tiles in this map.
|
||||
*/
|
||||
constructor(game: Game, key: string, mapData: string, format: number, resizeWorld: bool = true, tileWidth?: number = 0, tileHeight?: number = 0) {
|
||||
constructor(game: Game, key: string, mapData: string, format: number, resizeWorld: boolean = true, tileWidth: number = 0, tileHeight: number = 0) {
|
||||
|
||||
this.game = game;
|
||||
this.type = Phaser.Types.TILEMAP;
|
||||
|
@ -90,22 +90,22 @@ module Phaser {
|
|||
/**
|
||||
* Controls if both <code>update</code> and render are called by the core game loop.
|
||||
*/
|
||||
public exists: bool;
|
||||
public exists: boolean;
|
||||
|
||||
/**
|
||||
* Controls if <code>update()</code> is automatically called by the core game loop.
|
||||
*/
|
||||
public active: bool;
|
||||
public active: boolean;
|
||||
|
||||
/**
|
||||
* Controls if this Sprite is rendered or skipped during the core game loop.
|
||||
*/
|
||||
public visible: bool;
|
||||
public visible: boolean;
|
||||
|
||||
/**
|
||||
* A useful state for many game objects. Kill and revive both flip this switch.
|
||||
*/
|
||||
public alive: bool;
|
||||
public alive: boolean;
|
||||
|
||||
/**
|
||||
* The texture used to render the Sprite.
|
||||
|
@ -326,7 +326,7 @@ module Phaser {
|
|||
* @param separateX {boolean} Enable seprate at x-axis.
|
||||
* @param separateY {boolean} Enable seprate at y-axis.
|
||||
*/
|
||||
public setCollisionRange(start: number, end: number, collision?:number = Types.ANY, resetCollisions?: bool = false, separateX?: bool = true, separateY?: bool = true) {
|
||||
public setCollisionRange(start: number, end: number, collision:number = Types.ANY, resetCollisions: boolean = false, separateX: boolean = true, separateY: boolean = true) {
|
||||
|
||||
for (var i = start; i < end; i++)
|
||||
{
|
||||
|
@ -343,7 +343,7 @@ module Phaser {
|
|||
* @param separateX {boolean} Enable seprate at x-axis.
|
||||
* @param separateY {boolean} Enable seprate at y-axis.
|
||||
*/
|
||||
public setCollisionByIndex(values:number[], collision?:number = Types.ANY, resetCollisions?: bool = false, separateX?: bool = true, separateY?: bool = true) {
|
||||
public setCollisionByIndex(values:number[], collision:number = Types.ANY, resetCollisions: boolean = false, separateX: boolean = true, separateY: boolean = true) {
|
||||
|
||||
for (var i = 0; i < values.length; i++)
|
||||
{
|
||||
|
@ -377,7 +377,7 @@ module Phaser {
|
|||
* @param [layer] {number} layer of this tile located.
|
||||
* @return {Tile} The tile with specific properties.
|
||||
*/
|
||||
public getTile(x: number, y: number, layer?: number = this.currentLayer.ID):Tile {
|
||||
public getTile(x: number, y: number, layer: number = this.currentLayer.ID):Tile {
|
||||
|
||||
return this.tiles[this.layers[layer].getTileIndex(x, y)];
|
||||
|
||||
|
@ -390,7 +390,7 @@ module Phaser {
|
|||
* @param [layer] {number} layer of this tile located.
|
||||
* @return {Tile} The tile with specific properties.
|
||||
*/
|
||||
public getTileFromWorldXY(x: number, y: number, layer?: number = this.currentLayer.ID):Tile {
|
||||
public getTileFromWorldXY(x: number, y: number, layer: number = this.currentLayer.ID):Tile {
|
||||
|
||||
return this.tiles[this.layers[layer].getTileFromWorldXY(x, y)];
|
||||
|
||||
|
@ -401,7 +401,7 @@ module Phaser {
|
|||
* @param layer The layer to check, defaults to 0
|
||||
* @returns {Tile}
|
||||
*/
|
||||
public getTileFromInputXY(layer?: number = this.currentLayer.ID):Tile {
|
||||
public getTileFromInputXY(layer: number = this.currentLayer.ID):Tile {
|
||||
|
||||
return this.tiles[this.layers[layer].getTileFromWorldXY(this.game.input.worldX, this.game.input.worldY)];
|
||||
|
||||
|
@ -456,7 +456,7 @@ module Phaser {
|
|||
* @param object {GameObject} Target object you want to check.
|
||||
* @return {boolean} Return true if this collides with given object, otherwise return false.
|
||||
*/
|
||||
public collideGameObject(object: Sprite): bool {
|
||||
public collideGameObject(object: Sprite): boolean {
|
||||
|
||||
if (object.body.type == Types.BODY_DYNAMIC && object.exists == true && object.body.allowCollisions != Types.NONE)
|
||||
{
|
||||
|
@ -483,7 +483,7 @@ module Phaser {
|
|||
* @param index {number} The index of this tile type in the core map data.
|
||||
* @param [layer] {number} which layer you want to set the tile to.
|
||||
*/
|
||||
public putTile(x: number, y: number, index: number, layer?: number = this.currentLayer.ID) {
|
||||
public putTile(x: number, y: number, index: number, layer: number = this.currentLayer.ID) {
|
||||
|
||||
this.layers[layer].putTile(x, y, index);
|
||||
|
||||
|
|
|
@ -108,13 +108,13 @@ module Phaser {
|
|||
* Controls whether update() and draw() are automatically called.
|
||||
* @type {boolean}
|
||||
*/
|
||||
public exists: bool = true;
|
||||
public exists: boolean = true;
|
||||
|
||||
/**
|
||||
* Controls whether draw() are automatically called.
|
||||
* @type {boolean}
|
||||
*/
|
||||
public visible: bool = true;
|
||||
public visible: boolean = true;
|
||||
|
||||
/**
|
||||
* Properties of this map layer. (normally set by map editors)
|
||||
|
@ -236,7 +236,7 @@ module Phaser {
|
|||
* @param [width] {number} specify a Rectangle of tiles to operate. The width in tiles.
|
||||
* @param [height] {number} specify a Rectangle of tiles to operate. The height in tiles.
|
||||
*/
|
||||
public swapTile(tileA: number, tileB: number, x?: number = 0, y?: number = 0, width?: number = this.widthInTiles, height?: number = this.heightInTiles) {
|
||||
public swapTile(tileA: number, tileB: number, x: number = 0, y: number = 0, width: number = this.widthInTiles, height: number = this.heightInTiles) {
|
||||
|
||||
this.getTempBlock(x, y, width, height);
|
||||
|
||||
|
@ -274,7 +274,7 @@ module Phaser {
|
|||
* @param [width] {number} width of block.
|
||||
* @param [height] {number} height of block.
|
||||
*/
|
||||
public fillTile(index: number, x?: number = 0, y?: number = 0, width?: number = this.widthInTiles, height?: number = this.heightInTiles) {
|
||||
public fillTile(index: number, x: number = 0, y: number = 0, width: number = this.widthInTiles, height: number = this.heightInTiles) {
|
||||
|
||||
this.getTempBlock(x, y, width, height);
|
||||
|
||||
|
@ -293,7 +293,7 @@ module Phaser {
|
|||
* @param [width] {number} width of block.
|
||||
* @param [height] {number} height of block.
|
||||
*/
|
||||
public randomiseTiles(tiles: number[], x?: number = 0, y?: number = 0, width?: number = this.widthInTiles, height?: number = this.heightInTiles) {
|
||||
public randomiseTiles(tiles: number[], x: number = 0, y: number = 0, width: number = this.widthInTiles, height: number = this.heightInTiles) {
|
||||
|
||||
this.getTempBlock(x, y, width, height);
|
||||
|
||||
|
@ -313,7 +313,7 @@ module Phaser {
|
|||
* @param [width] {number} width of block.
|
||||
* @param [height] {number} height of block.
|
||||
*/
|
||||
public replaceTile(tileA: number, tileB: number, x?: number = 0, y?: number = 0, width?: number = this.widthInTiles, height?: number = this.heightInTiles) {
|
||||
public replaceTile(tileA: number, tileB: number, x: number = 0, y: number = 0, width: number = this.widthInTiles, height: number = this.heightInTiles) {
|
||||
|
||||
this.getTempBlock(x, y, width, height);
|
||||
|
||||
|
@ -409,7 +409,7 @@ module Phaser {
|
|||
* @param height {number} Height of block.
|
||||
* @param collisionOnly {boolean} Whethor or not ONLY return tiles which will collide (its allowCollisions value is not Collision.NONE).
|
||||
*/
|
||||
private getTempBlock(x: number, y: number, width: number, height: number, collisionOnly?: bool = false) {
|
||||
private getTempBlock(x: number, y: number, width: number, height: number, collisionOnly: boolean = false) {
|
||||
|
||||
if (x < 0)
|
||||
{
|
||||
|
|
|
@ -91,13 +91,13 @@ module Phaser {
|
|||
* Will this tween automatically restart when it completes?
|
||||
* @type {boolean}
|
||||
*/
|
||||
private _loop: bool = false;
|
||||
private _loop: boolean = false;
|
||||
|
||||
/**
|
||||
* A yoyo tween is one that plays once fully, then reverses back to the original tween values before completing.
|
||||
* @type {boolean}
|
||||
*/
|
||||
private _yoyo: bool = false;
|
||||
private _yoyo: boolean = false;
|
||||
private _yoyoCount: number = 0;
|
||||
|
||||
/**
|
||||
|
@ -141,7 +141,7 @@ module Phaser {
|
|||
* @param [loop] {boolean} Should the tween automatically restart once complete? (ignores any chained tweens)
|
||||
* @return {Tween} Itself.
|
||||
*/
|
||||
public to(properties, duration?: number = 1000, ease?: any = null, autoStart?: bool = false, delay?:number = 0, loop?:bool = false, yoyo?:bool = false): Tween {
|
||||
public to(properties, duration: number = 1000, ease: any = null, autoStart: boolean = false, delay:number = 0, loop:boolean = false, yoyo:boolean = false): Tween {
|
||||
|
||||
this._duration = duration;
|
||||
|
||||
|
@ -173,14 +173,14 @@ module Phaser {
|
|||
|
||||
}
|
||||
|
||||
public loop(value: bool): Tween {
|
||||
public loop(value: boolean): Tween {
|
||||
|
||||
this._loop = value;
|
||||
return this;
|
||||
|
||||
}
|
||||
|
||||
public yoyo(value: bool): Tween {
|
||||
public yoyo(value: boolean): Tween {
|
||||
|
||||
this._yoyo = value;
|
||||
this._yoyoCount = 0;
|
||||
|
@ -188,12 +188,12 @@ module Phaser {
|
|||
|
||||
}
|
||||
|
||||
public isRunning: bool = false;
|
||||
public isRunning: boolean = false;
|
||||
|
||||
/**
|
||||
* Start to tween.
|
||||
*/
|
||||
public start(looped: bool = false): Tween {
|
||||
public start(looped: boolean = false): Tween {
|
||||
|
||||
if (this.game === null || this._object === null)
|
||||
{
|
||||
|
@ -356,7 +356,7 @@ module Phaser {
|
|||
|
||||
}
|
||||
|
||||
private _paused: bool;
|
||||
private _paused: boolean;
|
||||
|
||||
/**
|
||||
* Update tweening.
|
||||
|
|
|
@ -66,7 +66,7 @@ module Phaser {
|
|||
* @param [localReference] {bool} If true the tween will be stored in the object.tween property so long as it exists. If already set it'll be over-written.
|
||||
* @return {Phaser.Tween} The newly created tween object.
|
||||
*/
|
||||
public create(object, localReference?:bool = false): Phaser.Tween {
|
||||
public create(object, localReference:boolean = false): Phaser.Tween {
|
||||
|
||||
if (localReference)
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ module Phaser.UI {
|
|||
* @param [outFrame] {string|number} This is the frame or frameName that will be set when this button is in an out state. Give either a number to use a frame ID or a string for a frame name.
|
||||
* @param [downFrame] {string|number} This is the frame or frameName that will be set when this button is in a down state. Give either a number to use a frame ID or a string for a frame name.
|
||||
*/
|
||||
constructor(game: Game, x?: number = 0, y?: number = 0, key?: string = null, callback? = null, callbackContext? = null, overFrame? = null, outFrame? = null, downFrame? = null) {
|
||||
constructor(game: Game, x: number = 0, y: number = 0, key: string = null, callback = null, callbackContext = null, overFrame = null, outFrame = null, downFrame = null) {
|
||||
|
||||
super(game, x, y, key, outFrame);
|
||||
|
||||
|
@ -116,7 +116,7 @@ module Phaser.UI {
|
|||
|
||||
// TODO
|
||||
//public tabIndex: number;
|
||||
//public tabEnabled: bool;
|
||||
//public tabEnabled: boolean;
|
||||
|
||||
// ENTER or SPACE can activate this button if it has focus
|
||||
|
||||
|
@ -204,11 +204,11 @@ module Phaser.UI {
|
|||
return this.input.priorityID;
|
||||
}
|
||||
|
||||
public set useHandCursor(value: bool) {
|
||||
public set useHandCursor(value: boolean) {
|
||||
this.input.useHandCursor = value;
|
||||
}
|
||||
|
||||
public get useHandCursor(): bool {
|
||||
public get useHandCursor(): boolean {
|
||||
return this.input.useHandCursor;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ module Phaser {
|
|||
* @param {Circle} [optional] out Optional Circle object. If given the values will be set into the object, otherwise a brand new Circle object will be created and returned.
|
||||
* @return {Phaser.Circle}
|
||||
**/
|
||||
static clone(a: Circle, out?: Circle = new Circle): Circle {
|
||||
static clone(a: Circle, out: Circle = new Circle): Circle {
|
||||
return out.setTo(a.x, a.y, a.diameter);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ module Phaser {
|
|||
* @param {Number} The Y value of the coordinate to test.
|
||||
* @return {Boolean} True if the coordinates are within this circle, otherwise false.
|
||||
**/
|
||||
static contains(a: Circle, x: number, y: number): bool {
|
||||
static contains(a: Circle, x: number, y: number): boolean {
|
||||
|
||||
// Check if x/y are within the bounds first
|
||||
if (x >= a.left && x <= a.right && y >= a.top && y <= a.bottom)
|
||||
|
@ -57,7 +57,7 @@ module Phaser {
|
|||
* @param {Point} The Point object to test.
|
||||
* @return {Boolean} True if the coordinates are within this circle, otherwise false.
|
||||
**/
|
||||
static containsPoint(a: Circle, point:Point): bool {
|
||||
static containsPoint(a: Circle, point:Point): boolean {
|
||||
return CircleUtils.contains(a, point.x, point.y);
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ module Phaser {
|
|||
* @param {Circle} The Circle object to test.
|
||||
* @return {Boolean} True if the coordinates are within this circle, otherwise false.
|
||||
**/
|
||||
static containsCircle(a:Circle, b:Circle): bool {
|
||||
static containsCircle(a:Circle, b:Circle): boolean {
|
||||
//return ((a.radius + b.radius) * (a.radius + b.radius)) >= Collision.distanceSquared(a.x, a.y, b.x, b.y);
|
||||
return true;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ module Phaser {
|
|||
* @param {Boolean} [optional] round - Round the distance to the nearest integer (default false)
|
||||
* @return {Number} The distance between this Point object and the destination Point object.
|
||||
**/
|
||||
static distanceBetween(a:Circle, target: any, round?: bool = false): number {
|
||||
static distanceBetween(a:Circle, target: any, round: boolean = false): number {
|
||||
|
||||
var dx = a.x - target.x;
|
||||
var dy = a.y - target.y;
|
||||
|
@ -104,7 +104,7 @@ module Phaser {
|
|||
* @param {Circle} b - The second Circle object.
|
||||
* @return {Boolean} A value of true if the object has exactly the same values for the x, y and diameter properties as this Circle object; otherwise false.
|
||||
**/
|
||||
static equals(a:Circle, b: Circle): bool {
|
||||
static equals(a:Circle, b: Circle): boolean {
|
||||
return (a.x == b.x && a.y == b.y && a.diameter == b.diameter);
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ module Phaser {
|
|||
* @param {Circle} b - The second Circle object.
|
||||
* @return {Boolean} A value of true if the specified object intersects with this Circle object; otherwise false.
|
||||
**/
|
||||
static intersects(a:Circle, b: Circle): bool {
|
||||
static intersects(a:Circle, b: Circle): boolean {
|
||||
return (CircleUtils.distanceBetween(a, b) <= (a.radius + b.radius));
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ module Phaser {
|
|||
* @param {Phaser.Point} [optional] output An optional Point object to put the result in to. If none specified a new Point object will be created.
|
||||
* @return {Phaser.Point} The Point object holding the result.
|
||||
**/
|
||||
static circumferencePoint(a:Circle, angle: number, asDegrees: bool = false, out?: Point = new Point): Point {
|
||||
static circumferencePoint(a:Circle, angle: number, asDegrees: boolean = false, out: Point = new Point): Point {
|
||||
|
||||
if (asDegrees === true)
|
||||
{
|
||||
|
@ -163,7 +163,7 @@ public static boolean intersect(Rectangle r, Circle c)
|
|||
}
|
||||
*/
|
||||
|
||||
static intersectsRectangle(c: Circle, r: Rectangle): bool {
|
||||
static intersectsRectangle(c: Circle, r: Rectangle): boolean {
|
||||
|
||||
var cx: number = Math.abs(c.x - r.x - r.halfWidth);
|
||||
var xDist: number = r.halfWidth + c.radius;
|
||||
|
|
|
@ -49,14 +49,13 @@ module Phaser {
|
|||
*
|
||||
* @return Array
|
||||
*/
|
||||
static public getHSVColorWheel(alpha: number = 255) {
|
||||
public static getHSVColorWheel(alpha: number = 255) {
|
||||
|
||||
var colors = [];
|
||||
|
||||
for (var c: number = 0; c <= 359; c++)
|
||||
{
|
||||
//colors[c] = HSVtoRGB(c, 1.0, 1.0, alpha);
|
||||
colors[c] = getWebRGB(HSVtoRGB(c, 1.0, 1.0, alpha));
|
||||
colors[c] = ColorUtils.getWebRGB(ColorUtils.HSVtoRGB(c, 1.0, 1.0, alpha));
|
||||
}
|
||||
|
||||
return colors;
|
||||
|
@ -72,13 +71,13 @@ module Phaser {
|
|||
*
|
||||
* @return 0xAARRGGBB format color value
|
||||
*/
|
||||
static public getComplementHarmony(color: number): number {
|
||||
public static getComplementHarmony(color: number): number {
|
||||
|
||||
var hsv: any = RGBtoHSV(color);
|
||||
var hsv: any = ColorUtils.RGBtoHSV(color);
|
||||
|
||||
var opposite: number = ColorUtils.game.math.wrapValue(hsv.hue, 180, 359);
|
||||
|
||||
return HSVtoRGB(opposite, 1.0, 1.0);
|
||||
return ColorUtils.HSVtoRGB(opposite, 1.0, 1.0);
|
||||
|
||||
}
|
||||
|
||||
|
@ -92,9 +91,9 @@ module Phaser {
|
|||
*
|
||||
* @return Object containing 3 properties: color1 (the original color), color2 (the warmer analogous color) and color3 (the colder analogous color)
|
||||
*/
|
||||
static public getAnalogousHarmony(color: number, threshold: number = 30) {
|
||||
public static getAnalogousHarmony(color: number, threshold: number = 30) {
|
||||
|
||||
var hsv: any = RGBtoHSV(color);
|
||||
var hsv: any = ColorUtils.RGBtoHSV(color);
|
||||
|
||||
if (threshold > 359 || threshold < 0)
|
||||
{
|
||||
|
@ -104,7 +103,7 @@ module Phaser {
|
|||
var warmer: number = ColorUtils.game.math.wrapValue(hsv.hue, 359 - threshold, 359);
|
||||
var colder: number = ColorUtils.game.math.wrapValue(hsv.hue, threshold, 359);
|
||||
|
||||
return { color1: color, color2: HSVtoRGB(warmer, 1.0, 1.0), color3: HSVtoRGB(colder, 1.0, 1.0), hue1: hsv.hue, hue2: warmer, hue3: colder }
|
||||
return { color1: color, color2: ColorUtils.HSVtoRGB(warmer, 1.0, 1.0), color3: ColorUtils.HSVtoRGB(colder, 1.0, 1.0), hue1: hsv.hue, hue2: warmer, hue3: colder }
|
||||
|
||||
}
|
||||
|
||||
|
@ -118,9 +117,9 @@ module Phaser {
|
|||
*
|
||||
* @return Object containing 3 properties: color1 (the original color), color2 (the warmer analogous color) and color3 (the colder analogous color)
|
||||
*/
|
||||
static public getSplitComplementHarmony(color: number, threshold: number = 30): any {
|
||||
public static getSplitComplementHarmony(color: number, threshold: number = 30): any {
|
||||
|
||||
var hsv: any = RGBtoHSV(color);
|
||||
var hsv: any = ColorUtils.RGBtoHSV(color);
|
||||
|
||||
if (threshold >= 359 || threshold <= 0)
|
||||
{
|
||||
|
@ -132,7 +131,7 @@ module Phaser {
|
|||
var warmer: number = ColorUtils.game.math.wrapValue(hsv.hue, opposite - threshold, 359);
|
||||
var colder: number = ColorUtils.game.math.wrapValue(hsv.hue, opposite + threshold, 359);
|
||||
|
||||
return { color1: color, color2: HSVtoRGB(warmer, hsv.saturation, hsv.value), color3: HSVtoRGB(colder, hsv.saturation, hsv.value), hue1: hsv.hue, hue2: warmer, hue3: colder }
|
||||
return { color1: color, color2: ColorUtils.HSVtoRGB(warmer, hsv.saturation, hsv.value), color3: ColorUtils.HSVtoRGB(colder, hsv.saturation, hsv.value), hue1: hsv.hue, hue2: warmer, hue3: colder }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -144,14 +143,14 @@ module Phaser {
|
|||
*
|
||||
* @return Object containing 3 properties: color1 (the original color), color2 and color3 (the equidistant colors)
|
||||
*/
|
||||
static public getTriadicHarmony(color: number): any {
|
||||
public static getTriadicHarmony(color: number): any {
|
||||
|
||||
var hsv: any = RGBtoHSV(color);
|
||||
var hsv: any = ColorUtils.RGBtoHSV(color);
|
||||
|
||||
var triadic1: number = ColorUtils.game.math.wrapValue(hsv.hue, 120, 359);
|
||||
var triadic2: number = ColorUtils.game.math.wrapValue(triadic1, 120, 359);
|
||||
|
||||
return { color1: color, color2: HSVtoRGB(triadic1, 1.0, 1.0), color3: HSVtoRGB(triadic2, 1.0, 1.0) }
|
||||
return { color1: color, color2: ColorUtils.HSVtoRGB(triadic1, 1.0, 1.0), color3: ColorUtils.HSVtoRGB(triadic2, 1.0, 1.0) }
|
||||
|
||||
}
|
||||
|
||||
|
@ -163,13 +162,13 @@ module Phaser {
|
|||
*
|
||||
* @return string containing the 3 lines of information
|
||||
*/
|
||||
static public getColorInfo(color: number): string {
|
||||
public static getColorInfo(color: number): string {
|
||||
|
||||
var argb: any = getRGB(color);
|
||||
var hsl: any = RGBtoHSV(color);
|
||||
var argb: any = ColorUtils.getRGB(color);
|
||||
var hsl: any = ColorUtils.RGBtoHSV(color);
|
||||
|
||||
// Hex format
|
||||
var result: string = RGBtoHexstring(color) + "\n";
|
||||
var result: string = ColorUtils.RGBtoHexstring(color) + "\n";
|
||||
|
||||
// RGB format
|
||||
result = result.concat("Alpha: " + argb.alpha + " Red: " + argb.red + " Green: " + argb.green + " Blue: " + argb.blue) + "\n";
|
||||
|
@ -188,11 +187,11 @@ module Phaser {
|
|||
*
|
||||
* @return A string of length 10 characters in the format 0xAARRGGBB
|
||||
*/
|
||||
static public RGBtoHexstring(color: number): string {
|
||||
public static RGBtoHexstring(color: number): string {
|
||||
|
||||
var argb: any = getRGB(color);
|
||||
var argb: any = ColorUtils.getRGB(color);
|
||||
|
||||
return "0x" + colorToHexstring(argb.alpha) + colorToHexstring(argb.red) + colorToHexstring(argb.green) + colorToHexstring(argb.blue);
|
||||
return "0x" + ColorUtils.colorToHexstring(argb.alpha) + ColorUtils.colorToHexstring(argb.red) + ColorUtils.colorToHexstring(argb.green) + ColorUtils.colorToHexstring(argb.blue);
|
||||
|
||||
}
|
||||
|
||||
|
@ -203,11 +202,11 @@ module Phaser {
|
|||
*
|
||||
* @return A string of length 10 characters in the format 0xAARRGGBB
|
||||
*/
|
||||
static public RGBtoWebstring(color: number): string {
|
||||
public static RGBtoWebstring(color: number): string {
|
||||
|
||||
var argb: any = getRGB(color);
|
||||
var argb: any = ColorUtils.getRGB(color);
|
||||
|
||||
return "#" + colorToHexstring(argb.red) + colorToHexstring(argb.green) + colorToHexstring(argb.blue);
|
||||
return "#" + ColorUtils.colorToHexstring(argb.red) + ColorUtils.colorToHexstring(argb.green) + ColorUtils.colorToHexstring(argb.blue);
|
||||
|
||||
}
|
||||
|
||||
|
@ -218,7 +217,7 @@ module Phaser {
|
|||
*
|
||||
* @return A string of length 2 characters, i.e. 255 = FF, 0 = 00
|
||||
*/
|
||||
static public colorToHexstring(color: number): string {
|
||||
public static colorToHexstring(color: number): string {
|
||||
|
||||
var digits: string = "0123456789ABCDEF";
|
||||
|
||||
|
@ -299,7 +298,7 @@ module Phaser {
|
|||
*
|
||||
* @return Object with the properties hue (from 0 to 360), saturation (from 0 to 1.0) and lightness (from 0 to 1.0, also available under .value)
|
||||
*/
|
||||
static public RGBtoHSV(color: number): any {
|
||||
public static RGBtoHSV(color: number): any {
|
||||
|
||||
var rgb: any = ColorUtils.getRGB(color);
|
||||
|
||||
|
@ -378,7 +377,7 @@ module Phaser {
|
|||
* @return {Number}
|
||||
* @static
|
||||
*/
|
||||
static public interpolateColor(color1: number, color2: number, steps: number, currentStep: number, alpha: number = 255): number {
|
||||
public static interpolateColor(color1: number, color2: number, steps: number, currentStep: number, alpha: number = 255): number {
|
||||
|
||||
var src1: any = ColorUtils.getRGB(color1);
|
||||
var src2: any = ColorUtils.getRGB(color2);
|
||||
|
@ -403,7 +402,7 @@ module Phaser {
|
|||
* @return {Number}
|
||||
* @static
|
||||
*/
|
||||
static public interpolateColorWithRGB(color: number, r2: number, g2: number, b2: number, steps: number, currentStep: number): number {
|
||||
public static interpolateColorWithRGB(color: number, r2: number, g2: number, b2: number, steps: number, currentStep: number): number {
|
||||
|
||||
var src: any = ColorUtils.getRGB(color);
|
||||
|
||||
|
@ -429,7 +428,7 @@ module Phaser {
|
|||
* @return {Number}
|
||||
* @static
|
||||
*/
|
||||
static public interpolateRGB(r1: number, g1: number, b1: number, r2: number, g2: number, b2: number, steps: number, currentStep: number): number {
|
||||
public static interpolateRGB(r1: number, g1: number, b1: number, r2: number, g2: number, b2: number, steps: number, currentStep: number): number {
|
||||
|
||||
var r: number = (((r2 - r1) * currentStep) / steps) + r1;
|
||||
var g: number = (((g2 - g1) * currentStep) / steps) + g1;
|
||||
|
@ -450,7 +449,7 @@ module Phaser {
|
|||
*
|
||||
* @return 32-bit color value with alpha
|
||||
*/
|
||||
static public getRandomColor(min: number = 0, max: number = 255, alpha: number = 255): number {
|
||||
public static getRandomColor(min: number = 0, max: number = 255, alpha: number = 255): number {
|
||||
|
||||
// Sanity checks
|
||||
if (max > 255)
|
||||
|
@ -480,7 +479,7 @@ module Phaser {
|
|||
*
|
||||
* @return Object with properties: alpha, red, green, blue
|
||||
*/
|
||||
static public getRGB(color: number): any {
|
||||
public static getRGB(color: number): any {
|
||||
return { alpha: color >>> 24, red: color >> 16 & 0xFF, green: color >> 8 & 0xFF, blue: color & 0xFF };
|
||||
}
|
||||
|
||||
|
@ -490,7 +489,7 @@ module Phaser {
|
|||
* @param {Number} color
|
||||
* @return {Any}
|
||||
*/
|
||||
static public getWebRGB(color: number): any {
|
||||
public static getWebRGB(color: number): any {
|
||||
|
||||
var alpha: number = (color >>> 24) / 255;
|
||||
var red: number = color >> 16 & 0xFF;
|
||||
|
@ -508,7 +507,7 @@ module Phaser {
|
|||
*
|
||||
* @return The Alpha component of the color, will be between 0 and 255 (0 being no Alpha, 255 full Alpha)
|
||||
*/
|
||||
static public getAlpha(color: number): number {
|
||||
public static getAlpha(color: number): number {
|
||||
return color >>> 24;
|
||||
}
|
||||
|
||||
|
@ -519,7 +518,7 @@ module Phaser {
|
|||
*
|
||||
* @return The Alpha component of the color, will be between 0 and 1 (0 being no Alpha (opaque), 1 full Alpha (transparent))
|
||||
*/
|
||||
static public getAlphaFloat(color: number): number {
|
||||
public static getAlphaFloat(color: number): number {
|
||||
return (color >>> 24) / 255;
|
||||
}
|
||||
|
||||
|
@ -530,7 +529,7 @@ module Phaser {
|
|||
*
|
||||
* @return The Red component of the color, will be between 0 and 255 (0 being no color, 255 full Red)
|
||||
*/
|
||||
static public getRed(color: number): number {
|
||||
public static getRed(color: number): number {
|
||||
return color >> 16 & 0xFF;
|
||||
}
|
||||
|
||||
|
@ -541,7 +540,7 @@ module Phaser {
|
|||
*
|
||||
* @return The Green component of the color, will be between 0 and 255 (0 being no color, 255 full Green)
|
||||
*/
|
||||
static public getGreen(color: number): number {
|
||||
public static getGreen(color: number): number {
|
||||
return color >> 8 & 0xFF;
|
||||
}
|
||||
|
||||
|
@ -552,7 +551,7 @@ module Phaser {
|
|||
*
|
||||
* @return The Blue component of the color, will be between 0 and 255 (0 being no color, 255 full Blue)
|
||||
*/
|
||||
static public getBlue(color: number): number {
|
||||
public static getBlue(color: number): number {
|
||||
return color & 0xFF;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,45 +29,45 @@ module Phaser {
|
|||
static font: string = '14px Courier';
|
||||
static lineHeight: number = 16;
|
||||
static currentColor: string;
|
||||
static renderShadow: bool = true;
|
||||
static renderShadow: boolean = true;
|
||||
|
||||
static start(x: number, y: number, color?: string = 'rgb(255,255,255)') {
|
||||
static start(x: number, y: number, color: string = 'rgb(255,255,255)') {
|
||||
|
||||
currentX = x;
|
||||
currentY = y;
|
||||
currentColor = color;
|
||||
DebugUtils.currentX = x;
|
||||
DebugUtils.currentY = y;
|
||||
DebugUtils.currentColor = color;
|
||||
|
||||
DebugUtils.context.fillStyle = color;
|
||||
DebugUtils.context.font = font;
|
||||
|
||||
}
|
||||
|
||||
static line(text: string, x?:number = null, y?:number = null) {
|
||||
static line(text: string, x:number = null, y:number = null) {
|
||||
|
||||
if (x !== null)
|
||||
{
|
||||
currentX = x;
|
||||
DebugUtils.currentX = x;
|
||||
}
|
||||
|
||||
if (y !== null)
|
||||
{
|
||||
currentY = y;
|
||||
DebugUtils.currentY = y;
|
||||
}
|
||||
|
||||
if (renderShadow)
|
||||
{
|
||||
DebugUtils.context.fillStyle = 'rgb(0,0,0)';
|
||||
DebugUtils.context.fillText(text, currentX + 1, currentY + 1);
|
||||
DebugUtils.context.fillStyle = currentColor;
|
||||
DebugUtils.context.fillText(text, DebugUtils.currentX + 1, DebugUtils.currentY + 1);
|
||||
DebugUtils.context.fillStyle = DebugUtils.currentColor;
|
||||
}
|
||||
|
||||
DebugUtils.context.fillText(text, currentX, currentY);
|
||||
DebugUtils.context.fillText(text, DebugUtils.currentX, DebugUtils.currentY);
|
||||
|
||||
currentY += lineHeight;
|
||||
DebugUtils.currentY += lineHeight;
|
||||
|
||||
}
|
||||
|
||||
static renderSpriteCorners(sprite: Sprite, color?: string = 'rgb(255,0,255)') {
|
||||
static renderSpriteCorners(sprite: Sprite, color: string = 'rgb(255,0,255)') {
|
||||
|
||||
start(0, 0, color);
|
||||
|
||||
|
@ -84,7 +84,7 @@ module Phaser {
|
|||
* @param y {number} Y position of the debug info to be rendered.
|
||||
* @param [color] {number} color of the debug info to be rendered. (format is css color string)
|
||||
*/
|
||||
static renderSoundInfo(sound: Sound, x: number, y: number, color?: string = 'rgb(255,255,255)') {
|
||||
static renderSoundInfo(sound: Sound, x: number, y: number, color: string = 'rgb(255,255,255)') {
|
||||
|
||||
start(x, y, color);
|
||||
|
||||
|
@ -110,7 +110,7 @@ module Phaser {
|
|||
* @param y {number} Y position of the debug info to be rendered.
|
||||
* @param [color] {number} color of the debug info to be rendered. (format is css color string)
|
||||
*/
|
||||
static renderCameraInfo(camera: Camera, x: number, y: number, color?: string = 'rgb(255,255,255)') {
|
||||
static renderCameraInfo(camera: Camera, x: number, y: number, color: string = 'rgb(255,255,255)') {
|
||||
|
||||
start(x, y, color);
|
||||
line('Camera ID: ' + camera.ID + ' (' + camera.screenView.width + ' x ' + camera.screenView.height + ')');
|
||||
|
@ -129,7 +129,7 @@ module Phaser {
|
|||
* Renders the Pointer.circle object onto the stage in green if down or red if up.
|
||||
* @method renderDebug
|
||||
*/
|
||||
static renderPointer(pointer: Pointer, hideIfUp: bool = false, downColor?: string = 'rgba(0,255,0,0.5)', upColor?: string = 'rgba(255,0,0,0.5)', color?: string = 'rgb(255,255,255)') {
|
||||
static renderPointer(pointer: Pointer, hideIfUp: boolean = false, downColor: string = 'rgba(0,255,0,0.5)', upColor: string = 'rgba(255,0,0,0.5)', color: string = 'rgb(255,255,255)') {
|
||||
|
||||
if (hideIfUp == true && pointer.isUp == true)
|
||||
{
|
||||
|
@ -175,7 +175,7 @@ module Phaser {
|
|||
* @param y {number} Y position of the debug info to be rendered.
|
||||
* @param [color] {number} color of the debug info to be rendered. (format is css color string)
|
||||
*/
|
||||
static renderSpriteInputInfo(sprite: Sprite, x: number, y: number, color?: string = 'rgb(255,255,255)') {
|
||||
static renderSpriteInputInfo(sprite: Sprite, x: number, y: number, color: string = 'rgb(255,255,255)') {
|
||||
|
||||
start(x, y, color);
|
||||
|
||||
|
@ -193,7 +193,7 @@ module Phaser {
|
|||
* @param y {number} Y position of the debug info to be rendered.
|
||||
* @param [color] {number} color of the debug info to be rendered. (format is css color string)
|
||||
*/
|
||||
static renderInputInfo(x: number, y: number, color?: string = 'rgb(255,255,255)') {
|
||||
static renderInputInfo(x: number, y: number, color: string = 'rgb(255,255,255)') {
|
||||
|
||||
start(x, y, color);
|
||||
|
||||
|
@ -213,7 +213,7 @@ module Phaser {
|
|||
|
||||
}
|
||||
|
||||
static renderSpriteWorldView(sprite: Sprite, x: number, y: number, color?: string = 'rgb(255,255,255)') {
|
||||
static renderSpriteWorldView(sprite: Sprite, x: number, y: number, color: string = 'rgb(255,255,255)') {
|
||||
|
||||
start(x, y, color);
|
||||
line('Sprite World Coords (' + sprite.width + ' x ' + sprite.height + ')');
|
||||
|
@ -228,7 +228,7 @@ module Phaser {
|
|||
* @param y {number} Y position of the debug info to be rendered.
|
||||
* @param [color] {number} color of the debug info to be rendered. (format is css color string)
|
||||
*/
|
||||
static renderSpriteInfo(sprite: Sprite, x: number, y: number, color?: string = 'rgb(255,255,255)') {
|
||||
static renderSpriteInfo(sprite: Sprite, x: number, y: number, color: string = 'rgb(255,255,255)') {
|
||||
|
||||
start(x, y, color);
|
||||
line('Sprite: ' + ' (' + sprite.width + ' x ' + sprite.height + ') origin: ' + sprite.transform.origin.x + ' x ' + sprite.transform.origin.y);
|
||||
|
@ -242,7 +242,7 @@ module Phaser {
|
|||
|
||||
}
|
||||
|
||||
static renderSpriteBounds(sprite: Sprite, camera?: Camera = null, color?: string = 'rgba(0,255,0,0.2)') {
|
||||
static renderSpriteBounds(sprite: Sprite, camera: Camera = null, color: string = 'rgba(0,255,0,0.2)') {
|
||||
|
||||
if (camera == null)
|
||||
{
|
||||
|
@ -292,7 +292,7 @@ module Phaser {
|
|||
* @param y {number} Y position of the debug info to be rendered.
|
||||
* @param [color] {number} color of the debug info to be rendered. (format is css color string)
|
||||
*/
|
||||
static renderText(text: string, x: number, y: number, color?: string = 'rgb(255,255,255)', font?: string = '16px Courier') {
|
||||
static renderText(text: string, x: number, y: number, color: string = 'rgb(255,255,255)', font: string = '16px Courier') {
|
||||
|
||||
DebugUtils.context.font = font;
|
||||
DebugUtils.context.fillStyle = color;
|
||||
|
|
|
@ -21,7 +21,7 @@ module Phaser {
|
|||
* @param {Point} out - Optional Point to store the value in, if not supplied a new Point object will be created.
|
||||
* @return {Point} The new Point object.
|
||||
**/
|
||||
static add(a: Point, b: Point, out?: Point = new Point): Point {
|
||||
static add(a: Point, b: Point, out: Point = new Point): Point {
|
||||
return out.setTo(a.x + b.x, a.y + b.y);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@ module Phaser {
|
|||
* @param {Point} out - Optional Point to store the value in, if not supplied a new Point object will be created.
|
||||
* @return {Point} The new Point object.
|
||||
**/
|
||||
static subtract(a: Point, b: Point, out?: Point = new Point): Point {
|
||||
static subtract(a: Point, b: Point, out: Point = new Point): Point {
|
||||
return out.setTo(a.x - b.x, a.y - b.y);
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ module Phaser {
|
|||
* @param {Point} out - Optional Point to store the value in, if not supplied a new Point object will be created.
|
||||
* @return {Point} The new Point object.
|
||||
**/
|
||||
static multiply(a: Point, b: Point, out?: Point = new Point): Point {
|
||||
static multiply(a: Point, b: Point, out: Point = new Point): Point {
|
||||
return out.setTo(a.x * b.x, a.y * b.y);
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ module Phaser {
|
|||
* @param {Point} out - Optional Point to store the value in, if not supplied a new Point object will be created.
|
||||
* @return {Point} The new Point object.
|
||||
**/
|
||||
static divide(a: Point, b: Point, out?: Point = new Point): Point {
|
||||
static divide(a: Point, b: Point, out: Point = new Point): Point {
|
||||
return out.setTo(a.x / b.x, a.y / b.y);
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ module Phaser {
|
|||
* @param {Point} output Optional Point object. If given the values will be set into this object, otherwise a brand new Point object will be created and returned.
|
||||
* @return {Point} The new Point object.
|
||||
**/
|
||||
static clone(a: Point, output?: Point = new Point): Point {
|
||||
static clone(a: Point, output: Point = new Point): Point {
|
||||
return output.setTo(a.x, a.y);
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ module Phaser {
|
|||
* @param {Boolean} round - Round the distance to the nearest integer (default false)
|
||||
* @return {Number} The distance between the two Point objects.
|
||||
**/
|
||||
static distanceBetween(a: Point, b: Point, round?: bool = false): number {
|
||||
static distanceBetween(a: Point, b: Point, round: boolean = false): number {
|
||||
|
||||
var dx = a.x - b.x;
|
||||
var dy = a.y - b.y;
|
||||
|
@ -148,7 +148,7 @@ module Phaser {
|
|||
* @param {Point} b - The second Point object.
|
||||
* @return {Boolean} A value of true if the Points are equal, otherwise false.
|
||||
**/
|
||||
static equals(a: Point, b: Point): bool {
|
||||
static equals(a: Point, b: Point): boolean {
|
||||
return (a.x == b.x && a.y == b.y);
|
||||
}
|
||||
|
||||
|
@ -184,7 +184,7 @@ module Phaser {
|
|||
* @param {Number} distance An optional distance constraint between the Point and the anchor.
|
||||
* @return The modified point object
|
||||
*/
|
||||
static rotate(a: Point, x: number, y: number, angle: number, asDegrees: bool = false, distance?: number = null): Point {
|
||||
static rotate(a: Point, x: number, y: number, angle: number, asDegrees: boolean = false, distance: number = null): Point {
|
||||
|
||||
if (asDegrees)
|
||||
{
|
||||
|
@ -212,7 +212,7 @@ module Phaser {
|
|||
* @param {Number} distance An optional distance constraint between the Point and the anchor.
|
||||
* @return The modified point object
|
||||
*/
|
||||
static rotateAroundPoint(a: Point, b: Point, angle: number, asDegrees: bool = false, distance?: number = null): Point {
|
||||
static rotateAroundPoint(a: Point, b: Point, angle: number, asDegrees: boolean = false, distance: number = null): Point {
|
||||
return PointUtils.rotate(a, b.x, b.y, angle, asDegrees, distance);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ module Phaser {
|
|||
* @param {Point} out - Optional Point to store the value in, if not supplied a new Point object will be created.
|
||||
* @return {Point} The new Point object.
|
||||
**/
|
||||
static getTopLeftAsPoint(a: Rectangle, out?: Point = new Point): Point {
|
||||
static getTopLeftAsPoint(a: Rectangle, out: Point = new Point): Point {
|
||||
return out.setTo(a.x, a.y);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ module Phaser {
|
|||
* @param {Point} out - Optional Point to store the value in, if not supplied a new Point object will be created.
|
||||
* @return {Point} The new Point object.
|
||||
**/
|
||||
static getBottomRightAsPoint(a: Rectangle, out?: Point = new Point): Point {
|
||||
static getBottomRightAsPoint(a: Rectangle, out: Point = new Point): Point {
|
||||
return out.setTo(a.right, a.bottom);
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ module Phaser {
|
|||
* @param {Point} output Optional Point object. If given the values will be set into the object, otherwise a brand new Point object will be created and returned.
|
||||
* @return {Point} The size of the Rectangle object
|
||||
**/
|
||||
static size(a: Rectangle, output?: Point = new Point): Point {
|
||||
static size(a: Rectangle, output: Point = new Point): Point {
|
||||
return output.setTo(a.width, a.height);
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ module Phaser {
|
|||
* @param {Rectangle} output Optional Rectangle object. If given the values will be set into the object, otherwise a brand new Rectangle object will be created and returned.
|
||||
* @return {Rectangle}
|
||||
**/
|
||||
static clone(a: Rectangle, output?: Rectangle = new Rectangle): Rectangle {
|
||||
static clone(a: Rectangle, output: Rectangle = new Rectangle): Rectangle {
|
||||
return output.setTo(a.x, a.y, a.width, a.height);
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ module Phaser {
|
|||
* @param {Number} y The y coordinate of the point to test.
|
||||
* @return {Boolean} A value of true if the Rectangle object contains the specified point; otherwise false.
|
||||
**/
|
||||
static contains(a: Rectangle, x: number, y: number): bool {
|
||||
static contains(a: Rectangle, x: number, y: number): boolean {
|
||||
return (x >= a.x && x <= a.right && y >= a.y && y <= a.bottom);
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ module Phaser {
|
|||
* @param {Point} point The point object being checked. Can be Point or any object with .x and .y values.
|
||||
* @return {Boolean} A value of true if the Rectangle object contains the specified point; otherwise false.
|
||||
**/
|
||||
static containsPoint(a: Rectangle, point: Point): bool {
|
||||
static containsPoint(a: Rectangle, point: Point): boolean {
|
||||
return RectangleUtils.contains(a, point.x, point.y);
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ module Phaser {
|
|||
* @param {Rectangle} b - The second Rectangle object.
|
||||
* @return {Boolean} A value of true if the Rectangle object contains the specified point; otherwise false.
|
||||
**/
|
||||
static containsRect(a: Rectangle, b: Rectangle): bool {
|
||||
static containsRect(a: Rectangle, b: Rectangle): boolean {
|
||||
|
||||
// If the given rect has a larger volume than this one then it can never contain it
|
||||
if (a.volume > b.volume)
|
||||
|
@ -140,7 +140,7 @@ module Phaser {
|
|||
* @param {Rectangle} b - The second Rectangle object.
|
||||
* @return {Boolean} A value of true if the two Rectangles have exactly the same values for the x, y, width and height properties; otherwise false.
|
||||
**/
|
||||
static equals(a: Rectangle, b: Rectangle): bool {
|
||||
static equals(a: Rectangle, b: Rectangle): boolean {
|
||||
return (a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height);
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ module Phaser {
|
|||
* @param {Rectangle} output Optional Rectangle object. If given the intersection values will be set into this object, otherwise a brand new Rectangle object will be created and returned.
|
||||
* @return {Rectangle} A Rectangle object that equals the area of intersection. If the Rectangles do not intersect, this method returns an empty Rectangle object; that is, a Rectangle with its x, y, width, and height properties set to 0.
|
||||
**/
|
||||
static intersection(a: Rectangle, b: Rectangle, out?: Rectangle = new Rectangle): Rectangle {
|
||||
static intersection(a: Rectangle, b: Rectangle, out: Rectangle = new Rectangle): Rectangle {
|
||||
|
||||
if (RectangleUtils.intersects(a, b))
|
||||
{
|
||||
|
@ -175,7 +175,7 @@ module Phaser {
|
|||
* @param {Number} tolerance A tolerance value to allow for an intersection test with padding, default to 0
|
||||
* @return {Boolean} A value of true if the specified object intersects with this Rectangle object; otherwise false.
|
||||
**/
|
||||
static intersects(a: Rectangle, b: Rectangle, tolerance?: number = 0): bool {
|
||||
static intersects(a: Rectangle, b: Rectangle, tolerance: number = 0): boolean {
|
||||
return !(a.left > b.right + tolerance || a.right < b.left - tolerance || a.top > b.bottom + tolerance || a.bottom < b.top - tolerance);
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ module Phaser {
|
|||
* @param {Number} tolerance A tolerance value to allow for an intersection test with padding, default to 0
|
||||
* @return {Boolean} A value of true if the specified object intersects with the Rectangle; otherwise false.
|
||||
**/
|
||||
static intersectsRaw(a: Rectangle, left: number, right: number, top: number, bottom: number, tolerance?: number = 0): bool {
|
||||
static intersectsRaw(a: Rectangle, left: number, right: number, top: number, bottom: number, tolerance: number = 0): boolean {
|
||||
return !(left > a.right + tolerance || right < a.left - tolerance || top > a.bottom + tolerance || bottom < a.top - tolerance);
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ module Phaser {
|
|||
* @param {Rectangle} output Optional Rectangle object. If given the new values will be set into this object, otherwise a brand new Rectangle object will be created and returned.
|
||||
* @return {Rectangle} A Rectangle object that is the union of the two Rectangles.
|
||||
**/
|
||||
static union(a: Rectangle, b: Rectangle, out?: Rectangle = new Rectangle): Rectangle {
|
||||
static union(a: Rectangle, b: Rectangle, out: Rectangle = new Rectangle): Rectangle {
|
||||
return out.setTo(Math.min(a.x, b.x), Math.min(a.y, b.y), Math.max(a.right, b.right), Math.max(a.bottom, b.bottom));
|
||||
}
|
||||
|
||||
|
|
|
@ -103,11 +103,11 @@ module Phaser {
|
|||
* @return {boolean} Whether or not the objects overlap this.
|
||||
*/
|
||||
/*
|
||||
static overlaps(objectOrGroup, inScreenSpace: bool = false, camera: Camera = null): bool {
|
||||
static overlaps(objectOrGroup, inScreenSpace: boolean = false, camera: Camera = null): boolean {
|
||||
|
||||
if (objectOrGroup.isGroup)
|
||||
{
|
||||
var results: bool = false;
|
||||
var results: boolean = false;
|
||||
var i: number = 0;
|
||||
var members = <Group> objectOrGroup.members;
|
||||
|
||||
|
@ -154,7 +154,7 @@ module Phaser {
|
|||
*
|
||||
* @return Whether or not the point overlaps this object.
|
||||
*/
|
||||
static overlapsXY(sprite: Phaser.Sprite, x: number, y: number): bool {
|
||||
static overlapsXY(sprite: Phaser.Sprite, x: number, y: number): boolean {
|
||||
|
||||
// if rotation == 0 then just do a rect check instead!
|
||||
if (sprite.transform.rotation == 0)
|
||||
|
@ -195,8 +195,8 @@ module Phaser {
|
|||
*
|
||||
* @return Whether or not the point overlaps this object.
|
||||
*/
|
||||
static overlapsPoint(sprite: Sprite, point: Point): bool {
|
||||
return overlapsXY(sprite, point.x, point.y);
|
||||
static overlapsPoint(sprite: Sprite, point: Point): boolean {
|
||||
return SpriteUtils.overlapsXY(sprite, point.x, point.y);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -206,7 +206,7 @@ module Phaser {
|
|||
*
|
||||
* @return {boolean} Whether the object is on screen or not.
|
||||
*/
|
||||
static onScreen(sprite: Sprite, camera: Camera = null): bool {
|
||||
static onScreen(sprite: Sprite, camera: Camera = null): boolean {
|
||||
|
||||
if (camera == null)
|
||||
{
|
||||
|
@ -254,7 +254,7 @@ module Phaser {
|
|||
* @param action {number} The action to take if the object hits the world bounds, either OUT_OF_BOUNDS_KILL or OUT_OF_BOUNDS_STOP
|
||||
*/
|
||||
/*
|
||||
static setBoundsFromWorld(action?: number = GameObject.OUT_OF_BOUNDS_STOP) {
|
||||
static setBoundsFromWorld(action: number = GameObject.OUT_OF_BOUNDS_STOP) {
|
||||
|
||||
this.setBounds(this.game.world.bounds.x, this.game.world.bounds.y, this.game.world.bounds.width, this.game.world.bounds.height);
|
||||
this.outOfBoundsAction = action;
|
||||
|
|
|
@ -24,7 +24,7 @@ module Phaser.Plugins.CameraFX {
|
|||
* Whether render border of this camera or not. (default is true)
|
||||
* @type {boolean}
|
||||
*/
|
||||
public showBorder: bool = true;
|
||||
public showBorder: boolean = true;
|
||||
|
||||
/**
|
||||
* Color of border of this camera. (in css color string)
|
||||
|
|
|
@ -33,7 +33,7 @@ module Phaser.Plugins.CameraFX {
|
|||
* @param OnComplete An optional function you want to run when the flash finishes. Set to null for no callback.
|
||||
* @param Force Force an already running flash effect to reset.
|
||||
*/
|
||||
public start(color: number = 0x000000, duration: number = 1, onComplete = null, force: bool = false) {
|
||||
public start(color: number = 0x000000, duration: number = 1, onComplete = null, force: boolean = false) {
|
||||
|
||||
if (force === false && this._fxFadeAlpha > 0)
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ module Phaser.Plugins.CameraFX {
|
|||
* @param OnComplete An optional function you want to run when the flash finishes. Set to null for no callback.
|
||||
* @param Force Force an already running flash effect to reset.
|
||||
*/
|
||||
public start(color: number = 0xffffff, duration: number = 1, onComplete = null, force: bool = false) {
|
||||
public start(color: number = 0xffffff, duration: number = 1, onComplete = null, force: boolean = false) {
|
||||
|
||||
if (force === false && this._fxFlashAlpha > 0)
|
||||
{
|
||||
|
|
|
@ -36,18 +36,18 @@ module Phaser.Plugins.CameraFX {
|
|||
|
||||
public camera: Phaser.Camera;
|
||||
|
||||
public flipX: bool = false;
|
||||
public flipY: bool = true;
|
||||
public flipX: boolean = false;
|
||||
public flipY: boolean = true;
|
||||
|
||||
public x: number;
|
||||
public y: number;
|
||||
public cls: bool = false;
|
||||
public cls: boolean = false;
|
||||
|
||||
/**
|
||||
* This is the rectangular region to grab from the Camera used in the Mirror effect
|
||||
* It is rendered to the Stage at Mirror.x/y (note the use of Stage coordinates, not World coordinates)
|
||||
*/
|
||||
public start(x: number, y: number, region: Phaser.Rectangle, fillColor?: string = 'rgba(0, 0, 100, 0.5)') {
|
||||
public start(x: number, y: number, region: Phaser.Rectangle, fillColor: string = 'rgba(0, 0, 100, 0.5)') {
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
|
|
@ -24,7 +24,7 @@ module Phaser.Plugins.CameraFX {
|
|||
* Render camera shadow or not. (default is false)
|
||||
* @type {boolean}
|
||||
*/
|
||||
public showShadow: bool = false;
|
||||
public showShadow: boolean = false;
|
||||
|
||||
/**
|
||||
* Color of shadow, in css color string.
|
||||
|
|
|
@ -41,7 +41,7 @@ module Phaser.Plugins.CameraFX {
|
|||
* @param Force Force the effect to reset (default = true, unlike flash() and fade()!).
|
||||
* @param Direction Whether to shake on both axes, just up and down, or just side to side (use class constants SHAKE_BOTH_AXES, SHAKE_VERTICAL_ONLY, or SHAKE_HORIZONTAL_ONLY).
|
||||
*/
|
||||
public start(intensity: number = 0.05, duration: number = 0.5, onComplete = null, force: bool = true, direction: number = Shake.SHAKE_BOTH_AXES) {
|
||||
public start(intensity: number = 0.05, duration: number = 0.5, onComplete = null, force: boolean = true, direction: number = Shake.SHAKE_BOTH_AXES) {
|
||||
|
||||
if (!force && ((this._fxShakeOffset.x != 0) || (this._fxShakeOffset.y != 0)))
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
}
|
||||
|
||||
var sprite: Phaser.Sprite;
|
||||
var rotate: bool = false;
|
||||
var rotate: boolean = false;
|
||||
|
||||
function create() {
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
|||
if (rotate == false) { rotate = true; } else { rotate = false; }
|
||||
}
|
||||
|
||||
var inPoint: bool = false;
|
||||
var inPoint: boolean = false;
|
||||
|
||||
function update() {
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
}
|
||||
|
||||
var sprite: Phaser.Sprite;
|
||||
var rotate: bool = false;
|
||||
var rotate: boolean = false;
|
||||
|
||||
function create() {
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
}
|
||||
|
||||
var sprite: Phaser.Sprite;
|
||||
var rotate: bool = false;
|
||||
var rotate: boolean = false;
|
||||
|
||||
function create() {
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
}
|
||||
|
||||
var sprite: Phaser.Sprite;
|
||||
var rotate: bool = false;
|
||||
var rotate: boolean = false;
|
||||
|
||||
function create() {
|
||||
|
||||
|
|
Loading…
Reference in a new issue