AxiosEngine-old 

AxiosEngine-old Commit Details


Date:2012-03-19 20:33:00 (12 years 9 months ago)
Author:nathan@daedalus
Branch:default
Commit:007bf2a6fc8b
Parents: bffd63700ae0
Message:Adding checks for if objects get deleted too fast

Fixing post-build event to create combined directory
Changes:
Maxios.suo
Maxios/Axios_WP7.csproj (1 diff)
Maxios/Axios_Windows.csproj (1 diff)
Maxios/Axios_Xbox_360.csproj (1 diff)
Maxios/Engine/AxiosGameScreen.cs (6 diffs)
Maxios/Engine/SimpleDrawableAxiosGameObject.cs (2 diffs)

File differences

axios/Axios_WP7.csproj
227227
228228
229229
230
230
231
231232
232233
233234
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" />
<PropertyGroup>
<PostBuildEvent>copy "$(TargetPath)" ..\..\Combined</PostBuildEvent>
<PostBuildEvent>if not exist "$(TargetPath)" ..\..\Combined mkdir "$(TargetPath)" ..\..\Combined
copy "$(TargetPath)" ..\..\Combined</PostBuildEvent>
</PropertyGroup>
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
axios/Axios_Windows.csproj
258258
259259
260260
261
261
262
262263
263264
264265
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" />
<PropertyGroup>
<PostBuildEvent>copy "$(TargetPath)" ..\..\Combined</PostBuildEvent>
<PostBuildEvent>if not exist "$(TargetPath)" ..\..\Combined mkdir "$(TargetPath)" ..\..\Combined
copy "$(TargetPath)" ..\..\Combined</PostBuildEvent>
</PropertyGroup>
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
axios/Axios_Xbox_360.csproj
222222
223223
224224
225
225
226
226227
227228
228229
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" />
<PropertyGroup>
<PostBuildEvent>copy "$(TargetPath)" ..\..\Combined</PostBuildEvent>
<PostBuildEvent>if not exist "$(TargetPath)" ..\..\Combined mkdir "$(TargetPath)" ..\..\Combined
copy "$(TargetPath)" ..\..\Combined</PostBuildEvent>
</PropertyGroup>
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
axios/Engine/AxiosGameScreen.cs
2727
2828
2929
30
3031
3132
3233
......
100101
101102
102103
104
105
106
103107
104108
105
106
107109
108110
109111
......
134136
135137
136138
137
138
139
139140
140
141
141
142
143
144
145
146
147
148
142149
143
150
144151
145
152
153
146154
147155
148156
......
192200
193201
194202
195
203
204
205
206
207
208
209
210
211
212
213
214
196215
197216
198
217
199218
200219
201
220
202221
203222
204223
......
208227
209228
210229
211
230
212231
213232
214233
......
329348
330349
331350
332
351
333352
334353
335
354
336355
337356
338357
public abstract class AxiosGameScreen : PhysicsGameScreen
{
private List<AxiosGameObject> _gameObjects;
private List<AxiosGameObject> _objectstoremove = new List<AxiosGameObject>();
private AxiosGameObject prevobj;
private AxiosGameObject prevfocusobj;
if (obj is AxiosGameObject || obj is AxiosUIObject || obj is AxiosTimer)
{
AxiosGameObject tmp = obj as AxiosGameObject;
if (obj is AxiosGameObject || obj is AxiosUIObject)
tmp.RemoveObject += new AxiosEvents.AxiosGameObjectHandler(RemoveGameObject);
tmp.LoadContent(this);
if (obj is AxiosGameObject || obj is AxiosUIObject)
tmp.RemoveObject += new AxiosEvents.AxiosGameObjectHandler(RemoveGameObject);
if (obj is AxiosGameObject && !(obj is AxiosUIObject))
{
_gameObjects.Add(tmp);
public void RemoveGameObject(AxiosGameObject gameobject)
{
gameobject.RemoveObject -= new AxiosGameObject.AxiosGameObjectHandler(RemoveGameObject);
try
if (this._gameObjects.Contains(gameobject))
{
gameobject.UnloadContent(this);
this._gameObjects.Remove(gameobject);
try
{
gameobject.UnloadContent(this);
this._gameObjects.Remove(gameobject);
}
catch (Exception)
{
}
}
catch (Exception)
else
{
//Not sure what is going on - but in certain cases an exception will be triggered that the body has already been marked for removal
Singleton<AxiosLog>.Instance.AddLine("[Axios Engine] - Adding objects too fast...remove " + gameobject.Name + " later", LoggingFlag.DEBUG);
this._objectstoremove.Add(gameobject);
}
}
{
base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
foreach (AxiosGameObject g in _gameObjects)
if (this._objectstoremove.Count > 0)
{
List<AxiosGameObject> list = this._objectstoremove.ToList<AxiosGameObject>();
foreach (AxiosGameObject obj in list)
{
this.RemoveGameObject(obj);
this._objectstoremove.Remove(obj);
}
}
foreach (AxiosGameObject g in _gameObjects.ToList())
g.Update(this, gameTime, otherScreenHasFocus, coveredByOtherScreen);
foreach (AxiosTimer t in _timers)
foreach (AxiosTimer t in _timers.ToList())
t.Update(this, gameTime, otherScreenHasFocus, coveredByOtherScreen);
foreach(AxiosUIObject g in _uiobjects)
foreach(AxiosUIObject g in _uiobjects.ToList())
g.Update(this, gameTime, otherScreenHasFocus, coveredByOtherScreen);
}
base.HandleCursor(input);
HandleMouseEvents(input);
foreach (AxiosGameObject g in _gameObjects)
foreach (AxiosGameObject g in _gameObjects.ToList())
g.HandleCursor(this, input);
}
{
base.HandleInput(input, gameTime);
foreach (AxiosGameObject g in _gameObjects)
foreach (AxiosGameObject g in _gameObjects.ToList())
g.HandleInput(this, input, gameTime);
foreach (AxiosUIObject g in _uiobjects)
foreach (AxiosUIObject g in _uiobjects.ToList())
g.HandleInput(this, input, gameTime);
}
axios/Engine/SimpleDrawableAxiosGameObject.cs
77
88
99
10
10
11
12
13
1114
1215
1316
......
8891
8992
9093
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
91125
92126
using FarseerPhysics.Dynamics;
using FarseerPhysics.SamplesFramework;
using Axios.Engine.Interfaces;
using FarseerPhysics.Common.Decomposition;
using FarseerPhysics.Common;
using FarseerPhysics.Factories;
using FarseerPhysics.Common.PolygonManipulation;
namespace Axios.Engine
{
this._draworder = value;
}
}
public void CreateBodyFromTexture(AxiosGameScreen gameScreen)
{
if (this.Texture != null)
{
uint[] data = new uint[this.Texture.Width * this.Texture.Height];
this.Texture.GetData<uint>(data);
Vertices vertices = PolygonTools.CreatePolygon(data, this.Texture.Width, false);
Vector2 vector = -vertices.GetCentroid();
vertices.Translate(ref vector);
base.Origin = -vector;
List<Vertices> list = BayazitDecomposer.ConvexPartition(SimplifyTools.ReduceByDistance(vertices, 4f));
base._scale = 1f;
Vector2 vector2 = (Vector2)(new Vector2(ConvertUnits.ToSimUnits(1)) * base._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;
}
}
}
}

Archive Download the corresponding diff file

Page rendered in 0.43700s using 13 queries.