Browse Source

Merge branch '3.6-beta' of https://github.com/esotericsoftware/spine-runtimes into 3.6-beta

badlogic 8 years ago
parent
commit
4bb4c4d17a

+ 1 - 0
spine-cocos2dx/README.md

@@ -36,6 +36,7 @@ The Spine cocos2d-x example works on Windows and Mac OS X.
 5. Click `Browse Source` and select the directory `spine-runtimes`
 6. Click `Browse Build` and select the `spine-runtimes/spine-cocos2dx/build` directory. You can create the `build` folder directly in the file dialog via `New Folder`.
 7. Click `Configure`. This will download the cocos2d-x dependency and wire it up with the example source code in `spine-runtimes/spine-cocos2dx/example`. The download is 400mb, so get yourself a cup of tea.
+7. Open the file `spine-cocos2dx\example\cocos2d\cocos\2d\cocos2dx.props` and remove the `libSpine.lib` entry from the `<AdditionalDependencies>` tag.
 8. Open the `spine-runtimes/spine-cocos2dx/example/proj.win32/spine-cocos2d-x.sln` file in Visual Studio 2015. Visual Studio may ask you to install the Windows XP/7 SDK, which you should install.
 9. Expand the cocos2d_libs sub project and delete the `editor-support/spine` group. This will remove the outdated Spine cocos2d-x runtime shipped by cocos2d-x from your build.
 9. Expand `References` of the cocos2d_libs sub project, and remove the entry for `libSpine`, which should be marked with an error.

+ 2 - 4
spine-cocos2dx/example/proj.win32/main.cpp

@@ -2,9 +2,7 @@
 #include "AppDelegate.h"
 #include "cocos2d.h"
 
-USING_NS_CC;
-
-int APIENTRY _tWinMain(HINSTANCE hInstance,
+int wWinMain(HINSTANCE hInstance,
                        HINSTANCE hPrevInstance,
                        LPTSTR    lpCmdLine,
                        int       nCmdShow)
@@ -14,5 +12,5 @@ int APIENTRY _tWinMain(HINSTANCE hInstance,
 
     // create the application instance
     AppDelegate app;
-    return Application::getInstance()->run();
+    return cocos2d::Application::getInstance()->run();
 }

+ 3 - 0
spine-cocos2dx/example/proj.win32/spine-cocos2d-x.vcxproj

@@ -155,6 +155,7 @@ xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y
     <ClCompile Include="..\..\..\spine-c\spine-c\src\spine\Bone.c" />
     <ClCompile Include="..\..\..\spine-c\spine-c\src\spine\BoneData.c" />
     <ClCompile Include="..\..\..\spine-c\spine-c\src\spine\BoundingBoxAttachment.c" />
+    <ClCompile Include="..\..\..\spine-c\spine-c\src\spine\Color.c" />
     <ClCompile Include="..\..\..\spine-c\spine-c\src\spine\Event.c" />
     <ClCompile Include="..\..\..\spine-c\spine-c\src\spine\EventData.c" />
     <ClCompile Include="..\..\..\spine-c\spine-c\src\spine\extension.c" />
@@ -165,6 +166,7 @@ xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y
     <ClCompile Include="..\..\..\spine-c\spine-c\src\spine\PathAttachment.c" />
     <ClCompile Include="..\..\..\spine-c\spine-c\src\spine\PathConstraint.c" />
     <ClCompile Include="..\..\..\spine-c\spine-c\src\spine\PathConstraintData.c" />
+    <ClCompile Include="..\..\..\spine-c\spine-c\src\spine\PointAttachment.c" />
     <ClCompile Include="..\..\..\spine-c\spine-c\src\spine\RegionAttachment.c" />
     <ClCompile Include="..\..\..\spine-c\spine-c\src\spine\Skeleton.c" />
     <ClCompile Include="..\..\..\spine-c\spine-c\src\spine\SkeletonBinary.c" />
@@ -182,6 +184,7 @@ xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y
     <ClCompile Include="..\..\src\spine\SkeletonAnimation.cpp" />
     <ClCompile Include="..\..\src\spine\SkeletonBatch.cpp" />
     <ClCompile Include="..\..\src\spine\SkeletonRenderer.cpp" />
+    <ClCompile Include="..\..\src\spine\SkeletonTwoColorBatch.cpp" />
     <ClCompile Include="..\..\src\spine\spine-cocos2dx.cpp" />
     <ClCompile Include="..\Classes\AppDelegate.cpp" />
     <ClCompile Include="..\Classes\BatchingExample.cpp" />

+ 9 - 0
spine-cocos2dx/example/proj.win32/spine-cocos2d-x.vcxproj.filters

@@ -156,6 +156,15 @@
     <ClCompile Include="..\..\..\spine-c\spine-c\src\spine\VertexAttachment.c">
       <Filter>spine</Filter>
     </ClCompile>
+    <ClCompile Include="..\..\..\spine-c\spine-c\src\spine\Color.c">
+      <Filter>spine</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\..\spine-c\spine-c\src\spine\PointAttachment.c">
+      <Filter>spine</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\spine\SkeletonTwoColorBatch.cpp">
+      <Filter>spine-cocos2dx</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="main.h">

+ 2 - 4
spine-cocos2dx/src/spine/SkeletonTwoColorBatch.cpp

@@ -28,7 +28,6 @@
  * POSSIBILITY OF SUCH DAMAGE.
  *****************************************************************************/
 #include <spine/SkeletonTwoColorBatch.h>
-#include "external/xxhash/xxhash.h"
 #include <spine/extension.h>
 #include <algorithm>
 
@@ -84,9 +83,8 @@ void TwoColorTrianglesCommand::generateMaterialID() {
 		setSkipBatching(true);
 	}
 	else {
-		int glProgram = (int)_glProgram->getProgram();
-		int intArray[4] = { glProgram, (int)_textureID, (int)_blendType.src, (int)_blendType.dst};
-		_materialID = XXH32((const void*)intArray, sizeof(intArray), 0);
+		int glProgram = (int)_glProgram->getProgram();		
+		_materialID = glProgram + (int)_textureID + (int)_blendType.src + (int)_blendType.dst;
 	}
 }