Adding mono project

adding game services static class to make it easier to access graphics device
adding axiosengine factory with extension to create texture from list of textures
This commit is contained in:
Nathan Adams
2014-11-30 11:50:21 -06:00
parent 00bc0f4fa4
commit ba49c70a91
8 changed files with 409 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,302 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{A622337F-9AE6-492A-85D6-01CCE0D7F9B4}</ProjectGuid>
<ProjectTypeGuids>{6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Axios</RootNamespace>
<AssemblyName>Axios.Windows.Mono</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
<XnaPlatform>Windows</XnaPlatform>
<XnaProfile>HiDef</XnaProfile>
<XnaCrossPlatformGroupID>cd94d25d-3fe9-470c-b921-7a5abdd2494c</XnaCrossPlatformGroupID>
<XnaOutputType>Library</XnaOutputType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoStdLib>true</NoStdLib>
<UseVSHostingProcess>false</UseVSHostingProcess>
<PlatformTarget>x86</PlatformTarget>
<XnaCompressContent>false</XnaCompressContent>
<RunCodeAnalysis>false</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\x86\Release</OutputPath>
<DefineConstants>TRACE;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoStdLib>true</NoStdLib>
<UseVSHostingProcess>false</UseVSHostingProcess>
<PlatformTarget>x86</PlatformTarget>
<XnaCompressContent>true</XnaCompressContent>
</PropertyGroup>
<ItemGroup>
<Reference Include="Lidgren.Network, Version=2011.3.12.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>c:\Program Files (x86)\MonoGame\v3.0\Assemblies\WindowsGL\Lidgren.Network.dll</HintPath>
</Reference>
<Reference Include="MonoGame.Framework, Version=3.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>c:\Program Files (x86)\MonoGame\v3.0\Assemblies\WindowsGL\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="mscorlib">
<Private>False</Private>
</Reference>
<Reference Include="OpenTK, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>c:\Program Files (x86)\MonoGame\v3.0\Assemblies\WindowsGL\OpenTK.dll</HintPath>
</Reference>
<Reference Include="System">
<Private>False</Private>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Data.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml">
<Private>False</Private>
</Reference>
<Reference Include="System.Core">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
<Private>False</Private>
</Reference>
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
<Private>False</Private>
</Reference>
<Reference Include="System.Net">
<Private>False</Private>
</Reference>
<Reference Include="Tao.Sdl, Version=1.2.13.0, Culture=neutral, PublicKeyToken=9c7a200e36c0094e, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>c:\Program Files (x86)\MonoGame\v3.0\Assemblies\WindowsGL\Tao.Sdl.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Engine\AxiosBreakableGameObject.cs" />
<Compile Include="Engine\AxiosCommandConsole.cs" />
<Compile Include="Engine\AxiosEvents.cs" />
<Compile Include="Axios_settings.cs" />
<Compile Include="Collision\Collision.cs" />
<Compile Include="Collision\Distance.cs" />
<Compile Include="Collision\DynamicTree.cs" />
<Compile Include="Collision\DynamicTreeBroadPhase.cs" />
<Compile Include="Collision\IBroadPhase.cs" />
<Compile Include="Collision\QuadTree.cs" />
<Compile Include="Collision\QuadTreeBroadPhase.cs" />
<Compile Include="Collision\Shapes\CircleShape.cs" />
<Compile Include="Collision\Shapes\EdgeShape.cs" />
<Compile Include="Collision\Shapes\LoopShape.cs" />
<Compile Include="Collision\Shapes\PolygonShape.cs" />
<Compile Include="Collision\Shapes\Shape.cs" />
<Compile Include="Collision\TimeOfImpact.cs" />
<Compile Include="Common\ConvexHull\ChainHull.cs" />
<Compile Include="Common\ConvexHull\GiftWrap.cs" />
<Compile Include="Common\ConvexHull\Melkman.cs" />
<Compile Include="Common\Decomposition\BayazitDecomposer.cs" />
<Compile Include="Common\Decomposition\CDTDecomposer.cs" />
<Compile Include="Common\Decomposition\CDT\Delaunay\DelaunayTriangle.cs" />
<Compile Include="Common\Decomposition\CDT\Delaunay\Sweep\AdvancingFront.cs" />
<Compile Include="Common\Decomposition\CDT\Delaunay\Sweep\AdvancingFrontNode.cs" />
<Compile Include="Common\Decomposition\CDT\Delaunay\Sweep\DTSweep.cs" />
<Compile Include="Common\Decomposition\CDT\Delaunay\Sweep\DTSweepConstraint.cs" />
<Compile Include="Common\Decomposition\CDT\Delaunay\Sweep\DTSweepContext.cs" />
<Compile Include="Common\Decomposition\CDT\Delaunay\Sweep\DTSweepPointComparator.cs" />
<Compile Include="Common\Decomposition\CDT\Delaunay\Sweep\PointOnEdgeException.cs" />
<Compile Include="Common\Decomposition\CDT\ITriangulatable.cs" />
<Compile Include="Common\Decomposition\CDT\Orientation.cs" />
<Compile Include="Common\Decomposition\CDT\Polygon\Polygon.cs" />
<Compile Include="Common\Decomposition\CDT\Polygon\PolygonPoint.cs" />
<Compile Include="Common\Decomposition\CDT\Polygon\PolygonSet.cs" />
<Compile Include="Common\Decomposition\CDT\Sets\ConstrainedPointSet.cs" />
<Compile Include="Common\Decomposition\CDT\Sets\PointSet.cs" />
<Compile Include="Common\Decomposition\CDT\TriangulationConstraint.cs" />
<Compile Include="Common\Decomposition\CDT\TriangulationContext.cs" />
<Compile Include="Common\Decomposition\CDT\TriangulationMode.cs" />
<Compile Include="Common\Decomposition\CDT\TriangulationPoint.cs" />
<Compile Include="Common\Decomposition\CDT\TriangulationUtil.cs" />
<Compile Include="Common\Decomposition\CDT\Util\FixedArray3.cs" />
<Compile Include="Common\Decomposition\CDT\Util\FixedBitArray3.cs" />
<Compile Include="Common\Decomposition\CDT\Util\PointGenerator.cs" />
<Compile Include="Common\Decomposition\CDT\Util\PolygonGenerator.cs" />
<Compile Include="Common\Decomposition\EarclipDecomposer.cs" />
<Compile Include="Common\Decomposition\FlipcodeDecomposer.cs" />
<Compile Include="Common\Decomposition\SeidelDecomposer.cs" />
<Compile Include="Common\FixedArray.cs" />
<Compile Include="Common\HashSet.cs" />
<Compile Include="Common\LineTools.cs" />
<Compile Include="Common\Math.cs" />
<Compile Include="Common\Path.cs" />
<Compile Include="Common\PathManager.cs" />
<Compile Include="Common\PhysicsLogic\Explosion.cs" />
<Compile Include="Common\PhysicsLogic\PhysicsLogic.cs" />
<Compile Include="Common\PolygonManipulation\CuttingTools.cs" />
<Compile Include="Common\PolygonManipulation\SimplifyTools.cs" />
<Compile Include="Common\PolygonManipulation\YuPengClipper.cs" />
<Compile Include="Common\PolygonTools.cs" />
<Compile Include="Common\Serialization.cs" />
<Compile Include="Common\TextureTools\MarchingSquares.cs" />
<Compile Include="Common\TextureTools\MSTerrain.cs" />
<Compile Include="Common\TextureTools\TextureConverter.cs" />
<Compile Include="Common\Vertices.cs" />
<Compile Include="Controllers\AbstractForceController.cs" />
<Compile Include="Controllers\BuoyancyController.cs" />
<Compile Include="Controllers\Controller.cs" />
<Compile Include="Controllers\GravityController.cs" />
<Compile Include="Controllers\SimpleWindForce.cs" />
<Compile Include="Controllers\VelocityLimitController.cs" />
<Compile Include="DebugView.cs" />
<Compile Include="DebugViewXNA.cs" />
<Compile Include="DrawingSystem\AssetCreator.cs" />
<Compile Include="DrawingSystem\LineBatch.cs" />
<Compile Include="DrawingSystem\Sprite.cs" />
<Compile Include="Dynamics\Body.cs" />
<Compile Include="Dynamics\BreakableBody.cs" />
<Compile Include="Dynamics\ContactManager.cs" />
<Compile Include="Dynamics\Contacts\Contact.cs" />
<Compile Include="Dynamics\Contacts\ContactSolver.cs" />
<Compile Include="Dynamics\Fixture.cs" />
<Compile Include="Dynamics\Island.cs" />
<Compile Include="Dynamics\Joints\AngleJoint.cs" />
<Compile Include="Dynamics\Joints\DistanceJoint.cs" />
<Compile Include="Dynamics\Joints\FixedAngleJoint.cs" />
<Compile Include="Dynamics\Joints\FixedDistanceJoint.cs" />
<Compile Include="Dynamics\Joints\FixedFrictionJoint.cs" />
<Compile Include="Dynamics\Joints\FixedLineJoint.cs" />
<Compile Include="Dynamics\Joints\FixedMouseJoint.cs" />
<Compile Include="Dynamics\Joints\FixedPrismaticJoint.cs" />
<Compile Include="Dynamics\Joints\FixedRevoluteJoint.cs" />
<Compile Include="Dynamics\Joints\FrictionJoint.cs" />
<Compile Include="Dynamics\Joints\GearJoint.cs" />
<Compile Include="Dynamics\Joints\Joint.cs" />
<Compile Include="Dynamics\Joints\LineJoint.cs" />
<Compile Include="Dynamics\Joints\PrismaticJoint.cs" />
<Compile Include="Dynamics\Joints\PulleyJoint.cs" />
<Compile Include="Dynamics\Joints\RevoluteJoint.cs" />
<Compile Include="Dynamics\Joints\RopeJoint.cs" />
<Compile Include="Dynamics\Joints\SliderJoint.cs" />
<Compile Include="Dynamics\Joints\WeldJoint.cs" />
<Compile Include="Dynamics\TimeStep.cs" />
<Compile Include="Dynamics\World.cs" />
<Compile Include="Dynamics\WorldCallbacks.cs" />
<Compile Include="Engine\AxiosGameObject.cs" />
<Compile Include="Engine\ComplexAxiosGameObject.cs" />
<Compile Include="Engine\Data\AxiosCSV.cs" />
<Compile Include="Engine\Data\AxiosDataTable.cs" />
<Compile Include="Engine\Data\DataEvents.cs" />
<Compile Include="Engine\DrawableAxiosGameObject.cs" />
<Compile Include="Engine\DrawableBreakableAxiosGameObject.cs" />
<Compile Include="Engine\Extensions\Bitmap.cs" />
<Compile Include="Engine\Extensions\Contact.cs" />
<Compile Include="Engine\Extensions\InputState.cs" />
<Compile Include="Engine\Extensions\Double.cs" />
<Compile Include="Engine\Extensions\MouseState.cs" />
<Compile Include="Engine\Extensions\String.cs" />
<Compile Include="Engine\Extensions\Texture2D.cs" />
<Compile Include="Engine\File\AxiosFile.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="Engine\Interfaces\IDrawableAxiosGameObject.cs" />
<Compile Include="Engine\Log\AxiosLog.cs" />
<Compile Include="Engine\Structures\AxiosPoint.cs" />
<Compile Include="Engine\Structures\AxiosRectangle.cs" />
<Compile Include="Engine\SimpleAxiosGameObject.cs" />
<Compile Include="Engine\SimpleDrawableAxiosGameObject.cs" />
<Compile Include="Engine\AxiosTimer.cs" />
<Compile Include="Engine\Singleton.cs" />
<Compile Include="Engine\UI\AxiosButton.cs" />
<Compile Include="Engine\UI\AxiosUIObject.cs" />
<Compile Include="Factories\BodyFactory.cs" />
<Compile Include="Factories\FixtureFactory.cs" />
<Compile Include="Factories\JointFactory.cs" />
<Compile Include="Factories\LinkFactory.cs" />
<Compile Include="PrimitiveBatch.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScreenSystem\BackgroundScreen.cs" />
<Compile Include="ScreenSystem\Button.cs" />
<Compile Include="ScreenSystem\Camera2D.cs" />
<Compile Include="ScreenSystem\ConvertUnits.cs" />
<Compile Include="ScreenSystem\FramerateCounterComponent.cs" />
<Compile Include="ScreenSystem\GameplayScreen.cs" />
<Compile Include="ScreenSystem\GameScreen.cs" />
<Compile Include="ScreenSystem\IDemoScreen.cs" />
<Compile Include="ScreenSystem\InputAction.cs" />
<Compile Include="Engine\AxiosGameScreen.cs" />
<Compile Include="ScreenSystem\InputState.cs" />
<Compile Include="ScreenSystem\IScreenFactory.cs" />
<Compile Include="ScreenSystem\LoadingScreen.cs" />
<Compile Include="ScreenSystem\LogoScreen.cs" />
<Compile Include="ScreenSystem\MainMenuScreen.cs" />
<Compile Include="ScreenSystem\MenuButton.cs" />
<Compile Include="ScreenSystem\MenuEntry.cs" />
<Compile Include="ScreenSystem\MenuScreen.cs" />
<Compile Include="ScreenSystem\MessageBoxScreen.cs" />
<Compile Include="ScreenSystem\OptionsMenuScreen.cs" />
<Compile Include="ScreenSystem\PauseMenuScreen.cs" />
<Compile Include="ScreenSystem\PhoneMainMenuScreen.cs" />
<Compile Include="ScreenSystem\PhoneMenuScreen.cs" />
<Compile Include="ScreenSystem\PhonePauseScreen.cs" />
<Compile Include="ScreenSystem\PhysicsGameScreen.cs" />
<Compile Include="ScreenSystem\PlayerIndexEventArgs.cs" />
<Compile Include="ScreenSystem\ScreenManager.cs" />
<Compile Include="ScreenSystem\ScreenManagerComponent.cs" />
<Compile Include="ScreenSystem\SpriteFonts.cs" />
<Compile Include="ScreenSystem\VirtualButton.cs" />
<Compile Include="ScreenSystem\VirtualStick.cs" />
<Compile Include="Settings.cs" />
<Compile Include="XNACC\CommandConsoleBase.cs" />
<Compile Include="XNACC\CommandConsoleBaseSharedTypes.cs" />
</ItemGroup>
<ItemGroup>
<None Include="AxiosEngine.cd" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Target Name="MonoGame_RemoveXnaAssemblies" AfterTargets="ImplicitlyExpandTargetFramework">
<Message Text="MonoGame - Removing XNA Assembly references!" Importance="normal" />
<ItemGroup>
<ReferencePath Remove="@(ReferencePath)" Condition="'%(Filename)%(Extension)'=='Microsoft.Xna.Framework.dll'" />
<ReferencePath Remove="@(ReferencePath)" Condition="'%(Filename)%(Extension)'=='Microsoft.Xna.Framework.GamerServices.dll'" />
<ReferencePath Remove="@(ReferencePath)" Condition="'%(Filename)%(Extension)'=='Microsoft.Xna.Framework.GamerServicesExtensions.dll'" />
<ReferencePath Remove="@(ReferencePath)" Condition="'%(Filename)%(Extension)'=='Microsoft.Xna.Framework.Input.Touch.dll'" />
<ReferencePath Remove="@(ReferencePath)" Condition="'%(Filename)%(Extension)'=='Microsoft.Xna.Framework.MediaLibraryExtensions.dll'" />
</ItemGroup>
</Target>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" />
<PropertyGroup>
<PostBuildEvent>if not exist "$(TargeDir)"..\..\Combined mkdir "$(TargetDir)"..\..\Combined
copy "$(TargetPath)" ..\..\Combined</PostBuildEvent>
</PropertyGroup>
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -129,6 +129,9 @@
* - Adding prompt factory class to generate a Final Fantasy type text prompt
* - Updating Gleed2D support to work with latest version of Gleed2D
*
* 1.0.1.11 -
* - Adding game services static class
*
*/
#endregion

View File

@@ -0,0 +1,32 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System.Collections.Generic;
namespace Axios.Engine.Factories
{
public class Texture2DFactory
{
public static Texture2D CreateFromList(List<Texture2D> textures, int width, int height)
{
if (textures.Count <= 0)
return (Texture2D)null;
Texture2D texture2D1 = new Texture2D(textures[0].GraphicsDevice, width, height);
Color[] data1 = new Color[width * height];
texture2D1.GetData<Color>(data1);
Rectangle rectangle = new Rectangle(0, 0, textures[0].Width, textures[0].Height);
foreach (Texture2D texture2D2 in textures)
{
Color[] data2 = new Color[texture2D2.Width * texture2D2.Height];
texture2D2.GetData<Color>(data2);
texture2D1.SetData<Color>(0, new Rectangle?(rectangle), data2, 0, texture2D2.Width * texture2D2.Height);
rectangle.X += texture2D2.Width;
if (rectangle.X >= width)
{
rectangle.X = 0;
rectangle.Y += texture2D2.Height;
}
}
return texture2D1;
}
}
}

View File

@@ -78,7 +78,8 @@ namespace Axios.Engine
this._uiobjects = new List<AxiosUIObject>();
prevuiobj = null;
prevuifocusobj = null;
GameServices.AddService<GraphicsDevice>(this.ScreenManager.GraphicsDevice);
GameServices.AddService<ContentManager>(this.ScreenManager.Game.Content);
}
public void LoadLevelFromStream(Stream s)

View File

@@ -0,0 +1,39 @@
using Microsoft.Xna.Framework;
namespace Axios.Engine
{
public static class GameServices
{
private static GameServiceContainer container;
private static object lockobj;
public static GameServiceContainer Instance
{
get
{
lock (GameServices.lockobj)
{
if (container == null)
{
container = new GameServiceContainer();
}
}
return container;
}
}
public static T GetService<T>()
{
return (T)Instance.GetService(typeof(T));
}
public static void AddService<T>(T service)
{
Instance.AddService(typeof(T), service);
}
public static void RemoveService<T>()
{
Instance.RemoveService(typeof(T));
}
}
}