axiosengine 

axiosengine Commit Details


Date:2012-05-12 22:02:23 (12 years 5 months ago)
Author:Natalie Adams
Branch:master
Commit:f57659e2e10eefa89c5c02ae05b460ce9fd46387
Parents: d14f65d779ac0a2fc7d54b9ba88cb48c71e1de2b
Message:Modfying draw method in AxiosGameScreen to draw Gleed2D textures

Changes:

File differences

axios/Axios_WP7.csproj
172172
173173
174174
175
175176
176177
177178
<Compile Include="Engine\File\AxiosIsolatedFile.cs" />
<Compile Include="Engine\File\AxiosRegularFile.cs" />
<Compile Include="Engine\File\AxiosTitleFile.cs" />
<Compile Include="Engine\Gleed2D\Camera.cs" />
<Compile Include="Engine\Gleed2D\CircleItem.cs" />
<Compile Include="Engine\Gleed2D\CustomProperty.cs" />
<Compile Include="Engine\Gleed2D\Item.cs" />
axios/Axios_Windows.csproj
215215
216216
217217
218
218219
219220
220221
<Compile Include="Engine\File\AxiosIsolatedFile.cs" />
<Compile Include="Engine\File\AxiosRegularFile.cs" />
<Compile Include="Engine\File\AxiosTitleFile.cs" />
<Compile Include="Engine\Gleed2D\Camera.cs" />
<Compile Include="Engine\Gleed2D\CircleItem.cs" />
<Compile Include="Engine\Gleed2D\CustomProperty.cs" />
<Compile Include="Engine\Gleed2D\Item.cs" />
axios/Axios_Xbox_360.csproj
165165
166166
167167
168
168169
169170
170171
<Compile Include="Engine\File\AxiosIsolatedFile.cs" />
<Compile Include="Engine\File\AxiosRegularFile.cs" />
<Compile Include="Engine\File\AxiosTitleFile.cs" />
<Compile Include="Engine\Gleed2D\Camera.cs" />
<Compile Include="Engine\Gleed2D\CircleItem.cs" />
<Compile Include="Engine\Gleed2D\CustomProperty.cs" />
<Compile Include="Engine\Gleed2D\Item.cs" />
axios/Axios_settings.cs
7474
7575
7676
77
78
7779
7880
7981
* - 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
* - Adjusting units for Gleed2D position for Farseer bodies
* - Modfying draw method in AxiosGameScreen to draw Gleed2D textures
*
*/
axios/Engine/AxiosGameScreen.cs
1111
1212
1313
14
1415
1516
1617
......
3637
3738
3839
40
41
42
43
3944
4045
4146
......
4651
4752
4853
54
4955
5056
5157
......
163169
164170
165171
172
166173
167174
168175
......
171178
172179
173180
181
174182
175183
176184
177185
178186
179187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
180203
181204
182205
183206
184207
208
209
210
185211
186212
187213
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using GameStateManagement;
using Axios.Engine.Gleed2D;
namespace Axios.Engine
{
private AxiosUIObject prevuiobj;
private AxiosUIObject prevuifocusobj;
protected Level Level;
private Camera camera;
public AxiosGameScreen()
: base()
{
this._uiobjects = new List<AxiosUIObject>();
prevuiobj = null;
prevuifocusobj = null;
}
/*public void AddGameObject<T>(T gameobject)
public override void Activate(bool instancePreserved)
{
base.Activate(instancePreserved);
#if DEBUG
if (!Axios.Settings.ScreenSaver)
this.DebugSpriteFont = man.Load<SpriteFont>(this.DebugTextFont);
}
#endif
camera = new Camera(ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height);
}
public override void Draw(GameTime gameTime)
{
base.Draw(gameTime);
if (Level != null)
{
foreach (Layer layer in Level.Layers)
{
Vector2 oldcameraposition = camera.Position;
camera.Position *= layer.ScrollSpeed;
ScreenManager.SpriteBatch.Begin(0, null, null, null, null, null, camera.matrix);
layer.draw(ScreenManager.SpriteBatch);
ScreenManager.SpriteBatch.End();
camera.Position = oldcameraposition;
}
}
foreach (AxiosGameObject g in (from x in (from i in _gameObjects where i is IDrawableAxiosGameObject select (IDrawableAxiosGameObject)i) orderby x.DrawOrder select x))
((IDrawableAxiosGameObject)g).Draw(this, gameTime);
foreach(AxiosUIObject g in (from x in _uiobjects orderby x.DrawOrder select x))
((IDrawableAxiosGameObject)g).Draw(this, gameTime);
//System.Diagnostics.Debugger.Break();
}
public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
axios/Engine/Gleed2D/Camera.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
namespace Axios.Engine.Gleed2D
{
public class Camera
{
Vector2 position;
public Vector2 Position
{
get
{
return position;
}
set
{
position = value;
updatematrix();
}
}
float rotation;
public float Rotation
{
get
{
return rotation;
}
set
{
rotation = value;
updatematrix();
}
}
float scale;
public float Scale
{
get
{
return scale;
}
set
{
scale = value;
updatematrix();
}
}
public Matrix matrix;
Vector2 viewport; //width and height of the viewport
public Camera(float width, float height)
{
position = Vector2.Zero;
rotation = 0;
scale = 1.0f;
viewport = new Vector2(width, height);
updatematrix();
}
void updatematrix()
{
matrix = Matrix.CreateTranslation(-position.X, -position.Y, 0.0f) *
Matrix.CreateRotationZ(rotation) *
Matrix.CreateScale(scale) *
Matrix.CreateTranslation(viewport.X / 2, viewport.Y / 2, 0.0f);
}
public void updateviewport(float width, float height)
{
viewport.X = width;
viewport.Y = height;
updatematrix();
}
}
}
axios/Engine/Gleed2D/CircleItem.cs
2828
2929
3030
31
31
3232
3333
3434
base.load(cm, world, ref cache);
_body = BodyFactory.CreateCircle(world, Radius, 1f);
_body.Position = Position;
_body.Position = ConvertUnits.ToSimUnits(Position);
_body.UserData = this;
}
axios/Engine/Gleed2D/PathItem.cs
3535
3636
3737
38
38
3939
4040
4141
v.Add(new Vector2(ConvertUnits.ToSimUnits(vec.X), ConvertUnits.ToSimUnits(vec.Y)));
_body = BodyFactory.CreateLoopShape(world, v);
_body.Position = this.Position;
_body.Position = ConvertUnits.ToSimUnits(this.Position);
_body.UserData = this;
}
axios/Engine/Gleed2D/RectangleItem.cs
2929
3030
3131
32
32
3333
3434
3535
base.load(cm, world, ref cache);
_body = BodyFactory.CreateRectangle(world, Width, Height, 1f);
_body.Position = Position;
_body.Position = ConvertUnits.ToSimUnits(Position);
_body.UserData = this;
}
}
axios/Engine/Gleed2D/TextureItem.cs
2525
2626
2727
28
28
2929
3030
3131
/// <summary>
/// The item's scale factor.
/// </summary>
public float Scale;
public Vector2 Scale;
/// <summary>
/// The color to tint the item's texture with (use white for no tint).

Archive Download the corresponding diff file

Branches

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