diff --git a/.gitignore b/.gitignore index 0360782d4..b88a4297c 100644 --- a/.gitignore +++ b/.gitignore @@ -60,13 +60,6 @@ spine-monogame/example/obj spine-monogame/example/Content/bin/ spine-monogame/example/Content/obj/ -spine-xna/bin -spine-xna/obj -spine-xna/example/bin -spine-xna/example/obj -spine-xna/example-content/obj/ -spine-xna/.vs/ - spine-unity/Assets/spine-csharp* !spine-unity/Assets/spine-csharp/Place spine-csharp src here.* !spine-unity/Assets/spine-csharp/add spine-csharp src here.* @@ -155,3 +148,10 @@ spine-ts/spine-threejs/dist spine-libgdx/gradle spine-libgdx/gradlew spine-libgdx/gradlew.bat +spine-monogame/packages +spine-monogame/spine-monogame/bin +spine-monogame/spine-monogame/obj +spine-monogame/spine-monogame-example/Content/bin +spine-monogame/spine-monogame-example/Content/obj +spine-monogame/spine-monogame-example/bin +spine-monogame/spine-monogame-example/obj diff --git a/CHANGELOG.md b/CHANGELOG.md index b97a56973..c203da161 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,8 @@ * **Restructuring (Non-Breaking)** ### XNA/MonoGame +* **Breaking change**: Removed spine-xna in favor of spine-monogame. See https://github.com/EsotericSoftware/spine-runtimes/issues/1949 +* Added new spine-monogame solution. See [spine-monogame/README.md](spine-monogame/README.md) for updated instructions on how to use spine-monogame. ## Java * **Breaking change**: `AttachmentLoader#newRegionAttachment()` and `AttachmentLoader#newMeshAttachment()` take an additional `Sequence` parameter. diff --git a/examples/export/runtimes.sh b/examples/export/runtimes.sh index 9271677f5..bb0ca9163 100755 --- a/examples/export/runtimes.sh +++ b/examples/export/runtimes.sh @@ -264,31 +264,31 @@ cp -f ../spineboy/export/spineboy-pro.skel "$ROOT/spine-ts/spine-player/example/ cp -f ../spineboy/export/spineboy-pma.atlas "$ROOT/spine-ts/spine-player/example/assets/" cp -f ../spineboy/export/spineboy-pma.png "$ROOT/spine-ts/spine-player/example/assets/" -echo "spine-xna" -rm "$ROOT/spine-xna/example/data/"* -cp -f ../coin/export/coin-pro.json "$ROOT/spine-xna/example/data/" -cp -f ../coin/export/coin-pro.skel "$ROOT/spine-xna/example/data/" -cp -f ../coin/export/coin.atlas "$ROOT/spine-xna/example/data/" -cp -f ../coin/export/coin.png "$ROOT/spine-xna/example/data/" +echo "spine-monogame" +rm "$ROOT/spine-monogame/spine-monogame-example/data/"* +cp -f ../coin/export/coin-pro.json "$ROOT/spine-monogame/spine-monogame-example/data/" +cp -f ../coin/export/coin-pro.skel "$ROOT/spine-monogame/spine-monogame-example/data/" +cp -f ../coin/export/coin.atlas "$ROOT/spine-monogame/spine-monogame-example/data/" +cp -f ../coin/export/coin.png "$ROOT/spine-monogame/spine-monogame-example/data/" -cp -f ../raptor/export/raptor-pro.json "$ROOT/spine-xna/example/data/" +cp -f ../raptor/export/raptor-pro.json "$ROOT/spine-monogame/spine-monogame-example/data/" # Note: normalmap need to be created manually. Thus we use a separately prepared atlas and # diffuse map so that the maps always match. These atlas textures are copied to the target dir. -cp -f ../raptor/manual-maps/raptor.atlas "$ROOT/spine-xna/example/data/" -cp -f ../raptor/manual-maps/raptor.png "$ROOT/spine-xna/example/data/" -cp -f ../raptor/manual-maps/raptor-normals.png "$ROOT/spine-xna/example/data/raptor_normals.png" +cp -f ../raptor/manual-maps/raptor.atlas "$ROOT/spine-monogame/spine-monogame-example/data/" +cp -f ../raptor/manual-maps/raptor.png "$ROOT/spine-monogame/spine-monogame-example/data/" +cp -f ../raptor/manual-maps/raptor-normals.png "$ROOT/spine-monogame/spine-monogame-example/data/raptor_normals.png" -cp -f ../spineboy/export/spineboy-pro.skel "$ROOT/spine-xna/example/data/" -cp -f ../spineboy/export/spineboy.atlas "$ROOT/spine-xna/example/data/" -cp -f ../spineboy/export/spineboy.png "$ROOT/spine-xna/example/data/" +cp -f ../spineboy/export/spineboy-pro.skel "$ROOT/spine-monogame/spine-monogame-example/data/" +cp -f ../spineboy/export/spineboy.atlas "$ROOT/spine-monogame/spine-monogame-example/data/" +cp -f ../spineboy/export/spineboy.png "$ROOT/spine-monogame/spine-monogame-example/data/" -cp -f ../tank/export/tank-pro.json "$ROOT/spine-xna/example/data/" -cp -f ../tank/export/tank.atlas "$ROOT/spine-xna/example/data/" -cp -f ../tank/export/tank.png "$ROOT/spine-xna/example/data/" +cp -f ../tank/export/tank-pro.json "$ROOT/spine-monogame/spine-monogame-example/data/" +cp -f ../tank/export/tank.atlas "$ROOT/spine-monogame/spine-monogame-example/data/" +cp -f ../tank/export/tank.png "$ROOT/spine-monogame/spine-monogame-example/data/" -cp -f ../mix-and-match/export/mix-and-match-pro.json "$ROOT/spine-xna/example/data/" -cp -f ../mix-and-match/export/mix-and-match.atlas "$ROOT/spine-xna/example/data/" -cp -f ../mix-and-match/export/mix-and-match.png "$ROOT/spine-xna/example/data/" +cp -f ../mix-and-match/export/mix-and-match-pro.json "$ROOT/spine-monogame/spine-monogame-example/data/" +cp -f ../mix-and-match/export/mix-and-match.atlas "$ROOT/spine-monogame/spine-monogame-example/data/" +cp -f ../mix-and-match/export/mix-and-match.png "$ROOT/spine-monogame/spine-monogame-example/data/" echo "spine-ue4" rm "$ROOT/spine-ue4/Content/GettingStarted/Assets/Raptor/raptor.json" diff --git a/formatters/format.sh b/formatters/format.sh index 9f13c9b8b..a9ff96fb4 100755 --- a/formatters/format.sh +++ b/formatters/format.sh @@ -8,8 +8,7 @@ setup() { cp $dir/.clang-format $dir/.. cp $dir/build.gradle $dir/.. cp $dir/settings.gradle $dir/.. - cp $dir/.editorconfig $dir/../spine-csharp - cp $dir/.editorconfig $dir/../spine-xna + cp $dir/.editorconfig $dir/../spine-csharp cp $dir/.editorconfig $dir/../spine-monogame cp $dir/.editorconfig $dir/../spine-unity } @@ -18,8 +17,7 @@ cleanup() { rm $dir/../.clang-format rm $dir/../build.gradle rm $dir/../settings.gradle - rm $dir/../spine-csharp/.editorconfig - rm $dir/../spine-xna/.editorconfig + rm $dir/../spine-csharp/.editorconfig rm $dir/../spine-monogame/.editorconfig rm $dir/../spine-unity/.editorconfig } @@ -31,7 +29,6 @@ setup pushd $dir/.. ./formatters/gradlew spotlessApply dotnet-format spine-csharp/spine-csharp.sln -dotnet-format -f spine-xna dotnet-format -f spine-monogame dotnet-format -f spine-unity popd diff --git a/spine-c/spine-c/src/spine/AtlasAttachmentLoader.c b/spine-c/spine-c/src/spine/AtlasAttachmentLoader.c index 6055b30e8..7ccff5d28 100644 --- a/spine-c/spine-c/src/spine/AtlasAttachmentLoader.c +++ b/spine-c/spine-c/src/spine/AtlasAttachmentLoader.c @@ -34,7 +34,7 @@ static int /*bool*/ loadSequence(spAtlas *atlas, const char *basePath, spSequence *sequence) { spTextureRegionArray *regions = sequence->regions; char *path = CALLOC(char, strlen(basePath) + sequence->digits + 1); - int i ; + int i; for (i = 0; i < regions->size; i++) { spSequence_getPath(basePath, i, path); regions->items[i] = SUPER(spAtlas_findRegion(atlas, path)); diff --git a/spine-c/spine-c/src/spine/Sequence.c b/spine-c/spine-c/src/spine/Sequence.c index 2811fbfdd..a611135ba 100644 --- a/spine-c/spine-c/src/spine/Sequence.c +++ b/spine-c/spine-c/src/spine/Sequence.c @@ -30,7 +30,7 @@ #include #include -_SP_ARRAY_IMPLEMENT_TYPE(spTextureRegionArray, spTextureRegion*) +_SP_ARRAY_IMPLEMENT_TYPE(spTextureRegionArray, spTextureRegion *) static int nextSequenceId = 0; @@ -69,7 +69,7 @@ void spSequence_apply(spSequence *self, spSlot *slot, spAttachment *attachment) region = self->regions->items[index]; if (attachment->type == SP_ATTACHMENT_REGION) { - spRegionAttachment *regionAttachment = (spRegionAttachment*)attachment; + spRegionAttachment *regionAttachment = (spRegionAttachment *) attachment; if (regionAttachment->region != region) { regionAttachment->rendererObject = region; regionAttachment->region = region; @@ -78,7 +78,7 @@ void spSequence_apply(spSequence *self, spSlot *slot, spAttachment *attachment) } if (attachment->type == SP_ATTACHMENT_MESH) { - spMeshAttachment *meshAttachment = (spMeshAttachment*)attachment; + spMeshAttachment *meshAttachment = (spMeshAttachment *) attachment; if (meshAttachment->region != region) { meshAttachment->rendererObject = region; meshAttachment->region = region; @@ -87,6 +87,6 @@ void spSequence_apply(spSequence *self, spSlot *slot, spAttachment *attachment) } } -void spSequence_getPath(const char* basePath, int index, char* path) { +void spSequence_getPath(const char *basePath, int index, char *path) { fix me } diff --git a/spine-c/spine-c/src/spine/Skeleton.c b/spine-c/spine-c/src/spine/Skeleton.c index f85bfe1b5..953f36e86 100644 --- a/spine-c/spine-c/src/spine/Skeleton.c +++ b/spine-c/spine-c/src/spine/Skeleton.c @@ -161,8 +161,7 @@ static void _addToUpdateCache(_spSkeleton *const internal, _spUpdateType type, v _spUpdate *update; if (internal->updateCacheCount == internal->updateCacheCapacity) { internal->updateCacheCapacity *= 2; - internal->updateCache = (_spUpdate *) realloc(internal->updateCache, - sizeof(_spUpdate) * internal->updateCacheCapacity); + internal->updateCache = (_spUpdate *) REALLOC(internal->updateCache, _spUpdate, internal->updateCacheCapacity); } update = internal->updateCache + internal->updateCacheCount; update->type = type; diff --git a/spine-cocos2dx/src/spine/SkeletonRenderer.cpp b/spine-cocos2dx/src/spine/SkeletonRenderer.cpp index fcd3819f0..2ae6ae389 100644 --- a/spine-cocos2dx/src/spine/SkeletonRenderer.cpp +++ b/spine-cocos2dx/src/spine/SkeletonRenderer.cpp @@ -656,7 +656,7 @@ namespace spine { RegionAttachment *attachment = (RegionAttachment *) slot->getAttachment(); float worldVertices[8]; - attachment->computeWorldVertices(*slot, worldVertices, 0, 2); + attachment->computeWorldVertices(*slot, worldVertices, 0, 2); const Vec2 points[4] = { {worldVertices[0], worldVertices[1]}, @@ -911,13 +911,17 @@ namespace spine { Attachment *attachment = slot.getAttachment(); if (!attachment || slotIsOutRange(slot, startSlotIndex, endSlotIndex) || - !slot.getBone().isActive() || - slot.getColor().a == 0) + !slot.getBone().isActive()) return true; - if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) { + const auto &attachmentRTTI = attachment->getRTTI(); + if (attachmentRTTI.isExactly(ClippingAttachment::rtti)) + return false; + if (slot.getColor().a == 0) + return true; + if (attachmentRTTI.isExactly(RegionAttachment::rtti)) { if (static_cast(attachment)->getColor().a == 0) return true; - } else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) { + } else if (attachmentRTTI.isExactly(MeshAttachment::rtti)) { if (static_cast(attachment)->getColor().a == 0) return true; } diff --git a/spine-csharp/src/AnimationState.cs b/spine-csharp/src/AnimationState.cs index c480494ce..abab61c1a 100644 --- a/spine-csharp/src/AnimationState.cs +++ b/spine-csharp/src/AnimationState.cs @@ -268,7 +268,8 @@ namespace Spine { } else { int[] timelineMode = current.timelineMode.Items; - bool firstFrame = current.timelinesRotation.Count != timelineCount << 1; + bool shortestRotation = current.shortestRotation; + bool firstFrame = !shortestRotation && current.timelinesRotation.Count != timelineCount << 1; if (firstFrame) current.timelinesRotation.Resize(timelineCount << 1); float[] timelinesRotation = current.timelinesRotation.Items; @@ -276,7 +277,7 @@ namespace Spine { Timeline timeline = timelines[ii]; MixBlend timelineBlend = timelineMode[ii] == AnimationState.Subsequent ? blend : MixBlend.Setup; var rotateTimeline = timeline as RotateTimeline; - if (rotateTimeline != null) + if (!shortestRotation && rotateTimeline != null) ApplyRotateTimeline(rotateTimeline, skeleton, applyTime, mix, timelineBlend, timelinesRotation, ii << 1, firstFrame); else if (timeline is AttachmentTimeline) @@ -383,7 +384,8 @@ namespace Spine { int[] timelineMode = from.timelineMode.Items; TrackEntry[] timelineHoldMix = from.timelineHoldMix.Items; - bool firstFrame = from.timelinesRotation.Count != timelineCount << 1; + bool shortestRotation = from.shortestRotation; + bool firstFrame = !shortestRotation && from.timelinesRotation.Count != timelineCount << 1; if (firstFrame) from.timelinesRotation.Resize(timelineCount << 1); float[] timelinesRotation = from.timelinesRotation.Items; @@ -419,7 +421,7 @@ namespace Spine { } from.totalAlpha += alpha; var rotateTimeline = timeline as RotateTimeline; - if (rotateTimeline != null) { + if (!shortestRotation && rotateTimeline != null) { ApplyRotateTimeline(rotateTimeline, skeleton, applyTime, alpha, timelineBlend, timelinesRotation, i << 1, firstFrame); } else if (timeline is AttachmentTimeline) { @@ -990,7 +992,7 @@ namespace Spine { internal int trackIndex; - internal bool loop, holdPrevious, reverse; + internal bool loop, holdPrevious, reverse, shortestRotation; internal float eventThreshold, attachmentThreshold, drawOrderThreshold; internal float animationStart, animationEnd, animationLast, nextAnimationLast; internal float delay, trackTime, trackLast, nextTrackLast, trackEnd, timeScale = 1f; @@ -1257,6 +1259,14 @@ namespace Spine { /// If true, the animation will be applied in reverse. Events are not fired when an animation is applied in reverse. public bool Reverse { get { return reverse; } set { reverse = value; } } + /// + /// If true, mixing rotation between tracks always uses the shortest rotation direction. If the rotation is animated, the + /// shortest rotation direction may change during the mix. + /// + /// If false, the shortest rotation direction is remembered when the mix starts and the same direction is used for the rest + /// of the mix. Defaults to false. + public bool ShortestRotation { get { return shortestRotation; } set { shortestRotation = value; } } + /// Returns true if this entry is for the empty animation. See , /// , and . public bool IsEmptyAnimation { get { return animation == AnimationState.EmptyAnimation; } } diff --git a/spine-monogame/.mgstats b/spine-monogame/.mgstats new file mode 100644 index 000000000..eab26b31b --- /dev/null +++ b/spine-monogame/.mgstats @@ -0,0 +1 @@ +Source File,Dest File,Processor Type,Content Type,Source File Size,Dest File Size,Build Seconds diff --git a/spine-monogame/README.md b/spine-monogame/README.md index 31b14f822..78858068b 100644 --- a/spine-monogame/README.md +++ b/spine-monogame/README.md @@ -21,11 +21,14 @@ spine-monogame supports all Spine features. ## Setup 1. Download the Spine Runtimes source using [git](https://help.github.com/articles/set-up-git) or by downloading it as a zip via the download button above. -1. Copy the contents of the `spine-csharp/src` and `spine-xna/src` directories into your project. +1. Let your MonoGame project reference the project `spine-monogame/spine-monogame/spine-monogame.csproj`. +1. Optionally add `spine-monogame/spine-monogame-example/Content/shaders/SpineEffect.fx` to your content pipeline build if you require two color tinting support. See the `spine-monogame-example/ExampleGame.cs` on how to use it. + +Note: `spine-monogame` references source files from `spine-csharp/src`. ## Example +1. Follow the [MonoGame Getting Started Guide](https://docs.monogame.net/articles/getting_started/0_getting_started.html) on how to setup your development environment for MonoGame. Make sure to also install the optional dependencies allowing compilation of shaders. 1. Download the Spine Runtimes source using [git](https://help.github.com/articles/set-up-git) or by downloading it [as a zip via the download button above. -1. Open the `spine-monogame-example.sln` Solution in either Visual Studio 2015 or Xamarin Studio -1. Right click the `spine-monogame-example` project in the solution explorer and select `Properties` -1. Select `Debug` and set the working directory to point to `spine-runtimes/spine-xna/example` +1. Open the `spine-monogame.sln` Solution in the IDE you choose based on the `Monogame Getting Started Guide`. +1. Set the `spine-monogame-example` project as the startup project, and ensure the working directory is set to `spine-runtimes/spine-monogame/spine-monogame-example` when running or debugging the project. diff --git a/spine-monogame/example.sln b/spine-monogame/example.sln deleted file mode 100644 index a0ead27e9..000000000 --- a/spine-monogame/example.sln +++ /dev/null @@ -1,38 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "spine-monogame-example", "example\spine-monogame-example.csproj", "{0A7474EC-4DF9-40E7-B920-D1D1601F20A7}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "spine-csharp", "..\spine-csharp\spine-csharp.csproj", "{94144E22-2431-4A8F-AC04-DEC22F7EDD8F}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0A7474EC-4DF9-40E7-B920-D1D1601F20A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0A7474EC-4DF9-40E7-B920-D1D1601F20A7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0A7474EC-4DF9-40E7-B920-D1D1601F20A7}.Debug|x86.ActiveCfg = Debug|Any CPU - {0A7474EC-4DF9-40E7-B920-D1D1601F20A7}.Debug|x86.Build.0 = Debug|Any CPU - {0A7474EC-4DF9-40E7-B920-D1D1601F20A7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0A7474EC-4DF9-40E7-B920-D1D1601F20A7}.Release|Any CPU.Build.0 = Release|Any CPU - {0A7474EC-4DF9-40E7-B920-D1D1601F20A7}.Release|x86.ActiveCfg = Release|Any CPU - {0A7474EC-4DF9-40E7-B920-D1D1601F20A7}.Release|x86.Build.0 = Release|Any CPU - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F}.Debug|x86.ActiveCfg = Debug|Any CPU - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F}.Debug|x86.Build.0 = Debug|Any CPU - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F}.Release|Any CPU.Build.0 = Release|Any CPU - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F}.Release|x86.ActiveCfg = Release|Any CPU - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/spine-monogame/example/Properties/AssemblyInfo.cs b/spine-monogame/example/Properties/AssemblyInfo.cs deleted file mode 100644 index 4654762a2..000000000 --- a/spine-monogame/example/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,65 +0,0 @@ -/****************************************************************************** - * Spine Runtimes License Agreement - * Last updated September 24, 2021. Replaces all prior versions. - * - * Copyright (c) 2013-2021, Esoteric Software LLC - * - * Integration of the Spine Runtimes into software or otherwise creating - * derivative works of the Spine Runtimes is permitted under the terms and - * conditions of Section 2 of the Spine Editor License Agreement: - * http://esotericsoftware.com/spine-editor-license - * - * Otherwise, it is permitted to integrate the Spine Runtimes into software - * or otherwise create derivative works of the Spine Runtimes (collectively, - * "Products"), provided that each user of the Products must obtain their own - * Spine Editor license and redistribution of the Products in any form must - * include this license and copyright notice. - * - * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, - * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -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 © 2017")] -[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)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("f47bbbe2-ac55-4263-b224-1c8fcef4714b")] - -// 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")] diff --git a/spine-monogame/example/spine-monogame-example.csproj b/spine-monogame/example/spine-monogame-example.csproj deleted file mode 100644 index bb44f0321..000000000 --- a/spine-monogame/example/spine-monogame-example.csproj +++ /dev/null @@ -1,146 +0,0 @@ - - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {0A7474EC-4DF9-40E7-B920-D1D1601F20A7} - WinExe - Properties - spine_monogame_example - spine-monogame-example - 512 - DesktopGL - v4.5 - - - true - bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\ - DEBUG;TRACE;LINUX - full - x64 - prompt - false - 4 - - - bin\$(MonoGamePlatform)\$(Platform)\$(Configuration)\ - TRACE;LINUX - true - pdbonly - AnyCPU - prompt - false - 4 - - - Icon.ico - - - app.manifest - - - - spine-xna\ShapeRenderer.cs - - - spine-xna\SkeletonDebugRenderer.cs - - - spine-xna\VertexEffect.cs - - - spine-xna\MeshBatcher.cs - - - spine-xna\SkeletonRenderer.cs - - - spine-xna\Util.cs - - - spine-xna\XnaTextureLoader.cs - - - - - - - - $(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\MonoGame.Framework.dll - - - - - - - - - - - Always - - - x86\SDL2.dll - PreserveNewest - - - x64\SDL2.dll - PreserveNewest - - - x86\soft_oal.dll - PreserveNewest - - - x64\soft_oal.dll - PreserveNewest - - - x86\libSDL2-2.0.so.0 - PreserveNewest - - - x64\libSDL2-2.0.so.0 - PreserveNewest - - - x86\libopenal.so.1 - PreserveNewest - - - x64\libopenal.so.1 - PreserveNewest - - - MonoGame.Framework.dll.config - PreserveNewest - - - - x64\libopenal.1.dylib - PreserveNewest - - - x64\libSDL2-2.0.0.dylib - PreserveNewest - - - - - {94144e22-2431-4a8f-ac04-dec22f7edd8f} - spine-csharp - - - - - - \ No newline at end of file diff --git a/spine-monogame/spine-monogame-example/Content/Content.mgcb b/spine-monogame/spine-monogame-example/Content/Content.mgcb new file mode 100644 index 000000000..d5787ee02 --- /dev/null +++ b/spine-monogame/spine-monogame-example/Content/Content.mgcb @@ -0,0 +1,33 @@ + +#----------------------------- Global Properties ----------------------------# + +/outputDir:bin/$(Platform) +/intermediateDir:obj/$(Platform) +/platform:DesktopGL +/config: +/profile:Reach +/compress:False + +#-------------------------------- References --------------------------------# + + +#---------------------------------- Content ---------------------------------# + +#begin SpineEffect.fx +/importer:EffectImporter +/processor:EffectProcessor +/processorParam:DebugMode=Auto +/build:shaders\\SpineEffect.fx + +#begin SpineEffectNormalMap.fx +/importer:EffectImporter +/processor:EffectProcessor +/processorParam:DebugMode=Auto +/build:shaders\\SpineEffectNormalMap.fx + +#begin SpineEffectOutline.fx +/importer:EffectImporter +/processor:EffectProcessor +/processorParam:DebugMode=Auto +/build:shaders\\SpineEffectOutline.fx + diff --git a/spine-monogame/example/Content/SpineEffect.fx b/spine-monogame/spine-monogame-example/Content/shaders/SpineEffect.fx similarity index 100% rename from spine-monogame/example/Content/SpineEffect.fx rename to spine-monogame/spine-monogame-example/Content/shaders/SpineEffect.fx diff --git a/spine-xna/example-content/SpineEffectNormalmap.fx b/spine-monogame/spine-monogame-example/Content/shaders/SpineEffectNormalmap.fx similarity index 95% rename from spine-xna/example-content/SpineEffectNormalmap.fx rename to spine-monogame/spine-monogame-example/Content/shaders/SpineEffectNormalmap.fx index 365ef76ee..9a47fe483 100644 --- a/spine-xna/example-content/SpineEffectNormalmap.fx +++ b/spine-monogame/spine-monogame-example/Content/shaders/SpineEffectNormalmap.fx @@ -1,3 +1,12 @@ +#if OPENGL + #define SV_POSITION POSITION + #define VS_SHADERMODEL vs_3_0 + #define PS_SHADERMODEL ps_3_0 +#else + #define VS_SHADERMODEL vs_4_0_level_9_1 + #define PS_SHADERMODEL ps_4_0_level_9_1 +#endif + float4x4 World; float4x4 View; float4x4 Projection; diff --git a/spine-xna/example-content/SpineEffectOutline.fx b/spine-monogame/spine-monogame-example/Content/shaders/SpineEffectOutline.fx similarity index 95% rename from spine-xna/example-content/SpineEffectOutline.fx rename to spine-monogame/spine-monogame-example/Content/shaders/SpineEffectOutline.fx index e83444264..4db462520 100644 --- a/spine-xna/example-content/SpineEffectOutline.fx +++ b/spine-monogame/spine-monogame-example/Content/shaders/SpineEffectOutline.fx @@ -1,3 +1,13 @@ +#if OPENGL + #define SV_POSITION POSITION + #define VS_SHADERMODEL vs_3_0 + #define PS_SHADERMODEL ps_3_0 +#else + #define VS_SHADERMODEL vs_4_0_level_9_1 + #define PS_SHADERMODEL ps_4_0_level_9_1 +#endif + + float4x4 World; float4x4 View; float4x4 Projection; diff --git a/spine-monogame/example/ExampleGame.cs b/spine-monogame/spine-monogame-example/ExampleGame.cs similarity index 99% rename from spine-monogame/example/ExampleGame.cs rename to spine-monogame/spine-monogame-example/ExampleGame.cs index 0528345cc..68e927faf 100644 --- a/spine-monogame/example/ExampleGame.cs +++ b/spine-monogame/spine-monogame-example/ExampleGame.cs @@ -119,7 +119,7 @@ namespace Spine { public TankScreen (Example game) : base(game) { // Instantiate and configure the two color tinting effect and // assign it to the skeleton renderer - var twoColorTintEffect = game.Content.Load("Content\\SpineEffect"); + var twoColorTintEffect = game.Content.Load("Content\\shaders\\SpineEffect"); twoColorTintEffect.Parameters["World"].SetValue(Matrix.Identity); twoColorTintEffect.Parameters["View"].SetValue(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 1.0f), Vector3.Zero, Vector3.Up)); skeletonRenderer.Effect = twoColorTintEffect; diff --git a/spine-monogame/example/ExampleProgram.cs b/spine-monogame/spine-monogame-example/ExampleProgram.cs similarity index 100% rename from spine-monogame/example/ExampleProgram.cs rename to spine-monogame/spine-monogame-example/ExampleProgram.cs diff --git a/spine-monogame/example/Icon.bmp b/spine-monogame/spine-monogame-example/Icon.bmp similarity index 100% rename from spine-monogame/example/Icon.bmp rename to spine-monogame/spine-monogame-example/Icon.bmp diff --git a/spine-monogame/example/Icon.ico b/spine-monogame/spine-monogame-example/Icon.ico similarity index 100% rename from spine-monogame/example/Icon.ico rename to spine-monogame/spine-monogame-example/Icon.ico diff --git a/spine-monogame/example/app.manifest b/spine-monogame/spine-monogame-example/app.manifest similarity index 92% rename from spine-monogame/example/app.manifest rename to spine-monogame/spine-monogame-example/app.manifest index 70daa8619..7feadf225 100644 --- a/spine-monogame/example/app.manifest +++ b/spine-monogame/spine-monogame-example/app.manifest @@ -36,6 +36,7 @@ true/pm + permonitorv2,permonitor diff --git a/spine-xna/example/data/coin-pro.json b/spine-monogame/spine-monogame-example/data/coin-pro.json similarity index 100% rename from spine-xna/example/data/coin-pro.json rename to spine-monogame/spine-monogame-example/data/coin-pro.json diff --git a/spine-xna/example/data/coin-pro.skel b/spine-monogame/spine-monogame-example/data/coin-pro.skel similarity index 100% rename from spine-xna/example/data/coin-pro.skel rename to spine-monogame/spine-monogame-example/data/coin-pro.skel diff --git a/spine-xna/example/data/coin.atlas b/spine-monogame/spine-monogame-example/data/coin.atlas similarity index 100% rename from spine-xna/example/data/coin.atlas rename to spine-monogame/spine-monogame-example/data/coin.atlas diff --git a/spine-xna/example/data/coin.png b/spine-monogame/spine-monogame-example/data/coin.png similarity index 100% rename from spine-xna/example/data/coin.png rename to spine-monogame/spine-monogame-example/data/coin.png diff --git a/spine-xna/example/data/mix-and-match-pro.json b/spine-monogame/spine-monogame-example/data/mix-and-match-pro.json similarity index 100% rename from spine-xna/example/data/mix-and-match-pro.json rename to spine-monogame/spine-monogame-example/data/mix-and-match-pro.json diff --git a/spine-xna/example/data/mix-and-match.atlas b/spine-monogame/spine-monogame-example/data/mix-and-match.atlas similarity index 100% rename from spine-xna/example/data/mix-and-match.atlas rename to spine-monogame/spine-monogame-example/data/mix-and-match.atlas diff --git a/spine-xna/example/data/mix-and-match.png b/spine-monogame/spine-monogame-example/data/mix-and-match.png similarity index 100% rename from spine-xna/example/data/mix-and-match.png rename to spine-monogame/spine-monogame-example/data/mix-and-match.png diff --git a/spine-xna/example/data/raptor-pro.json b/spine-monogame/spine-monogame-example/data/raptor-pro.json similarity index 100% rename from spine-xna/example/data/raptor-pro.json rename to spine-monogame/spine-monogame-example/data/raptor-pro.json diff --git a/spine-xna/example/data/raptor.atlas b/spine-monogame/spine-monogame-example/data/raptor.atlas similarity index 100% rename from spine-xna/example/data/raptor.atlas rename to spine-monogame/spine-monogame-example/data/raptor.atlas diff --git a/spine-xna/example/data/raptor.png b/spine-monogame/spine-monogame-example/data/raptor.png similarity index 100% rename from spine-xna/example/data/raptor.png rename to spine-monogame/spine-monogame-example/data/raptor.png diff --git a/spine-xna/example/data/raptor_normals.png b/spine-monogame/spine-monogame-example/data/raptor_normals.png similarity index 100% rename from spine-xna/example/data/raptor_normals.png rename to spine-monogame/spine-monogame-example/data/raptor_normals.png diff --git a/spine-xna/example/data/spineboy-pro.skel b/spine-monogame/spine-monogame-example/data/spineboy-pro.skel similarity index 100% rename from spine-xna/example/data/spineboy-pro.skel rename to spine-monogame/spine-monogame-example/data/spineboy-pro.skel diff --git a/spine-xna/example/data/spineboy.atlas b/spine-monogame/spine-monogame-example/data/spineboy.atlas similarity index 100% rename from spine-xna/example/data/spineboy.atlas rename to spine-monogame/spine-monogame-example/data/spineboy.atlas diff --git a/spine-xna/example/data/spineboy.png b/spine-monogame/spine-monogame-example/data/spineboy.png similarity index 100% rename from spine-xna/example/data/spineboy.png rename to spine-monogame/spine-monogame-example/data/spineboy.png diff --git a/spine-xna/example/data/tank-pro.json b/spine-monogame/spine-monogame-example/data/tank-pro.json similarity index 100% rename from spine-xna/example/data/tank-pro.json rename to spine-monogame/spine-monogame-example/data/tank-pro.json diff --git a/spine-xna/example/data/tank.atlas b/spine-monogame/spine-monogame-example/data/tank.atlas similarity index 100% rename from spine-xna/example/data/tank.atlas rename to spine-monogame/spine-monogame-example/data/tank.atlas diff --git a/spine-xna/example/data/tank.png b/spine-monogame/spine-monogame-example/data/tank.png similarity index 100% rename from spine-xna/example/data/tank.png rename to spine-monogame/spine-monogame-example/data/tank.png diff --git a/spine-monogame/spine-monogame-example/spine-monogame-example.csproj b/spine-monogame/spine-monogame-example/spine-monogame-example.csproj new file mode 100644 index 000000000..a46d1424c --- /dev/null +++ b/spine-monogame/spine-monogame-example/spine-monogame-example.csproj @@ -0,0 +1,58 @@ + + + WinExe + netcoreapp3.1 + false + false + + + app.manifest + Icon.ico + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spine-monogame/spine-monogame.sln b/spine-monogame/spine-monogame.sln new file mode 100644 index 000000000..bd1381134 --- /dev/null +++ b/spine-monogame/spine-monogame.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.810.17 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "spine-monogame-example", "spine-monogame-example\spine-monogame-example.csproj", "{B6A0B6D0-1186-46A6-89C5-4CD15CA6C18D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "spine-monogame", "spine-monogame\spine-monogame.csproj", "{82271611-1E77-4E5F-B78A-18F8CDBFDF84}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B6A0B6D0-1186-46A6-89C5-4CD15CA6C18D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B6A0B6D0-1186-46A6-89C5-4CD15CA6C18D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B6A0B6D0-1186-46A6-89C5-4CD15CA6C18D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B6A0B6D0-1186-46A6-89C5-4CD15CA6C18D}.Release|Any CPU.Build.0 = Release|Any CPU + {82271611-1E77-4E5F-B78A-18F8CDBFDF84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {82271611-1E77-4E5F-B78A-18F8CDBFDF84}.Debug|Any CPU.Build.0 = Debug|Any CPU + {82271611-1E77-4E5F-B78A-18F8CDBFDF84}.Release|Any CPU.ActiveCfg = Release|Any CPU + {82271611-1E77-4E5F-B78A-18F8CDBFDF84}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1D10CEBB-7A36-4BCD-A598-BF9A61769961} + EndGlobalSection +EndGlobal diff --git a/spine-monogame/example/Content/Content.mgcb b/spine-monogame/spine-monogame/Content/Content.mgcb similarity index 73% rename from spine-monogame/example/Content/Content.mgcb rename to spine-monogame/spine-monogame/Content/Content.mgcb index e4de620d4..ddc4c3679 100644 --- a/spine-monogame/example/Content/Content.mgcb +++ b/spine-monogame/spine-monogame/Content/Content.mgcb @@ -13,9 +13,3 @@ #---------------------------------- Content ---------------------------------# -#begin SpineEffect.fx -/importer:EffectImporter -/processor:EffectProcessor -/processorParam:DebugMode=Auto -/build:SpineEffect.fx - diff --git a/spine-monogame/spine-monogame/spine-monogame.csproj b/spine-monogame/spine-monogame/spine-monogame.csproj new file mode 100644 index 000000000..e5a3a0b48 --- /dev/null +++ b/spine-monogame/spine-monogame/spine-monogame.csproj @@ -0,0 +1,318 @@ + + + netstandard2.0 + + + + All + + + + + + + + + + + + + + + spine-csharp\Animation.cs + + + spine-csharp\AnimationState.cs + + + spine-csharp\AnimationStateData.cs + + + spine-csharp\Atlas.cs + + + spine-csharp\BlendMode.cs + + + spine-csharp\Bone.cs + + + spine-csharp\BoneData.cs + + + spine-csharp\ConstraintData.cs + + + spine-csharp\Event.cs + + + spine-csharp\EventData.cs + + + spine-csharp\ExposedList.cs + + + spine-csharp\IkConstraint.cs + + + spine-csharp\IkConstraintData.cs + + + spine-csharp\IUpdatable.cs + + + spine-csharp\Json.cs + + + spine-csharp\MathUtils.cs + + + spine-csharp\PathConstraint.cs + + + spine-csharp\PathConstraintData.cs + + + spine-csharp\Skeleton.cs + + + spine-csharp\SkeletonBinary.cs + + + spine-csharp\SkeletonBounds.cs + + + spine-csharp\SkeletonClipping.cs + + + spine-csharp\SkeletonData.cs + + + spine-csharp\SkeletonJson.cs + + + spine-csharp\SkeletonLoader.cs + + + spine-csharp\Skin.cs + + + spine-csharp\Slot.cs + + + spine-csharp\SlotData.cs + + + spine-csharp\SpringConstraint.cs + + + spine-csharp\SpringConstraintData.cs + + + spine-csharp\TextureRegion.cs + + + spine-csharp\TransformConstraint.cs + + + spine-csharp\TransformConstraintData.cs + + + spine-csharp\Triangulator.cs + + + spine-csharp\Attachments\AtlasAttachmentLoader.cs + + + spine-csharp\Attachments\Attachment.cs + + + spine-csharp\Attachments\AttachmentLoader.cs + + + spine-csharp\Attachments\AttachmentType.cs + + + spine-csharp\Attachments\BoundingBoxAttachment.cs + + + spine-csharp\Attachments\ClippingAttachment.cs + + + spine-csharp\Attachments\IHasTextureRegion.cs + + + spine-csharp\Attachments\MeshAttachment.cs + + + spine-csharp\Attachments\PathAttachment.cs + + + spine-csharp\Attachments\PointAttachment.cs + + + spine-csharp\Attachments\RegionAttachment.cs + + + spine-csharp\Attachments\Sequence.cs + + + spine-csharp\Attachments\VertexAttachment.cs + + + + + spine-csharp\Animation.cs.meta + + + spine-csharp\AnimationState.cs.meta + + + spine-csharp\AnimationStateData.cs.meta + + + spine-csharp\Atlas.cs.meta + + + spine-csharp\Attachments.meta + + + spine-csharp\BlendMode.cs.meta + + + spine-csharp\Bone.cs.meta + + + spine-csharp\BoneData.cs.meta + + + spine-csharp\ConstraintData.cs.meta + + + spine-csharp\Event.cs.meta + + + spine-csharp\EventData.cs.meta + + + spine-csharp\ExposedList.cs.meta + + + spine-csharp\IkConstraint.cs.meta + + + spine-csharp\IkConstraintData.cs.meta + + + spine-csharp\IUpdatable.cs.meta + + + spine-csharp\Json.cs.meta + + + spine-csharp\MathUtils.cs.meta + + + spine-csharp\package.json + + + spine-csharp\package.json.meta + + + spine-csharp\PathConstraint.cs.meta + + + spine-csharp\PathConstraintData.cs.meta + + + spine-csharp\Skeleton.cs.meta + + + spine-csharp\SkeletonBinary.cs.meta + + + spine-csharp\SkeletonBounds.cs.meta + + + spine-csharp\SkeletonClipping.cs.meta + + + spine-csharp\SkeletonData.cs.meta + + + spine-csharp\SkeletonJson.cs.meta + + + spine-csharp\SkeletonLoader.cs.meta + + + spine-csharp\Skin.cs.meta + + + spine-csharp\Slot.cs.meta + + + spine-csharp\SlotData.cs.meta + + + spine-csharp\spine-csharp.asmdef + + + spine-csharp\spine-csharp.asmdef.meta + + + spine-csharp\SpringConstraint.cs.meta + + + spine-csharp\SpringConstraintData.cs.meta + + + spine-csharp\TransformConstraint.cs.meta + + + spine-csharp\TransformConstraintData.cs.meta + + + spine-csharp\Triangulator.cs.meta + + + spine-csharp\Attachments\AtlasAttachmentLoader.cs.meta + + + spine-csharp\Attachments\Attachment.cs.meta + + + spine-csharp\Attachments\AttachmentLoader.cs.meta + + + spine-csharp\Attachments\AttachmentType.cs.meta + + + spine-csharp\Attachments\BoundingBoxAttachment.cs.meta + + + spine-csharp\Attachments\ClippingAttachment.cs.meta + + + spine-csharp\Attachments\IHasTextureRegion.cs.meta + + + spine-csharp\Attachments\MeshAttachment.cs.meta + + + spine-csharp\Attachments\PathAttachment.cs.meta + + + spine-csharp\Attachments\PointAttachment.cs.meta + + + spine-csharp\Attachments\RegionAttachment.cs.meta + + + spine-csharp\Attachments\Sequence.cs.meta + + + spine-csharp\Attachments\VertexAttachment.cs.meta + + + \ No newline at end of file diff --git a/spine-xna/src/MeshBatcher.cs b/spine-monogame/spine-monogame/src/MeshBatcher.cs similarity index 100% rename from spine-xna/src/MeshBatcher.cs rename to spine-monogame/spine-monogame/src/MeshBatcher.cs diff --git a/spine-xna/src/ShapeRenderer.cs b/spine-monogame/spine-monogame/src/ShapeRenderer.cs similarity index 100% rename from spine-xna/src/ShapeRenderer.cs rename to spine-monogame/spine-monogame/src/ShapeRenderer.cs diff --git a/spine-xna/src/SkeletonDebugRenderer.cs b/spine-monogame/spine-monogame/src/SkeletonDebugRenderer.cs similarity index 99% rename from spine-xna/src/SkeletonDebugRenderer.cs rename to spine-monogame/spine-monogame/src/SkeletonDebugRenderer.cs index 75d1f1ab3..41af1dc2e 100644 --- a/spine-xna/src/SkeletonDebugRenderer.cs +++ b/spine-monogame/spine-monogame/src/SkeletonDebugRenderer.cs @@ -118,7 +118,7 @@ namespace Spine { if (attachment is RegionAttachment) { var regionAttachment = (RegionAttachment)attachment; var vertices = this.vertices; - regionAttachment.ComputeWorldVertices(slot.Bone, vertices, 0, 2); + regionAttachment.ComputeWorldVertices(slot, vertices, 0, 2); renderer.Line(vertices[0], vertices[1], vertices[2], vertices[3]); renderer.Line(vertices[2], vertices[3], vertices[4], vertices[5]); renderer.Line(vertices[4], vertices[5], vertices[6], vertices[7]); diff --git a/spine-xna/src/SkeletonRenderer.cs b/spine-monogame/spine-monogame/src/SkeletonRenderer.cs similarity index 97% rename from spine-xna/src/SkeletonRenderer.cs rename to spine-monogame/spine-monogame/src/SkeletonRenderer.cs index 7523fbce1..17c9c712a 100644 --- a/spine-xna/src/SkeletonRenderer.cs +++ b/spine-monogame/spine-monogame/src/SkeletonRenderer.cs @@ -123,17 +123,17 @@ namespace Spine { if (attachment is RegionAttachment) { RegionAttachment regionAttachment = (RegionAttachment)attachment; attachmentColorR = regionAttachment.R; attachmentColorG = regionAttachment.G; attachmentColorB = regionAttachment.B; attachmentColorA = regionAttachment.A; - AtlasRegion region = (AtlasRegion)regionAttachment.RendererObject; + AtlasRegion region = (AtlasRegion)regionAttachment.Region; textureObject = region.page.rendererObject; verticesCount = 4; - regionAttachment.ComputeWorldVertices(slot.Bone, vertices, 0, 2); + regionAttachment.ComputeWorldVertices(slot, vertices, 0, 2); indicesCount = 6; indices = quadTriangles; uvs = regionAttachment.UVs; } else if (attachment is MeshAttachment) { MeshAttachment mesh = (MeshAttachment)attachment; attachmentColorR = mesh.R; attachmentColorG = mesh.G; attachmentColorB = mesh.B; attachmentColorA = mesh.A; - AtlasRegion region = (AtlasRegion)mesh.RendererObject; + AtlasRegion region = (AtlasRegion)mesh.Region; textureObject = region.page.rendererObject; int vertexCount = mesh.WorldVerticesLength; if (vertices.Length < vertexCount) vertices = new float[vertexCount]; diff --git a/spine-xna/src/Util.cs b/spine-monogame/spine-monogame/src/Util.cs similarity index 100% rename from spine-xna/src/Util.cs rename to spine-monogame/spine-monogame/src/Util.cs diff --git a/spine-xna/src/VertexEffect.cs b/spine-monogame/spine-monogame/src/VertexEffect.cs similarity index 100% rename from spine-xna/src/VertexEffect.cs rename to spine-monogame/spine-monogame/src/VertexEffect.cs diff --git a/spine-xna/src/XnaTextureLoader.cs b/spine-monogame/spine-monogame/src/XnaTextureLoader.cs similarity index 100% rename from spine-xna/src/XnaTextureLoader.cs rename to spine-monogame/spine-monogame/src/XnaTextureLoader.cs diff --git a/spine-ts/spine-canvas/src/SkeletonRenderer.ts b/spine-ts/spine-canvas/src/SkeletonRenderer.ts index c66eb2e40..b2b6d82c9 100644 --- a/spine-ts/spine-canvas/src/SkeletonRenderer.ts +++ b/spine-ts/spine-canvas/src/SkeletonRenderer.ts @@ -94,13 +94,7 @@ export class SkeletonRenderer { ctx.scale(1, -1); ctx.translate(-w / 2, -h / 2); - if (color.r != 1 || color.g != 1 || color.b != 1 || color.a != 1) { - ctx.globalAlpha = color.a; - // experimental tinting via compositing, doesn't work - // ctx.globalCompositeOperation = "source-atop"; - // ctx.fillStyle = "rgba(" + (color.r * 255 | 0) + ", " + (color.g * 255 | 0) + ", " + (color.b * 255 | 0) + ", " + color.a + ")"; - // ctx.fillRect(0, 0, w, h); - } + ctx.globalAlpha = color.a; ctx.drawImage(image, region.x, region.y, w, h, 0, 0, w, h); if (this.debugRendering) ctx.strokeRect(0, 0, w, h); ctx.restore(); @@ -147,13 +141,7 @@ export class SkeletonRenderer { skeletonColor.b * slotColor.b * attachmentColor.b, skeletonColor.a * slotColor.a * attachmentColor.a); - if (color.r != 1 || color.g != 1 || color.b != 1 || color.a != 1) { - ctx.globalAlpha = color.a; - // experimental tinting via compositing, doesn't work - // ctx.globalCompositeOperation = "source-atop"; - // ctx.fillStyle = "rgba(" + (color.r * 255 | 0) + ", " + (color.g * 255 | 0) + ", " + (color.b * 255 | 0) + ", " + color.a + ")"; - // ctx.fillRect(0, 0, w, h); - } + ctx.globalAlpha = color.a; for (var j = 0; j < triangles.length; j += 3) { let t1 = triangles[j] * 8, t2 = triangles[j + 1] * 8, t3 = triangles[j + 2] * 8; diff --git a/spine-ts/spine-core/src/AssetManagerBase.ts b/spine-ts/spine-core/src/AssetManagerBase.ts index b18778ab8..67f047bfd 100644 --- a/spine-ts/spine-core/src/AssetManagerBase.ts +++ b/spine-ts/spine-core/src/AssetManagerBase.ts @@ -138,7 +138,8 @@ export class AssetManagerBase implements Disposable { loadTextureAtlas (path: string, success: (path: string, atlas: TextureAtlas) => void = null, - error: (path: string, message: string) => void = null + error: (path: string, message: string) => void = null, + fileAlias: { [keyword: string]: string } = null ) { let index = path.lastIndexOf("/"); let parent = index >= 0 ? path.substring(0, index + 1) : ""; @@ -149,7 +150,7 @@ export class AssetManagerBase implements Disposable { let atlas = new TextureAtlas(atlasText); let toLoad = atlas.pages.length, abort = false; for (let page of atlas.pages) { - this.loadTexture(parent + page.name, + this.loadTexture(fileAlias == null ? parent + page.name : fileAlias[page.name], (imagePath: string, texture: Texture) => { if (!abort) { page.setTexture(texture); diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs index d5b3a48e8..924cc3850 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/AssetUtility.cs @@ -956,7 +956,8 @@ namespace Spine.Unity.Editor { skeletonDataAsset.Clear(); } var skeletonData = skeletonDataAsset.GetSkeletonData(true); - BlendModeMaterialsUtility.UpdateBlendModeMaterials(skeletonDataAsset, ref skeletonData); + if (skeletonData != null) + BlendModeMaterialsUtility.UpdateBlendModeMaterials(skeletonDataAsset, ref skeletonData); AssetDatabase.SaveAssets(); return skeletonDataAsset; @@ -1006,9 +1007,9 @@ namespace Spine.Unity.Editor { ); switch (result) { - case -1: - //Debug.Log("Select Atlas"); - AtlasAssetBase selectedAtlas = BrowseAtlasDialog(Path.GetDirectoryName(skeletonPath).Replace('\\', '/')); + case -1: { // Select Atlas + string pathForwardSlash = Path.GetDirectoryName(skeletonPath).Replace('\\', '/'); + AtlasAssetBase selectedAtlas = BrowseAtlasDialog(pathForwardSlash, localAtlases); if (selectedAtlas != null) { localAtlases.Clear(); localAtlases.Add(selectedAtlas); @@ -1019,14 +1020,17 @@ namespace Spine.Unity.Editor { } } break; - case 0: // Resolve AtlasAssets... - var atlasList = MultiAtlasDialog(requiredPaths, Path.GetDirectoryName(skeletonPath).Replace('\\', '/'), - Path.GetFileNameWithoutExtension(skeletonPath)); + } + case 0: { // Resolve AtlasAssets... + string pathForwardSlash = Path.GetDirectoryName(skeletonPath).Replace('\\', '/'); + var atlasList = MultiAtlasDialog(requiredPaths, pathForwardSlash, + localAtlases, filename); if (atlasList != null) AssetUtility.IngestSpineProject(AssetDatabase.LoadAssetAtPath(skeletonPath), atlasList.ToArray()); resolved = true; break; + } case 1: // Import without atlas Debug.LogWarning("Imported with missing atlases. Skeleton will not render: " + Path.GetFileName(skeletonPath)); AssetUtility.IngestSpineProject(AssetDatabase.LoadAssetAtPath(skeletonPath), new AtlasAssetBase[] { }); @@ -1040,7 +1044,9 @@ namespace Spine.Unity.Editor { } } - public static List MultiAtlasDialog (List requiredPaths, string initialDirectory, string filename = "") { + public static List MultiAtlasDialog (List requiredPaths, string initialDirectory, + List localAtlases, string filename = "") { + List atlasAssets = new List(); bool resolved = false; string lastAtlasPath = initialDirectory; @@ -1095,7 +1101,7 @@ namespace Spine.Unity.Editor { switch (result) { case 0: // Browse... - AtlasAssetBase selectedAtlasAsset = BrowseAtlasDialog(lastAtlasPath); + AtlasAssetBase selectedAtlasAsset = BrowseAtlasDialog(lastAtlasPath, localAtlases); if (selectedAtlasAsset != null) { if (!atlasAssets.Contains(selectedAtlasAsset)) { var atlas = selectedAtlasAsset.GetAtlas(); @@ -1123,7 +1129,7 @@ namespace Spine.Unity.Editor { return atlasAssets; } - public static AtlasAssetBase BrowseAtlasDialog (string dirPath) { + public static AtlasAssetBase BrowseAtlasDialog (string dirPath, List localAtlases) { string path = EditorUtility.OpenFilePanel("Select AtlasAsset...", dirPath, "asset"); if (path == "") return null; // Canceled or closed by user. @@ -1131,12 +1137,20 @@ namespace Spine.Unity.Editor { int subLen = Application.dataPath.Length - 6; string assetRelativePath = path.Substring(subLen, path.Length - subLen).Replace("\\", "/"); - var obj = AssetDatabase.LoadAssetAtPath(assetRelativePath, typeof(AtlasAssetBase)); + UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(assetRelativePath, typeof(AtlasAssetBase)); + if (obj == null) { + // atlas assets that were just created fail to load, search localAtlases + foreach (AtlasAssetBase localAtlas in localAtlases) { + string newAtlasPath = AssetDatabase.GetAssetPath(localAtlas); + if (newAtlasPath == assetRelativePath) + return localAtlas; + } + } + if (obj == null || !(obj is AtlasAssetBase)) { Debug.Log("Chosen asset was not of type AtlasAssetBase"); return null; } - return (AtlasAssetBase)obj; } #endregion diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/MeshGenerator.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/MeshGenerator.cs index ab3a98650..8b0865857 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/MeshGenerator.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Mesh Generation/MeshGenerator.cs @@ -262,8 +262,7 @@ namespace Spine.Unity { if (lastRendererMaterial != material) { if (lastRendererMaterial != null) return true; - else - lastRendererMaterial = material; + lastRendererMaterial = material; } } } diff --git a/spine-xna/LICENSE b/spine-xna/LICENSE deleted file mode 100644 index 4501a611f..000000000 --- a/spine-xna/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Spine Runtimes License Agreement -Last updated May 1, 2019. Replaces all prior versions. - -Copyright (c) 2013-2019, Esoteric Software LLC - -Integration of the Spine Runtimes into software or otherwise creating -derivative works of the Spine Runtimes is permitted under the terms and -conditions of Section 2 of the Spine Editor License Agreement: -http://esotericsoftware.com/spine-editor-license - -Otherwise, it is permitted to integrate the Spine Runtimes into software -or otherwise create derivative works of the Spine Runtimes (collectively, -"Products"), provided that each user of the Products must obtain their own -Spine Editor license and redistribution of the Products in any form must -include this license and copyright notice. - -THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY EXPRESS -OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN -NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS -INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/spine-xna/Properties/AssemblyInfo.cs b/spine-xna/Properties/AssemblyInfo.cs deleted file mode 100644 index dd50aeaae..000000000 --- a/spine-xna/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,34 +0,0 @@ -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-xna")] -[assembly: AssemblyProduct("spine-xna")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyCompany("Esoteric Software")] -[assembly: AssemblyCopyright("Copyright © Esoteric Software 2013-2016")] -[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. Only Windows -// assemblies support COM. -[assembly: ComVisible(false)] - -// On Windows, the following GUID is for the ID of the typelib if this -// project is exposed to COM. On other platforms, it unique identifies the -// title storage container when deploying this assembly to the device. -[assembly: Guid("bce68f54-1e09-449a-90a2-b7ca28f491a5")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("1.0.0.0")] diff --git a/spine-xna/README.md b/spine-xna/README.md index f3dc7f9c3..be20991c1 100644 --- a/spine-xna/README.md +++ b/spine-xna/README.md @@ -1,30 +1,3 @@ # spine-xna -The spine-xna runtime provides functionality to load, manipulate and render [Spine](http://esotericsoftware.com) skeletal animation data using [XNA](http://msdn.microsoft.com/xna/). spine-xna is based on [spine-csharp](../spine-csharp). - -## Licensing - -You are welcome to evaluate the Spine Runtimes and the examples we provide in this repository free of charge. - -You can integrate the Spine Runtimes into your software free of charge, but users of your software must have their own [Spine license](https://esotericsoftware.com/spine-purchase). Please make your users aware of this requirement! This option is often chosen by those making development tools, such as an SDK, game toolkit, or software library. - -In order to distribute your software containing the Spine Runtimes to others that don't have a Spine license, you need a [Spine license](https://esotericsoftware.com/spine-purchase) at the time of integration. Then you can distribute your software containing the Spine Runtimes however you like, provided others don't modify it or use it to create new software. If others want to do that, they'll need their own Spine license. - -For the official legal terms governing the Spine Runtimes, please read the [Spine Runtimes License Agreement](http://esotericsoftware.com/spine-runtimes-license) and Section 2 of the [Spine Editor License Agreement](http://esotericsoftware.com/spine-editor-license#s2). - -## Spine version - -spine-xna works with data exported from Spine 4.1.xx. - -spine-xna supports all Spine features. - -## Setup - -1. Download the Spine Runtimes source using [git](https://help.github.com/articles/set-up-git) or by downloading it as a zip via the download button above. -1. For XNA with Visual Studio 2015, download [XNA 4.0 refresh for Visual Studio 2015](https://mxa.codeplex.com/releases/view/618279). Install each subfolder as per the README file. -1. Open the `spine-xna.sln` project file with Visual Studio. -1. Set `spine-xna-example` as the startup project -1. Set the working directory of `spine-xna-example` to `spine-runtimes/spine-xna/example` -1. Run the example! - -Alternatively, the contents of the `spine-csharp/src` and `spine-xna/src` directories can be copied into your project. +spine-xna has been discontinued in favor of spine-monogame. Microsoft no longer offers the old XNA tools for download. Projects still relying on Microsoft's XNA implementation can use the sources from spine-monogame. diff --git a/spine-xna/example-content/SpineEffect.fx b/spine-xna/example-content/SpineEffect.fx deleted file mode 100644 index 38d1ef0be..000000000 --- a/spine-xna/example-content/SpineEffect.fx +++ /dev/null @@ -1,59 +0,0 @@ -float4x4 World; -float4x4 View; -float4x4 Projection; - -sampler TextureSampler : register(s0); - -// TODO: add effect parameters here. - -struct VertexShaderInput -{ - float4 Position : POSITION0; - float4 Color : COLOR0; - float4 TextureCoordinate : TEXCOORD0; - float4 Color2 : COLOR1; -}; - -struct VertexShaderOutput -{ - float4 Position : POSITION0; - float4 Color : COLOR0; - float4 TextureCoordinate : TEXCOORD0; - float4 Color2 : COLOR1; -}; - -VertexShaderOutput VertexShaderFunction(VertexShaderInput input) -{ - VertexShaderOutput output; - - float4 worldPosition = mul(input.Position, World); - float4 viewPosition = mul(worldPosition, View); - output.Position = mul(viewPosition, Projection); - output.TextureCoordinate = input.TextureCoordinate; - output.Color = input.Color; - output.Color2 = input.Color2; - - return output; -} - -float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 -{ - float4 texColor = tex2D(TextureSampler, input.TextureCoordinate); - float alpha = texColor.a * input.Color.a; - float4 output; - output.a = alpha; - output.rgb = ((texColor.a - 1.0) * input.Color2.a + 1.0 - texColor.rgb) * input.Color2.rgb + texColor.rgb * input.Color.rgb; - - return output; -} - -technique Technique1 -{ - pass Pass1 - { - // TODO: set renderstates here. - - VertexShader = compile vs_2_0 VertexShaderFunction(); - PixelShader = compile ps_2_0 PixelShaderFunction(); - } -} diff --git a/spine-xna/example-content/spine-xna-example-content.contentproj b/spine-xna/example-content/spine-xna-example-content.contentproj deleted file mode 100644 index a9f87d98f..000000000 --- a/spine-xna/example-content/spine-xna-example-content.contentproj +++ /dev/null @@ -1,51 +0,0 @@ - - - - {D0632D20-BC92-4A73-896B-30BB687732B8} - {96E2B04D-8817-42c6-938A-82C39BA4D311};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Debug - x86 - Library - Properties - v4.0 - v4.0 - bin\$(Platform)\$(Configuration) - - - - - - - - - - - - SpineEffect - EffectImporter - EffectProcessor - - - - - SpineEffectNormalmap - EffectImporter - EffectProcessor - - - - - SpineEffectOutline - EffectImporter - EffectProcessor - - - - - \ No newline at end of file diff --git a/spine-xna/example/Game.ico b/spine-xna/example/Game.ico deleted file mode 100644 index 8cff41eab..000000000 Binary files a/spine-xna/example/Game.ico and /dev/null differ diff --git a/spine-xna/example/GameThumbnail.png b/spine-xna/example/GameThumbnail.png deleted file mode 100644 index 1ad1711a2..000000000 Binary files a/spine-xna/example/GameThumbnail.png and /dev/null differ diff --git a/spine-xna/example/Properties/AssemblyInfo.cs b/spine-xna/example/Properties/AssemblyInfo.cs deleted file mode 100644 index 707431561..000000000 --- a/spine-xna/example/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,34 +0,0 @@ -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-xna-example")] -[assembly: AssemblyProduct("spine-xna-example")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyCompany("Esoteric Software")] -[assembly: AssemblyCopyright("Copyright © Esoteric Software 2013-2016")] -[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. Only Windows -// assemblies support COM. -[assembly: ComVisible(false)] - -// On Windows, the following GUID is for the ID of the typelib if this -// project is exposed to COM. On other platforms, it unique identifies the -// title storage container when deploying this assembly to the device. -[assembly: Guid("078eb4ac-3a70-4ab4-b103-a048c6a15898")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("1.0.0.0")] diff --git a/spine-xna/example/spine-xna-example.csproj b/spine-xna/example/spine-xna-example.csproj deleted file mode 100644 index 82e410431..000000000 --- a/spine-xna/example/spine-xna-example.csproj +++ /dev/null @@ -1,218 +0,0 @@ - - - - {29CC4385-294A-4885-A3E8-FD4825E0CFDD} - {6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Debug - x86 - WinExe - Properties - Spine - spine-xna-example - v4.0 - Client - v4.0 - Windows - HiDef - bf3b738e-f348-48d3-b35b-94bc118edb90 - Game - Game.ico - GameThumbnail.png - false - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - true - - - true - full - false - bin\x86\Debug - DEBUG;TRACE;WINDOWS - prompt - 4 - true - false - x86 - True - - - pdbonly - true - bin\x86\Release - TRACE;WINDOWS - prompt - 4 - true - false - x86 - True - - - Spine.ExampleProgram - - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - - - - - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - - PreserveNewest - - - PreserveNewest - - - - - {94144e22-2431-4a8f-ac04-dec22f7edd8f} - spine-csharp - - - {D0632D20-BC92-4A73-896B-30BB687732B8} - spine-xna-example-content - Content - - - {7F8F2327-C016-49C8-BB4D-F3F77971961E} - spine-xna - - - - - False - Microsoft .NET Framework 4 Client Profile %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - false - - - False - Windows Installer 3.1 - true - - - False - Microsoft XNA Framework Redistributable 4.0 - true - - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - - - \ No newline at end of file diff --git a/spine-xna/example/src/ExampleGame.cs b/spine-xna/example/src/ExampleGame.cs deleted file mode 100644 index b688a21ca..000000000 --- a/spine-xna/example/src/ExampleGame.cs +++ /dev/null @@ -1,246 +0,0 @@ -/****************************************************************************** - * Spine Runtimes License Agreement - * Last updated September 24, 2021. Replaces all prior versions. - * - * Copyright (c) 2013-2021, Esoteric Software LLC - * - * Integration of the Spine Runtimes into software or otherwise creating - * derivative works of the Spine Runtimes is permitted under the terms and - * conditions of Section 2 of the Spine Editor License Agreement: - * http://esotericsoftware.com/spine-editor-license - * - * Otherwise, it is permitted to integrate the Spine Runtimes into software - * or otherwise create derivative works of the Spine Runtimes (collectively, - * "Products"), provided that each user of the Products must obtain their own - * Spine Editor license and redistribution of the Products in any form must - * include this license and copyright notice. - * - * THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, - * BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - *****************************************************************************/ - -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Audio; -using Microsoft.Xna.Framework.Content; -using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; -using Microsoft.Xna.Framework.Media; -using Spine; -using System; -using System.Collections.Generic; -using System.IO; - -namespace Spine { - public class Example : Microsoft.Xna.Framework.Game { - GraphicsDeviceManager graphics; - SkeletonRenderer skeletonRenderer; - SkeletonDebugRenderer skeletonDebugRenderer; - Skeleton skeleton; - Slot headSlot; - AnimationState state; - SkeletonBounds bounds = new SkeletonBounds(); - -#if WINDOWS_STOREAPP - private string assetsFolder = @"Assets\"; -#else - private string assetsFolder = "data/"; -#endif - - public Example () { - IsMouseVisible = true; - - graphics = new GraphicsDeviceManager(this); - graphics.IsFullScreen = false; - graphics.PreferredBackBufferWidth = 800; - graphics.PreferredBackBufferHeight = 600; - } - - protected override void Initialize () { - // TODO: Add your initialization logic here - - base.Initialize(); - } - - protected override void LoadContent () { - - bool useNormalmapShader = false; - Effect spineEffect; - if (!useNormalmapShader) { - // Two color tint effect. Note that you can also use the default BasicEffect instead. - spineEffect = Content.Load("spine-xna-example-content\\SpineEffect"); - } else { - spineEffect = Content.Load("spine-xna-example-content\\SpineEffectNormalmap"); - spineEffect.Parameters["Light0_Direction"].SetValue(new Vector3(-0.5265408f, 0.5735765f, -0.6275069f)); - spineEffect.Parameters["Light0_Diffuse"].SetValue(new Vector3(1, 0.9607844f, 0.8078432f)); - spineEffect.Parameters["Light0_Specular"].SetValue(new Vector3(1, 0.9607844f, 0.8078432f)); - spineEffect.Parameters["Light0_SpecularExponent"].SetValue(2.0f); - } - spineEffect.Parameters["World"].SetValue(Matrix.Identity); - spineEffect.Parameters["View"].SetValue(Matrix.CreateLookAt(new Vector3(0.0f, 0.0f, 1.0f), Vector3.Zero, Vector3.Up)); - - skeletonRenderer = new SkeletonRenderer(GraphicsDevice); - skeletonRenderer.PremultipliedAlpha = false; - skeletonRenderer.Effect = spineEffect; - - skeletonDebugRenderer = new SkeletonDebugRenderer(GraphicsDevice); - skeletonDebugRenderer.DisableAll(); - skeletonDebugRenderer.DrawClipping = true; - - //String name = "spineboy-pro"; - String name = "raptor-pro"; - // String name = "tank-pro"; - //String name = "coin-pro"; - if (useNormalmapShader) - name = "raptor-pro"; // we only have normalmaps for raptor - String atlasName = name.Replace("-pro", "").Replace("-ess", ""); - - bool binaryData = name.Contains("spineboy"); - - Atlas atlas; - if (!useNormalmapShader) { - atlas = new Atlas(assetsFolder + atlasName + ".atlas", new XnaTextureLoader(GraphicsDevice)); - } else { - atlas = new Atlas(assetsFolder + atlasName + ".atlas", new XnaTextureLoader(GraphicsDevice, - loadMultipleTextureLayers: true, textureSuffixes: new string[] { "", "_normals" })); - } - float scale = 1; - if (name == "spineboy-pro") scale = 0.6f; - if (name == "raptor-pro") scale = 0.5f; - if (name == "tank-pro") scale = 0.3f; - if (name == "coin-pro") scale = 1; - - SkeletonData skeletonData; - if (binaryData) { - SkeletonBinary binary = new SkeletonBinary(atlas); - binary.Scale = scale; - skeletonData = binary.ReadSkeletonData(assetsFolder + name + ".skel"); - } else { - SkeletonJson json = new SkeletonJson(atlas); - json.Scale = scale; - skeletonData = json.ReadSkeletonData(assetsFolder + name + ".json"); - } - skeleton = new Skeleton(skeletonData); - if (name == "goblins-pro") skeleton.SetSkin("goblin"); - - // Define mixing between animations. - AnimationStateData stateData = new AnimationStateData(skeleton.Data); - state = new AnimationState(stateData); - - if (name == "spineboy-pro") { - skeleton.SetAttachment("head-bb", "head"); - - stateData.SetMix("run", "jump", 0.2f); - stateData.SetMix("jump", "run", 0.4f); - - // Event handling for all animations. - state.Start += Start; - state.End += End; - state.Complete += Complete; - state.Event += Event; - - state.SetAnimation(0, "run", true); - TrackEntry entry = state.AddAnimation(0, "jump", false, 0); - entry.End += End; // Event handling for queued animations. - state.AddAnimation(0, "run", true, 0); - } else if (name == "raptor-pro") { - state.SetAnimation(0, "walk", true); - state.AddAnimation(1, "gun-grab", false, 2); - } else if (name == "coin-pro") { - state.SetAnimation(0, "animation", true); - } else if (name == "tank-pro") { - skeleton.X += 300; - state.SetAnimation(0, "drive", true); - } else { - state.SetAnimation(0, "walk", true); - } - - skeleton.X += 400; - skeleton.Y += GraphicsDevice.Viewport.Height; - skeleton.UpdateWorldTransform(); - - headSlot = skeleton.FindSlot("head"); - } - - protected override void UnloadContent () { - // TODO: Unload any non ContentManager content here - } - - protected override void Update (GameTime gameTime) { - // TODO: Add your update logic here -#if (!WINDOWS_STOREAPP || WINDOWS_PHONE81) && !IOS - if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) - this.Exit(); -#endif - base.Update(gameTime); - } - - protected override void Draw (GameTime gameTime) { - GraphicsDevice.Clear(Color.Black); - - state.Update((float)(gameTime.ElapsedGameTime.TotalMilliseconds / 1000.0)); - state.Apply(skeleton); - skeleton.UpdateWorldTransform(); - if (skeletonRenderer.Effect is BasicEffect) { - ((BasicEffect)skeletonRenderer.Effect).Projection = Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 1, 0); - } else { - skeletonRenderer.Effect.Parameters["Projection"].SetValue(Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 1, 0)); - } - skeletonRenderer.Begin(); - skeletonRenderer.Draw(skeleton); - skeletonRenderer.End(); - - skeletonDebugRenderer.Effect.Projection = Matrix.CreateOrthographicOffCenter(0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 1, 0); - skeletonDebugRenderer.Begin(); - skeletonDebugRenderer.Draw(skeleton); - skeletonDebugRenderer.End(); - - bounds.Update(skeleton, true); - MouseState mouse = Mouse.GetState(); - if (headSlot != null) { - headSlot.G = 1; - headSlot.B = 1; - if (bounds.AabbContainsPoint(mouse.X, mouse.Y)) { - BoundingBoxAttachment hit = bounds.ContainsPoint(mouse.X, mouse.Y); - if (hit != null) { - headSlot.G = 0; - headSlot.B = 0; - } - } - } - - base.Draw(gameTime); - } - - public void Start (TrackEntry entry) { -#if !WINDOWS_STOREAPP - Console.WriteLine(entry + ": start"); -#endif - } - - public void End (TrackEntry entry) { -#if !WINDOWS_STOREAPP - Console.WriteLine(entry + ": end"); -#endif - } - - public void Complete (TrackEntry entry) { -#if !WINDOWS_STOREAPP - Console.WriteLine(entry + ": complete "); -#endif - } - - public void Event (TrackEntry entry, Event e) { -#if !WINDOWS_STOREAPP - Console.WriteLine(entry + ": event " + e); -#endif - } - } -} diff --git a/spine-xna/example/src/ExampleProgram.cs b/spine-xna/example/src/ExampleProgram.cs deleted file mode 100644 index 9b2995636..000000000 --- a/spine-xna/example/src/ExampleProgram.cs +++ /dev/null @@ -1,26 +0,0 @@ - -using System; - -namespace Spine { -#if WINDOWS || XBOX - static class ExampleProgram { - static void Main (string[] args) { - using (Example game = new Example()) { - game.Run(); - } - } - } -#elif WINDOWS_STOREAPP - public static class Program - { - /// - /// The main entry point for the application. - /// - static void Main() - { - var factory = new MonoGame.Framework.GameFrameworkViewSource(); - Windows.ApplicationModel.Core.CoreApplication.Run(factory); - } - } -#endif -} diff --git a/spine-xna/spine-xna.csproj b/spine-xna/spine-xna.csproj deleted file mode 100644 index 6ae041699..000000000 --- a/spine-xna/spine-xna.csproj +++ /dev/null @@ -1,160 +0,0 @@ - - - - {7F8F2327-C016-49C8-BB4D-F3F77971961E} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Debug - x86 - Library - Properties - Spine - spine-xna - v4.0 - Client - v4.0 - Windows - HiDef - f1fc4580-2d86-4a03-bd33-44b1703f36a1 - Library - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - true - full - false - bin\x86\Debug - DEBUG;TRACE;WINDOWS - prompt - 4 - true - false - x86 - false - - - pdbonly - true - bin\x86\Release - TRACE;WINDOWS - prompt - 4 - true - false - x86 - true - - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - False - - - 4.0 - False - - - 4.0 - False - - - False - - - - - - - - - - - - - - False - Microsoft .NET Framework 4 Client Profile %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - false - - - False - Windows Installer 3.1 - true - - - - - - - - {94144e22-2431-4a8f-ac04-dec22f7edd8f} - spine-csharp - - - - - - \ No newline at end of file diff --git a/spine-xna/spine-xna.sln b/spine-xna/spine-xna.sln deleted file mode 100644 index e3ec9de83..000000000 --- a/spine-xna/spine-xna.sln +++ /dev/null @@ -1,71 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "spine-xna", "spine-xna.csproj", "{7F8F2327-C016-49C8-BB4D-F3F77971961E}" - ProjectSection(ProjectDependencies) = postProject - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F} = {94144E22-2431-4A8F-AC04-DEC22F7EDD8F} - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "spine-xna-example", "example\spine-xna-example.csproj", "{29CC4385-294A-4885-A3E8-FD4825E0CFDD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "spine-csharp", "..\spine-csharp\spine-csharp.csproj", "{94144E22-2431-4A8F-AC04-DEC22F7EDD8F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "spine-xna-example-content", "example-content\spine-xna-example-content.contentproj", "{D0632D20-BC92-4A73-896B-30BB687732B8}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|Mixed Platforms = Debug|Mixed Platforms - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|Mixed Platforms = Release|Mixed Platforms - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7F8F2327-C016-49C8-BB4D-F3F77971961E}.Debug|Any CPU.ActiveCfg = Debug|x86 - {7F8F2327-C016-49C8-BB4D-F3F77971961E}.Debug|Any CPU.Build.0 = Debug|x86 - {7F8F2327-C016-49C8-BB4D-F3F77971961E}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {7F8F2327-C016-49C8-BB4D-F3F77971961E}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {7F8F2327-C016-49C8-BB4D-F3F77971961E}.Debug|x86.ActiveCfg = Debug|x86 - {7F8F2327-C016-49C8-BB4D-F3F77971961E}.Debug|x86.Build.0 = Debug|x86 - {7F8F2327-C016-49C8-BB4D-F3F77971961E}.Release|Any CPU.ActiveCfg = Release|x86 - {7F8F2327-C016-49C8-BB4D-F3F77971961E}.Release|Any CPU.Build.0 = Release|x86 - {7F8F2327-C016-49C8-BB4D-F3F77971961E}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {7F8F2327-C016-49C8-BB4D-F3F77971961E}.Release|Mixed Platforms.Build.0 = Release|x86 - {7F8F2327-C016-49C8-BB4D-F3F77971961E}.Release|x86.ActiveCfg = Release|x86 - {7F8F2327-C016-49C8-BB4D-F3F77971961E}.Release|x86.Build.0 = Release|x86 - {29CC4385-294A-4885-A3E8-FD4825E0CFDD}.Debug|Any CPU.ActiveCfg = Debug|x86 - {29CC4385-294A-4885-A3E8-FD4825E0CFDD}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 - {29CC4385-294A-4885-A3E8-FD4825E0CFDD}.Debug|Mixed Platforms.Build.0 = Debug|x86 - {29CC4385-294A-4885-A3E8-FD4825E0CFDD}.Debug|x86.ActiveCfg = Debug|x86 - {29CC4385-294A-4885-A3E8-FD4825E0CFDD}.Debug|x86.Build.0 = Debug|x86 - {29CC4385-294A-4885-A3E8-FD4825E0CFDD}.Release|Any CPU.ActiveCfg = Release|x86 - {29CC4385-294A-4885-A3E8-FD4825E0CFDD}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {29CC4385-294A-4885-A3E8-FD4825E0CFDD}.Release|Mixed Platforms.Build.0 = Release|x86 - {29CC4385-294A-4885-A3E8-FD4825E0CFDD}.Release|x86.ActiveCfg = Release|x86 - {29CC4385-294A-4885-A3E8-FD4825E0CFDD}.Release|x86.Build.0 = Release|x86 - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F}.Debug|x86.ActiveCfg = Debug|Any CPU - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F}.Debug|x86.Build.0 = Debug|Any CPU - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F}.Release|Any CPU.Build.0 = Release|Any CPU - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F}.Release|x86.ActiveCfg = Release|Any CPU - {94144E22-2431-4A8F-AC04-DEC22F7EDD8F}.Release|x86.Build.0 = Release|Any CPU - {D0632D20-BC92-4A73-896B-30BB687732B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D0632D20-BC92-4A73-896B-30BB687732B8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {D0632D20-BC92-4A73-896B-30BB687732B8}.Debug|x86.ActiveCfg = Debug|Any CPU - {D0632D20-BC92-4A73-896B-30BB687732B8}.Release|Any CPU.ActiveCfg = Debug|Any CPU - {D0632D20-BC92-4A73-896B-30BB687732B8}.Release|Mixed Platforms.ActiveCfg = Debug|Any CPU - {D0632D20-BC92-4A73-896B-30BB687732B8}.Release|x86.ActiveCfg = Debug|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal