Link existing assets and code from XNA example to make a MonoGame WindowsStore example project.

This commit is contained in:
randolphburt 2014-04-25 00:24:56 +01:00
parent eeaba21e2f
commit b75bb765fe
11 changed files with 343 additions and 2 deletions

4
.gitignore vendored
View File

@ -34,6 +34,10 @@ spine-monogame/xamarinstudio-ios/src/obj
spine-monogame/windows8-store/src/bin
spine-monogame/windows8-store/src/obj
spine-monogame/windows8-store/example/spine-monogame-example_TemporaryKey.pfx
spine-monogame/windows8-store/example/obj/*
spine-monogame/windows8-store/example/bin/*
spine-xna/bin
spine-xna/obj
spine-xna/example/bin

Binary file not shown.

After

Width:  |  Height:  |  Size: 801 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 429 B

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
<Identity Name="250c9491-a89c-4807-9d04-9e460d32af09" Publisher="CN=Spine" Version="1.0.0.0" />
<Properties>
<DisplayName>spine-monogame-example</DisplayName>
<PublisherDisplayName>Spine</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.2.1</OSMinVersion>
<OSMaxVersionTested>6.2.1</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="spine_monogame_example.App">
<VisualElements DisplayName="spine-monogame-example" Logo="Assets\Logo.png" SmallLogo="Assets\SmallLogo.png" Description="spine-monogame-example" ForegroundText="light" BackgroundColor="#464646">
<DefaultTile ShowName="allLogos" />
<SplashScreen Image="Assets\SplashScreen.png" />
</VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
</Package>

View File

@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("spine-monogame-example")]
[assembly: AssemblyProduct("spine-monogame-example")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,187 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{0A121D95-0803-47DC-B839-FF76AE8F7E7F}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Spine</RootNamespace>
<AssemblyName>spine-monogame-example</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>spine-monogame-example_TemporaryKey.pfx</PackageCertificateKeyFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Windows8\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;NETFX_CORE;WINDOWS_STOREAPP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Windows8\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_STOREAPP</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Windows8\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<OutputPath>bin\Windows8\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Windows8\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\Windows8\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Windows8\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\Windows8\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
<Reference Include="MonoGame.Framework">
<HintPath>$(MSBuildExtensionsPath)\..\MonoGame\v3.0\Assemblies\Windows8\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="SharpDX">
<HintPath>$(MSBuildExtensionsPath)\..\MonoGame\v3.0\Assemblies\Windows8\SharpDX.dll</HintPath>
</Reference>
<Reference Include="SharpDX.XInput">
<HintPath>$(MSBuildExtensionsPath)\..\MonoGame\v3.0\Assemblies\Windows8\SharpDX.XInput.dll</HintPath>
</Reference>
<Reference Include="SharpDX.Direct2D1">
<HintPath>$(MSBuildExtensionsPath)\..\MonoGame\v3.0\Assemblies\Windows8\SharpDX.Direct2D1.dll</HintPath>
</Reference>
<Reference Include="SharpDX.Direct3D11">
<HintPath>$(MSBuildExtensionsPath)\..\MonoGame\v3.0\Assemblies\Windows8\SharpDX.Direct3D11.dll</HintPath>
</Reference>
<Reference Include="SharpDX.DXGI">
<HintPath>$(MSBuildExtensionsPath)\..\MonoGame\v3.0\Assemblies\Windows8\SharpDX.DXGI.dll</HintPath>
</Reference>
<Reference Include="SharpDX.MediaFoundation">
<HintPath>$(MSBuildExtensionsPath)\..\MonoGame\v3.0\Assemblies\Windows8\SharpDX.MediaFoundation.dll</HintPath>
</Reference>
<Reference Include="SharpDX.XAudio2">
<HintPath>$(MSBuildExtensionsPath)\..\MonoGame\v3.0\Assemblies\Windows8\SharpDX.XAudio2.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\spine-xna\example\src\ExampleGame.cs">
<Link>ExampleGame.cs</Link>
</Compile>
<Compile Include="..\..\..\spine-xna\example\src\ExampleProgram.cs">
<Link>ExampleProgram.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<Content Include="..\..\..\spine-xna\example\data\goblins-ffd.atlas">
<Link>Assets\goblins-ffd.atlas</Link>
</Content>
<Content Include="..\..\..\spine-xna\example\data\goblins-ffd.json">
<Link>Assets\goblins-ffd.json</Link>
</Content>
<Content Include="..\..\..\spine-xna\example\data\spineboy.atlas">
<Link>Assets\spineboy.atlas</Link>
</Content>
<Content Include="..\..\..\spine-xna\example\data\spineboy.json">
<Link>Assets\spineboy.json</Link>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="..\..\..\spine-xna\example\data\goblins-ffd.png">
<Link>Assets\goblins-ffd.png</Link>
</Content>
<Content Include="..\..\..\spine-xna\example\data\spineboy.png">
<Link>Assets\spineboy.png</Link>
</Content>
<Content Include="Assets\Logo.png" />
<Content Include="Assets\SmallLogo.png" />
<Content Include="Assets\SplashScreen.png" />
<Content Include="Assets\StoreLogo.png" />
</ItemGroup>
<ItemGroup>
<Folder Include="Content\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\spine-monogame\windows8-store\src\SpineMonogameWindows8Store.csproj">
<Project>{8e5baee2-8ccc-4a32-8bcf-5ff438056c0e}</Project>
<Name>SpineMonogameWindows8Store</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '11.0' ">
<VisualStudioVersion>11.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- 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

@ -0,0 +1,64 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "spine-monogame-example", "spine-monogame-example.csproj", "{0A121D95-0803-47DC-B839-FF76AE8F7E7F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpineMonogameWindows8Store", "..\src\SpineMonogameWindows8Store.csproj", "{8E5BAEE2-8CCC-4A32-8BCF-5FF438056C0E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Debug|ARM.ActiveCfg = Debug|ARM
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Debug|ARM.Build.0 = Debug|ARM
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Debug|ARM.Deploy.0 = Debug|ARM
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Debug|x64.ActiveCfg = Debug|x64
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Debug|x64.Build.0 = Debug|x64
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Debug|x64.Deploy.0 = Debug|x64
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Debug|x86.ActiveCfg = Debug|x86
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Debug|x86.Build.0 = Debug|x86
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Debug|x86.Deploy.0 = Debug|x86
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Release|Any CPU.Build.0 = Release|Any CPU
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Release|Any CPU.Deploy.0 = Release|Any CPU
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Release|ARM.ActiveCfg = Release|ARM
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Release|ARM.Build.0 = Release|ARM
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Release|ARM.Deploy.0 = Release|ARM
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Release|x64.ActiveCfg = Release|x64
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Release|x64.Build.0 = Release|x64
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Release|x64.Deploy.0 = Release|x64
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Release|x86.ActiveCfg = Release|x86
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Release|x86.Build.0 = Release|x86
{0A121D95-0803-47DC-B839-FF76AE8F7E7F}.Release|x86.Deploy.0 = Release|x86
{8E5BAEE2-8CCC-4A32-8BCF-5FF438056C0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8E5BAEE2-8CCC-4A32-8BCF-5FF438056C0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8E5BAEE2-8CCC-4A32-8BCF-5FF438056C0E}.Debug|ARM.ActiveCfg = Debug|ARM
{8E5BAEE2-8CCC-4A32-8BCF-5FF438056C0E}.Debug|ARM.Build.0 = Debug|ARM
{8E5BAEE2-8CCC-4A32-8BCF-5FF438056C0E}.Debug|x64.ActiveCfg = Debug|x64
{8E5BAEE2-8CCC-4A32-8BCF-5FF438056C0E}.Debug|x64.Build.0 = Debug|x64
{8E5BAEE2-8CCC-4A32-8BCF-5FF438056C0E}.Debug|x86.ActiveCfg = Debug|x86
{8E5BAEE2-8CCC-4A32-8BCF-5FF438056C0E}.Debug|x86.Build.0 = Debug|x86
{8E5BAEE2-8CCC-4A32-8BCF-5FF438056C0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8E5BAEE2-8CCC-4A32-8BCF-5FF438056C0E}.Release|Any CPU.Build.0 = Release|Any CPU
{8E5BAEE2-8CCC-4A32-8BCF-5FF438056C0E}.Release|ARM.ActiveCfg = Release|ARM
{8E5BAEE2-8CCC-4A32-8BCF-5FF438056C0E}.Release|ARM.Build.0 = Release|ARM
{8E5BAEE2-8CCC-4A32-8BCF-5FF438056C0E}.Release|x64.ActiveCfg = Release|x64
{8E5BAEE2-8CCC-4A32-8BCF-5FF438056C0E}.Release|x64.Build.0 = Release|x64
{8E5BAEE2-8CCC-4A32-8BCF-5FF438056C0E}.Release|x86.ActiveCfg = Release|x86
{8E5BAEE2-8CCC-4A32-8BCF-5FF438056C0E}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -49,6 +49,12 @@ namespace Spine {
AnimationState state;
SkeletonBounds bounds = new SkeletonBounds();
#if WINDOWS_STOREAPP
private string assetsFolder = @"Assets\";
#else
private string assetsFolder = "data/";
#endif
public Example () {
IsMouseVisible = true;
@ -71,10 +77,10 @@ namespace Spine {
// String name = "spineboy";
String name = "goblins-ffd";
Atlas atlas = new Atlas("data/" + name + ".atlas", new XnaTextureLoader(GraphicsDevice));
Atlas atlas = new Atlas(assetsFolder + name + ".atlas", new XnaTextureLoader(GraphicsDevice));
SkeletonJson json = new SkeletonJson(atlas);
if (name == "spineboy") json.Scale = 0.6f;
skeleton = new Skeleton(json.ReadSkeletonData("data/" + name + ".json"));
skeleton = new Skeleton(json.ReadSkeletonData(assetsFolder + name + ".json"));
if (name == "goblins-ffd") skeleton.SetSkin("goblin");
// Define mixing between animations.
@ -146,19 +152,27 @@ namespace Spine {
}
public void Start (AnimationState state, int trackIndex) {
#if !WINDOWS_STOREAPP
Console.WriteLine(trackIndex + " " + state.GetCurrent(trackIndex) + ": start");
#endif
}
public void End (AnimationState state, int trackIndex) {
#if !WINDOWS_STOREAPP
Console.WriteLine(trackIndex + " " + state.GetCurrent(trackIndex) + ": end");
#endif
}
public void Complete (AnimationState state, int trackIndex, int loopCount) {
#if !WINDOWS_STOREAPP
Console.WriteLine(trackIndex + " " + state.GetCurrent(trackIndex) + ": complete " + loopCount);
#endif
}
public void Event (AnimationState state, int trackIndex, Event e) {
#if !WINDOWS_STOREAPP
Console.WriteLine(trackIndex + " " + state.GetCurrent(trackIndex) + ": event " + e);
#endif
}
}
}

View File

@ -11,5 +11,17 @@ namespace Spine {
}
}
}
#elif WINDOWS_STOREAPP
public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
var factory = new MonoGame.Framework.GameFrameworkViewSource<Example>();
Windows.ApplicationModel.Core.CoreApplication.Run(factory);
}
}
#endif
}