Making AxiosTimer inheirt from AxiosGameObject for it to be casted properly

This commit is contained in:
nathan@daedalus 2012-04-07 13:15:15 -05:00
parent 7d3c8a9f39
commit b3183d6f04
4 changed files with 110 additions and 32 deletions

BIN
axios.suo

Binary file not shown.

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ClassDiagram MajorVersion="1" MinorVersion="1"> <ClassDiagram MajorVersion="1" MinorVersion="1">
<Class Name="Axios.Engine.AxiosEvents"> <Class Name="Axios.Engine.AxiosEvents">
<Position X="11" Y="0.5" Width="1.5" /> <Position X="11" Y="1.25" Width="1.5" />
<NestedTypes> <NestedTypes>
<Delegate Name="Axios.Engine.AxiosEvents.AxiosHandler" Collapsed="true"> <Delegate Name="Axios.Engine.AxiosEvents.AxiosHandler" Collapsed="true">
<TypeIdentifier> <TypeIdentifier>
@ -20,99 +20,172 @@
</TypeIdentifier> </TypeIdentifier>
</Class> </Class>
<Class Name="Axios.Engine.AxiosGameObject"> <Class Name="Axios.Engine.AxiosGameObject">
<Position X="5.75" Y="0.5" Width="1.5" /> <Position X="6.25" Y="0.75" Width="1.5" />
<TypeIdentifier> <TypeIdentifier>
<HashCode>AAQAMACAAAAAAAAEACIIBAQAIAAAAAAAAAAAAAAAACQ=</HashCode> <HashCode>AAQAMACAAAAAAAAEACIIBAQAIAAAAAAAAAAAAAAAACQ=</HashCode>
<FileName>Engine\AxiosGameObject.cs</FileName> <FileName>Engine\AxiosGameObject.cs</FileName>
</TypeIdentifier> </TypeIdentifier>
<Lollipop Position="0.2" /> <Lollipop Position="0.2" />
</Class> </Class>
<Class Name="Axios.Engine.ComplexAxiosGameObject&lt;T&gt;">
<Position X="2.5" Y="0.5" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAAAAAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAQ=</HashCode>
<FileName>Engine\ComplexAxiosGameObject.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="Axios.Engine.SimpleAxiosGameObject"> <Class Name="Axios.Engine.SimpleAxiosGameObject">
<Position X="8.5" Y="1.25" Width="2" /> <Position X="8.75" Y="1.5" Width="2" />
<TypeIdentifier> <TypeIdentifier>
<HashCode>AEQAEAABAgAAAAAgAAAAAAAAAAAAAAAAAAAAAAgAAAA=</HashCode> <HashCode>AEQAEAABAgAAAAAgAAQAAAAAAAAAAAAAIAAAAAgAAAA=</HashCode>
<FileName>Engine\SimpleAxiosGameObject.cs</FileName> <FileName>Engine\SimpleAxiosGameObject.cs</FileName>
</TypeIdentifier> </TypeIdentifier>
</Class> </Class>
<Class Name="Axios.Engine.SimpleDrawableAxiosGameObject"> <Class Name="Axios.Engine.SimpleDrawableAxiosGameObject">
<Position X="5.25" Y="4.25" Width="2.75" /> <Position X="5.5" Y="4.75" Width="2.75" />
<TypeIdentifier> <TypeIdentifier>
<HashCode>AAAAAIAAAAAAAgAAAAAAAAAAAAIACAAgAAIAIAAAAAQ=</HashCode> <HashCode>AAAAEIAAAAAAAgAAAAAAAAAAAAIACAAgAAIAIAAAAAQ=</HashCode>
<FileName>Engine\SimpleDrawableAxiosGameObject.cs</FileName> <FileName>Engine\SimpleDrawableAxiosGameObject.cs</FileName>
</TypeIdentifier> </TypeIdentifier>
<Lollipop Position="0.2" /> <Lollipop Position="0.2" />
</Class> </Class>
<Class Name="Axios.Engine.AxiosGameScreen"> <Class Name="Axios.Engine.AxiosGameScreen">
<Position X="0.5" Y="0.5" Width="1.5" /> <Position X="3.75" Y="0.5" Width="1.5" />
<TypeIdentifier> <TypeIdentifier>
<HashCode>AARoEQCCAAACAggBACAAAgAICAAAAAAAIAAAAIIAAAQ=</HashCode> <HashCode>AARoEQCHAAACAggBACAAAgAICAAAAAAAIAAAAIIQAAQ=</HashCode>
<FileName>Engine\AxiosGameScreen.cs</FileName> <FileName>Engine\AxiosGameScreen.cs</FileName>
</TypeIdentifier> </TypeIdentifier>
</Class> </Class>
<Class Name="Axios.Engine.AxiosTimer"> <Class Name="Axios.Engine.AxiosTimer">
<Position X="0.5" Y="5.75" Width="1.5" /> <Position X="3.75" Y="6" Width="1.5" />
<TypeIdentifier> <TypeIdentifier>
<HashCode>AAQAEACAAAAAAIAAAKAAAACAAAAAAAAQAAAAACAAQAQ=</HashCode> <HashCode>AAQAEACAAAAAAIAAAKAAAACAAAAAAAAQAAAAACAAQAQ=</HashCode>
<FileName>Engine\AxiosTimer.cs</FileName> <FileName>Engine\AxiosTimer.cs</FileName>
</TypeIdentifier> </TypeIdentifier>
<Lollipop Position="0.2" />
</Class> </Class>
<Class Name="Axios.Engine.Extenions.AxiosExtensions_String"> <Class Name="Axios.Engine.Extenions.AxiosExtensions_String">
<Position X="11" Y="5.75" Width="2" /> <Position X="14.5" Y="4.5" Width="2" />
<TypeIdentifier> <TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAA=</HashCode> <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAA=</HashCode>
<FileName>Engine\Extensions\String.cs</FileName> <FileName>Engine\Extensions\String.cs</FileName>
</TypeIdentifier> </TypeIdentifier>
</Class> </Class>
<Class Name="Axios.Engine.Extenions.AxiosExtensions_Texture2D"> <Class Name="Axios.Engine.Extenions.AxiosExtensions_Texture2D">
<Position X="11" Y="7" Width="2.25" /> <Position X="14.5" Y="5.75" Width="2.25" />
<TypeIdentifier> <TypeIdentifier>
<HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAA=</HashCode> <HashCode>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAQAAAAA=</HashCode>
<FileName>Engine\Extensions\Texture2D.cs</FileName> <FileName>Engine\Extensions\Texture2D.cs</FileName>
</TypeIdentifier> </TypeIdentifier>
</Class> </Class>
<Class Name="Axios.Engine.UI.AxiosUIObject"> <Class Name="Axios.Engine.UI.AxiosUIObject">
<Position X="13" Y="2" Width="1.5" /> <Position X="12.75" Y="1.5" Width="1.5" />
<TypeIdentifier> <TypeIdentifier>
<HashCode>AAAAAAAABAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAA=</HashCode> <HashCode>AAAAAAAABAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Engine\UI\AxiosUIObject.cs</FileName> <FileName>Engine\UI\AxiosUIObject.cs</FileName>
</TypeIdentifier> </TypeIdentifier>
</Class> </Class>
<Class Name="Axios.Engine.DrawableAxiosGameObject"> <Class Name="Axios.Engine.DrawableAxiosGameObject">
<Position X="15" Y="0.5" Width="2.25" /> <Position X="14.5" Y="0.5" Width="2.25" />
<TypeIdentifier> <TypeIdentifier>
<HashCode>AAAAAIAAAAAAAgAgAAAABAAAAAAACAAgAAIAIAgAAAQ=</HashCode> <HashCode>AABAAIAAAAAAAgAgAAAABAAAAAAACAAoAAIAIAgAAAQ=</HashCode>
<FileName>Engine\DrawableAxiosGameObject.cs</FileName> <FileName>Engine\DrawableAxiosGameObject.cs</FileName>
</TypeIdentifier> </TypeIdentifier>
<Lollipop Position="0.2" /> <Lollipop Position="0.2" />
</Class> </Class>
<Class Name="Axios.Engine.UI.AxiosButton"> <Class Name="Axios.Engine.UI.AxiosButton">
<Position X="13.5" Y="3.75" Width="1.5" /> <Position X="12.75" Y="3.25" Width="1.5" />
<TypeIdentifier> <TypeIdentifier>
<HashCode>AAAAgAAIQAAIAAAAACAAgAAAAAAASAAAIAAAAAgCAAQ=</HashCode> <HashCode>AAAAgAAIQAAIAAAAACAAgAAAAAAASAAAIAAAAAgCAAQ=</HashCode>
<FileName>Engine\UI\AxiosButton.cs</FileName> <FileName>Engine\UI\AxiosButton.cs</FileName>
</TypeIdentifier> </TypeIdentifier>
</Class> </Class>
<Class Name="Axios.Engine.File.AxiosFile">
<Position X="11" Y="7" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAgABAAQBAAAAAAAAAAAgAAAAAAAAAAAAAAA=</HashCode>
<FileName>Engine\File\AxiosFile.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="Axios.Engine.File.AxiosIsolatedFile">
<Position X="12.75" Y="7" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAABAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAA=</HashCode>
<FileName>Engine\File\AxiosIsolatedFile.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="Axios.Engine.File.AxiosRegularFile">
<Position X="9" Y="8.25" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAABAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAA=</HashCode>
<FileName>Engine\File\AxiosRegularFile.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="Axios.Engine.File.AxiosTitleFile">
<Position X="11" Y="9.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAABAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAA=</HashCode>
<FileName>Engine\File\AxiosTitleFile.cs</FileName>
</TypeIdentifier>
<Lollipop Position="0.2" />
</Class>
<Class Name="Axios.Engine.Structures.AxiosPoint">
<Position X="17" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAIAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAYAA=</HashCode>
<FileName>Engine\Structures\AxiosPoint.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="Axios.Engine.Structures.AxiosRectangle">
<Position X="17" Y="2.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAAAABACAAAAEAAAUAEAAABAIAAAACACAAAAAAAQ=</HashCode>
<FileName>Engine\Structures\AxiosRectangle.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="Axios.Engine.Log.AxiosLog">
<Position X="2" Y="0.5" Width="1.5" />
<TypeIdentifier>
<HashCode>AAgAAAAAAAAAAEAAAAAAAIAAEAAAAAAAAAAAAAAAAAA=</HashCode>
<FileName>Engine\Log\AxiosLog.cs</FileName>
</TypeIdentifier>
</Class>
<Class Name="Axios.Settings">
<Position X="2" Y="4.75" Width="1.5" />
<TypeIdentifier>
<HashCode>IAAAAEAAAAAAAAAAgAAAAgAAAAAACAAAIIACCAACAAA=</HashCode>
<FileName>Axios_settings.cs</FileName>
</TypeIdentifier>
</Class>
<Interface Name="Axios.Engine.Interfaces.IAxiosGameObject"> <Interface Name="Axios.Engine.Interfaces.IAxiosGameObject">
<Position X="8.5" Y="4.25" Width="2.25" /> <Position X="8.5" Y="4.75" Width="2.25" />
<TypeIdentifier> <TypeIdentifier>
<HashCode>AAQAEACAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAQ=</HashCode> <HashCode>AAQAEACAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAAQ=</HashCode>
<FileName>Engine\Interfaces\IAxiosGameObject.cs</FileName> <FileName>Engine\Interfaces\IAxiosGameObject.cs</FileName>
</TypeIdentifier> </TypeIdentifier>
</Interface> </Interface>
<Interface Name="Axios.Engine.Interfaces.IDrawableAxiosGameObject"> <Interface Name="Axios.Engine.Interfaces.IDrawableAxiosGameObject">
<Position X="8.5" Y="6" Width="2.25" /> <Position X="8.5" Y="6.5" Width="2.25" />
<TypeIdentifier> <TypeIdentifier>
<HashCode>AAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAgAAAAAAAAAAA=</HashCode> <HashCode>AAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAgAAAAAAAAAAA=</HashCode>
<FileName>Engine\Interfaces\IDrawableAxiosGameObject.cs</FileName> <FileName>Engine\Interfaces\IDrawableAxiosGameObject.cs</FileName>
</TypeIdentifier> </TypeIdentifier>
</Interface> </Interface>
<Interface Name="Axios.Engine.Interfaces.IAxiosFile">
<Position X="14.5" Y="7" Width="2.25" />
<TypeIdentifier>
<HashCode>AAAAAAAAAAABAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAA=</HashCode>
<FileName>Engine\Interfaces\IAxiosFile.cs</FileName>
</TypeIdentifier>
</Interface>
<Enum Name="Axios.Engine.Log.LoggingFlag">
<Position X="2" Y="2.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAAAAACBgAAAAAAAAQAAAAAAAQAAAAAAAAQABAAAAAA=</HashCode>
<FileName>Engine\Log\AxiosLog.cs</FileName>
</TypeIdentifier>
</Enum>
<Enum Name="Axios.ResolutionSetting">
<Position X="2" Y="7.75" Width="1.5" />
<TypeIdentifier>
<HashCode>AAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAICAAAA=</HashCode>
<FileName>Axios_settings.cs</FileName>
</TypeIdentifier>
</Enum>
<Font Name="Tahoma" Size="8.25" /> <Font Name="Tahoma" Size="8.25" />
</ClassDiagram> </ClassDiagram>

View File

@ -56,7 +56,8 @@
* - RelativeToCamera * - RelativeToCamera
* - Cleaning and sorting using statements * - Cleaning and sorting using statements
* *
* * 1.0.1.2 - 4/1/2012
* - Making AxiosTimer inheirt from AxiosGameObject for it to be casted properly
* *
*/ */

View File

@ -10,7 +10,7 @@ namespace Axios.Engine
* Source: http://www.gamedev.net/topic/473544-how-to-make-a-timer-using-xna/page__view__findpost__p__4107032 * Source: http://www.gamedev.net/topic/473544-how-to-make-a-timer-using-xna/page__view__findpost__p__4107032
* *
*/ */
public class AxiosTimer : IAxiosGameObject public class AxiosTimer : AxiosGameObject
{ {
TimeSpan interval = new TimeSpan(0, 0, 1); TimeSpan interval = new TimeSpan(0, 0, 1);
TimeSpan lastTick = new TimeSpan(); TimeSpan lastTick = new TimeSpan();
@ -35,7 +35,7 @@ namespace Axios.Engine
} }
public void Update(AxiosGameScreen gameScreen, GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen) public override void Update(AxiosGameScreen gameScreen, GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
{ {
if (_enabled) if (_enabled)
@ -43,7 +43,11 @@ namespace Axios.Engine
if (gameTime.TotalGameTime - lastTick >= interval) if (gameTime.TotalGameTime - lastTick >= interval)
{ {
if (Tick != null) if (Tick != null)
{
//EventArgs e = new EventArgs();
Tick(this, null); Tick(this, null);
}
lastTick = gameTime.TotalGameTime; lastTick = gameTime.TotalGameTime;
} }
@ -54,22 +58,22 @@ namespace Axios.Engine
} }
} }
public virtual void LoadContent(AxiosGameScreen gameScreen) public override void LoadContent(AxiosGameScreen gameScreen)
{ {
} }
public void HandleInput(AxiosGameScreen gameScreen, FarseerPhysics.SamplesFramework.InputHelper input, Microsoft.Xna.Framework.GameTime gameTime) public override void HandleInput(AxiosGameScreen gameScreen, FarseerPhysics.SamplesFramework.InputHelper input, Microsoft.Xna.Framework.GameTime gameTime)
{ {
} }
public void HandleCursor(AxiosGameScreen gameScreen, FarseerPhysics.SamplesFramework.InputHelper input) public override void HandleCursor(AxiosGameScreen gameScreen, FarseerPhysics.SamplesFramework.InputHelper input)
{ {
} }
public void UnloadContent(AxiosGameScreen gameScreen) public override void UnloadContent(AxiosGameScreen gameScreen)
{ {
} }