axiosengine 

axiosengine Commit Details


Date:2012-05-12 18:49:22 (12 years 5 months ago)
Author:Natalie Adams
Branch:master
Commit:d14f65d779ac0a2fc7d54b9ba88cb48c71e1de2b
Parents: e74c663c0258ea16655ffa747ff7116383e9ee66
Message:Adding support to load a Gleed2D level from a stream

Changes:

File differences

axios/Axios_settings.cs
7373
7474
7575
76
7677
7778
7879
* - Splitting the code for Gleed2D into seperate files
* - Adding a cache for loading in textures for Gleed2D
* - Adding GetStream(FileMode) to get the stream of a file
* - Adding support to load a Gleed2D level from a stream
*
*/
axios/Engine/Gleed2D/Level.cs
3838
3939
4040
41
42
4341
4442
4543
4644
4745
4846
49
5047
5148
5249
......
5552
5653
5754
58
5955
6056
61
57
6258
59
6360
6461
6562
......
7774
7875
7976
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
8096
8197
8298
/// </summary>
public SerializableDictionary CustomProperties;
private Dictionary<string, Texture2D> _texturecache;
public Level()
{
Visible = true;
Layers = new List<Layer>();
CustomProperties = new SerializableDictionary();
_texturecache = new Dictionary<string, Texture2D>();
}
public Level(World world)
Layers = new List<Layer>();
CustomProperties = new SerializableDictionary();
_world = world;
_texturecache = new Dictionary<string, Texture2D>();
}
public static Level FromFile(string filename, ContentManager cm, World world, ref Dictionary<string, Texture2D> cache)
public static Level FromFile(string filename, ContentManager cm, World world)
{
Dictionary<string, Texture2D> cache = new Dictionary<string, Texture2D>();
FileStream stream = System.IO.File.Open(filename, FileMode.Open);
XmlSerializer serializer = new XmlSerializer(typeof(Level));
Level level = (Level)serializer.Deserialize(stream);
return level;
}
public static Level FromStream(FileStream stream, ContentManager cm, World world)
{
Dictionary<string, Texture2D> cache = new Dictionary<string, Texture2D>();
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(cm, world, ref cache);
}
}
return level;
}
public Item getItemByName(string name)
{
foreach (Layer layer in Layers)

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.08570s using 14 queries.