diff -r 67ebb6b105017011274ded86c80c1ad4e8f922b9 -r 97265e7c111a3ce5cbf71d6a2988c322dcc133d7 axios/Axios_Windows.csproj
--- a/axios/Axios_Windows.csproj Mon May 26 17:07:42 2014 -0500
+++ b/axios/Axios_Windows.csproj Sun Jun 01 22:02:50 2014 -0500
@@ -10,7 +10,8 @@
Axios
Axios.Windows
v4.0
- Client
+
+
v4.0
Windows
HiDef
@@ -44,6 +45,13 @@
true
+
+ ..\..\..\git\axiosmapeditor\Gleed2D-master\src\Gleed2D.Core\bin\x86\Debug\Gleed2D.Core.dll
+
+
+ False
+ ..\..\..\git\axiosmapeditor\Gleed2D-master\src\Gleed2D.Core\bin\x86\Debug\Gleed2D.InGame.dll
+
False
@@ -222,14 +230,8 @@
-
-
-
-
-
-
@@ -287,7 +289,6 @@
-
diff -r 67ebb6b105017011274ded86c80c1ad4e8f922b9 -r 97265e7c111a3ce5cbf71d6a2988c322dcc133d7 axios/Axios_Windows.csproj.user
--- a/axios/Axios_Windows.csproj.user Mon May 26 17:07:42 2014 -0500
+++ b/axios/Axios_Windows.csproj.user Sun Jun 01 22:02:50 2014 -0500
@@ -1,6 +1,6 @@
- ProjectFiles
+ ShowAllFiles
\ No newline at end of file
diff -r 67ebb6b105017011274ded86c80c1ad4e8f922b9 -r 97265e7c111a3ce5cbf71d6a2988c322dcc133d7 axios/Engine/AxiosGameScreen.cs
--- a/axios/Engine/AxiosGameScreen.cs Mon May 26 17:07:42 2014 -0500
+++ b/axios/Engine/AxiosGameScreen.cs Sun Jun 01 22:02:50 2014 -0500
@@ -12,8 +12,15 @@
using Microsoft.Xna.Framework.Graphics;
using GameStateManagement;
using Microsoft.Xna.Framework.Input;
+using Axios.Engine.Extensions;
+using System.IO;
+using System.IO.Compression;
+using Gleed2D.InGame;
+using Axios.Engine.File;
+using System.Xml.Linq;
+using Gleed2D.Core;
+using System.Diagnostics;
using Axios.Engine.Gleed2D;
-using Axios.Engine.Extensions;
namespace Axios.Engine
{
@@ -36,6 +43,12 @@
private List _timers;
private List _uiobjects;
+ protected Dictionary PathItems = new Dictionary();
+ protected Dictionary TextureItems = new Dictionary();
+ //protected List TextureItems = new List();
+
+ protected Dictionary cache = new Dictionary();
+
private AxiosUIObject prevuiobj;
private AxiosUIObject prevuifocusobj;
@@ -68,6 +81,50 @@
}
+ public void LoadLevelFromStream(Stream s)
+ {
+ XElement xml = XElement.Load(s);
+ Level level = LevelLoader.Load(xml);
+ this.Level = level;
+
+ foreach (Layer layer in level.Layers)
+ {
+ foreach (LayerItem item in layer.Items)
+ {
+ //Debug.WriteLine(item.PropertyType);
+ switch (item.PropertyType)
+ {
+ case "Gleed2D.InGame.PathItemProperties":
+ this.LoadPathItem((PathItemProperties)item.Properties, layer);
+ break;
+ case "Gleed2D.InGame.TextureItemProperties":
+ this.LoadTextureItem((TextureItemProperties)item.Properties, layer);
+ break;
+ default:
+ this.LoadOtherItem(item.Properties, item.PropertyType, layer);
+ break;
+ }
+ /*Debug.WriteLine(item.Properties.Id);
+ Debug.WriteLine(item.Properties.Name);
+ Debug.WriteLine(item.PropertyType);*/
+
+ }
+ }
+ }
+
+ public void LoadLevelFromFile(string s)
+ {
+ AxiosTitleFile file = new AxiosTitleFile(s);
+ this.LoadLevelFromStream(file.GetStream(FileMode.Open));
+ }
+
+ public void LoadLevelFromGZFile(string s)
+ {
+ AxiosTitleFile file = new AxiosTitleFile(s);
+ GZipStream zipstream = new GZipStream(file.GetStream(FileMode.Open), CompressionMode.Decompress);
+ this.LoadLevelFromStream(zipstream);
+ }
+
public Vector2 MouseAimVector(MouseState ms, Vector2 relativeposition)
{
Vector2 ret;
@@ -234,10 +291,16 @@
foreach (Layer layer in Level.Layers)
{
Vector2 oldcameraposition = camera.Position;
- camera.Position *= layer.ScrollSpeed;
+ //camera.Position *= layer.ScrollSpeed;
ScreenManager.SpriteBatch.Begin(0, null, null, null, null, null, Camera.View);
- layer.draw(ScreenManager.SpriteBatch);
+ foreach (TextureItem i in TextureItems.Values)
+ {
+ if (i.LayerItem.Visible == true)
+ {
+ i.draw(ScreenManager.SpriteBatch);
+ }
+ }
ScreenManager.SpriteBatch.End();
camera.Position = oldcameraposition;
@@ -250,6 +313,8 @@
foreach(AxiosUIObject g in (from x in _uiobjects orderby x.DrawOrder select x))
((IDrawableAxiosGameObject)g).Draw(this, gameTime);
+
+
base.Draw(gameTime); //This is placed at the end so that Farseer debug information is visible
}
@@ -459,25 +524,31 @@
///
///
///
- public virtual bool LoadCircleItem(CircleItem circleitem)
+ public virtual bool LoadCircleItem(object circleitem)
{
return true;
}
- public virtual bool LoadPathItem(PathItem pathitem)
+ public virtual void LoadPathItem(PathItemProperties pathitem, Layer l)
+ {
+ PathItem p = new PathItem((PathItemProperties)pathitem);
+ p.load(this, ref cache);
+ PathItems[pathitem.Name] = p;
+ }
+
+ public virtual bool LoadRectangleItem(object rectangleitem)
{
return true;
}
- public virtual bool LoadRectangleItem(RectangleItem rectangleitem)
+ public virtual void LoadTextureItem(TextureItemProperties textureitem, Layer l)
{
- return true;
+ TextureItem i = new TextureItem((TextureItemProperties)textureitem);
+ i.load(this, ref cache);
+ TextureItems[textureitem.Name] = i;
}
- public virtual bool LoadTextureItem(TextureItem textureitem)
- {
- return true;
- }
+ public virtual void LoadOtherItem(ItemProperties prop, string type, Layer l) { }
}
}
diff -r 67ebb6b105017011274ded86c80c1ad4e8f922b9 -r 97265e7c111a3ce5cbf71d6a2988c322dcc133d7 axios/Engine/Gleed2D/Camera.cs
--- a/axios/Engine/Gleed2D/Camera.cs Mon May 26 17:07:42 2014 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Microsoft.Xna.Framework;
-
-namespace Axios.Engine.Gleed2D
-{
- public class Camera
- {
- Vector2 position;
- public Vector2 Position
- {
- get
- {
- return position;
- }
- set
- {
- position = value;
- updatematrix();
- }
- }
-
- float rotation;
- public float Rotation
- {
- get
- {
- return rotation;
- }
- set
- {
- rotation = value;
- updatematrix();
- }
- }
-
- float scale;
- public float Scale
- {
- get
- {
- return scale;
- }
- set
- {
- scale = value;
- updatematrix();
- }
- }
-
- public Matrix matrix;
- Vector2 viewport; //width and height of the viewport
-
-
- public Camera(float width, float height)
- {
- position = Vector2.Zero;
- rotation = 0;
- scale = 1.0f;
- viewport = new Vector2(width, height);
- updatematrix();
- }
-
- void updatematrix()
- {
- matrix = Matrix.CreateTranslation(-position.X, -position.Y, 0.0f) *
- Matrix.CreateRotationZ(rotation) *
- Matrix.CreateScale(scale) *
- Matrix.CreateTranslation(viewport.X / 2, viewport.Y / 2, 0.0f);
- }
-
- public void updateviewport(float width, float height)
- {
- viewport.X = width;
- viewport.Y = height;
- updatematrix();
- }
-
- }
-}
diff -r 67ebb6b105017011274ded86c80c1ad4e8f922b9 -r 97265e7c111a3ce5cbf71d6a2988c322dcc133d7 axios/Engine/Gleed2D/CustomProperty.cs
--- a/axios/Engine/Gleed2D/CustomProperty.cs Mon May 26 17:07:42 2014 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using FarseerPhysics.Dynamics;
-using FarseerPhysics.Common;
-using FarseerPhysics.SamplesFramework;
-using FarseerPhysics.Factories;
-using Microsoft.Xna.Framework.Content;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework;
-using System.Xml;
-using System.Xml.Serialization;
-
-namespace Axios.Engine.Gleed2D
-{
- ///////////////////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////////////////
- //
- // NEEDED FOR SERIALIZATION. YOU SHOULDN'T CHANGE ANYTHING BELOW!
- //
- ///////////////////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////////////////
-
-
- public class CustomProperty
- {
- public string name;
- public object value;
- public Type type;
- public string description;
-
- public CustomProperty()
- {
- }
-
- public CustomProperty(string n, object v, Type t, string d)
- {
- name = n;
- value = v;
- type = t;
- description = d;
- }
-
- public CustomProperty clone()
- {
- CustomProperty result = new CustomProperty(name, value, type, description);
- return result;
- }
- }
-
-
- public class SerializableDictionary : Dictionary, IXmlSerializable
- {
-
- public SerializableDictionary()
- : base()
- {
-
- }
-
- public SerializableDictionary(SerializableDictionary copyfrom)
- : base(copyfrom)
- {
- string[] keyscopy = new string[Keys.Count];
- Keys.CopyTo(keyscopy, 0);
- foreach (string key in keyscopy)
- {
- this[key] = this[key].clone();
- }
- }
-
- public System.Xml.Schema.XmlSchema GetSchema()
- {
- return null;
- }
-
- public void ReadXml(System.Xml.XmlReader reader)
- {
-
- bool wasEmpty = reader.IsEmptyElement;
- reader.Read();
-
- if (wasEmpty) return;
-
- while (reader.NodeType != System.Xml.XmlNodeType.EndElement)
- {
- CustomProperty cp = new CustomProperty();
- cp.name = reader.GetAttribute("Name");
- cp.description = reader.GetAttribute("Description");
-
- string type = reader.GetAttribute("Type");
- if (type == "string") cp.type = typeof(string);
- if (type == "bool") cp.type = typeof(bool);
- if (type == "Vector2") cp.type = typeof(Vector2);
- if (type == "Color") cp.type = typeof(Color);
- if (type == "Item") cp.type = typeof(Item);
-
- if (cp.type == typeof(Item))
- {
- cp.value = reader.ReadInnerXml();
- this.Add(cp.name, cp);
- }
- else
- {
- reader.ReadStartElement("Property");
- XmlSerializer valueSerializer = new XmlSerializer(cp.type);
- object obj = valueSerializer.Deserialize(reader);
-#if WINDOWS
- cp.value = Convert.ChangeType(obj, cp.type);
-#elif WINDOWS_PHONE || XBOX360
- cp.value = Convert.ChangeType(obj, cp.type, null);
-#endif
- this.Add(cp.name, cp);
- reader.ReadEndElement();
- }
-
- reader.MoveToContent();
- }
- reader.ReadEndElement();
- }
-
- public void WriteXml(System.Xml.XmlWriter writer)
- {
- foreach (String key in this.Keys)
- {
- writer.WriteStartElement("Property");
- writer.WriteAttributeString("Name", this[key].name);
- if (this[key].type == typeof(string)) writer.WriteAttributeString("Type", "string");
- if (this[key].type == typeof(bool)) writer.WriteAttributeString("Type", "bool");
- if (this[key].type == typeof(Vector2)) writer.WriteAttributeString("Type", "Vector2");
- if (this[key].type == typeof(Color)) writer.WriteAttributeString("Type", "Color");
- if (this[key].type == typeof(Item)) writer.WriteAttributeString("Type", "Item");
- writer.WriteAttributeString("Description", this[key].description);
-
- if (this[key].type == typeof(Item))
- {
- Item item = (Item)this[key].value;
- if (item != null) writer.WriteString(item.Name);
- else writer.WriteString("$null$");
- }
- else
- {
- XmlSerializer valueSerializer = new XmlSerializer(this[key].type);
- valueSerializer.Serialize(writer, this[key].value);
- }
- writer.WriteEndElement();
- }
- }
-
- ///
- /// Must be called after all Items have been deserialized.
- /// Restores the Item references in CustomProperties of type Item.
- ///
- public void RestoreItemAssociations(Level level)
- {
- foreach (CustomProperty cp in Values)
- {
- if (cp.type == typeof(Item)) cp.value = level.getItemByName((string)cp.value);
- }
- }
-
-
- }
-}
diff -r 67ebb6b105017011274ded86c80c1ad4e8f922b9 -r 97265e7c111a3ce5cbf71d6a2988c322dcc133d7 axios/Engine/Gleed2D/Item.cs
--- a/axios/Engine/Gleed2D/Item.cs Mon May 26 17:07:42 2014 -0500
+++ b/axios/Engine/Gleed2D/Item.cs Sun Jun 01 22:02:50 2014 -0500
@@ -8,48 +8,19 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using FarseerPhysics.Dynamics;
+using Gleed2D.InGame;
namespace Axios.Engine.Gleed2D
{
- [XmlInclude(typeof(TextureItem))]
- [XmlInclude(typeof(RectangleItem))]
- [XmlInclude(typeof(CircleItem))]
- [XmlInclude(typeof(PathItem))]
- public partial class Item
+ public class Item
{
- ///
- /// The name of this item.
- ///
- [XmlAttribute()]
- public String Name;
- ///
- /// Should this item be visible?
- ///
- [XmlAttribute()]
- public bool Visible;
-
- ///
- /// The item's position in world space.
- ///
- public Vector2 Position;
-
- ///
- /// A Dictionary containing any user-defined Properties.
- ///
- public SerializableDictionary CustomProperties;
-
-
- public Item()
- {
- CustomProperties = new SerializableDictionary();
- }
///
/// 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, Layer layer)
+ public virtual void load(AxiosGameScreen gameScreen, ref Dictionary cache)
{
}
diff -r 67ebb6b105017011274ded86c80c1ad4e8f922b9 -r 97265e7c111a3ce5cbf71d6a2988c322dcc133d7 axios/Engine/Gleed2D/Layer.cs
--- a/axios/Engine/Gleed2D/Layer.cs Mon May 26 17:07:42 2014 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Xml;
-using System.Xml.Serialization;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework;
-
-namespace Axios.Engine.Gleed2D
-{
- public partial class Layer
- {
- ///
- /// The name of the layer.
- ///
- [XmlAttribute()]
- public String Name;
-
- ///
- /// Should this layer be visible?
- ///
- [XmlAttribute()]
- public bool Visible;
-
- ///
- /// The list of the items in this layer.
- ///
- public List- Items;
-
- ///
- /// The Scroll Speed relative to the main camera. The X and Y components are
- /// interpreted as factors, so (1;1) means the same scrolling speed as the main camera.
- /// Enables parallax scrolling.
- ///
- public Vector2 ScrollSpeed;
-
- ///
- /// A Dictionary containing any user-defined Properties.
- ///
- public SerializableDictionary CustomProperties;
-
-
- public Layer()
- {
- Items = new List
- ();
- ScrollSpeed = Vector2.One;
- }
-
- public void draw(SpriteBatch sb)
- {
- if (!Visible) return;
- foreach (Item item in Items) item.draw(sb);
- }
-
- }
-}
diff -r 67ebb6b105017011274ded86c80c1ad4e8f922b9 -r 97265e7c111a3ce5cbf71d6a2988c322dcc133d7 axios/Engine/Gleed2D/Level.cs
--- a/axios/Engine/Gleed2D/Level.cs Mon May 26 17:07:42 2014 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Xml;
-using System.Xml.Serialization;
-using Microsoft.Xna.Framework;
-using Microsoft.Xna.Framework.Graphics;
-using Microsoft.Xna.Framework.Content;
-using System.IO;
-using FarseerPhysics.Dynamics;
-using FarseerPhysics.Common;
-using FarseerPhysics.SamplesFramework;
-using FarseerPhysics.Factories;
-
-namespace Axios.Engine.Gleed2D
-{
- public partial class Level
- {
- private World _world;
-
- ///
- /// The name of the level.
- ///
- [XmlAttribute()]
- public String Name;
-
- [XmlAttribute()]
- public bool Visible;
-
- ///
- /// A Level contains several Layers. Each Layer contains several Items.
- ///
- public List Layers;
-
- ///
- /// A Dictionary containing any user-defined Properties.
- ///
- public SerializableDictionary CustomProperties;
-
-
- public Level()
- {
- Visible = true;
- Layers = new List();
- CustomProperties = new SerializableDictionary();
- }
-
- public Level(World world)
- {
- Visible = true;
- Layers = new List();
- CustomProperties = new SerializableDictionary();
- _world = world;
- }
-
- public static Level FromFile(string filename, AxiosGameScreen gameScreen)
- {
- Dictionary cache = new Dictionary();
- FileStream stream = System.IO.File.Open(filename, FileMode.Open);
- XmlSerializer serializer = new XmlSerializer(typeof(Level));
- Level level = (Level)serializer.Deserialize(stream);
- stream.Close();
-
- foreach (Layer layer in level.Layers)
- {
- foreach (Item item in layer.Items)
- {
- item.CustomProperties.RestoreItemAssociations(level);
- item.load(gameScreen, ref cache, layer);
- }
- }
-
- return level;
- }
-
- public static Level FromStream(Stream stream, AxiosGameScreen gameScreen)
- {
- Dictionary cache = new Dictionary();
- XmlSerializer serializer = new XmlSerializer(typeof(Level));
- Level level = (Level)serializer.Deserialize(stream);
- stream.Close();
-
- foreach (Layer layer in level.Layers)
- {
- foreach (Item item in layer.Items)
- {
- item.CustomProperties.RestoreItemAssociations(level);
- item.load(gameScreen, ref cache, layer);
- }
- }
-
- return level;
- }
-
- public Item getItemByName(string name)
- {
- foreach (Layer layer in Layers)
- {
- foreach (Item item in layer.Items)
- {
- if (item.Name == name) return item;
- }
- }
- return null;
- }
-
- public Layer getLayerByName(string name)
- {
- foreach (Layer layer in Layers)
- {
- if (layer.Name == name) return layer;
- }
- return null;
- }
-
- public void draw(SpriteBatch sb)
- {
- foreach (Layer layer in Layers) layer.draw(sb);
- }
-
-
- }
-
-
-
-
-
-}
diff -r 67ebb6b105017011274ded86c80c1ad4e8f922b9 -r 97265e7c111a3ce5cbf71d6a2988c322dcc133d7 axios/Engine/Gleed2D/PathItem.cs
--- a/axios/Engine/Gleed2D/PathItem.cs Mon May 26 17:07:42 2014 -0500
+++ b/axios/Engine/Gleed2D/PathItem.cs Sun Jun 01 22:02:50 2014 -0500
@@ -9,36 +9,39 @@
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
+using Gleed2D.InGame;
namespace Axios.Engine.Gleed2D
{
- public partial class PathItem : Item
+ public class PathItem : Item
{
- public Vector2[] LocalPoints;
- public Vector2[] WorldPoints;
- public bool IsPolygon;
- public int LineWidth;
- public Color LineColor;
+ private PathItemProperties _item;
+
+ public PathItemProperties LayerItem
+ {
+ get { return _item; }
+ set { }
+ }
Body _body;
- public PathItem()
+ public PathItem(PathItemProperties i)
{
+ this._item = i;
}
- public override void load(AxiosGameScreen gameScreen, ref Dictionary cache, Layer layer)
+ public override void load(AxiosGameScreen gameScreen, ref Dictionary cache)
{
- base.load(gameScreen, ref cache, layer);
- if (gameScreen.LoadPathItem(this))
- {
- Vertices v = new Vertices(LocalPoints.Length);
- foreach (Vector2 vec in LocalPoints)
- v.Add(new Vector2(ConvertUnits.ToSimUnits(vec.X), ConvertUnits.ToSimUnits(vec.Y)));
+ base.load(gameScreen, ref cache);
+
+ Vertices v = new Vertices(LayerItem.LocalPoints.Count);
+ foreach (Vector2 vec in LayerItem.LocalPoints)
+ v.Add(new Vector2(ConvertUnits.ToSimUnits(vec.X), ConvertUnits.ToSimUnits(vec.Y)));
- _body = BodyFactory.CreateLoopShape(gameScreen.World, v);
- _body.Position = ConvertUnits.ToSimUnits(this.Position);
- _body.UserData = this;
- }
+ _body = BodyFactory.CreateLoopShape(gameScreen.World, v);
+ _body.Position = ConvertUnits.ToSimUnits(this.LayerItem.Position);
+ _body.UserData = this;
+
}
}
diff -r 67ebb6b105017011274ded86c80c1ad4e8f922b9 -r 97265e7c111a3ce5cbf71d6a2988c322dcc133d7 axios/Engine/Gleed2D/TextureItem.cs
--- a/axios/Engine/Gleed2D/TextureItem.cs Mon May 26 17:07:42 2014 -0500
+++ b/axios/Engine/Gleed2D/TextureItem.cs Sun Jun 01 22:02:50 2014 -0500
@@ -12,67 +12,25 @@
using FarseerPhysics.Common;
using FarseerPhysics.SamplesFramework;
using FarseerPhysics.Factories;
+using Gleed2D.InGame;
namespace Axios.Engine.Gleed2D
{
public partial class TextureItem : Item
{
- ///
- /// The item's rotation in radians.
- ///
- public float Rotation;
-
- ///
- /// The item's scale factor.
- ///
- public Vector2 Scale;
-
- ///
- /// The color to tint the item's texture with (use white for no tint).
- ///
- public Color TintColor;
-
- ///
- /// If true, the texture is flipped horizontally when drawn.
- ///
- public bool FlipHorizontally;
-
- ///
- /// If true, the texture is flipped vertically when drawn.
- ///
- public bool FlipVertically;
-
- ///
- /// The path to the texture's filename (including the extension) relative to ContentRootFolder.
- ///
- public String texture_filename;
-
- ///
- /// The texture_filename without extension. For using in Content.Load().
- ///
- public String asset_name;
-
- ///
- /// The XNA texture to be drawn. Can be loaded either from file (using "texture_filename")
- /// or via the Content Pipeline (using "asset_name") - then you must ensure that the texture
- /// exists as an asset in your project.
- /// Loading is done in the Item's load() method.
- ///
- ///
- [XmlIgnore]
public Texture2D texture;
- ///
- /// The item's origin relative to the upper left corner of the texture. Usually the middle of the texture.
- /// Used for placing and rotating the texture when drawn.
- ///
- public Vector2 Origin;
+ private TextureItemProperties _item;
- public Layer Layer;
+ public TextureItemProperties LayerItem
+ {
+ get { return _item; }
+ set { }
+ }
-
- public TextureItem()
+ public TextureItem(TextureItemProperties i)
{
+ this._item = i;
}
///
@@ -81,22 +39,21 @@
/// 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, Layer layer)
+ public override void load(AxiosGameScreen gameScreen, ref Dictionary cache)
{
- this.Layer = layer;
- base.load(gameScreen, ref cache, layer);
+ base.load(gameScreen, ref cache);
//throw new NotImplementedException();
//TODO: provide your own implementation of how a TextureItem loads its assets
//for example:
//this.texture = Texture2D.FromFile(, texture_filename);
//or by using the Content Pipeline:
- if (!cache.ContainsKey(asset_name))
+ if (!cache.ContainsKey(LayerItem.AssetName))
{
- cache[asset_name] = gameScreen.ScreenManager.Game.Content.Load(asset_name);
+ cache[LayerItem.AssetName] = gameScreen.ScreenManager.Game.Content.Load(LayerItem.AssetName);
}
- this.texture = cache[asset_name];
- Visible = gameScreen.LoadTextureItem(this);
+ this.texture = cache[LayerItem.AssetName];
+ //Visible = gameScreen.LoadTextureItem(this);
//this.texture = cm.Load(asset_name);
@@ -104,11 +61,11 @@
public override void draw(SpriteBatch sb)
{
- if (!Visible) return;
+ if (!LayerItem.Visible) return;
SpriteEffects effects = SpriteEffects.None;
- if (FlipHorizontally) effects |= SpriteEffects.FlipHorizontally;
- if (FlipVertically) effects |= SpriteEffects.FlipVertically;
- sb.Draw(texture, Position, null, TintColor, Rotation, Origin, Scale, effects, 0);
+ if (LayerItem.FlipHorizontally) effects |= SpriteEffects.FlipHorizontally;
+ if (LayerItem.FlipVertically) effects |= SpriteEffects.FlipVertically;
+ sb.Draw(texture, LayerItem.Position, null, LayerItem.TintColor, LayerItem.Rotation, LayerItem.Origin, LayerItem.Scale, effects, 0);
}
}
}