* - Starting work on AxiosCSV
* - Adding CustomProperties field to Glee2D Layer object (this is because Layers can have custom properties) * - Passing Layer to Items in Glee2D library * - Adding public virtual bool LoadTextureItem(TextureItem textureitem) to AxiosGameScreen
This commit is contained in:
parent
c0ef5e2a94
commit
0fb31c3b0f
@ -107,7 +107,10 @@
|
||||
* - Adding DegreeToRadian/RadianToDegree double extensions
|
||||
* - Fixing UI detect bug
|
||||
* - Adding Width/Height/Position/RealPosition to DrawableAxiosGameObject
|
||||
*
|
||||
* - Starting work on AxiosCSV
|
||||
* - Adding CustomProperties field to Glee2D Layer object (this is because Layers can have custom properties)
|
||||
* - Passing Layer to Items in Glee2D library
|
||||
* - Adding public virtual bool LoadTextureItem(TextureItem textureitem) to AxiosGameScreen
|
||||
*
|
||||
*/
|
||||
#endregion
|
||||
|
@ -464,6 +464,10 @@ namespace Axios.Engine
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual bool LoadTextureItem(TextureItem textureitem)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Axios.Engine.File;
|
||||
|
||||
namespace Axios.Engine.Data
|
||||
@ -10,5 +10,12 @@ namespace Axios.Engine.Data
|
||||
{
|
||||
_file = file;
|
||||
}
|
||||
|
||||
public List<Dictionary<string, string>> GetData()
|
||||
{
|
||||
List<Dictionary<string, string>> ret = new List<Dictionary<string, string>>();
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,9 +23,9 @@ namespace Axios.Engine.Gleed2D
|
||||
{
|
||||
}
|
||||
|
||||
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache)
|
||||
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache, Layer layer)
|
||||
{
|
||||
base.load(gameScreen, ref cache);
|
||||
base.load(gameScreen, ref cache, layer);
|
||||
if (gameScreen.LoadCircleItem(this))
|
||||
{
|
||||
_body = BodyFactory.CreateCircle(gameScreen.World, Radius, 1f);
|
||||
|
@ -49,7 +49,7 @@ namespace Axios.Engine.Gleed2D
|
||||
/// Called by Level.FromFile(filename) on each Item after the deserialization process.
|
||||
/// Should be overriden and can be used to load anything needed by the Item (e.g. a texture).
|
||||
/// </summary>
|
||||
public virtual void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache)
|
||||
public virtual void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache, Layer layer)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -35,6 +35,11 @@ namespace Axios.Engine.Gleed2D
|
||||
/// </summary>
|
||||
public Vector2 ScrollSpeed;
|
||||
|
||||
/// <summary>
|
||||
/// A Dictionary containing any user-defined Properties.
|
||||
/// </summary>
|
||||
public SerializableDictionary CustomProperties;
|
||||
|
||||
|
||||
public Layer()
|
||||
{
|
||||
|
@ -67,7 +67,7 @@ namespace Axios.Engine.Gleed2D
|
||||
foreach (Item item in layer.Items)
|
||||
{
|
||||
item.CustomProperties.RestoreItemAssociations(level);
|
||||
item.load(gameScreen, ref cache);
|
||||
item.load(gameScreen, ref cache, layer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ namespace Axios.Engine.Gleed2D
|
||||
foreach (Item item in layer.Items)
|
||||
{
|
||||
item.CustomProperties.RestoreItemAssociations(level);
|
||||
item.load(gameScreen, ref cache);
|
||||
item.load(gameScreen, ref cache, layer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,9 +26,9 @@ namespace Axios.Engine.Gleed2D
|
||||
{
|
||||
}
|
||||
|
||||
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache)
|
||||
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache, Layer layer)
|
||||
{
|
||||
base.load(gameScreen, ref cache);
|
||||
base.load(gameScreen, ref cache, layer);
|
||||
if (gameScreen.LoadPathItem(this))
|
||||
{
|
||||
Vertices v = new Vertices(LocalPoints.Length);
|
||||
|
@ -22,11 +22,12 @@ namespace Axios.Engine.Gleed2D
|
||||
|
||||
public RectangleItem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache)
|
||||
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache, Layer layer)
|
||||
{
|
||||
base.load(gameScreen, ref cache);
|
||||
base.load(gameScreen, ref cache, layer);
|
||||
if (gameScreen.LoadRectangleItem(this))
|
||||
{
|
||||
_body = BodyFactory.CreateRectangle(gameScreen.World, ConvertUnits.ToSimUnits(Width), ConvertUnits.ToSimUnits(Height), 1f);
|
||||
|
@ -58,7 +58,7 @@ namespace Axios.Engine.Gleed2D
|
||||
/// exists as an asset in your project.
|
||||
/// Loading is done in the Item's load() method.
|
||||
/// </summary>
|
||||
Texture2D texture;
|
||||
public Texture2D texture;
|
||||
|
||||
/// <summary>
|
||||
/// The item's origin relative to the upper left corner of the texture. Usually the middle of the texture.
|
||||
@ -66,6 +66,8 @@ namespace Axios.Engine.Gleed2D
|
||||
/// </summary>
|
||||
public Vector2 Origin;
|
||||
|
||||
public Layer Layer;
|
||||
|
||||
|
||||
public TextureItem()
|
||||
{
|
||||
@ -77,8 +79,10 @@ namespace Axios.Engine.Gleed2D
|
||||
/// You must provide your own implementation. However, you can rely on all public fields being
|
||||
/// filled by the level deserialization process.
|
||||
/// </summary>
|
||||
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache)
|
||||
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache, Layer layer)
|
||||
{
|
||||
this.Layer = layer;
|
||||
base.load(gameScreen, ref cache, layer);
|
||||
//throw new NotImplementedException();
|
||||
|
||||
//TODO: provide your own implementation of how a TextureItem loads its assets
|
||||
@ -90,8 +94,10 @@ namespace Axios.Engine.Gleed2D
|
||||
cache[asset_name] = gameScreen.ScreenManager.Game.Content.Load<Texture2D>(asset_name);
|
||||
}
|
||||
this.texture = cache[asset_name];
|
||||
Visible = gameScreen.LoadTextureItem(this);
|
||||
|
||||
//this.texture = cm.Load<Texture2D>(asset_name);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override void draw(SpriteBatch sb)
|
||||
|
@ -95,20 +95,20 @@ namespace Axios.Engine
|
||||
Vertices vertices = PolygonTools.CreatePolygon(data, this.Texture.Width, false);
|
||||
Vector2 vector = -vertices.GetCentroid();
|
||||
vertices.Translate(ref vector);
|
||||
base.Origin = -vector;
|
||||
this.Origin = -vector;
|
||||
List<Vertices> list = BayazitDecomposer.ConvexPartition(SimplifyTools.ReduceByDistance(vertices, 4f));
|
||||
base._scale = 1f;
|
||||
Vector2 vector2 = (Vector2)(new Vector2(ConvertUnits.ToSimUnits(1)) * base._scale);
|
||||
this._scale = 1f;
|
||||
Vector2 vector2 = (Vector2)(new Vector2(ConvertUnits.ToSimUnits(1)) * this._scale);
|
||||
foreach (Vertices vertices2 in list)
|
||||
{
|
||||
vertices2.Scale(ref vector2);
|
||||
}
|
||||
base.BodyPart = BodyFactory.CreateCompoundPolygon(gameScreen.World, list, 1f, BodyType.Dynamic);
|
||||
base.BodyPart.BodyType = BodyType.Dynamic;
|
||||
base.BodyPart.Position = base.Position;
|
||||
base.BodyPart.UserData = this;
|
||||
base.BodyPart.CollidesWith = Category.All;
|
||||
base.BodyPart.CollisionCategories = Category.All;
|
||||
this.BodyPart = BodyFactory.CreateCompoundPolygon(gameScreen.World, list, 1f, BodyType.Dynamic);
|
||||
this.BodyPart.BodyType = BodyType.Dynamic;
|
||||
this.BodyPart.Position = this.Position;
|
||||
this.BodyPart.UserData = this;
|
||||
this.BodyPart.CollidesWith = Category.All;
|
||||
this.BodyPart.CollisionCategories = Category.All;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user