axiosengine 

axiosengine Commit Details


Date:2012-07-20 22:11:10 (12 years 2 months ago)
Author:Natalie Adams
Branch:master
Commit:0fb31c3b0fcadad7b2bf7b9e0853c05cc7d47596
Parents: c0ef5e2a94999c0e6a9f8ce289a244a47d1a92eb
Message:* - 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

Changes:

File differences

axios/Axios_settings.cs
107107
108108
109109
110
110
111
112
113
111114
112115
113116
* - 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
axios/Engine/AxiosGameScreen.cs
464464
465465
466466
467
468
469
470
467471
468472
469473
return true;
}
public virtual bool LoadTextureItem(TextureItem textureitem)
{
return true;
}
}
}
axios/Engine/Data/AxiosCSV.cs
1
1
22
33
44
......
1010
1111
1212
13
14
15
16
17
18
19
1320
1421

using System.Collections.Generic;
using Axios.Engine.File;
namespace Axios.Engine.Data
{
_file = file;
}
public List<Dictionary<string, string>> GetData()
{
List<Dictionary<string, string>> ret = new List<Dictionary<string, string>>();
return ret;
}
}
}
axios/Engine/Gleed2D/CircleItem.cs
2323
2424
2525
26
26
2727
28
28
2929
3030
3131
{
}
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache)
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> 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);
axios/Engine/Gleed2D/Item.cs
4949
5050
5151
52
52
5353
5454
5555
/// 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).
/// </summary>
public virtual void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache)
public virtual void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache, Layer layer)
{
}
axios/Engine/Gleed2D/Layer.cs
3535
3636
3737
38
39
40
41
42
3843
3944
4045
/// </summary>
public Vector2 ScrollSpeed;
/// <summary>
/// A Dictionary containing any user-defined Properties.
/// </summary>
public SerializableDictionary CustomProperties;
public Layer()
{
axios/Engine/Gleed2D/Level.cs
6767
6868
6969
70
70
7171
7272
7373
......
8686
8787
8888
89
89
9090
9191
9292
foreach (Item item in layer.Items)
{
item.CustomProperties.RestoreItemAssociations(level);
item.load(gameScreen, ref cache);
item.load(gameScreen, ref cache, layer);
}
}
foreach (Item item in layer.Items)
{
item.CustomProperties.RestoreItemAssociations(level);
item.load(gameScreen, ref cache);
item.load(gameScreen, ref cache, layer);
}
}
axios/Engine/Gleed2D/PathItem.cs
2626
2727
2828
29
29
3030
31
31
3232
3333
3434
{
}
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache)
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache, Layer layer)
{
base.load(gameScreen, ref cache);
base.load(gameScreen, ref cache, layer);
if (gameScreen.LoadPathItem(this))
{
Vertices v = new Vertices(LocalPoints.Length);
axios/Engine/Gleed2D/RectangleItem.cs
2222
2323
2424
25
2526
2627
27
28
2829
29
30
3031
3132
3233
public RectangleItem()
{
}
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache)
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> 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);
axios/Engine/Gleed2D/TextureItem.cs
5858
5959
6060
61
61
6262
6363
6464
......
6666
6767
6868
69
70
6971
7072
7173
......
7779
7880
7981
80
82
8183
84
85
8286
8387
8488
......
9094
9195
9296
97
98
9399
94
100
95101
96102
97103
/// exists as an asset in your project.
/// Loading is done in the Item's load() method.
/// </summary>
Texture2D texture;
public Texture2D texture;
/// <summary>
/// The item's origin relative to the upper left corner of the texture. Usually the middle of the texture.
/// </summary>
public Vector2 Origin;
public Layer Layer;
public TextureItem()
{
/// You must provide your own implementation. However, you can rely on all public fields being
/// filled by the level deserialization process.
/// </summary>
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache)
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> 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
cache[asset_name] = gameScreen.ScreenManager.Game.Content.Load<Texture2D>(asset_name);
}
this.texture = cache[asset_name];
Visible = gameScreen.LoadTextureItem(this);
//this.texture = cm.Load<Texture2D>(asset_name);
}
public override void draw(SpriteBatch sb)
axios/Engine/SimpleDrawableAxiosGameObject.cs
9595
9696
9797
98
98
9999
100
101
100
101
102102
103103
104104
105105
106
107
108
109
110
111
106
107
108
109
110
111
112112
113113
114114
Vertices vertices = PolygonTools.CreatePolygon(data, this.Texture.Width, false);
Vector2 vector = -vertices.GetCentroid();
vertices.Translate(ref vector);
base.Origin = -vector;
this.Origin = -vector;
List<Vertices> 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;
}
}

Archive Download the corresponding diff file

Branches

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