Skip to content

Commit

Permalink
Preparing for 1.0 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
photonstorm committed Aug 1, 2013
1 parent ce27acd commit 9559099
Show file tree
Hide file tree
Showing 36 changed files with 3,570 additions and 1,007 deletions.
Binary file added Docs/Physics Comparison.xlsx
Binary file not shown.
12 changes: 12 additions & 0 deletions Phaser/Phaser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,14 @@
<Content Include="net\Net.js">
<DependentUpon>Net.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="physics\ArcadePhysics.ts" />
<TypeScriptCompile Include="physics\AdvancedPhysics.ts" />
<Content Include="physics\AdvancedPhysics.js">
<DependentUpon>AdvancedPhysics.ts</DependentUpon>
</Content>
<Content Include="physics\ArcadePhysics.js">
<DependentUpon>ArcadePhysics.ts</DependentUpon>
</Content>
<Content Include="physics\Body.js">
<DependentUpon>Body.ts</DependentUpon>
</Content>
Expand Down Expand Up @@ -270,6 +278,10 @@
<Content Include="system\screens\OrientationScreen.js">
<DependentUpon>OrientationScreen.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="utils\BodyUtils.ts" />
<Content Include="utils\BodyUtils.js">
<DependentUpon>BodyUtils.ts</DependentUpon>
</Content>
<Content Include="utils\CircleUtils.js">
<DependentUpon>CircleUtils.ts</DependentUpon>
</Content>
Expand Down
11 changes: 11 additions & 0 deletions Phaser/Stage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ module Phaser {
*/
public scaleMode: number;

/**
* If set to true the game will never pause when the browser or browser tab loses focuses
* @type {boolean}
*/
public disableVisibilityChange: bool = false;

/**
* Stage boot
*/
Expand Down Expand Up @@ -230,6 +236,11 @@ module Phaser {
*/
private visibilityChange(event) {

if (this.disableVisibilityChange)
{
return;
}

if (event.type == 'pagehide' || event.type == 'blur' || document['hidden'] == true || document['webkitHidden'] == true)
{
if (this._game.paused == false)
Expand Down
7 changes: 7 additions & 0 deletions Phaser/components/Texture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ module Phaser.Components {
*/
public isDynamic: bool = false;

/**
* The crop rectangle allows you to control which part of the sprite texture is rendered without distorting it.
* Set to null to disable, set to a Phaser.Rectangle object to control the region that will be rendered, anything outside the rectangle is ignored.
* @type {Phaser.Rectangle}
*/
public crop: Phaser.Rectangle;

/**
* Updates the texture being used to render the Sprite.
* Called automatically by SpriteUtils.loadTexture and SpriteUtils.loadDynamicTexture.
Expand Down
1 change: 1 addition & 0 deletions Phaser/components/sprite/Input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ module Phaser.Components.Sprite {
if (this.bringToTop)
{
this._parent.bringToTop();
//this._parent.game.world.group.bringToTop(this._parent);
}

}
Expand Down
16 changes: 11 additions & 5 deletions Phaser/core/Group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ module Phaser {

/**
* Override this function to handle any deleting or "shutdown" type operations you might need,
* such as removing traditional Flash children like Basic objects.
* such as removing traditional children like Basic objects.
*/
public destroy() {

Expand Down Expand Up @@ -417,10 +417,10 @@ module Phaser {
* @param y {number} Y position of the new sprite.
* @param [key] {string} The image key as defined in the Game.Cache to use as the texture for this sprite
* @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.
* @param [bodyType] {number} The physics body type of the object (defaults to BODY_DYNAMIC)
* @param [bodyType] {number} The physics body type of the object (defaults to BODY_DISABLED)
* @returns {Sprite} The newly created sprite object.
*/
public addNewSprite(x: number, y: number, key?: string = '', frame? = null, bodyType?: number = Phaser.Types.BODY_DYNAMIC): Sprite {
public addNewSprite(x: number, y: number, key?: string = '', frame? = null, bodyType?: number = Phaser.Types.BODY_DISABLED): Sprite {
return <Sprite> this.add(new Sprite(this.game, x, y, key, frame, bodyType));
}

Expand Down Expand Up @@ -527,7 +527,7 @@ module Phaser {
*/
public remove(object, splice: bool = false) {

console.log('removing from group');
//console.log('removing from group: ', object.name);

this._i = this.members.indexOf(object);

Expand All @@ -546,7 +546,7 @@ module Phaser {
this.members[this._i] = null;
}

console.log('nulled');
//console.log('nulled');

if (object['events'])
{
Expand Down Expand Up @@ -728,6 +728,12 @@ module Phaser {
*/
public sortHandler(obj1, obj2): number {

if (!obj1 || !obj2)
{
//console.log('null objects in sort', obj1, obj2);
return 0;
}

if (obj1[this._sortIndex] < obj2[this._sortIndex])
{
return this._sortOrder;
Expand Down
14 changes: 11 additions & 3 deletions Phaser/gameobjects/Sprite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ module Phaser {

if (bodyType !== Phaser.Types.BODY_DISABLED)
{
this.body = new Phaser.Physics.Body(this, bodyType, 0, 0, shapeType);
this.game.physics.addBody(this.body);
this.transform.origin.setTo(0.5, 0.5);
//this.body = new Phaser.Physics.Body(this, bodyType, 0, 0, shapeType);
//this.game.physics.addBody(this.body);
//this.transform.origin.setTo(0.5, 0.5);
}

this.worldView = new Rectangle(x, y, this.width, this.height);
Expand All @@ -88,6 +88,7 @@ module Phaser {
this.scale = this.transform.scale;
this.alpha = this.texture.alpha;
this.origin = this.transform.origin;
this.crop = this.texture.crop;

}

Expand Down Expand Up @@ -255,6 +256,13 @@ module Phaser {
*/
public scale: Phaser.Vec2;

/**
* The crop rectangle allows you to control which part of the sprite texture is rendered without distorting it.
* Set to null to disable, set to a Phaser.Rectangle object to control the region that will be rendered, anything outside the rectangle is ignored.
* @type {Phaser.Rectangle}
*/
public crop: Phaser.Rectangle;

/**
* The origin of the Sprite around which rotation and positioning takes place.
* This is a reference to Sprite.transform.origin
Expand Down
Loading

0 comments on commit 9559099

Please sign in to comment.