AxiosEngine-old 

AxiosEngine-old Commit Details


Date:2012-05-12 18:49:00 (12 years 7 months ago)
Author:Natalie Adams
Branch:default
Commit:8687559a9f72
Parents: 9b4390d6d1d1
Message:Adding support to load a Gleed2D level from a stream

Changes:
Maxios/Axios_settings.cs (1 diff)
Maxios/Engine/Gleed2D/Level.cs (3 diffs)

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

Page rendered in 0.43123s using 14 queries.