0.2.0
This is a major release of the EndGate framework. Several breaking changes are included in this release as well as several significant features and a few bug fixes.
Breaking Changes
- The MapManager and Scenery handler have been removed. #68
In previous releases you could add "scenery" to the game by doing the following within your game class:
this.Map.Scenery.AddLayer(...);
Now the equivalent of this is:
this.Scene.Add(...);
Note: ZIndexes between existing scenery objects will now be competing for draw order against other element within the game scene.
- Game canvases are no longer styled. #80
In previous releases EndGate required two game canvases because of the SceneryHandler. Now that the SceneryHandler is gone there's no need for all the styling on the base game canvas so a game canvas will appear exactly how it is built and will not be altered.
- TileMap and SquareTileMap have been moved to the Graphics namespace. #66
Before:
var stm: eg.Map.SquareTileMap,
tm: eg.Map.TileMap,
st: eg.Map.SquareTile;
Now:
var stm: eg.Graphics.SquareTileMap,
tm: eg.Graphics.TileMap,
st: eg.Graphics.Assets.SquareTile;
- AudioManager has been removed. #57
Before (inside a game):
this.Audio.Load("myAudio", "foo/bar.mp3");
this.Audio.Play("myAudio");
this.Audio.GetAudioPlayer("myAudio");
this.Audio.Unload("myAudio");
Now (equivalent inside a game):
var player = this.Content.LoadAudio("myAudio", "foo/bar.mp3");
player.Play();
this.Content.GetAudio("myAudio"); // This return value is "player"
this.Content.UnloadAudio("myAudio");
- SquareTileMap's are now loaded asynchronously. #35
Before:
SquareTileMap's loaded all tiles synchronously resulting in them being drawn as a full loaded graphic once they were added to the scene. (If the maps were too big the page would freeze)
Now:
SquareTileMap's load tiles asynchronously. To have near the same behavior as before you should tie into the SquareTileMap's OnLoaded event handler to determine when the SquareTileMap has finished loading. Otherwise you can keep your existing code if you don't mind seeing SquareTileMap's loaded in asynchronously (you will see the map load in row by row).
- Moved the ImageSource object to the Graphics namespace. #32
Before:
var source: eg.Graphics.Assets.ImageSource;
Now:
var source: eg.Graphics.ImageSource;
- Moved CollisionData from the eg.Collision.Assets namespace into the eg.Collision namespace. #71
- Removed the At property from CollisionData. #23
Before:
class MyCollidable extends eg.Collidable {
constructor() {
super(new eg.Bounds.BoundingCircle(eg.Vector2d.Zero, 3));
}
public Collided(data: eg.Collision.Assets.CollisionData): void {
var iCollidedAt: eg.Vector2d = data.At;
}
}
Now:
class MyCollidable extends eg.Collidable {
constructor() {
super(new eg.Bounds.BoundingCircle(eg.Vector2d.Zero, 3));
}
// Note that CollisionData is now in the Collision namespace.
public Collided(data: eg.Collision.CollisionData): void {
// All At did was capture the position of "me", so there's really no need to capture that value because we already have it!
var iCollidedAt: eg.Vector2d = this.Bounds.Position;
}
}
- Moved Graphic2d, Bounds2d, and MovementController out of their Abstraction namespaces. #19
Before:
var graphic: eg.Graphics.Abstractions.Graphic2d,
bounds: eg.Bounds.Abstractions.Bounds2d,
movementController: eg.MovementControllers.Abstractions.MovementController;
Now:
var graphic: eg.Graphics.Graphic2d,
bounds: eg.Bounds.Bounds2d,
movementController: eg.MovementControllers.MovementController;
- Graphic2d's with colors (Shape's and Line2d) have their colors default to black so that they're not invisible by default. #78
Before:
var transparentCircle = new eg.Graphics.Circle(0, 0, 5);
Now:
var transparentCircle = new eg.Graphics.Circle(0, 0, 5, eg.Graphics.Color.Transparent);
- The Map namespace has been removed. #70
- Mouse events prevent all default actions on the games canvas, this involves not allowing right click -> context menu. #55
- Renamed Graphic2d's Children() method to GetChildren(). #55
- Renamed ImageSource's Loaded() method to IsLoaded(). #41
- Moved the Opacity property onto the Graphic2d class, before it was implemented individually on all of the drawable graphics, now it's inherited. #33
Features
- Added a LoadContent method to the game class. This method is triggered at the end of the "super()" call. All content is loaded in asynchronously, to wait on loaded content capture the results from the Content's LoadImage function and wait on the OnLoaded event for those objects to be triggered. #28
- Added a ContentManager that can be accessed from inside a game object. #27
Usage:
class MyGame extends eg.Game {
constructor() {
super();
var image1: eg.Graphics.ImageSource = this.Content.GetImage("myFirstImage"),
audio1: eg.Sound.AudioPlayer = this.Content.GetAudio("myFirstAudio");
}
public LoadContent(): void {
this.Content.LoadImage("myFirstImage", "/images/foo.png");
this.Content.LoadAudio("myFirstAudio", "/audio/foo.mp3");
}
}
- Added a new Color object. #30
- Modified existing graphics "Color" properties to utilize the new Color object. #72
Usage:
var circle = new eg.Graphics.Circle(0, 0, 5, "red");
// Change the circle's color to yellow (multiple different ways, all are equivalent)
circle.Color.G = 255; // Since we initialized it to red, changing the green component to 255 makes yellow
circle.Color = "yellow";
circle.Color = eg.Graphics.Color.Yellow;
circle.Color = new eg.Graphics.Color(255, 255, 0);
circle.Color = new eg.Graphics.Color(255, 255, 0, 1);
circle.Color = new eg.Graphics.Color("yellow");
circle.Color = new eg.Graphics.Color("rgb(255, 255, 0)");
circle.Color = new eg.Graphics.Color("rgba(255, 255, 0, 1)");
- Added a particle emitter. Checkout the Particles sample to see more capabilities of particle emitters. #26
Usage:
class MyGame extends eg.Game {
private _emitter: eg.Particles.Emitter;
constructor() {
super();
var emitter = new eg.Particles.Emitter(0, 0, eg.Tweening.Functions.Linear.EaseNone);
// Build a pool of textures that the emitter randomly selects to emit.
emitter.AddTexture(new eg.Graphics.Circle(0, 0, 5, "red"));
emitter.AddTexture(new eg.Graphics.Rectangle(0, 0, 10, 10, "green"));
emitter.AddTexture(new eg.Graphics.Line2d(0, 0, 10, 10, 3, "black"));
emitter.AddTexture(new eg.Graphics.Text2d(0, 0, "Hello World", "blue"));
emitter.Start();
// Emitter has several different properties that can be modified to affect how the emitter emits particles. Take a look at the Particles sample to learn more.
this.Scene.Add(emitter);
this._emitter = emitter;
}
public Update(gameTime: eg.GameTime): void {
this._emitter.Update(gameTime);
}
}
- Added a Color Tween. Checkout the Tweening sample to see the tween in action. #31
Usage:
class MyGame extends eg.Game {
private _tween: eg.Tweening.ColorTween;
constructor() {
super();
var graphic = new eg.Graphics.Circle(0, 0, 30, "red"),
tween = new eg.Tweening.ColorTween(graphic.Color, eg.Graphics.Color.Blue, eg.TimeSpan.FromSeconds(1), eg.Tweening.Functions.Linear.EaseNone);
tween.OnChange.Bind((newColor: eg.Graphics.Color) => {
graphic.Color = newColor;
});
tween.Play();
this.Scene.Add(graphic);
this._tween = tween;
}
public Update(gameTime: eg.GameTime): void {
this._tween.Update(gameTime);
}
}
- Added a JSON Map loader for tile maps that are created via a tmx file (http://www.mapeditor.org/). Checkout the MapLoading sample to see more capabilities of JSON map loading. #3
Usage:
class MyGame extends eg.Game {
constructor() {
super();
}
public LoadContent(): void {
// This assumes "mapJson" is set to your maps JSON data.
eg.MapLoaders.JSONLoader.Load(mapJson, (result: eg.MapLoaders.IMapLoadedResult) => {
// Triggered when the map has finished loading
for(var i = 0; i < result.Layers.length; i++) {
this.Scene.Add(result.Layers[i]);
}
};
}
}
- The CollisionManager has been highly optimized. It now uses a dynamically re-sizing quad tree for speedy collision checks. This also involved adding a new parameter to the CollisionManager's Monitor method to indicate if a Collidable is static or not. If a Collidable is static it means that it will not move throughout its life time and it cannot collide with other static objects (since they don't move). #6
class Rock extends Collidable {
constructor() {
super(new eg.Bounds.BoundingCircle(eg.Vector2d.Zero, 10));
}
}
class MyGame extends eg.Game {
constructor() {
super();
/*
* To further optimize the QuadTree you can change the games collision configuration
* Aka: this.Configuration.CollisionConfiguration.MinQuadTreeNodeSize and this.Configuration.CollisionConfiguration.InitialQuadTreeSize
*/
// Monitor the rock for collisions but it cannot move, it's "static". By letting the CollisionManager know that it's static it can further optimize its collision checking algorithm to increase performance.
this.CollisionManager.Monitor(new Rock(), true);
}
}
- Text2d's now inherit from Shape, therefore they can be treated as shapes. #67
- Graphic2d's now implement ICloneable, therefore graphics can be created and cloned via the Clone method. #65
- Graphic2d's now have a Scale method, it takes in a number to multiply the size of the Graphic2d by. This allows for generic sizing of Graphic2d's. #63
- AudioPlayer's now have a BuildClip method. Before AudioPlayer's could just play audio clips, now they can build a "non-playing" audio clip. #60
- ImageSource now implements ICloneable. You do not need to call Extract or create a new ImageSource in order to create a copy of your ImageSource, just call the Clone method. #59
- Graphic2d's now have a Parent property. Whenever a Graphic2d is added as a child to another Graphic2d, it's Parent property is updated appropriately. #54
- Graphic2d's now have an AbsolutePosition property. AbsolutePosition is used to locate the exact location of a Graphic2d, despite its Parent's. This becomes useful when trying to locate where a child Graphic2d is in the context of the entire scene. #54
- Tween's are now disposable. #53
- AudioClip's are now disposable. #52
- SpriteAnimation's are now disposable. #51
- InputManager's are now disposable. #49
- MouseHandler's are now disposable. #48
- KeyboardHandler's are now disposable. #47
- ImageSource's are now disposable. #46
- CollisionManager's are now disposable. #45
- EventHandler, EventHandler1 and EventHandler2 are now disposable. #42
- Added a BindFor method to EventHandler, EventHandler1 and EventHandler2. #40
- The Grid class has been optimized to only build it's grid lines when the DrawGridLines property has been set to true. This will result in a much smaller memory footprint and will increase the grid's overall speed. #37
- SquareTileMap's are now loaded asynchronously, with this feature the SquareTileMap's now have a OnTileLoaded and OnLoaded events to tie into. #36
Bug Fixes
- Graphics can be added removed from the Scene multiple times without leaking OnDisposed event bindings. #44
- Collidables can be monitored/unmonitored via the CollisionManager without leaking OnDisposed. #43
- Grid Fill silently fails when graphic is undefined or null. #38
- SpriteAnimation requires that the ImageSource is loaded, otherwise it throws. Now SpriteAnimation will only throw if the ImageSource is Played while the ImageSource has not been loaded. #22
- Graphic2d dispose does not dispose all children. #21
- Update rate is now defaulted to 65. Prior to this release Update Rate updated as fast as possible. #93 #92
- ImageSource OnLoaded event will always trigger even if the image has already been loaded, this is now more consistent and sets sizes correctly. #90
- SpriteAnimation now sets clip locations and clip sizes on construction. This also involved fixing an issue where SpriteAnimation was incorrectly calculating the frames per row. #89
- The canvas can now be re-sized after the games construction (in run-time). #88
- Fixed mouse scrolling in ie11. #96