diff --git a/axios/Axios_settings.cs b/axios/Axios_settings.cs index 5affa94..6d8f906 100644 --- a/axios/Axios_settings.cs +++ b/axios/Axios_settings.cs @@ -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 diff --git a/axios/Engine/AxiosGameScreen.cs b/axios/Engine/AxiosGameScreen.cs index 5096089..c564034 100644 --- a/axios/Engine/AxiosGameScreen.cs +++ b/axios/Engine/AxiosGameScreen.cs @@ -464,6 +464,10 @@ namespace Axios.Engine return true; } + public virtual bool LoadTextureItem(TextureItem textureitem) + { + return true; + } } } diff --git a/axios/Engine/Data/AxiosCSV.cs b/axios/Engine/Data/AxiosCSV.cs index fb9716b..cdc302d 100644 --- a/axios/Engine/Data/AxiosCSV.cs +++ b/axios/Engine/Data/AxiosCSV.cs @@ -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> GetData() + { + List> ret = new List>(); + + return ret; + } } } diff --git a/axios/Engine/Gleed2D/CircleItem.cs b/axios/Engine/Gleed2D/CircleItem.cs index d2b111a..31e10cb 100644 --- a/axios/Engine/Gleed2D/CircleItem.cs +++ b/axios/Engine/Gleed2D/CircleItem.cs @@ -23,9 +23,9 @@ namespace Axios.Engine.Gleed2D { } - public override void load(AxiosGameScreen gameScreen, ref Dictionary cache) + public override void load(AxiosGameScreen gameScreen, ref Dictionary 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); diff --git a/axios/Engine/Gleed2D/Item.cs b/axios/Engine/Gleed2D/Item.cs index e934a39..92c69a4 100644 --- a/axios/Engine/Gleed2D/Item.cs +++ b/axios/Engine/Gleed2D/Item.cs @@ -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). /// - public virtual void load(AxiosGameScreen gameScreen, ref Dictionary cache) + public virtual void load(AxiosGameScreen gameScreen, ref Dictionary cache, Layer layer) { } diff --git a/axios/Engine/Gleed2D/Layer.cs b/axios/Engine/Gleed2D/Layer.cs index ff625e0..0456c42 100644 --- a/axios/Engine/Gleed2D/Layer.cs +++ b/axios/Engine/Gleed2D/Layer.cs @@ -35,6 +35,11 @@ namespace Axios.Engine.Gleed2D /// public Vector2 ScrollSpeed; + /// + /// A Dictionary containing any user-defined Properties. + /// + public SerializableDictionary CustomProperties; + public Layer() { diff --git a/axios/Engine/Gleed2D/Level.cs b/axios/Engine/Gleed2D/Level.cs index 6c42202..13e5bc8 100644 --- a/axios/Engine/Gleed2D/Level.cs +++ b/axios/Engine/Gleed2D/Level.cs @@ -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); } } diff --git a/axios/Engine/Gleed2D/PathItem.cs b/axios/Engine/Gleed2D/PathItem.cs index aab0820..08494a1 100644 --- a/axios/Engine/Gleed2D/PathItem.cs +++ b/axios/Engine/Gleed2D/PathItem.cs @@ -26,9 +26,9 @@ namespace Axios.Engine.Gleed2D { } - public override void load(AxiosGameScreen gameScreen, ref Dictionary cache) + public override void load(AxiosGameScreen gameScreen, ref Dictionary cache, Layer layer) { - base.load(gameScreen, ref cache); + base.load(gameScreen, ref cache, layer); if (gameScreen.LoadPathItem(this)) { Vertices v = new Vertices(LocalPoints.Length); diff --git a/axios/Engine/Gleed2D/RectangleItem.cs b/axios/Engine/Gleed2D/RectangleItem.cs index 249a6ef..fcdefdd 100644 --- a/axios/Engine/Gleed2D/RectangleItem.cs +++ b/axios/Engine/Gleed2D/RectangleItem.cs @@ -22,11 +22,12 @@ namespace Axios.Engine.Gleed2D public RectangleItem() { + } - public override void load(AxiosGameScreen gameScreen, ref Dictionary cache) + public override void load(AxiosGameScreen gameScreen, ref Dictionary 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); diff --git a/axios/Engine/Gleed2D/TextureItem.cs b/axios/Engine/Gleed2D/TextureItem.cs index ca64ec6..7fdfd28 100644 --- a/axios/Engine/Gleed2D/TextureItem.cs +++ b/axios/Engine/Gleed2D/TextureItem.cs @@ -58,7 +58,7 @@ namespace Axios.Engine.Gleed2D /// exists as an asset in your project. /// Loading is done in the Item's load() method. /// - Texture2D texture; + public Texture2D texture; /// /// 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 /// 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. /// - public override void load(AxiosGameScreen gameScreen, ref Dictionary cache) + public override void load(AxiosGameScreen gameScreen, ref Dictionary 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(asset_name); } this.texture = cache[asset_name]; + Visible = gameScreen.LoadTextureItem(this); + //this.texture = cm.Load(asset_name); - + } public override void draw(SpriteBatch sb) diff --git a/axios/Engine/SimpleDrawableAxiosGameObject.cs b/axios/Engine/SimpleDrawableAxiosGameObject.cs index eee8aed..826f8e9 100644 --- a/axios/Engine/SimpleDrawableAxiosGameObject.cs +++ b/axios/Engine/SimpleDrawableAxiosGameObject.cs @@ -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 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; } }