axiosengine 

axiosengine Commit Details


Date:2014-11-29 17:16:46 (9 years 10 months ago)
Author:Natalie Adams
Branch:master
Commit:dfea1994f0bb3f1eeb0ed20fadb4093804f04017
Parents: 22017d6c1905f0d96909c4ebb9152f76e06ec9ce
Message:* 1.0.1.9 - 5/20/2013 * - Adding mono support * * 1.0.1.10 - 11/29/2014 * - Adding prompt factory class to generate a Final Fantasy type text prompt * - Updating Gleed2D support to work with latest version of Gleed2D

Changes:

File differences

README
3131
3232
3333
34
34
3535
3636
3737
38
38
3939
4040
4141
4242
4343
44
4445
4546
4647
......
6566
6667
6768
68
69
70
71
72
Official versions can be downloaded here:
http://code.google.com/p/axiosengine/downloads/list
https://srchub.org/p/axiosengine/downloads/
Of course you can always build from source from:
http://code.google.com/p/axiosengine/source/checkout
https://srchub.org/hg/axiosengine
Authors
-------
General questions/comments/concerns can be directed at:
Nathan Adams - adamsna[at]datanethost.net
Contributors:
http://xnacc.codeplex.com/
Portions of this product are (C) 2009-2011 JRTwine Software, LLC
Portions of this product are (C) 2009-2011 JRTwine Software, LLC
Prompt Factory - By Blaze Phoenix
http://stackoverflow.com/a/17260476/195722
axios.sln
11
22
3
3
44
55
66
77
88
99
10
11
1012
1113
1214
......
7577
7678
7779
80
81
82
83
84
85
86
87
88
89
90
91
92
93
7894
7995
8096

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010 Express for Windows Phone
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Axios_Windows", "axios\Axios_Windows.csproj", "{742C938F-997D-4EFD-95D2-BB09CDADCD2E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Axios_Xbox_360", "axios\Axios_Xbox_360.csproj", "{B5664516-72B7-4BA3-9F72-25CAA90867D8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Axios_WP7", "axios\Axios_WP7.csproj", "{C09D9005-76AC-4F1A-9479-2787BB3DB158}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Axios_Windows_mono", "axios\Axios_Windows_mono.csproj", "{A622337F-9AE6-492A-85D6-01CCE0D7F9B4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
{C09D9005-76AC-4F1A-9479-2787BB3DB158}.Release|x86.Build.0 = Release|Windows Phone
{C09D9005-76AC-4F1A-9479-2787BB3DB158}.Release|Xbox 360.ActiveCfg = Release|Windows Phone
{C09D9005-76AC-4F1A-9479-2787BB3DB158}.Release|Xbox 360.Build.0 = Release|Windows Phone
{A622337F-9AE6-492A-85D6-01CCE0D7F9B4}.Debug|Any CPU.ActiveCfg = Debug|x86
{A622337F-9AE6-492A-85D6-01CCE0D7F9B4}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{A622337F-9AE6-492A-85D6-01CCE0D7F9B4}.Debug|Mixed Platforms.Build.0 = Debug|x86
{A622337F-9AE6-492A-85D6-01CCE0D7F9B4}.Debug|Windows Phone.ActiveCfg = Debug|x86
{A622337F-9AE6-492A-85D6-01CCE0D7F9B4}.Debug|x86.ActiveCfg = Debug|x86
{A622337F-9AE6-492A-85D6-01CCE0D7F9B4}.Debug|x86.Build.0 = Debug|x86
{A622337F-9AE6-492A-85D6-01CCE0D7F9B4}.Debug|Xbox 360.ActiveCfg = Debug|x86
{A622337F-9AE6-492A-85D6-01CCE0D7F9B4}.Release|Any CPU.ActiveCfg = Release|x86
{A622337F-9AE6-492A-85D6-01CCE0D7F9B4}.Release|Mixed Platforms.ActiveCfg = Release|x86
{A622337F-9AE6-492A-85D6-01CCE0D7F9B4}.Release|Mixed Platforms.Build.0 = Release|x86
{A622337F-9AE6-492A-85D6-01CCE0D7F9B4}.Release|Windows Phone.ActiveCfg = Release|x86
{A622337F-9AE6-492A-85D6-01CCE0D7F9B4}.Release|x86.ActiveCfg = Release|x86
{A622337F-9AE6-492A-85D6-01CCE0D7F9B4}.Release|x86.Build.0 = Release|x86
{A622337F-9AE6-492A-85D6-01CCE0D7F9B4}.Release|Xbox 360.ActiveCfg = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
axios/Axios_WP7.csproj
156156
157157
158158
159
159160
160161
161162
......
202203
203204
204205
206
205207
206208
207209
<Compile Include="Dynamics\World.cs" />
<Compile Include="Dynamics\WorldCallbacks.cs" />
<Compile Include="Engine\AxiosCommandConsole.cs" />
<Compile Include="Engine\AxiosEngineFactory.cs" />
<Compile Include="Engine\AxiosEvents.cs" />
<Compile Include="Engine\AxiosGameObject.cs" />
<Compile Include="Engine\AxiosGameScreen.cs" />
<Compile Include="Factories\FixtureFactory.cs" />
<Compile Include="Factories\JointFactory.cs" />
<Compile Include="Factories\LinkFactory.cs" />
<Compile Include="Factories\Prompt.cs" />
<Compile Include="PrimitiveBatch.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScreenSystem\BackgroundScreen.cs" />
axios/Axios_Windows.csproj
1010
1111
1212
13
13
14
1415
1516
1617
......
4445
4546
4647
48
49
50
51
52
53
54
4755
4856
4957
......
99107
100108
101109
110
102111
103112
104113
......
221230
222231
223232
224
225
226
227233
228
229
230234
231
232235
233236
234237
......
246249
247250
248251
252
249253
250254
251255
......
286290
287291
288292
289
290293
291294
292295
<RootNamespace>Axios</RootNamespace>
<AssemblyName>Axios.Windows</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
<XnaPlatform>Windows</XnaPlatform>
<XnaProfile>HiDef</XnaProfile>
<XnaCompressContent>true</XnaCompressContent>
</PropertyGroup>
<ItemGroup>
<Reference Include="Gleed2D.Core">
<HintPath>..\..\..\git\axiosmapeditor\Gleed2D-master\src\Gleed2D.Core\bin\x86\Debug\Gleed2D.Core.dll</HintPath>
</Reference>
<Reference Include="Gleed2D.InGame, Version=1.0.0.0, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\git\axiosmapeditor\Gleed2D-master\src\Gleed2D.Core\bin\x86\Debug\Gleed2D.InGame.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private>
</Reference>
<ItemGroup>
<Compile Include="Engine\AxiosBreakableGameObject.cs" />
<Compile Include="Engine\AxiosCommandConsole.cs" />
<Compile Include="Engine\AxiosEngineFactory.cs" />
<Compile Include="Engine\AxiosEvents.cs" />
<Compile Include="Axios_settings.cs" />
<Compile Include="Collision\Collision.cs" />
<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" />
<Compile Include="Engine\Gleed2D\Layer.cs" />
<Compile Include="Engine\Gleed2D\Level.cs" />
<Compile Include="Engine\Gleed2D\PathItem.cs" />
<Compile Include="Engine\Gleed2D\RectangleItem.cs" />
<Compile Include="Engine\Gleed2D\TextureItem.cs" />
<Compile Include="Engine\Interfaces\IAxiosFile.cs" />
<Compile Include="Engine\Interfaces\IAxiosGameObject.cs" />
<Compile Include="Factories\FixtureFactory.cs" />
<Compile Include="Factories\JointFactory.cs" />
<Compile Include="Factories\LinkFactory.cs" />
<Compile Include="Factories\Prompt.cs" />
<Compile Include="PrimitiveBatch.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScreenSystem\BackgroundScreen.cs" />
<ItemGroup>
<None Include="AxiosEngine.cd" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" />
<PropertyGroup>
axios/Axios_Windows.csproj.user
11
22
33
4
4
55
66
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
</Project>
axios/Axios_Xbox_360.csproj
150150
151151
152152
153
153154
154155
155156
......
195196
196197
197198
199
198200
199201
200202
<Compile Include="Dynamics\WorldCallbacks.cs" />
<Compile Include="Engine\AxiosBreakableGameObject.cs" />
<Compile Include="Engine\AxiosCommandConsole.cs" />
<Compile Include="Engine\AxiosEngineFactory.cs" />
<Compile Include="Engine\AxiosEvents.cs" />
<Compile Include="Engine\AxiosGameObject.cs" />
<Compile Include="Engine\AxiosGameScreen.cs" />
<Compile Include="Factories\FixtureFactory.cs" />
<Compile Include="Factories\JointFactory.cs" />
<Compile Include="Factories\LinkFactory.cs" />
<Compile Include="Factories\Prompt.cs" />
<Compile Include="PrimitiveBatch.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScreenSystem\BackgroundScreen.cs" />
axios/Axios_settings.cs
122122
123123
124124
125
126
127
128
129
130
131
125132
126133
127134
* 1.0.1.8 - 1/12/2012
* - Adding UseSecondStep flag in PhysicsGameScreen (default false)
*
* 1.0.1.9 - 5/20/2013
* - Adding mono support
*
* 1.0.1.10 - 11/29/2014
* - Adding prompt factory class to generate a Final Fantasy type text prompt
* - Updating Gleed2D support to work with latest version of Gleed2D
*
*/
#endregion
axios/Engine/AxiosGameScreen.cs
1212
1313
1414
15
1615
16
17
18
19
20
21
22
23
1724
1825
1926
......
3643
3744
3845
46
47
48
49
50
51
3952
4053
4154
......
6881
6982
7083
84
85
86
87
88
89
90
91
92
93
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
125
126
127
128
129
130
131
132
133
71134
72135
73136
......
234297
235298
236299
237
300
238301
239302
240
303
304
305
306
307
308
309
241310
242311
243312
......
250319
251320
252321
322
323
253324
254325
255326
......
459530
460531
461532
462
533
463534
464
535
465536
466537
467
538
468539
469
540
541
542
470543
471544
472
545
473546
474
547
475548
476549
477
550
478551
479
552
553
554
480555
481556
557
558
482559
483560
using Microsoft.Xna.Framework.Graphics;
using GameStateManagement;
using Microsoft.Xna.Framework.Input;
using Axios.Engine.Gleed2D;
using Axios.Engine.Extensions;
using System.IO;
using System.IO.Compression;
using Gleed2D.InGame;
using Axios.Engine.File;
using System.Xml.Linq;
using Gleed2D.Core;
using System.Diagnostics;
using Axios.Engine.Gleed2D;
namespace Axios.Engine
{
private List<AxiosTimer> _timers;
private List<AxiosUIObject> _uiobjects;
protected Dictionary<string, PathItem> PathItems = new Dictionary<string, PathItem>();
protected Dictionary<string, TextureItem> TextureItems = new Dictionary<string, TextureItem>();
//protected List<TextureItem> TextureItems = new List<TextureItem>();
protected Dictionary<string, Texture2D> cache = new Dictionary<string, Texture2D>();
private AxiosUIObject prevuiobj;
private AxiosUIObject prevuifocusobj;
}
public void LoadLevelFromStream(Stream s)
{
XElement xml = XElement.Load(s);
Level level = LevelLoader.Load(xml);
this.Level = level;
foreach (Layer layer in level.Layers)
{
foreach (LayerItem item in layer.Items)
{
//Debug.WriteLine(item.PropertyType);
switch (item.PropertyType)
{
case "Gleed2D.InGame.PathItemProperties":
this.LoadPathItem((PathItemProperties)item.Properties, layer);
break;
case "Gleed2D.InGame.TextureItemProperties":
this.LoadTextureItem((TextureItemProperties)item.Properties, layer);
break;
case "Gleed2D.InGame.RectangleItemProperties":
this.LoadRectangleItem((RectangleItemProperties)item.Properties, layer);
break;
case "Gleed2D.InGame.CircleItemProperties":
this.LoadCircleItem((CircleItemProperties)item.Properties, layer);
break;
default:
this.LoadOtherItem(item.Properties, item.PropertyType, layer);
break;
}
/*Debug.WriteLine(item.Properties.Id);
Debug.WriteLine(item.Properties.Name);
Debug.WriteLine(item.PropertyType);*/
}
}
}
public void LoadLevelFromFile(string s)
{
AxiosTitleFile file = new AxiosTitleFile(s);
this.LoadLevelFromStream(file.GetStream(FileMode.Open));
}
public void LoadLevelFromGZFile(string s)
{
AxiosTitleFile file = new AxiosTitleFile(s);
GZipStream zipstream = new GZipStream(file.GetStream(FileMode.Open), CompressionMode.Decompress);
this.LoadLevelFromStream(zipstream);
}
public Vector2 MouseAimVector(MouseState ms, Vector2 relativeposition)
{
Vector2 ret;
foreach (Layer layer in Level.Layers)
{
Vector2 oldcameraposition = camera.Position;
camera.Position *= layer.ScrollSpeed;
//camera.Position *= layer.ScrollSpeed;
ScreenManager.SpriteBatch.Begin(0, null, null, null, null, null, Camera.View);
layer.draw(ScreenManager.SpriteBatch);
foreach (TextureItem i in TextureItems.Values)
{
if (i.LayerItem.Visible == true)
{
i.draw(ScreenManager.SpriteBatch);
}
}
ScreenManager.SpriteBatch.End();
camera.Position = oldcameraposition;
foreach(AxiosUIObject g in (from x in _uiobjects orderby x.DrawOrder select x))
((IDrawableAxiosGameObject)g).Draw(this, gameTime);
base.Draw(gameTime); //This is placed at the end so that Farseer debug information is visible
}
/// </summary>
/// <param name="circleitem"></param>
/// <returns></returns>
public virtual bool LoadCircleItem(CircleItem circleitem)
public virtual void LoadCircleItem(CircleItemProperties circleitem, Layer l)
{
return true;
}
public virtual bool LoadPathItem(PathItem pathitem)
public virtual void LoadPathItem(PathItemProperties pathitem, Layer l)
{
return true;
PathItem p = new PathItem((PathItemProperties)pathitem);
p.load(this, ref cache);
PathItems[pathitem.Name] = p;
}
public virtual bool LoadRectangleItem(RectangleItem rectangleitem)
public virtual void LoadRectangleItem(RectangleItemProperties rectangleitem, Layer l)
{
return true;
}
public virtual bool LoadTextureItem(TextureItem textureitem)
public virtual void LoadTextureItem(TextureItemProperties textureitem, Layer l)
{
return true;
TextureItem i = new TextureItem((TextureItemProperties)textureitem);
i.load(this, ref cache);
TextureItems[textureitem.Name] = i;
}
public virtual void LoadOtherItem(ItemProperties prop, string type, Layer l) { }
}
}
axios/Engine/Gleed2D/Item.cs
88
99
1010
11
1112
1213
1314
14
15
16
17
18
15
1916
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
4117
4218
43
44
45
46
47
4819
4920
5021
5122
52
23
5324
5425
5526
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using FarseerPhysics.Dynamics;
using Gleed2D.InGame;
namespace Axios.Engine.Gleed2D
{
[XmlInclude(typeof(TextureItem))]
[XmlInclude(typeof(RectangleItem))]
[XmlInclude(typeof(CircleItem))]
[XmlInclude(typeof(PathItem))]
public partial class Item
public class Item
{
/// <summary>
/// The name of this item.
/// </summary>
[XmlAttribute()]
public String Name;
/// <summary>
/// Should this item be visible?
/// </summary>
[XmlAttribute()]
public bool Visible;
/// <summary>
/// The item's position in world space.
/// </summary>
public Vector2 Position;
/// <summary>
/// A Dictionary containing any user-defined Properties.
/// </summary>
public SerializableDictionary CustomProperties;
public Item()
{
CustomProperties = new SerializableDictionary();
}
/// <summary>
/// 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, Layer layer)
public virtual void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache)
{
}
axios/Engine/Gleed2D/PathItem.cs
99
1010
1111
12
1213
1314
1415
15
16
1617
17
18
19
20
21
18
19
20
21
22
23
24
2225
2326
2427
25
28
2629
30
2731
2832
29
33
3034
31
32
33
34
35
36
35
36
37
38
39
3740
38
39
40
41
41
42
43
44
4245
4346
4447
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Gleed2D.InGame;
namespace Axios.Engine.Gleed2D
{
public partial class PathItem : Item
public class PathItem : Item
{
public Vector2[] LocalPoints;
public Vector2[] WorldPoints;
public bool IsPolygon;
public int LineWidth;
public Color LineColor;
private PathItemProperties _item;
public PathItemProperties LayerItem
{
get { return _item; }
set { }
}
Body _body;
public PathItem()
public PathItem(PathItemProperties i)
{
this._item = i;
}
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache, Layer layer)
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache)
{
base.load(gameScreen, ref cache, layer);
if (gameScreen.LoadPathItem(this))
{
Vertices v = new Vertices(LocalPoints.Length);
foreach (Vector2 vec in LocalPoints)
v.Add(new Vector2(ConvertUnits.ToSimUnits(vec.X), ConvertUnits.ToSimUnits(vec.Y)));
base.load(gameScreen, ref cache);
Vertices v = new Vertices(LayerItem.LocalPoints.Count);
foreach (Vector2 vec in LayerItem.LocalPoints)
v.Add(new Vector2(ConvertUnits.ToSimUnits(vec.X), ConvertUnits.ToSimUnits(vec.Y)));
_body = BodyFactory.CreateLoopShape(gameScreen.World, v);
_body.Position = ConvertUnits.ToSimUnits(this.Position);
_body.UserData = this;
}
_body = BodyFactory.CreateLoopShape(gameScreen.World, v);
_body.Position = ConvertUnits.ToSimUnits(this.LayerItem.Position);
_body.UserData = this;
}
}
axios/Engine/Gleed2D/TextureItem.cs
1212
1313
1414
15
1516
1617
1718
1819
1920
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
6121
6222
63
64
65
66
67
68
69
23
7024
25
26
27
28
29
7130
72
31
7332
33
7434
7535
7636
......
7939
8040
8141
82
42
8343
84
85
44
8645
8746
8847
8948
9049
9150
92
51
9352
94
53
9554
96
97
55
56
9857
9958
10059
......
10261
10362
10463
105
64
10665
107
108
109
66
67
68
11069
11170
11271
using FarseerPhysics.Common;
using FarseerPhysics.SamplesFramework;
using FarseerPhysics.Factories;
using Gleed2D.InGame;
namespace Axios.Engine.Gleed2D
{
public partial class TextureItem : Item
{
/// <summary>
/// The item's rotation in radians.
/// </summary>
public float Rotation;
/// <summary>
/// The item's scale factor.
/// </summary>
public Vector2 Scale;
/// <summary>
/// The color to tint the item's texture with (use white for no tint).
/// </summary>
public Color TintColor;
/// <summary>
/// If true, the texture is flipped horizontally when drawn.
/// </summary>
public bool FlipHorizontally;
/// <summary>
/// If true, the texture is flipped vertically when drawn.
/// </summary>
public bool FlipVertically;
/// <summary>
/// The path to the texture's filename (including the extension) relative to ContentRootFolder.
/// </summary>
public String texture_filename;
/// <summary>
/// The texture_filename without extension. For using in Content.Load<Texture2D>().
/// </summary>
public String asset_name;
/// <summary>
/// The XNA texture to be drawn. Can be loaded either from file (using "texture_filename")
/// or via the Content Pipeline (using "asset_name") - then you must ensure that the texture
/// exists as an asset in your project.
/// Loading is done in the Item's load() method.
/// </summary>
public Texture2D texture;
/// <summary>
/// The item's origin relative to the upper left corner of the texture. Usually the middle of the texture.
/// Used for placing and rotating the texture when drawn.
/// </summary>
public Vector2 Origin;
public Layer Layer;
private TextureItemProperties _item;
public TextureItemProperties LayerItem
{
get { return _item; }
set { }
}
public TextureItem()
public TextureItem(TextureItemProperties i)
{
this._item = i;
}
/// <summary>
/// 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, Layer layer)
public override void load(AxiosGameScreen gameScreen, ref Dictionary<string, Texture2D> cache)
{
this.Layer = layer;
base.load(gameScreen, ref cache, layer);
base.load(gameScreen, ref cache);
//throw new NotImplementedException();
//TODO: provide your own implementation of how a TextureItem loads its assets
//for example:
//this.texture = Texture2D.FromFile(<GraphicsDevice>, texture_filename);
//or by using the Content Pipeline:
if (!cache.ContainsKey(asset_name))
if (!cache.ContainsKey(LayerItem.AssetName))
{
cache[asset_name] = gameScreen.ScreenManager.Game.Content.Load<Texture2D>(asset_name);
cache[LayerItem.AssetName] = gameScreen.ScreenManager.Game.Content.Load<Texture2D>(LayerItem.AssetName);
}
this.texture = cache[asset_name];
Visible = gameScreen.LoadTextureItem(this);
this.texture = cache[LayerItem.AssetName];
//Visible = gameScreen.LoadTextureItem(this);
//this.texture = cm.Load<Texture2D>(asset_name);
public override void draw(SpriteBatch sb)
{
if (!Visible) return;
if (!LayerItem.Visible) return;
SpriteEffects effects = SpriteEffects.None;
if (FlipHorizontally) effects |= SpriteEffects.FlipHorizontally;
if (FlipVertically) effects |= SpriteEffects.FlipVertically;
sb.Draw(texture, Position, null, TintColor, Rotation, Origin, Scale, effects, 0);
if (LayerItem.FlipHorizontally) effects |= SpriteEffects.FlipHorizontally;
if (LayerItem.FlipVertically) effects |= SpriteEffects.FlipVertically;
sb.Draw(texture, LayerItem.Position, null, LayerItem.TintColor, LayerItem.Rotation, LayerItem.Origin, LayerItem.Scale, effects, 0);
}
}
}
axios/Factories/Prompt.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
83
84
85
86
87
88
89
90
91
92
93
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Axios.Factories
{
public static class Prompt
{
// Copied from http://stackoverflow.com/a/17260476/195722
// Written by Blaze Phoenix
/// <summary>
/// Creates a rounded rectangle
/// </summary>
/// <param name="graphics"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <param name="borderThickness"></param>
/// <param name="borderRadius"></param>
/// <param name="borderShadow"></param>
/// <param name="backgroundColors"></param>
/// <param name="borderColors"></param>
/// <param name="initialShadowIntensity"></param>
/// <param name="finalShadowIntensity"></param>
/// <returns></returns>
public static Texture2D CreateRoundedRectangleTexture(this GraphicsDevice graphics, int width, int height, int borderThickness, int borderRadius, int borderShadow, List<Color> backgroundColors, List<Color> borderColors, float initialShadowIntensity, float finalShadowIntensity)
{
if (backgroundColors == null || backgroundColors.Count == 0) throw new ArgumentException("Must define at least one background color (up to four).");
if (borderColors == null || borderColors.Count == 0) throw new ArgumentException("Must define at least one border color (up to three).");
if (borderRadius < 1) throw new ArgumentException("Must define a border radius (rounds off edges).");
if (borderThickness < 1) throw new ArgumentException("Must define border thikness.");
if (borderThickness + borderRadius > height / 2 || borderThickness + borderRadius > width / 2) throw new ArgumentException("Border will be too thick and/or rounded to fit on the texture.");
if (borderShadow > borderRadius) throw new ArgumentException("Border shadow must be lesser in magnitude than the border radius (suggeted: shadow <= 0.25 * radius).");
Texture2D texture = new Texture2D(graphics, width, height, false, SurfaceFormat.Color);
Color[] color = new Color[width * height];
for (int x = 0; x < texture.Width; x++)
{
for (int y = 0; y < texture.Height; y++)
{
switch (backgroundColors.Count)
{
case 4:
Color leftColor0 = Color.Lerp(backgroundColors[0], backgroundColors[1], ((float)y / (width - 1)));
Color rightColor0 = Color.Lerp(backgroundColors[2], backgroundColors[3], ((float)y / (height - 1)));
color[x + width * y] = Color.Lerp(leftColor0, rightColor0, ((float)x / (width - 1)));
break;
case 3:
Color leftColor1 = Color.Lerp(backgroundColors[0], backgroundColors[1], ((float)y / (width - 1)));
Color rightColor1 = Color.Lerp(backgroundColors[1], backgroundColors[2], ((float)y / (height - 1)));
color[x + width * y] = Color.Lerp(leftColor1, rightColor1, ((float)x / (width - 1)));
break;
case 2:
color[x + width * y] = Color.Lerp(backgroundColors[0], backgroundColors[1], ((float)x / (width - 1)));
break;
default:
color[x + width * y] = backgroundColors[0];
break;
}
color[x + width * y] = ColorBorder(x, y, width, height, borderThickness, borderRadius, borderShadow, color[x + width * y], borderColors, initialShadowIntensity, finalShadowIntensity);
}
}
texture.SetData<Color>(color);
return texture;
}
private static Color ColorBorder(int x, int y, int width, int height, int borderThickness, int borderRadius, int borderShadow, Color initialColor, List<Color> borderColors, float initialShadowIntensity, float finalShadowIntensity)
{
Rectangle internalRectangle = new Rectangle((borderThickness + borderRadius), (borderThickness + borderRadius), width - 2 * (borderThickness + borderRadius), height - 2 * (borderThickness + borderRadius));
if (internalRectangle.Contains(x, y)) return initialColor;
Vector2 origin = Vector2.Zero;
Vector2 point = new Vector2(x, y);
if (x < borderThickness + borderRadius)
{
if (y < borderRadius + borderThickness)
origin = new Vector2(borderRadius + borderThickness, borderRadius + borderThickness);
else if (y > height - (borderRadius + borderThickness))
origin = new Vector2(borderRadius + borderThickness, height - (borderRadius + borderThickness));
else
origin = new Vector2(borderRadius + borderThickness, y);
}
else if (x > width - (borderRadius + borderThickness))
{
if (y < borderRadius + borderThickness)
origin = new Vector2(width - (borderRadius + borderThickness), borderRadius + borderThickness);
else if (y > height - (borderRadius + borderThickness))
origin = new Vector2(width - (borderRadius + borderThickness), height - (borderRadius + borderThickness));
else
origin = new Vector2(width - (borderRadius + borderThickness), y);
}
else
{
if (y < borderRadius + borderThickness)
origin = new Vector2(x, borderRadius + borderThickness);
else if (y > height - (borderRadius + borderThickness))
origin = new Vector2(x, height - (borderRadius + borderThickness));
}
if (!origin.Equals(Vector2.Zero))
{
float distance = Vector2.Distance(point, origin);
if (distance > borderRadius + borderThickness + 1)
{
return Color.Transparent;
}
else if (distance > borderRadius + 1)
{
if (borderColors.Count > 2)
{
float modNum = distance - borderRadius;
if (modNum < borderThickness / 2)
{
return Color.Lerp(borderColors[2], borderColors[1], (float)((modNum) / (borderThickness / 2.0)));
}
else
{
return Color.Lerp(borderColors[1], borderColors[0], (float)((modNum - (borderThickness / 2.0)) / (borderThickness / 2.0)));
}
}
if (borderColors.Count > 0)
return borderColors[0];
}
else if (distance > borderRadius - borderShadow + 1)
{
float mod = (distance - (borderRadius - borderShadow)) / borderShadow;
float shadowDiff = initialShadowIntensity - finalShadowIntensity;
return DarkenColor(initialColor, ((shadowDiff * mod) + finalShadowIntensity));
}
}
return initialColor;
}
private static Color DarkenColor(Color color, float shadowIntensity)
{
return Color.Lerp(color, Color.Black, shadowIntensity);
}
}
}
axios/Properties/AssemblyInfo.cs
99
1010
1111
12
12
1313
1414
1515
......
3131
3232
3333
34
34
3535
3636
3737
[assembly: AssemblyProduct("Axios")]
[assembly: AssemblyDescription("XNA 2D Game Engine")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright © 2012 - Nathan Adams")]
[assembly: AssemblyCopyright("Copyright © 2014 - Nathan Adams")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.1.7")]
[assembly: AssemblyVersion("1.0.1.10")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
axios/ScreenSystem/PhysicsGameScreen.cs
5757
5858
5959
60
60
6161
6262
6363
base.Activate(instancePreserved);
//We enable diagnostics to show get values for our performance counters.
Settings.EnableDiagnostics = true;
FarseerPhysics.Settings.EnableDiagnostics = true;
if (World == null)
{

Archive Download the corresponding diff file

Branches

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