Skip to content

Commit

Permalink
Merge pull request #204 from photonstorm/release-v2.7.8
Browse files Browse the repository at this point in the history
Phaser CE Version 2.7.8
  • Loading branch information
photonstorm committed May 8, 2017
2 parents 7412d8b + 8829b2b commit 49ac475
Show file tree
Hide file tree
Showing 432 changed files with 9,838 additions and 8,105 deletions.
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,41 @@

See [README: Change Log](README.md#change-log).

## Version 2.7.8 - 8th May 2017

### New Features

* You can now set [Group#updateOnlyExistingChildren](https://photonstorm.github.io/phaser-ce/Phaser.Group.html#updateOnlyExistingChildren) to skip [update](https://photonstorm.github.io/phaser-ce/Phaser.Component.Core.html#update) calls on children with `exists = false` (#187).
* [Phaser.ScaleManager#setUserScale](https://photonstorm.github.io/phaser-ce/Phaser.ScaleManager.html#setUserScale) now has `queueUpdate` and `force` parameters. Set these to false if your [resize callback](https://photonstorm.github.io/phaser-ce/Phaser.ScaleManager.html#setResizeCallback) is being called repeatedly (#197).
* Added [Phaser.Creature#createAllAnimations](https://photonstorm.github.io/phaser-ce/Phaser.Creature.html#createAllAnimations) to force load all animations in a creature mesh. It must be called before [Phaser.Creature#setAnimation](https://photonstorm.github.io/phaser-ce/Phaser.Creature.html#setAnimation).
* Added [Phaser.Creature#setAnimationPlaySpeed](https://photonstorm.github.io/phaser-ce/Phaser.Creature.html#setAnimationPlaySpeed).
* Added [Phaser.Creature.html#height](https://photonstorm.github.io/phaser-ce/Phaser.Creature.html#height) and [Phaser.Creature#width](https://photonstorm.github.io/phaser-ce/Phaser.Creature.html#width). You can set these dimensions directly rather than by using `scale`.
* Added [Phaser.Creature#setAnchorPointEnabled](https://photonstorm.github.io/phaser-ce/Phaser.Creature.html#setAnchorPointEnabled), [Phaser.Creature#anchorX](https://photonstorm.github.io/phaser-ce/Phaser.Creature.html#anchorX), and [Phaser.Creature#anchorY](https://photonstorm.github.io/phaser-ce/Phaser.Creature.html#anchorY) for setting a Creature's anchor point dynamically (still experimental).

### Updates

* Removed the upper limit of 12 for [Phaser.Loader#maxParallelDownloads](https://photonstorm.github.io/phaser-ce/Phaser.Loader.html#maxParallelDownloads). The default value is still 4. Most browsers limit parallel connections to 6 per domain. Older IE and Android browsers may suffer with a value above 4 (#170).
* Arcade Physics Bodies no longer receive angular motion updates while they have [allowRotation](https://photonstorm.github.io/phaser-ce/Phaser.Physics.Arcade.Body.html#allowRotation) disabled, as this was unnecessary.
* [Phaser.Text#align](https://photonstorm.github.io/phaser-ce/Phaser.Text.html#align) can now be set in any case or mix of cases (e.g., 'left', 'Left', 'LEFT').
* [Phaser CE API](https://photonstorm.github.io/phaser-ce/) now shows a synopsis like the Phaser 2.6 docs. You can still find the complete [README](https://github.com/photonstorm/phaser-ce/blob/master/README.md) on GitHub.
* Updated [ScaleManager](https://photonstorm.github.io/phaser-ce/Phaser.ScaleManager.html) docs.
* Clarified `gid` argument in [Phaser.Tilemap#createFromObjects](https://photonstorm.github.io/phaser-ce/Phaser.Tilemap.html#createFromObjects). It can represent an object's `gid`, `id`, or `name`.
* Clarified [Phaser.Image](https://photonstorm.github.io/phaser-ce/Phaser.Image.html)'s use of the Animation component (#185). Images can be animated the same way Sprites can.

### Bug Fixes

* Fixed an issue where Sprites sharing the same texture were distorted or hidden when a WebGLFilter was applied (#39, #153, #154).
* Fixed a 'memory exhausted' error in PIXI.PixiFastShader when compiling shaders with multiTexture enabled.
* Fixed a TypeError in PIXI.WebGLGraphics when trying to render a Graphics object with a missing WebGL context (#178)
* Fixed a ReferenceError in [PIXI.WebGLRenderer](https://photonstorm.github.io/phaser-ce/PIXI.WebGLRenderer.html) when running Phaser in ES5 strict mode.
* Fixed some Typescript definitions (#167).
* Phaser now correctly sets a Creature's anchor point (as set in Creature editor) when a creature mesh is loaded.
* Fixed CreatureManager#CreateAllAnimations crashing in Chrome.

### Thanks

@aaronransley, @andrewjb123, @Cryt1c, @goldfire, @gre, @LandonSchropp, @NickH-nz, @noseglid, @photonstorm, @samme, @tanquetav, @vantreeseba, @vpmedia, @Xan0C

## Version 2.7.7 - 20th April 2017

### Bug Fixes
Expand Down
33 changes: 8 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Thousands of developers worldwide use Phaser. From indies and multi-national dig

Phaser v2 was originally built and maintained by the company [Photon Storm](http://www.photonstorm.com), but was turned over to the community in November 2016. [Phaser v3](https://github.com/photonstorm/phaser/tree/master/v3) is in active development.

The [current Phaser CE release is 2.7.7](https://github.com/photonstorm/phaser-ce/releases/tag/v2.7.7).
The [current Phaser CE release is 2.7.8](https://github.com/photonstorm/phaser-ce/releases/tag/v2.7.8).

- **Visit:** The [Phaser website](http://phaser.io) and follow on [Twitter](https://twitter.com/photonstorm) (#[phaserjs](https://twitter.com/hashtag/phaserjs))
- **Learn:** [API Docs](https://photonstorm.github.io/phaser-ce/), [Support Forum][forum] and [StackOverflow](http://stackoverflow.com/questions/tagged/phaser-framework)
Expand Down Expand Up @@ -122,11 +122,11 @@ Using Browserify? Please [read this](#browserify).

[Phaser CE is on jsDelivr](http://www.jsdelivr.com/projects/phaser-ce), a "super-fast CDN for developers". Include the following in your html:

<script src="//cdn.jsdelivr.net/phaser-ce/2.7.7/phaser.js"></script>
<script src="//cdn.jsdelivr.net/phaser-ce/2.7.8/phaser.js"></script>

or the minified version:

<script src="//cdn.jsdelivr.net/phaser-ce/2.7.7/phaser.min.js"></script>
<script src="//cdn.jsdelivr.net/phaser-ce/2.7.8/phaser.min.js"></script>

### Web Templates

Expand Down Expand Up @@ -258,7 +258,7 @@ If you code with [TypeScript](http://www.typescriptlang.org/) there are comprehe

# Change Log

## Version 2.7.8 - Unreleased
## Version 2.7.8 - 8th May 2017

### New Features

Expand Down Expand Up @@ -293,23 +293,6 @@ If you code with [TypeScript](http://www.typescriptlang.org/) there are comprehe

@aaronransley, @andrewjb123, @Cryt1c, @goldfire, @gre, @LandonSchropp, @NickH-nz, @noseglid, @photonstorm, @samme, @tanquetav, @vantreeseba, @vpmedia, @Xan0C

## Version 2.7.7 - 20th April 2017

### Bug Fixes

* Fixed failure to load compressed textures when using URLs with query strings (#166)
* Fixed some TypeScript definitions (#168)
* Fixed missing default values for `resolution` in Phaser.LoaderParser BitmapFont methods (#168).
* Fixed particle [autoAlpha](https://photonstorm.github.io/phaser-ce/Phaser.Particles.Arcade.Emitter.html#autoAlpha) and [autoScale](https://photonstorm.github.io/phaser-ce/Phaser.Particles.Arcade.Emitter.html#autoScale) tweens running at double speed (#160).
* Fixed loading of compressed textures (#17, #162)
* Removed `any` key in [Phaser.Physics.Arcade.Body#checkCollision](https://photonstorm.github.io/phaser-ce/Phaser.Physics.Arcade.Body.html#checkCollision). It was never used, so setting it had no effect (#161). Use `!checkCollision.none` instead.
* Fixed [Phaser.Sound](https://photonstorm.github.io/phaser-ce/Phaser.Sound.html) exception when using IE with AudioTag and high volume values (#157). Now volume is clamped between 0 and 1 in every browser when using AudioTags.
* Fixed incorrect [worldScale](https://photonstorm.github.io/phaser-ce/PIXI.DisplayObject.html#worldScale) calculation (#15)

### Thanks

@fridrisnew, @goldfire, @hdodov, @Peter42, @photonstorm, @samme, @SBCGames, @vpmedia

For changes in previous releases please see the extensive [Version History](https://github.com/photonstorm/phaser-ce/blob/master/CHANGELOG.md).

<a name="contributing"></a>
Expand Down Expand Up @@ -342,10 +325,10 @@ All rights reserved.

[![Analytics](https://ga-beacon.appspot.com/UA-44006568-2/phaser/index)](https://github.com/igrigorik/ga-beacon)

[get-js]: https://github.com/photonstorm/phaser-ce/releases/download/v2.7.7/phaser.js
[get-minjs]: https://github.com/photonstorm/phaser-ce/releases/download/v2.7.7/phaser.min.js
[get-zip]: https://github.com/photonstorm/phaser-ce/archive/v2.7.7.zip
[get-tgz]: https://github.com/photonstorm/phaser-ce/archive/v2.7.7.tar.gz
[get-js]: https://github.com/photonstorm/phaser-ce/releases/download/v2.7.8/phaser.js
[get-minjs]: https://github.com/photonstorm/phaser-ce/releases/download/v2.7.8/phaser.min.js
[get-zip]: https://github.com/photonstorm/phaser-ce/archive/v2.7.8.zip
[get-tgz]: https://github.com/photonstorm/phaser-ce/archive/v2.7.8.tar.gz
[clone-http]: https://github.com/photonstorm/phaser.git
[clone-ssh]: ssh://git@github.com:photonstorm/phaser.git
[clone-svn]: https://github.com/photonstorm/phaser
Expand Down
127 changes: 126 additions & 1 deletion build/creature.js
Original file line number Diff line number Diff line change
Expand Up @@ -6486,10 +6486,74 @@ function Creature(load_data)
this.boundary_indices = [];
this.boundary_min = vec2.create();
this.boundary_max = vec2.create();
this.anchor_point_map = {};
this.anchor_points_active = false;

this.LoadFromData(load_data);
};

// experimental - must enable - disabled by default
Creature.prototype.SetAnchorPointEnabled = function(value) {
this.anchor_points_active = value;
};

Creature.prototype.GetPixelScaling = function(desired_x, desired_y)
{
// compute pixel scaling relative to mesh scaling
this.ComputeBoundaryMinMax();

var mesh_size_x = this.boundary_max[0] - this.boundary_min[0];
var mesh_size_y = this.boundary_max[1] - this.boundary_min[1];

var scale_x = 1.0 / mesh_size_x * desired_x;
var scale_y = 1.0 / mesh_size_y * desired_y;

return [scale_x, scale_y];
};

Creature.prototype.SetAnchorPoint = function(x, y, anim_clip_name_in) {
if (!anim_clip_name_in) {
anim_clip_name_in = 'default';
}

this.ComputeBoundaryMinMax();

var mesh_size_x = this.boundary_max[0] - this.boundary_min[0];
var mesh_size_y = this.boundary_max[1] - this.boundary_min[1];

var target_size_x = this.boundary_max[0];
var target_size_y = this.boundary_max[1];

if (x !== 0) {
target_size_x = this.boundary_max[0] - (mesh_size_x * (x));
}

if (y !== 0) {
target_size_y = this.boundary_max[1] - (mesh_size_y * (y));
}

var anchor_point_base = {
AnchorPoints: [
{
point: [target_size_x, target_size_y],
anim_clip_name: anim_clip_name_in
}
]
};

this.anchor_point_map = this.FillAnchorPointMap(anchor_point_base);
};

Creature.prototype.GetAnchorPoint = function(anim_clip_name_in)
{
if(anim_clip_name_in in this.anchor_point_map)
{
return this.anchor_point_map[anim_clip_name_in];
}

return vec2.fromValues(0, 0);
};

// Fills entire mesh with (r,g,b,a) colours
Creature.prototype.FillRenderColours = function(r, g, b, a)
{
Expand Down Expand Up @@ -6652,8 +6716,45 @@ Creature.prototype.LoadFromData = function(load_data)
}

this.render_composition.resetToWorldRestPts();

// Load Anchor Points
if("anchor_points_items" in load_data)
{
var anchor_point_base = load_data["anchor_points_items"];
this.anchor_point_map = this.FillAnchorPointMap(anchor_point_base);
}
};

Creature.prototype.FillAnchorPointMap = function(json_obj)
{
var anchor_data_node = json_obj["AnchorPoints"];

ret_map = {};
for (var i = 0; i < anchor_data_node.length; i++)
{
var cur_node = anchor_data_node[i];
var cur_pt = this.ReadVector2JSON(cur_node, "point");
var cur_name = cur_node["anim_clip_name"];

ret_map[cur_name] = cur_pt;
}

return ret_map;
};


Creature.prototype.ReadVector2JSON = function(data, key)
{
var raw_array = this.getFloatArray(data[key]);
return vec2.fromValues(raw_array[0], raw_array[1]);
};

Creature.prototype.getFloatArray = function(raw_data)
{
return raw_data;
};


// CreatureAnimation
function CreatureAnimation(load_data, name_in)
{
Expand All @@ -6667,6 +6768,28 @@ function CreatureAnimation(load_data, name_in)
this.LoadFromData(name_in, load_data);
};

CreatureManager.prototype.AlterBonesByAnchor = function(bones_map, animation_name_in)
{
if(this.target_creature.anchor_points_active == false)
{
return;
}

var anchor_point = this.target_creature.GetAnchorPoint(animation_name_in);
for(var cur_bone_key in bones_map)
{
var cur_bone = bones_map[cur_bone_key];
var start_pt = cur_bone.getWorldStartPt();
var end_pt = cur_bone.getWorldEndPt();

start_pt = vec3.subtract(start_pt, start_pt, vec3.fromValues(anchor_point[0], anchor_point[1], 0));
end_pt = vec3.subtract(end_pt, end_pt, vec3.fromValues(anchor_point[0], anchor_point[1], 0));

cur_bone.setWorldStartPt(start_pt);
cur_bone.setWorldEndPt(end_pt);
}
};

CreatureAnimation.prototype.LoadFromData = function(name_in, load_data)
{
var json_anim_base = load_data["animation"];
Expand Down Expand Up @@ -6783,7 +6906,7 @@ CreatureManager.prototype.CreateAllAnimations = function(load_data)
this.CreateAnimation(load_data, cur_name);
}

this.SetActiveAnimationName (all_animation_names.get(0));
this.SetActiveAnimationName (all_animation_names[0]);
};

// Add an animation
Expand Down Expand Up @@ -7162,6 +7285,8 @@ CreatureManager.prototype.PoseCreature = function(animation_name_in, target_pts)

bone_cache_manager.retrieveValuesAtTime(this.getRunTime(),
bones_map);

this.AlterBonesByAnchor(bones_map, animation_name_in);

if(this.bones_override_callback != null)
{
Expand Down
2 changes: 1 addition & 1 deletion build/creature.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions build/creature.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/custom/p2.min.js

Large diffs are not rendered by default.

0 comments on commit 49ac475

Please sign in to comment.