diff -r ffcca9881813e5b1e37f685d41d6e598a11a453e -r 746146cbe1763068f59c2a8c4f03fc0a59378403 axios/Axios_settings.cs --- a/axios/Axios_settings.cs Mon May 07 22:20:22 2012 -0500 +++ b/axios/Axios_settings.cs Sat May 12 17:45:03 2012 -0500 @@ -69,7 +69,9 @@ * - Adding SplitFlat extension for Texture2D * - Removing uneeded Game Screen checking code * - Adding SplitFlat extension with offsets for Texture2D - * - Adding support for Glee2D + * - Adding support for Gleed2D + * - Splitting the code for Gleed2D into seperate files + * - Adding a cache for loading in textures for Gleed2D * */ diff -r ffcca9881813e5b1e37f685d41d6e598a11a453e -r 746146cbe1763068f59c2a8c4f03fc0a59378403 axios/Engine/Glee2D/CircleItem.cs --- a/axios/Engine/Glee2D/CircleItem.cs Mon May 07 22:20:22 2012 -0500 +++ b/axios/Engine/Glee2D/CircleItem.cs Sat May 12 17:45:03 2012 -0500 @@ -23,9 +23,9 @@ { } - public override void load(ContentManager cm, World world) + public override void load(ContentManager cm, World world, ref Dictionary cache) { - base.load(cm, world); + base.load(cm, world, ref cache); _body = BodyFactory.CreateCircle(world, Radius, 1f); _body.Position = Position; diff -r ffcca9881813e5b1e37f685d41d6e598a11a453e -r 746146cbe1763068f59c2a8c4f03fc0a59378403 axios/Engine/Glee2D/Item.cs --- a/axios/Engine/Glee2D/Item.cs Mon May 07 22:20:22 2012 -0500 +++ b/axios/Engine/Glee2D/Item.cs Sat May 12 17:45:03 2012 -0500 @@ -49,7 +49,7 @@ /// 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(ContentManager cm, World world) + public virtual void load(ContentManager cm, World world, ref Dictionary cache) { } diff -r ffcca9881813e5b1e37f685d41d6e598a11a453e -r 746146cbe1763068f59c2a8c4f03fc0a59378403 axios/Engine/Glee2D/Level.cs --- a/axios/Engine/Glee2D/Level.cs Mon May 07 22:20:22 2012 -0500 +++ b/axios/Engine/Glee2D/Level.cs Sat May 12 17:45:03 2012 -0500 @@ -38,12 +38,15 @@ /// public SerializableDictionary CustomProperties; + private Dictionary _texturecache; + public Level() { Visible = true; Layers = new List(); CustomProperties = new SerializableDictionary(); + _texturecache = new Dictionary(); } public Level(World world) @@ -52,9 +55,10 @@ Layers = new List(); CustomProperties = new SerializableDictionary(); _world = world; + _texturecache = new Dictionary(); } - public static Level FromFile(string filename, ContentManager cm, World world) + public static Level FromFile(string filename, ContentManager cm, World world, ref Dictionary cache) { FileStream stream = System.IO.File.Open(filename, FileMode.Open); XmlSerializer serializer = new XmlSerializer(typeof(Level)); @@ -66,7 +70,7 @@ foreach (Item item in layer.Items) { item.CustomProperties.RestoreItemAssociations(level); - item.load(cm, world); + item.load(cm, world, ref cache); } } diff -r ffcca9881813e5b1e37f685d41d6e598a11a453e -r 746146cbe1763068f59c2a8c4f03fc0a59378403 axios/Engine/Glee2D/PathItem.cs --- a/axios/Engine/Glee2D/PathItem.cs Mon May 07 22:20:22 2012 -0500 +++ b/axios/Engine/Glee2D/PathItem.cs Sat May 12 17:45:03 2012 -0500 @@ -26,9 +26,9 @@ { } - public override void load(ContentManager cm, World world) + public override void load(ContentManager cm, World world, ref Dictionary cache) { - base.load(cm, world); + base.load(cm, world, ref cache); Vertices v = new Vertices(WorldPoints.Length); foreach (Vector2 vec in WorldPoints) diff -r ffcca9881813e5b1e37f685d41d6e598a11a453e -r 746146cbe1763068f59c2a8c4f03fc0a59378403 axios/Engine/Glee2D/RectangleItem.cs --- a/axios/Engine/Glee2D/RectangleItem.cs Mon May 07 22:20:22 2012 -0500 +++ b/axios/Engine/Glee2D/RectangleItem.cs Sat May 12 17:45:03 2012 -0500 @@ -24,9 +24,9 @@ { } - public override void load(ContentManager cm, World world) + public override void load(ContentManager cm, World world, ref Dictionary cache) { - base.load(cm, world); + base.load(cm, world, ref cache); _body = BodyFactory.CreateRectangle(world, Width, Height, 1f); _body.Position = Position; diff -r ffcca9881813e5b1e37f685d41d6e598a11a453e -r 746146cbe1763068f59c2a8c4f03fc0a59378403 axios/Engine/Glee2D/TextureItem.cs --- a/axios/Engine/Glee2D/TextureItem.cs Mon May 07 22:20:22 2012 -0500 +++ b/axios/Engine/Glee2D/TextureItem.cs Sat May 12 17:45:03 2012 -0500 @@ -77,7 +77,7 @@ /// 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(ContentManager cm, World world) + public override void load(ContentManager cm, World world, ref Dictionary cache) { //throw new NotImplementedException(); @@ -85,7 +85,12 @@ //for example: //this.texture = Texture2D.FromFile(, texture_filename); //or by using the Content Pipeline: - this.texture = cm.Load(asset_name); + if (!cache.ContainsKey(asset_name)) + { + cache[asset_name] = cm.Load(asset_name); + } + this.texture = cache[asset_name]; + //this.texture = cm.Load(asset_name); }