[cpp] All Spine objects derrive from SpineObject so we can override new/delete, which in turn calls SpineExtension allocation methods (not implemented yet). Refactored SpineExtension, removing use of macros, introducing use of templated static methods for more comfort. Rewired all allocation code throughout the runtime. See #1046.
@ -9,7 +9,9 @@ set(SPINE_COCOS2D_X FALSE CACHE BOOL FALSE)
|
|||||||
|
|
||||||
if((${SPINE_SFML}) OR (${CMAKE_CURRENT_BINARY_DIR} MATCHES "spine-sfml"))
|
if((${SPINE_SFML}) OR (${CMAKE_CURRENT_BINARY_DIR} MATCHES "spine-sfml"))
|
||||||
add_subdirectory(spine-c)
|
add_subdirectory(spine-c)
|
||||||
add_subdirectory(spine-sfml)
|
add_subdirectory(spine-sfml/c)
|
||||||
|
add_subdirectory(spine-cpp)
|
||||||
|
add_subdirectory(spine-sfml/cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if((${SPINE_COCOS2D_OBJC}) OR (${CMAKE_CURRENT_BINARY_DIR} MATCHES "spine-cocos2d-objc"))
|
if((${SPINE_COCOS2D_OBJC}) OR (${CMAKE_CURRENT_BINARY_DIR} MATCHES "spine-cocos2d-objc"))
|
||||||
@ -22,4 +24,5 @@ if((${SPINE_COCOS2D_X}) OR (${CMAKE_CURRENT_BINARY_DIR} MATCHES "spine-cocos2dx"
|
|||||||
add_subdirectory(spine-cocos2dx)
|
add_subdirectory(spine-cocos2dx)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(spine-c/spine-c-unit-tests)
|
add_subdirectory(spine-c/spine-c-unit-tests)
|
||||||
|
add_subdirectory(spine-cpp/spine-cpp-unit-tests)
|
||||||
@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 2.8.9)
|
cmake_minimum_required(VERSION 2.8.9)
|
||||||
project(spine_unit_test)
|
project(spine_cpp_unit_test)
|
||||||
|
|
||||||
set(CMAKE_INSTALL_PREFIX "./")
|
set(CMAKE_INSTALL_PREFIX "./")
|
||||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||||
@ -38,21 +38,21 @@ set(MEMLEAK_SRC
|
|||||||
#########################################################
|
#########################################################
|
||||||
# setup main project
|
# setup main project
|
||||||
#########################################################
|
#########################################################
|
||||||
add_executable(spine_unit_test main.cpp ${MINICPP_SRC} ${TEAMCITY_SRC} ${TEST_SRC} ${MEMLEAK_SRC})
|
add_executable(spine_cpp_unit_test main.cpp ${MINICPP_SRC} ${TEAMCITY_SRC} ${TEST_SRC} ${MEMLEAK_SRC})
|
||||||
target_link_libraries(spine_unit_test spine-cpp)
|
target_link_libraries(spine_cpp_unit_test spine-cpp)
|
||||||
|
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
# copy resources to build output directory
|
# copy resources to build output directory
|
||||||
#########################################################
|
#########################################################
|
||||||
add_custom_command(TARGET spine_unit_test PRE_BUILD
|
add_custom_command(TARGET spine_cpp_unit_test PRE_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
${CMAKE_CURRENT_LIST_DIR}/../../examples/spineboy/export $<TARGET_FILE_DIR:spine_unit_test>/testdata/spineboy)
|
${CMAKE_CURRENT_LIST_DIR}/../../examples/spineboy/export $<TARGET_FILE_DIR:spine_cpp_unit_test>/testdata/spineboy)
|
||||||
|
|
||||||
add_custom_command(TARGET spine_unit_test PRE_BUILD
|
add_custom_command(TARGET spine_cpp_unit_test PRE_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
${CMAKE_CURRENT_LIST_DIR}/../../examples/raptor/export $<TARGET_FILE_DIR:spine_unit_test>/testdata/raptor)
|
${CMAKE_CURRENT_LIST_DIR}/../../examples/raptor/export $<TARGET_FILE_DIR:spine_cpp_unit_test>/testdata/raptor)
|
||||||
|
|
||||||
add_custom_command(TARGET spine_unit_test PRE_BUILD
|
add_custom_command(TARGET spine_cpp_unit_test PRE_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
${CMAKE_CURRENT_LIST_DIR}/../../examples/goblins/export $<TARGET_FILE_DIR:spine_unit_test>/testdata/goblins)
|
${CMAKE_CURRENT_LIST_DIR}/../../examples/goblins/export $<TARGET_FILE_DIR:spine_cpp_unit_test>/testdata/goblins)
|
||||||
|
|||||||
@ -1,28 +1,28 @@
|
|||||||
#include "C_InterfaceTestFixture.h"
|
#include "C_InterfaceTestFixture.h"
|
||||||
#include "SpineEventMonitor.h"
|
#include "SpineEventMonitor.h"
|
||||||
|
|
||||||
#include <spine/SkeletonJson.h>
|
|
||||||
#include <spine/SkeletonData.h>
|
|
||||||
#include <spine/Atlas.h>
|
|
||||||
#include <spine/AnimationStateData.h>
|
|
||||||
#include <spine/Skeleton.h>
|
|
||||||
#include <spine/AnimationState.h>
|
|
||||||
#include <spine/Animation.h>
|
|
||||||
|
|
||||||
#include <vector>
|
#include <spine/SkeletonJson.h>
|
||||||
#include <spine/Extension.h>
|
#include <spine/SkeletonData.h>
|
||||||
#include <spine/TextureLoader.h>
|
#include <spine/Atlas.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/AnimationStateData.h>
|
||||||
|
#include <spine/Skeleton.h>
|
||||||
#include <spine/CurveTimeline.h>
|
#include <spine/AnimationState.h>
|
||||||
#include <spine/VertexAttachment.h>
|
#include <spine/Animation.h>
|
||||||
#include <spine/Json.h>
|
|
||||||
|
#include <vector>
|
||||||
#include <spine/AttachmentLoader.h>
|
#include <spine/Extension.h>
|
||||||
#include <spine/AtlasAttachmentLoader.h>
|
#include <spine/TextureLoader.h>
|
||||||
|
#include <spine/Vector.h>
|
||||||
|
|
||||||
|
#include <spine/CurveTimeline.h>
|
||||||
|
#include <spine/VertexAttachment.h>
|
||||||
|
#include <spine/Json.h>
|
||||||
|
|
||||||
|
#include <spine/AttachmentLoader.h>
|
||||||
|
#include <spine/AtlasAttachmentLoader.h>
|
||||||
#include <spine/LinkedMesh.h>
|
#include <spine/LinkedMesh.h>
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
|
|
||||||
#include "KMemory.h" // last include
|
#include "KMemory.h" // last include
|
||||||
|
|
||||||
@ -35,7 +35,7 @@
|
|||||||
#define GOBLINS_JSON "testdata/goblins/goblins-pro.json"
|
#define GOBLINS_JSON "testdata/goblins/goblins-pro.json"
|
||||||
#define GOBLINS_ATLAS "testdata/goblins/goblins.atlas"
|
#define GOBLINS_ATLAS "testdata/goblins/goblins.atlas"
|
||||||
|
|
||||||
#define MAX_RUN_TIME 6000 // equal to about 100 seconds of execution
|
#define MAX_RUN_TIME 6000 // equal to about 100 seconds of execution
|
||||||
|
|
||||||
void C_InterfaceTestFixture::setUp()
|
void C_InterfaceTestFixture::setUp()
|
||||||
{
|
{
|
||||||
@ -45,21 +45,21 @@ void C_InterfaceTestFixture::tearDown()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static Spine::SkeletonData* readSkeletonJsonData(const char* filename, Atlas* atlas)
|
static Spine::SkeletonData* readSkeletonJsonData(const char* filename, Atlas* atlas)
|
||||||
{
|
{
|
||||||
using namespace Spine;
|
using namespace Spine;
|
||||||
|
|
||||||
Vector<Atlas*> atlasArray;
|
Vector<Atlas*> atlasArray;
|
||||||
atlasArray.push_back(atlas);
|
atlasArray.push_back(atlas);
|
||||||
|
|
||||||
SkeletonJson* skeletonJson = NEW(SkeletonJson);
|
SkeletonJson* skeletonJson = NEW(SkeletonJson);
|
||||||
new (skeletonJson) SkeletonJson(atlasArray);
|
new (skeletonJson) SkeletonJson(atlasArray);
|
||||||
ASSERT(skeletonJson != 0);
|
ASSERT(skeletonJson != 0);
|
||||||
|
|
||||||
SkeletonData* skeletonData = skeletonJson->readSkeletonDataFile(filename);
|
SkeletonData* skeletonData = skeletonJson->readSkeletonDataFile(filename);
|
||||||
ASSERT(skeletonData != 0);
|
ASSERT(skeletonData != 0);
|
||||||
|
|
||||||
DESTROY(SkeletonJson, skeletonJson);
|
DESTROY(SkeletonJson, skeletonJson);
|
||||||
|
|
||||||
return skeletonData;
|
return skeletonData;
|
||||||
}
|
}
|
||||||
@ -68,78 +68,78 @@ typedef std::vector<std::string> AnimList;
|
|||||||
|
|
||||||
static size_t enumerateAnimations(AnimList& outList, SkeletonData* skeletonData)
|
static size_t enumerateAnimations(AnimList& outList, SkeletonData* skeletonData)
|
||||||
{
|
{
|
||||||
if (skeletonData)
|
if (skeletonData)
|
||||||
{
|
{
|
||||||
for (int n = 0; n < skeletonData->getAnimations().size(); n++)
|
for (int n = 0; n < skeletonData->getAnimations().size(); n++)
|
||||||
{
|
{
|
||||||
outList.push_back(skeletonData->getAnimations()[n]->getName());
|
outList.push_back(skeletonData->getAnimations()[n]->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return outList.size();
|
return outList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyTextureLoader : public TextureLoader
|
class MyTextureLoader : public TextureLoader
|
||||||
{
|
{
|
||||||
virtual void load(AtlasPage& page, std::string path)
|
virtual void load(AtlasPage& page, std::string path)
|
||||||
{
|
{
|
||||||
page.rendererObject = NULL;
|
page.rendererObject = NULL;
|
||||||
page.width = 2048;
|
page.width = 2048;
|
||||||
page.height = 2048;
|
page.height = 2048;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void unload(void* texture)
|
virtual void unload(void* texture)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static void testRunner(const char* jsonName, const char* atlasName)
|
static void testRunner(const char* jsonName, const char* atlasName)
|
||||||
{
|
{
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Global Animation Information
|
// Global Animation Information
|
||||||
MyTextureLoader myTextureLoader;
|
MyTextureLoader myTextureLoader;
|
||||||
Atlas* atlas = NEW(Atlas);
|
Atlas* atlas = NEW(Atlas);
|
||||||
new (atlas) Atlas(atlasName, myTextureLoader);
|
new (atlas) Atlas(atlasName, myTextureLoader);
|
||||||
ASSERT(atlas != 0);
|
ASSERT(atlas != 0);
|
||||||
|
|
||||||
SkeletonData* skeletonData = readSkeletonJsonData(jsonName, atlas);
|
SkeletonData* skeletonData = readSkeletonJsonData(jsonName, atlas);
|
||||||
ASSERT(skeletonData != 0);
|
ASSERT(skeletonData != 0);
|
||||||
|
|
||||||
AnimationStateData* stateData = NEW(AnimationStateData);
|
AnimationStateData* stateData = NEW(AnimationStateData);
|
||||||
new (stateData) AnimationStateData(skeletonData);
|
new (stateData) AnimationStateData(skeletonData);
|
||||||
ASSERT(stateData != 0);
|
ASSERT(stateData != 0);
|
||||||
stateData->setDefaultMix(0.2f); // force mixing
|
stateData->setDefaultMix(0.2f); // force mixing
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Animation Instance
|
// Animation Instance
|
||||||
Skeleton* skeleton = NEW(Skeleton);
|
Skeleton* skeleton = NEW(Skeleton);
|
||||||
new (skeleton) Skeleton(skeletonData);
|
new (skeleton) Skeleton(skeletonData);
|
||||||
ASSERT(skeleton != 0);
|
ASSERT(skeleton != 0);
|
||||||
|
|
||||||
AnimationState* state = NEW(AnimationState);
|
AnimationState* state = NEW(AnimationState);
|
||||||
new (state) AnimationState(stateData);
|
new (state) AnimationState(stateData);
|
||||||
ASSERT(state != 0);
|
ASSERT(state != 0);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Run animation
|
// Run animation
|
||||||
skeleton->setToSetupPose();
|
skeleton->setToSetupPose();
|
||||||
SpineEventMonitor eventMonitor(state);
|
SpineEventMonitor eventMonitor(state);
|
||||||
|
|
||||||
AnimList anims; // Let's chain all the animations together as a test
|
AnimList anims; // Let's chain all the animations together as a test
|
||||||
size_t count = enumerateAnimations(anims, skeletonData);
|
size_t count = enumerateAnimations(anims, skeletonData);
|
||||||
if (count > 0)
|
if (count > 0)
|
||||||
{
|
{
|
||||||
state->setAnimation(0, anims[0].c_str(), false);
|
state->setAnimation(0, anims[0].c_str(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 1; i < count; ++i)
|
for (size_t i = 1; i < count; ++i)
|
||||||
{
|
{
|
||||||
state->addAnimation(0, anims[i].c_str(), false, 0.0f);
|
state->addAnimation(0, anims[i].c_str(), false, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run Loop
|
// Run Loop
|
||||||
for (int i = 0; i < MAX_RUN_TIME && eventMonitor.isAnimationPlaying(); ++i)
|
for (int i = 0; i < MAX_RUN_TIME && eventMonitor.isAnimationPlaying(); ++i)
|
||||||
{
|
{
|
||||||
const float timeSlice = 1.0f / 60.0f;
|
const float timeSlice = 1.0f / 60.0f;
|
||||||
skeleton->update(timeSlice);
|
skeleton->update(timeSlice);
|
||||||
@ -149,13 +149,13 @@ static void testRunner(const char* jsonName, const char* atlasName)
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Dispose Instance
|
// Dispose Instance
|
||||||
DESTROY(Skeleton, skeleton);
|
DESTROY(Skeleton, skeleton);
|
||||||
DESTROY(AnimationState, state);
|
DESTROY(AnimationState, state);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// Dispose Global
|
// Dispose Global
|
||||||
DESTROY(AnimationStateData, stateData);
|
DESTROY(AnimationStateData, stateData);
|
||||||
DESTROY(SkeletonData, skeletonData);
|
DESTROY(SkeletonData, skeletonData);
|
||||||
DESTROY(Atlas, atlas);
|
DESTROY(Atlas, atlas);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,339 +0,0 @@
|
|||||||
#include <spine/Extension.h>
|
|
||||||
#include "MemoryTestFixture.h"
|
|
||||||
#include "SpineEventMonitor.h"
|
|
||||||
|
|
||||||
#include "KMemory.h" // last include
|
|
||||||
|
|
||||||
#define SPINEBOY_JSON "testdata/spineboy/spineboy-ess.json"
|
|
||||||
#define SPINEBOY_ATLAS "testdata/spineboy/spineboy.atlas"
|
|
||||||
|
|
||||||
#define MAX_RUN_TIME 6000 // equal to about 100 seconds of execution
|
|
||||||
|
|
||||||
MemoryTestFixture::~MemoryTestFixture()
|
|
||||||
{
|
|
||||||
finalize();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemoryTestFixture::initialize()
|
|
||||||
{
|
|
||||||
// on a Per- Fixture Basis, before Test execution
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemoryTestFixture::finalize()
|
|
||||||
{
|
|
||||||
// on a Per- Fixture Basis, after all tests pass/fail
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemoryTestFixture::setUp()
|
|
||||||
{
|
|
||||||
// Setup on Per-Test Basis
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemoryTestFixture::tearDown()
|
|
||||||
{
|
|
||||||
// Tear Down on Per-Test Basis
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
// Helper methods
|
|
||||||
static spSkeletonData* readSkeletonJsonData(const char* filename, spAtlas* atlas) {
|
|
||||||
spSkeletonJson* json = spSkeletonJson_create(atlas);
|
|
||||||
ASSERT(json != 0);
|
|
||||||
|
|
||||||
spSkeletonData* skeletonData = spSkeletonJson_readSkeletonDataFile(json, filename);
|
|
||||||
ASSERT(skeletonData != 0);
|
|
||||||
|
|
||||||
spSkeletonJson_dispose(json);
|
|
||||||
return skeletonData;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void LoadSpineboyExample(spAtlas* &atlas, spSkeletonData* &skeletonData, spAnimationStateData* &stateData, spSkeleton* &skeleton, spAnimationState* &state)
|
|
||||||
{
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// Global Animation Information
|
|
||||||
atlas = spAtlas_createFromFile(SPINEBOY_ATLAS, 0);
|
|
||||||
ASSERT(atlas != 0);
|
|
||||||
|
|
||||||
skeletonData = readSkeletonJsonData(SPINEBOY_JSON, atlas);
|
|
||||||
ASSERT(skeletonData != 0);
|
|
||||||
|
|
||||||
stateData = spAnimationStateData_create(skeletonData);
|
|
||||||
ASSERT(stateData != 0);
|
|
||||||
stateData->defaultMix = 0.4f; // force mixing
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// Animation Instance
|
|
||||||
skeleton = spSkeleton_create(skeletonData);
|
|
||||||
ASSERT(skeleton != 0);
|
|
||||||
|
|
||||||
state = spAnimationState_create(stateData);
|
|
||||||
ASSERT(state != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void DisposeAll(spSkeleton* skeleton, spAnimationState* state, spAnimationStateData* stateData, spSkeletonData* skeletonData, spAtlas* atlas)
|
|
||||||
{
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// Dispose Instance
|
|
||||||
spSkeleton_dispose(skeleton);
|
|
||||||
spAnimationState_dispose(state);
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// Dispose Global
|
|
||||||
spAnimationStateData_dispose(stateData);
|
|
||||||
spSkeletonData_dispose(skeletonData);
|
|
||||||
spAtlas_dispose(atlas);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
// Reproduce Memory leak as described in Issue #776
|
|
||||||
// https://github.com/EsotericSoftware/spine-runtimes/issues/776
|
|
||||||
void MemoryTestFixture::reproduceIssue_776()
|
|
||||||
{
|
|
||||||
spAtlas* atlas = 0;
|
|
||||||
spSkeletonData* skeletonData = 0;
|
|
||||||
spAnimationStateData* stateData = 0;
|
|
||||||
spSkeleton* skeleton = 0;
|
|
||||||
spAnimationState* state = 0;
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
// Initialize Animations
|
|
||||||
LoadSpineboyExample(atlas, skeletonData, stateData, skeleton, state);
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// Run animation
|
|
||||||
spSkeleton_setToSetupPose(skeleton);
|
|
||||||
InterruptMonitor eventMonitor(state);
|
|
||||||
//eventMonitor.SetDebugLogging(true);
|
|
||||||
|
|
||||||
// Interrupt the animation on this specific sequence of spEventType(s)
|
|
||||||
eventMonitor
|
|
||||||
.AddInterruptEvent(SP_ANIMATION_INTERRUPT, "jump")
|
|
||||||
.AddInterruptEvent(SP_ANIMATION_START);
|
|
||||||
|
|
||||||
spAnimationState_setAnimationByName(state, 0, "walk", true);
|
|
||||||
spAnimationState_addAnimationByName(state, 0, "jump", false, 0.0f);
|
|
||||||
spAnimationState_addAnimationByName(state, 0, "run", true, 0.0f);
|
|
||||||
spAnimationState_addAnimationByName(state, 0, "jump", false, 3.0f);
|
|
||||||
spAnimationState_addAnimationByName(state, 0, "walk", true, 0.0f);
|
|
||||||
spAnimationState_addAnimationByName(state, 0, "idle", false, 1.0f);
|
|
||||||
|
|
||||||
for (int i = 0; i < MAX_RUN_TIME && eventMonitor.isAnimationPlaying(); ++i) {
|
|
||||||
const float timeSlice = 1.0f / 60.0f;
|
|
||||||
spSkeleton_update(skeleton, timeSlice);
|
|
||||||
spAnimationState_update(state, timeSlice);
|
|
||||||
spAnimationState_apply(state, skeleton);
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
// Cleanup Animations
|
|
||||||
DisposeAll(skeleton, state, stateData, skeletonData, atlas);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemoryTestFixture::reproduceIssue_777()
|
|
||||||
{
|
|
||||||
spAtlas* atlas = 0;
|
|
||||||
spSkeletonData* skeletonData = 0;
|
|
||||||
spAnimationStateData* stateData = 0;
|
|
||||||
spSkeleton* skeleton = 0;
|
|
||||||
spAnimationState* state = 0;
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
// Initialize Animations
|
|
||||||
LoadSpineboyExample(atlas, skeletonData, stateData, skeleton, state);
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// Run animation
|
|
||||||
spSkeleton_setToSetupPose(skeleton);
|
|
||||||
SpineEventMonitor eventMonitor(state);
|
|
||||||
//eventMonitor.SetDebugLogging(true);
|
|
||||||
|
|
||||||
// Set Animation and Play for 5 frames
|
|
||||||
spAnimationState_setAnimationByName(state, 0, "walk", true);
|
|
||||||
for (int i = 0; i < 5; ++i) {
|
|
||||||
const float timeSlice = 1.0f / 60.0f;
|
|
||||||
spSkeleton_update(skeleton, timeSlice);
|
|
||||||
spAnimationState_update(state, timeSlice);
|
|
||||||
spAnimationState_apply(state, skeleton);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Change animation twice in a row
|
|
||||||
spAnimationState_setAnimationByName(state, 0, "walk", false);
|
|
||||||
spAnimationState_setAnimationByName(state, 0, "run", false);
|
|
||||||
|
|
||||||
// run normal update
|
|
||||||
for (int i = 0; i < 5; ++i) {
|
|
||||||
const float timeSlice = 1.0f / 60.0f;
|
|
||||||
spSkeleton_update(skeleton, timeSlice);
|
|
||||||
spAnimationState_update(state, timeSlice);
|
|
||||||
spAnimationState_apply(state, skeleton);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now we'd lose mixingFrom (the first "walk" entry we set above) and should leak
|
|
||||||
spAnimationState_setAnimationByName(state, 0, "run", false);
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
// Cleanup Animations
|
|
||||||
DisposeAll(skeleton, state, stateData, skeletonData, atlas);
|
|
||||||
}
|
|
||||||
|
|
||||||
spSkeleton* skeleton = 0;
|
|
||||||
static void spineAnimStateHandler(spAnimationState* state, int type, spTrackEntry* entry, spEvent* event)
|
|
||||||
{
|
|
||||||
if (type == SP_ANIMATION_COMPLETE)
|
|
||||||
{
|
|
||||||
spAnimationState_setAnimationByName(state, 0, "walk", false);
|
|
||||||
spAnimationState_update(state, 0);
|
|
||||||
spAnimationState_apply(state, skeleton);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemoryTestFixture::reproduceIssue_Loop()
|
|
||||||
{
|
|
||||||
spAtlas* atlas = 0;
|
|
||||||
spSkeletonData* skeletonData = 0;
|
|
||||||
spAnimationStateData* stateData = 0;
|
|
||||||
spAnimationState* state = 0;
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
// Initialize Animations
|
|
||||||
LoadSpineboyExample(atlas, skeletonData, stateData, skeleton, state);
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
if (state)
|
|
||||||
state->listener = (spAnimationStateListener)&spineAnimStateHandler;
|
|
||||||
|
|
||||||
spAnimationState_setAnimationByName(state, 0, "walk", false);
|
|
||||||
|
|
||||||
// run normal update
|
|
||||||
for (int i = 0; i < 50; ++i) {
|
|
||||||
const float timeSlice = 1.0f / 60.0f;
|
|
||||||
spSkeleton_update(skeleton, timeSlice);
|
|
||||||
spAnimationState_update(state, timeSlice);
|
|
||||||
spAnimationState_apply(state, skeleton);
|
|
||||||
}
|
|
||||||
|
|
||||||
DisposeAll(skeleton, state, stateData, skeletonData, atlas);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemoryTestFixture::triangulator() {
|
|
||||||
spTriangulator* triangulator = spTriangulator_create();
|
|
||||||
spFloatArray* polygon = spFloatArray_create(16);
|
|
||||||
spFloatArray_add(polygon, 0);
|
|
||||||
spFloatArray_add(polygon, 0);
|
|
||||||
spFloatArray_add(polygon, 100);
|
|
||||||
spFloatArray_add(polygon, 0);
|
|
||||||
spFloatArray_add(polygon, 100);
|
|
||||||
spFloatArray_add(polygon, 100);
|
|
||||||
spFloatArray_add(polygon, 0);
|
|
||||||
spFloatArray_add(polygon, 100);
|
|
||||||
|
|
||||||
spShortArray* triangles = spTriangulator_triangulate(triangulator, polygon);
|
|
||||||
ASSERT(triangles->size == 6);
|
|
||||||
ASSERT(triangles->items[0] == 3);
|
|
||||||
ASSERT(triangles->items[1] == 0);
|
|
||||||
ASSERT(triangles->items[2] == 1);
|
|
||||||
ASSERT(triangles->items[3] == 3);
|
|
||||||
ASSERT(triangles->items[4] == 1);
|
|
||||||
ASSERT(triangles->items[5] == 2);
|
|
||||||
|
|
||||||
spArrayFloatArray* polys = spTriangulator_decompose(triangulator, polygon, triangles);
|
|
||||||
ASSERT(polys->size == 1);
|
|
||||||
ASSERT(polys->items[0]->size == 8);
|
|
||||||
ASSERT(polys->items[0]->items[0] == 0);
|
|
||||||
ASSERT(polys->items[0]->items[1] == 100);
|
|
||||||
ASSERT(polys->items[0]->items[2] == 0);
|
|
||||||
ASSERT(polys->items[0]->items[3] == 0);
|
|
||||||
ASSERT(polys->items[0]->items[4] == 100);
|
|
||||||
ASSERT(polys->items[0]->items[5] == 0);
|
|
||||||
ASSERT(polys->items[0]->items[6] == 100);
|
|
||||||
ASSERT(polys->items[0]->items[7] == 100);
|
|
||||||
|
|
||||||
spFloatArray_dispose(polygon);
|
|
||||||
spTriangulator_dispose(triangulator);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MemoryTestFixture::skeletonClipper() {
|
|
||||||
spSkeletonClipping* clipping = spSkeletonClipping_create();
|
|
||||||
|
|
||||||
spBoneData* boneData = spBoneData_create(0, "bone", 0);
|
|
||||||
spBone* bone = spBone_create(boneData, 0, 0);
|
|
||||||
CONST_CAST(float, bone->a) = 1;
|
|
||||||
CONST_CAST(float, bone->b) = 0;
|
|
||||||
CONST_CAST(float, bone->c) = 0;
|
|
||||||
CONST_CAST(float, bone->d) = 1;
|
|
||||||
CONST_CAST(float, bone->worldX) = 0;
|
|
||||||
CONST_CAST(float, bone->worldY) = 0;
|
|
||||||
spSlotData* slotData = spSlotData_create(0, "slot", 0);
|
|
||||||
spSlot* slot = spSlot_create(slotData, bone);
|
|
||||||
spClippingAttachment* clip = spClippingAttachment_create("clipping");
|
|
||||||
clip->endSlot = slotData;
|
|
||||||
clip->super.worldVerticesLength = 4 * 2;
|
|
||||||
clip->super.verticesCount = 4;
|
|
||||||
clip->super.vertices = MALLOC(float, 4 * 8);
|
|
||||||
clip->super.vertices[0] = 0;
|
|
||||||
clip->super.vertices[1] = 50;
|
|
||||||
clip->super.vertices[2] = 100;
|
|
||||||
clip->super.vertices[3] = 50;
|
|
||||||
clip->super.vertices[4] = 100;
|
|
||||||
clip->super.vertices[5] = 70;
|
|
||||||
clip->super.vertices[6] = 0;
|
|
||||||
clip->super.vertices[7] = 70;
|
|
||||||
|
|
||||||
spSkeletonClipping_clipStart(clipping, slot, clip);
|
|
||||||
|
|
||||||
spFloatArray* vertices = spFloatArray_create(16);
|
|
||||||
spFloatArray_add(vertices, 0);
|
|
||||||
spFloatArray_add(vertices, 0);
|
|
||||||
spFloatArray_add(vertices, 100);
|
|
||||||
spFloatArray_add(vertices, 0);
|
|
||||||
spFloatArray_add(vertices, 50);
|
|
||||||
spFloatArray_add(vertices, 150);
|
|
||||||
spFloatArray* uvs = spFloatArray_create(16);
|
|
||||||
spFloatArray_add(uvs, 0);
|
|
||||||
spFloatArray_add(uvs, 0);
|
|
||||||
spFloatArray_add(uvs, 1);
|
|
||||||
spFloatArray_add(uvs, 0);
|
|
||||||
spFloatArray_add(uvs, 0.5f);
|
|
||||||
spFloatArray_add(uvs, 1);
|
|
||||||
spUnsignedShortArray* indices = spUnsignedShortArray_create(16);
|
|
||||||
spUnsignedShortArray_add(indices, 0);
|
|
||||||
spUnsignedShortArray_add(indices, 1);
|
|
||||||
spUnsignedShortArray_add(indices, 2);
|
|
||||||
|
|
||||||
spSkeletonClipping_clipTriangles(clipping, vertices->items, vertices->size, indices->items, indices->size, uvs->items, 2);
|
|
||||||
|
|
||||||
float expectedVertices[8] = { 83.333328, 50.000000, 76.666664, 70.000000, 23.333334, 70.000000, 16.666672, 50.000000 };
|
|
||||||
ASSERT(clipping->clippedVertices->size == 8);
|
|
||||||
for (int i = 0; i < clipping->clippedVertices->size; i++) {
|
|
||||||
ASSERT(ABS(clipping->clippedVertices->items[i] - expectedVertices[i]) < 0.001);
|
|
||||||
}
|
|
||||||
|
|
||||||
float expectedUVs[8] = { 0.833333f, 0.333333, 0.766667, 0.466667, 0.233333, 0.466667, 0.166667, 0.333333 };
|
|
||||||
ASSERT(clipping->clippedUVs->size == 8);
|
|
||||||
for (int i = 0; i < clipping->clippedUVs->size; i++) {
|
|
||||||
ASSERT(ABS(clipping->clippedUVs->items[i] - expectedUVs[i]) < 0.001);
|
|
||||||
}
|
|
||||||
|
|
||||||
short expectedIndices[6] = { 0, 1, 2, 0, 2, 3 };
|
|
||||||
ASSERT(clipping->clippedTriangles->size == 6);
|
|
||||||
for (int i = 0; i < clipping->clippedTriangles->size; i++) {
|
|
||||||
ASSERT(clipping->clippedTriangles->items[i] == expectedIndices[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
spFloatArray_dispose(vertices);
|
|
||||||
spFloatArray_dispose(uvs);
|
|
||||||
spUnsignedShortArray_dispose(indices);
|
|
||||||
|
|
||||||
spSlotData_dispose(slotData);
|
|
||||||
spSlot_dispose(slot);
|
|
||||||
spBoneData_dispose(boneData);
|
|
||||||
spBone_dispose(bone);
|
|
||||||
_spClippingAttachment_dispose(SUPER(SUPER(clip)));
|
|
||||||
spSkeletonClipping_dispose(clipping);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,50 +0,0 @@
|
|||||||
//////////////////////////////////////////////////////////////////////
|
|
||||||
// filename: MemoryTestFixture.h
|
|
||||||
//
|
|
||||||
// purpose: Reproduce Memory Error/Leak Bugs to help debug
|
|
||||||
// and for regression testing
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include "MiniCppUnit.hxx"
|
|
||||||
#include "TestOptions.h"
|
|
||||||
|
|
||||||
class MemoryTestFixture : public TestFixture < MemoryTestFixture >
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
TEST_FIXTURE(MemoryTestFixture){
|
|
||||||
|
|
||||||
// Comment out here to disable individual test cases
|
|
||||||
TEST_CASE(reproduceIssue_776);
|
|
||||||
TEST_CASE(reproduceIssue_777);
|
|
||||||
TEST_CASE(reproduceIssue_Loop);
|
|
||||||
TEST_CASE(triangulator);
|
|
||||||
TEST_CASE(skeletonClipper);
|
|
||||||
|
|
||||||
initialize();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~MemoryTestFixture();
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
// Test Cases
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
public:
|
|
||||||
void reproduceIssue_776();
|
|
||||||
void reproduceIssue_777();
|
|
||||||
void reproduceIssue_Loop(); // http://esotericsoftware.com/forum/spine-c-3-5-animation-jerking-7451
|
|
||||||
void triangulator();
|
|
||||||
void skeletonClipper();
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
// test fixture setup
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
|
||||||
void initialize();
|
|
||||||
void finalize();
|
|
||||||
public:
|
|
||||||
virtual void setUp();
|
|
||||||
virtual void tearDown();
|
|
||||||
};
|
|
||||||
#if defined(gForceAllTests) || defined(gMemoryTestFixture)
|
|
||||||
REGISTER_FIXTURE(MemoryTestFixture);
|
|
||||||
#endif
|
|
||||||
@ -34,6 +34,7 @@
|
|||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
#include <spine/MixPose.h>
|
#include <spine/MixPose.h>
|
||||||
#include <spine/MixDirection.h>
|
#include <spine/MixDirection.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ namespace Spine {
|
|||||||
class Skeleton;
|
class Skeleton;
|
||||||
class Event;
|
class Event;
|
||||||
|
|
||||||
class Animation {
|
class Animation : public SpineObject {
|
||||||
friend class AnimationState;
|
friend class AnimationState;
|
||||||
friend class TrackEntry;
|
friend class TrackEntry;
|
||||||
friend class AnimationStateData;
|
friend class AnimationStateData;
|
||||||
|
|||||||
@ -34,6 +34,7 @@
|
|||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
#include <spine/Pool.h>
|
#include <spine/Pool.h>
|
||||||
#include <spine/MixPose.h>
|
#include <spine/MixPose.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
enum EventType {
|
enum EventType {
|
||||||
@ -57,7 +58,7 @@ namespace Spine {
|
|||||||
typedef void (*OnAnimationEventFunc) (AnimationState* state, EventType type, TrackEntry* entry, Event* event);
|
typedef void (*OnAnimationEventFunc) (AnimationState* state, EventType type, TrackEntry* entry, Event* event);
|
||||||
|
|
||||||
/// State for the playback of an animation
|
/// State for the playback of an animation
|
||||||
class TrackEntry {
|
class TrackEntry : public SpineObject {
|
||||||
friend class EventQueue;
|
friend class EventQueue;
|
||||||
friend class AnimationState;
|
friend class AnimationState;
|
||||||
|
|
||||||
@ -238,7 +239,7 @@ namespace Spine {
|
|||||||
void reset();
|
void reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
class EventQueueEntry {
|
class EventQueueEntry : public SpineObject {
|
||||||
friend class EventQueue;
|
friend class EventQueue;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -249,7 +250,7 @@ namespace Spine {
|
|||||||
EventQueueEntry(EventType eventType, TrackEntry* trackEntry, Event* event = NULL);
|
EventQueueEntry(EventType eventType, TrackEntry* trackEntry, Event* event = NULL);
|
||||||
};
|
};
|
||||||
|
|
||||||
class EventQueue {
|
class EventQueue : public SpineObject {
|
||||||
friend class AnimationState;
|
friend class AnimationState;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -282,7 +283,7 @@ namespace Spine {
|
|||||||
void drain();
|
void drain();
|
||||||
};
|
};
|
||||||
|
|
||||||
class AnimationState {
|
class AnimationState : public SpineObject {
|
||||||
friend class TrackEntry;
|
friend class TrackEntry;
|
||||||
friend class EventQueue;
|
friend class EventQueue;
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,7 @@
|
|||||||
#define Spine_AnimationStateData_h
|
#define Spine_AnimationStateData_h
|
||||||
|
|
||||||
#include <spine/HashMap.h>
|
#include <spine/HashMap.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -41,7 +42,7 @@ namespace Spine {
|
|||||||
class Animation;
|
class Animation;
|
||||||
|
|
||||||
/// Stores mix (crossfade) durations to be applied when AnimationState animations are changed.
|
/// Stores mix (crossfade) durations to be applied when AnimationState animations are changed.
|
||||||
class AnimationStateData {
|
class AnimationStateData : public SpineObject {
|
||||||
friend class AnimationState;
|
friend class AnimationState;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -68,7 +69,7 @@ namespace Spine {
|
|||||||
float getMix(Animation* from, Animation* to);
|
float getMix(Animation* from, Animation* to);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class AnimationPair {
|
class AnimationPair : public SpineObject {
|
||||||
public:
|
public:
|
||||||
Animation* _a1;
|
Animation* _a1;
|
||||||
Animation* _a2;
|
Animation* _a2;
|
||||||
@ -78,7 +79,7 @@ namespace Spine {
|
|||||||
bool operator==(const AnimationPair &other) const;
|
bool operator==(const AnimationPair &other) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct HashAnimationPair {
|
struct HashAnimationPair : public SpineObject {
|
||||||
std::size_t operator()(const Spine::AnimationStateData::AnimationPair& val) const;
|
std::size_t operator()(const Spine::AnimationStateData::AnimationPair& val) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
#include <spine/Extension.h>
|
#include <spine/Extension.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ namespace Spine {
|
|||||||
TextureWrap_Repeat
|
TextureWrap_Repeat
|
||||||
};
|
};
|
||||||
|
|
||||||
class AtlasPage {
|
class AtlasPage : public SpineObject {
|
||||||
public:
|
public:
|
||||||
std::string name;
|
std::string name;
|
||||||
Format format;
|
Format format;
|
||||||
@ -77,7 +78,7 @@ namespace Spine {
|
|||||||
AtlasPage(std::string inName) : name(inName) {}
|
AtlasPage(std::string inName) : name(inName) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class AtlasRegion {
|
class AtlasRegion : public SpineObject {
|
||||||
public:
|
public:
|
||||||
AtlasPage* page;
|
AtlasPage* page;
|
||||||
std::string name;
|
std::string name;
|
||||||
@ -93,7 +94,7 @@ namespace Spine {
|
|||||||
|
|
||||||
class TextureLoader;
|
class TextureLoader;
|
||||||
|
|
||||||
class Atlas {
|
class Atlas : SpineObject {
|
||||||
public:
|
public:
|
||||||
Atlas(const char* path, TextureLoader& textureLoader);
|
Atlas(const char* path, TextureLoader& textureLoader);
|
||||||
|
|
||||||
|
|||||||
@ -32,9 +32,9 @@
|
|||||||
#define Spine_AtlasAttachmentLoader_h
|
#define Spine_AtlasAttachmentLoader_h
|
||||||
|
|
||||||
#include <spine/AttachmentLoader.h>
|
#include <spine/AttachmentLoader.h>
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
|
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
class Atlas;
|
class Atlas;
|
||||||
class AtlasRegion;
|
class AtlasRegion;
|
||||||
@ -47,7 +47,7 @@ namespace Spine {
|
|||||||
RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AtlasAttachmentLoader(Vector<Atlas*>& inAtlasArray);
|
AtlasAttachmentLoader(Atlas& atlas);
|
||||||
|
|
||||||
virtual RegionAttachment* newRegionAttachment(Skin& skin, std::string name, std::string path);
|
virtual RegionAttachment* newRegionAttachment(Skin& skin, std::string name, std::string path);
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ namespace Spine {
|
|||||||
AtlasRegion* findRegion(std::string name);
|
AtlasRegion* findRegion(std::string name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Vector<Atlas*> _atlasArray;
|
Atlas& _atlas;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,11 +32,11 @@
|
|||||||
#define Spine_Attachment_h
|
#define Spine_Attachment_h
|
||||||
|
|
||||||
#include <spine/RTTI.h>
|
#include <spine/RTTI.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
class Attachment {
|
class Attachment : public SpineObject {
|
||||||
RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
#define Spine_AttachmentLoader_h
|
#define Spine_AttachmentLoader_h
|
||||||
|
|
||||||
#include <spine/RTTI.h>
|
#include <spine/RTTI.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
@ -44,7 +44,7 @@ namespace Spine {
|
|||||||
class PointAttachment;
|
class PointAttachment;
|
||||||
class ClippingAttachment;
|
class ClippingAttachment;
|
||||||
|
|
||||||
class AttachmentLoader {
|
class AttachmentLoader : public SpineObject {
|
||||||
RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
AttachmentLoader();
|
AttachmentLoader();
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
#define Spine_AttachmentTimeline_h
|
#define Spine_AttachmentTimeline_h
|
||||||
|
|
||||||
#include <spine/Timeline.h>
|
#include <spine/Timeline.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
#include <spine/MixPose.h>
|
#include <spine/MixPose.h>
|
||||||
#include <spine/MixDirection.h>
|
#include <spine/MixDirection.h>
|
||||||
|
|||||||
@ -32,7 +32,7 @@
|
|||||||
#define Spine_Bone_h
|
#define Spine_Bone_h
|
||||||
|
|
||||||
#include <spine/Updatable.h>
|
#include <spine/Updatable.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
|
|||||||
@ -32,11 +32,11 @@
|
|||||||
#define Spine_BoneData_h
|
#define Spine_BoneData_h
|
||||||
|
|
||||||
#include <spine/TransformMode.h>
|
#include <spine/TransformMode.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
class BoneData {
|
class BoneData : public SpineObject {
|
||||||
friend class SkeletonBinary;
|
friend class SkeletonBinary;
|
||||||
friend class SkeletonJson;
|
friend class SkeletonJson;
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,7 @@
|
|||||||
#define Spine_BoundingBoxAttachment_h
|
#define Spine_BoundingBoxAttachment_h
|
||||||
|
|
||||||
#include <spine/VertexAttachment.h>
|
#include <spine/VertexAttachment.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
/// Attachment that has a polygon for bounds checking.
|
/// Attachment that has a polygon for bounds checking.
|
||||||
|
|||||||
@ -34,12 +34,13 @@
|
|||||||
#include <spine/Extension.h>
|
#include <spine/Extension.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
#include <spine/HashMap.h>
|
#include <spine/HashMap.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
class ContainerUtil {
|
class ContainerUtil : public SpineObject {
|
||||||
public:
|
public:
|
||||||
/// Finds an item by comparing each item's name.
|
/// Finds an item by comparing each item's name.
|
||||||
/// It is more efficient to cache the results of this method than to call it multiple times.
|
/// It is more efficient to cache the results of this method than to call it multiple times.
|
||||||
@ -110,7 +111,7 @@ namespace Spine {
|
|||||||
for (size_t i = 0; i < items.size(); ) {
|
for (size_t i = 0; i < items.size(); ) {
|
||||||
T* item = items[i];
|
T* item = items[i];
|
||||||
|
|
||||||
DESTROY(T, item);
|
delete item;
|
||||||
|
|
||||||
items.erase(i);
|
items.erase(i);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,13 +31,15 @@
|
|||||||
#ifndef Spine_Event_h
|
#ifndef Spine_Event_h
|
||||||
#define Spine_Event_h
|
#define Spine_Event_h
|
||||||
|
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
class EventData;
|
class EventData;
|
||||||
|
|
||||||
/// Stores the current pose values for an Event.
|
/// Stores the current pose values for an Event.
|
||||||
class Event {
|
class Event : public SpineObject {
|
||||||
friend class SkeletonBinary;
|
friend class SkeletonBinary;
|
||||||
friend class SkeletonJson;
|
friend class SkeletonJson;
|
||||||
friend class AnimationState;
|
friend class AnimationState;
|
||||||
|
|||||||
@ -31,11 +31,13 @@
|
|||||||
#ifndef Spine_EventData_h
|
#ifndef Spine_EventData_h
|
||||||
#define Spine_EventData_h
|
#define Spine_EventData_h
|
||||||
|
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
/// Stores the setup pose values for an Event.
|
/// Stores the setup pose values for an Event.
|
||||||
class EventData {
|
class EventData : public SpineObject {
|
||||||
friend class SkeletonBinary;
|
friend class SkeletonBinary;
|
||||||
friend class SkeletonJson;
|
friend class SkeletonJson;
|
||||||
friend class Event;
|
friend class Event;
|
||||||
|
|||||||
@ -33,42 +33,64 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#define SPINE_EXTENSION (SpineExtension::getInstance())
|
// #define SPINE_EXTENSION (SpineExtension::getInstance())
|
||||||
|
|
||||||
/* All allocation uses these. */
|
/* All allocation uses these. */
|
||||||
|
/*
|
||||||
#define MALLOC(TYPE,COUNT) ((TYPE*)SPINE_EXTENSION->spineAlloc(sizeof(TYPE) * (COUNT), __FILE__, __LINE__))
|
#define MALLOC(TYPE,COUNT) ((TYPE*)SPINE_EXTENSION->spineAlloc(sizeof(TYPE) * (COUNT), __FILE__, __LINE__))
|
||||||
#define CALLOC(TYPE,COUNT) ((TYPE*)SPINE_EXTENSION->spineCalloc(COUNT, sizeof(TYPE), __FILE__, __LINE__))
|
#define CALLOC(TYPE,COUNT) ((TYPE*)SPINE_EXTENSION->spineCalloc(COUNT, sizeof(TYPE), __FILE__, __LINE__))
|
||||||
#define NEW(TYPE) CALLOC(TYPE,1)
|
#define NEW(TYPE) CALLOC(TYPE,1)
|
||||||
#define REALLOC(PTR,TYPE,COUNT) ((TYPE*)SPINE_EXTENSION->spineRealloc(PTR, sizeof(TYPE) * (COUNT), __FILE__, __LINE__))
|
#define REALLOC(PTR,TYPE,COUNT) ((TYPE*)SPINE_EXTENSION->spineRealloc(PTR, sizeof(TYPE) * (COUNT), __FILE__, __LINE__))
|
||||||
|
*/
|
||||||
|
|
||||||
/* Frees memory. Can be used on const types. */
|
/* Frees memory. Can be used on const types. */
|
||||||
#define FREE(VALUE) SPINE_EXTENSION->spineFree((void*)VALUE)
|
// #define FREE(VALUE) SPINE_EXTENSION->spinefree(VALUE)
|
||||||
|
|
||||||
/* Call destructor and then frees memory. Can be used on const types. */
|
/* Call destructor and then frees memory. Can be used on const types. */
|
||||||
#define DESTROY(TYPE,VALUE) VALUE->~TYPE(); SPINE_EXTENSION->spineFree((void*)VALUE)
|
// #define DESTROY(TYPE,VALUE) VALUE->~TYPE(); SPINE_EXTENSION->spinefree(VALUE)
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
class SpineExtension {
|
class SpineExtension {
|
||||||
public:
|
public:
|
||||||
|
template <typename T> static T* alloc(size_t num, const char* file, int line) {
|
||||||
|
return (T*)getInstance()->_alloc(sizeof(T) * num, file, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T> static T* calloc(size_t num, const char* file, int line) {
|
||||||
|
return (T*)getInstance()->_calloc(sizeof(T) * num, file, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T> static T* realloc(T* ptr, size_t num, const char* file, int line) {
|
||||||
|
return (T*)getInstance()->_realloc(ptr, sizeof(T) * num, file, line);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T> static void free(T* ptr) {
|
||||||
|
getInstance()->_free((void*)ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static char* readFile(const char* path, int* length) {
|
||||||
|
return getInstance()->_readFile(path, length);
|
||||||
|
}
|
||||||
|
|
||||||
static void setInstance(SpineExtension* inSpineExtension);
|
static void setInstance(SpineExtension* inSpineExtension);
|
||||||
|
|
||||||
static SpineExtension* getInstance();
|
static SpineExtension* getInstance();
|
||||||
|
|
||||||
virtual ~SpineExtension();
|
virtual ~SpineExtension();
|
||||||
|
|
||||||
|
protected:
|
||||||
/// Implement this function to use your own memory allocator
|
/// Implement this function to use your own memory allocator
|
||||||
virtual void* spineAlloc(size_t size, const char* file, int line) = 0;
|
virtual void* _alloc(size_t size, const char* file, int line) = 0;
|
||||||
|
|
||||||
virtual void* spineCalloc(size_t num, size_t size, const char* file, int line) = 0;
|
virtual void* _calloc(size_t size, const char* file, int line) = 0;
|
||||||
|
|
||||||
virtual void* spineRealloc(void* ptr, size_t size, const char* file, int line) = 0;
|
virtual void* _realloc(void* ptr, size_t size, const char* file, int line) = 0;
|
||||||
|
|
||||||
/// If you provide a spineAllocFunc, you should also provide a spineFreeFunc
|
/// If you provide a spineAllocFunc, you should also provide a spineFreeFunc
|
||||||
virtual void spineFree(void* mem) = 0;
|
virtual void _free(void* mem) = 0;
|
||||||
|
|
||||||
virtual char* spineReadFile(const char* path, int* length);
|
virtual char* _readFile(const char* path, int* length);
|
||||||
|
|
||||||
protected:
|
|
||||||
SpineExtension();
|
SpineExtension();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -77,19 +99,17 @@ namespace Spine {
|
|||||||
|
|
||||||
class DefaultSpineExtension : public SpineExtension {
|
class DefaultSpineExtension : public SpineExtension {
|
||||||
public:
|
public:
|
||||||
static DefaultSpineExtension* getInstance();
|
|
||||||
|
|
||||||
virtual ~DefaultSpineExtension();
|
virtual ~DefaultSpineExtension();
|
||||||
|
|
||||||
virtual void* spineAlloc(size_t size, const char* file, int line);
|
|
||||||
|
|
||||||
virtual void* spineCalloc(size_t num, size_t size, const char* file, int line);
|
|
||||||
|
|
||||||
virtual void* spineRealloc(void* ptr, size_t size, const char* file, int line);
|
|
||||||
|
|
||||||
virtual void spineFree(void* mem);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void* _alloc(size_t size, const char* file, int line);
|
||||||
|
|
||||||
|
virtual void* _calloc(size_t size, const char* file, int line);
|
||||||
|
|
||||||
|
virtual void* _realloc(void* ptr, size_t size, const char* file, int line);
|
||||||
|
|
||||||
|
virtual void _free(void* mem);
|
||||||
|
|
||||||
DefaultSpineExtension();
|
DefaultSpineExtension();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,15 +33,16 @@
|
|||||||
|
|
||||||
#include <spine/Extension.h>
|
#include <spine/Extension.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
template <typename K, typename V, typename H>
|
template <typename K, typename V, typename H>
|
||||||
class HashMap {
|
class HashMap : public SpineObject {
|
||||||
private:
|
private:
|
||||||
class Entry;
|
class Entry;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class Iterator {
|
class Iterator : public SpineObject {
|
||||||
friend class HashMap;
|
friend class HashMap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -129,8 +130,7 @@ namespace Spine {
|
|||||||
|
|
||||||
size_t index = hash(key);
|
size_t index = hash(key);
|
||||||
|
|
||||||
Entry* entry = NEW(Entry);
|
Entry* entry = new Entry();
|
||||||
new (entry) Entry();
|
|
||||||
entry->_key = key;
|
entry->_key = key;
|
||||||
entry->_value = value;
|
entry->_value = value;
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ namespace Spine {
|
|||||||
pos._entry->next->prev = pos._entry->prev;
|
pos._entry->next->prev = pos._entry->prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
DESTROY(Entry, pos._entry);
|
delete pos._entry;
|
||||||
}
|
}
|
||||||
else if (_hashTable[index].next == pos._entry) {
|
else if (_hashTable[index].next == pos._entry) {
|
||||||
_hashTable[index].next = pos._entry->next;
|
_hashTable[index].next = pos._entry->next;
|
||||||
@ -235,7 +235,7 @@ namespace Spine {
|
|||||||
pos._entry->next->prev = pos._entry->prev;
|
pos._entry->next->prev = pos._entry->prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
DESTROY(Entry, pos._entry);
|
delete pos._entry;
|
||||||
}
|
}
|
||||||
else if (_hashTable[index].prev == pos._entry) {
|
else if (_hashTable[index].prev == pos._entry) {
|
||||||
_hashTable[index].prev = pos._entry->prev;
|
_hashTable[index].prev = pos._entry->prev;
|
||||||
@ -248,13 +248,13 @@ namespace Spine {
|
|||||||
pos._entry->next->prev = pos._entry->prev;
|
pos._entry->next->prev = pos._entry->prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
DESTROY(Entry, pos._entry);
|
delete pos._entry;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pos._entry->prev->next = pos._entry->next;
|
pos._entry->prev->next = pos._entry->next;
|
||||||
pos._entry->next->prev = pos._entry->prev;
|
pos._entry->next->prev = pos._entry->prev;
|
||||||
|
|
||||||
DESTROY(Entry, pos._entry);
|
delete pos._entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
_hashSize--;
|
_hashSize--;
|
||||||
@ -276,7 +276,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Entry {
|
class Entry : public SpineObject {
|
||||||
public:
|
public:
|
||||||
K _key;
|
K _key;
|
||||||
V _value;
|
V _value;
|
||||||
|
|||||||
@ -32,13 +32,14 @@
|
|||||||
#define Spine_IkConstraintData_h
|
#define Spine_IkConstraintData_h
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
class BoneData;
|
class BoneData;
|
||||||
|
|
||||||
class IkConstraintData {
|
class IkConstraintData : public SpineObject {
|
||||||
friend class SkeletonBinary;
|
friend class SkeletonBinary;
|
||||||
friend class SkeletonJson;
|
friend class SkeletonJson;
|
||||||
friend class IkConstraint;
|
friend class IkConstraint;
|
||||||
|
|||||||
@ -31,13 +31,15 @@
|
|||||||
#ifndef Spine_Json_h
|
#ifndef Spine_Json_h
|
||||||
#define Spine_Json_h
|
#define Spine_Json_h
|
||||||
|
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
#ifndef SPINE_JSON_HAVE_PREV
|
#ifndef SPINE_JSON_HAVE_PREV
|
||||||
/* Spine doesn't use the "prev" link in the Json sibling lists. */
|
/* Spine doesn't use the "prev" link in the Json sibling lists. */
|
||||||
#define SPINE_JSON_HAVE_PREV 0
|
#define SPINE_JSON_HAVE_PREV 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
class Json {
|
class Json : public SpineObject {
|
||||||
friend class SkeletonJson;
|
friend class SkeletonJson;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -31,12 +31,14 @@
|
|||||||
#ifndef Spine_LinkedMesh_h
|
#ifndef Spine_LinkedMesh_h
|
||||||
#define Spine_LinkedMesh_h
|
#define Spine_LinkedMesh_h
|
||||||
|
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
class MeshAttachment;
|
class MeshAttachment;
|
||||||
|
|
||||||
class LinkedMesh {
|
class LinkedMesh : public SpineObject {
|
||||||
friend class SkeletonBinary;
|
friend class SkeletonBinary;
|
||||||
friend class SkeletonJson;
|
friend class SkeletonJson;
|
||||||
|
|
||||||
|
|||||||
@ -31,6 +31,8 @@
|
|||||||
#ifndef Spine_MathUtil_h
|
#ifndef Spine_MathUtil_h
|
||||||
#define Spine_MathUtil_h
|
#define Spine_MathUtil_h
|
||||||
|
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
@ -78,7 +80,7 @@ namespace Spine {
|
|||||||
return fminf(upper, fmaxf(x, lower));
|
return fminf(upper, fmaxf(x, lower));
|
||||||
}
|
}
|
||||||
|
|
||||||
class MathUtil {
|
class MathUtil : public SpineObject {
|
||||||
public:
|
public:
|
||||||
MathUtil();
|
MathUtil();
|
||||||
|
|
||||||
|
|||||||
@ -35,6 +35,7 @@
|
|||||||
#include <spine/SpacingMode.h>
|
#include <spine/SpacingMode.h>
|
||||||
#include <spine/RotateMode.h>
|
#include <spine/RotateMode.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ namespace Spine {
|
|||||||
class BoneData;
|
class BoneData;
|
||||||
class SlotData;
|
class SlotData;
|
||||||
|
|
||||||
class PathConstraintData {
|
class PathConstraintData : public SpineObject {
|
||||||
friend class SkeletonBinary;
|
friend class SkeletonBinary;
|
||||||
friend class SkeletonJson;
|
friend class SkeletonJson;
|
||||||
|
|
||||||
|
|||||||
@ -34,10 +34,11 @@
|
|||||||
#include <spine/Extension.h>
|
#include <spine/Extension.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
#include <spine/ContainerUtil.h>
|
#include <spine/ContainerUtil.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class Pool {
|
class Pool : public SpineObject {
|
||||||
public:
|
public:
|
||||||
Pool() {
|
Pool() {
|
||||||
// Empty
|
// Empty
|
||||||
@ -56,8 +57,7 @@ namespace Spine {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
T* ret = NEW(T);
|
T* ret = new T();
|
||||||
new (ret) T();
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,10 +31,11 @@
|
|||||||
#ifndef Spine_RTTI_h
|
#ifndef Spine_RTTI_h
|
||||||
#define Spine_RTTI_h
|
#define Spine_RTTI_h
|
||||||
|
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
class RTTI {
|
class RTTI : public SpineObject {
|
||||||
public:
|
public:
|
||||||
RTTI(const std::string& className);
|
RTTI(const std::string& className);
|
||||||
|
|
||||||
|
|||||||
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
#include <spine/MathUtil.h>
|
#include <spine/MathUtil.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <limits> // std::numeric_limits
|
#include <limits> // std::numeric_limits
|
||||||
@ -48,7 +49,7 @@ namespace Spine {
|
|||||||
class Skin;
|
class Skin;
|
||||||
class Attachment;
|
class Attachment;
|
||||||
|
|
||||||
class Skeleton {
|
class Skeleton : public SpineObject {
|
||||||
friend class AnimationState;
|
friend class AnimationState;
|
||||||
friend class SkeletonBounds;
|
friend class SkeletonBounds;
|
||||||
friend class SkeletonClipping;
|
friend class SkeletonClipping;
|
||||||
|
|||||||
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include <spine/TransformMode.h>
|
#include <spine/TransformMode.h>
|
||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ namespace Spine {
|
|||||||
class Animation;
|
class Animation;
|
||||||
class CurveTimeline;
|
class CurveTimeline;
|
||||||
|
|
||||||
class SkeletonBinary {
|
class SkeletonBinary : public SpineObject {
|
||||||
public:
|
public:
|
||||||
static const int BONE_ROTATE;
|
static const int BONE_ROTATE;
|
||||||
static const int BONE_TRANSLATE;
|
static const int BONE_TRANSLATE;
|
||||||
@ -68,7 +69,7 @@ namespace Spine {
|
|||||||
|
|
||||||
static const TransformMode TRANSFORM_MODE_VALUES[5];
|
static const TransformMode TRANSFORM_MODE_VALUES[5];
|
||||||
|
|
||||||
SkeletonBinary(Vector<Atlas*>& atlasArray);
|
SkeletonBinary(Atlas& atlasArray);
|
||||||
|
|
||||||
SkeletonBinary(AttachmentLoader* attachmentLoader);
|
SkeletonBinary(AttachmentLoader* attachmentLoader);
|
||||||
|
|
||||||
@ -79,7 +80,7 @@ namespace Spine {
|
|||||||
SkeletonData* readSkeletonDataFile(const char* path);
|
SkeletonData* readSkeletonDataFile(const char* path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct DataInput {
|
struct DataInput : public SpineObject {
|
||||||
const unsigned char* cursor;
|
const unsigned char* cursor;
|
||||||
const unsigned char* end;
|
const unsigned char* end;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -32,6 +32,7 @@
|
|||||||
#define Spine_SkeletonBounds_h
|
#define Spine_SkeletonBounds_h
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
class Skeleton;
|
class Skeleton;
|
||||||
@ -43,7 +44,7 @@ namespace Spine {
|
|||||||
/// Collects each BoundingBoxAttachment that is visible and computes the world vertices for its polygon.
|
/// Collects each BoundingBoxAttachment that is visible and computes the world vertices for its polygon.
|
||||||
/// The polygon vertices are provided along with convenience methods for doing hit detection.
|
/// The polygon vertices are provided along with convenience methods for doing hit detection.
|
||||||
///
|
///
|
||||||
class SkeletonBounds {
|
class SkeletonBounds : public SpineObject {
|
||||||
public:
|
public:
|
||||||
SkeletonBounds();
|
SkeletonBounds();
|
||||||
|
|
||||||
@ -94,7 +95,7 @@ namespace Spine {
|
|||||||
void aabbCompute();
|
void aabbCompute();
|
||||||
};
|
};
|
||||||
|
|
||||||
class Polygon {
|
class Polygon : public SpineObject {
|
||||||
public:
|
public:
|
||||||
Vector<float> _vertices;
|
Vector<float> _vertices;
|
||||||
int _count;
|
int _count;
|
||||||
|
|||||||
@ -38,7 +38,7 @@ namespace Spine {
|
|||||||
class Slot;
|
class Slot;
|
||||||
class ClippingAttachment;
|
class ClippingAttachment;
|
||||||
|
|
||||||
class SkeletonClipping {
|
class SkeletonClipping : public SpineObject {
|
||||||
public:
|
public:
|
||||||
SkeletonClipping();
|
SkeletonClipping();
|
||||||
|
|
||||||
|
|||||||
@ -46,7 +46,7 @@ namespace Spine {
|
|||||||
class PathConstraintData;
|
class PathConstraintData;
|
||||||
|
|
||||||
/// Stores the setup pose and all of the stateless data for a skeleton.
|
/// Stores the setup pose and all of the stateless data for a skeleton.
|
||||||
class SkeletonData {
|
class SkeletonData : public SpineObject {
|
||||||
friend class SkeletonBinary;
|
friend class SkeletonBinary;
|
||||||
friend class SkeletonJson;
|
friend class SkeletonJson;
|
||||||
friend class Skeleton;
|
friend class Skeleton;
|
||||||
|
|||||||
@ -32,6 +32,7 @@
|
|||||||
#define Spine_SkeletonJson_h
|
#define Spine_SkeletonJson_h
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -45,9 +46,9 @@ namespace Spine {
|
|||||||
class AttachmentLoader;
|
class AttachmentLoader;
|
||||||
class LinkedMesh;
|
class LinkedMesh;
|
||||||
|
|
||||||
class SkeletonJson {
|
class SkeletonJson : public SpineObject {
|
||||||
public:
|
public:
|
||||||
SkeletonJson(Vector<Atlas*>& atlasArray);
|
SkeletonJson(Atlas& atlas);
|
||||||
|
|
||||||
SkeletonJson(AttachmentLoader* attachmentLoader);
|
SkeletonJson(AttachmentLoader* attachmentLoader);
|
||||||
|
|
||||||
|
|||||||
@ -42,11 +42,11 @@ namespace Spine {
|
|||||||
/// Stores attachments by slot index and attachment name.
|
/// Stores attachments by slot index and attachment name.
|
||||||
/// See SkeletonData::getDefaultSkin, Skeleton::getSkin, and
|
/// See SkeletonData::getDefaultSkin, Skeleton::getSkin, and
|
||||||
/// http://esotericsoftware.com/spine-runtime-skins in the Spine Runtimes Guide.
|
/// http://esotericsoftware.com/spine-runtime-skins in the Spine Runtimes Guide.
|
||||||
class Skin {
|
class Skin : public SpineObject {
|
||||||
friend class Skeleton;
|
friend class Skeleton;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class AttachmentKey {
|
class AttachmentKey : public SpineObject {
|
||||||
public:
|
public:
|
||||||
int _slotIndex;
|
int _slotIndex;
|
||||||
std::string _name;
|
std::string _name;
|
||||||
@ -56,7 +56,7 @@ namespace Spine {
|
|||||||
bool operator==(const AttachmentKey &other) const;
|
bool operator==(const AttachmentKey &other) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct HashAttachmentKey {
|
struct HashAttachmentKey : public SpineObject {
|
||||||
std::size_t operator()(const Spine::Skin::AttachmentKey& val) const;
|
std::size_t operator()(const Spine::Skin::AttachmentKey& val) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,7 @@
|
|||||||
#define Spine_Slot_h
|
#define Spine_Slot_h
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -41,7 +42,7 @@ namespace Spine {
|
|||||||
class Skeleton;
|
class Skeleton;
|
||||||
class Attachment;
|
class Attachment;
|
||||||
|
|
||||||
class Slot {
|
class Slot : public SpineObject {
|
||||||
friend class VertexAttachment;
|
friend class VertexAttachment;
|
||||||
friend class Skeleton;
|
friend class Skeleton;
|
||||||
friend class SkeletonBounds;
|
friend class SkeletonBounds;
|
||||||
|
|||||||
@ -32,13 +32,14 @@
|
|||||||
#define Spine_SlotData_h
|
#define Spine_SlotData_h
|
||||||
|
|
||||||
#include <spine/BlendMode.h>
|
#include <spine/BlendMode.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
class BoneData;
|
class BoneData;
|
||||||
|
|
||||||
class SlotData {
|
class SlotData : public SpineObject {
|
||||||
friend class SkeletonBinary;
|
friend class SkeletonBinary;
|
||||||
friend class SkeletonJson;
|
friend class SkeletonJson;
|
||||||
|
|
||||||
|
|||||||
@ -1,73 +1,45 @@
|
|||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Spine Runtimes Software License v2.5
|
* Spine Runtimes Software License v2.5
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013-2016, Esoteric Software
|
* Copyright (c) 2013-2016, Esoteric Software
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* You are granted a perpetual, non-exclusive, non-sublicensable, and
|
* You are granted a perpetual, non-exclusive, non-sublicensable, and
|
||||||
* non-transferable license to use, install, execute, and perform the Spine
|
* non-transferable license to use, install, execute, and perform the Spine
|
||||||
* Runtimes software and derivative works solely for personal or internal
|
* Runtimes software and derivative works solely for personal or internal
|
||||||
* use. Without the written permission of Esoteric Software (see Section 2 of
|
* use. Without the written permission of Esoteric Software (see Section 2 of
|
||||||
* the Spine Software License Agreement), you may not (a) modify, translate,
|
* the Spine Software License Agreement), you may not (a) modify, translate,
|
||||||
* adapt, or develop new applications using the Spine Runtimes or otherwise
|
* adapt, or develop new applications using the Spine Runtimes or otherwise
|
||||||
* create derivative works or improvements of the Spine Runtimes or (b) remove,
|
* create derivative works or improvements of the Spine Runtimes or (b) remove,
|
||||||
* delete, alter, or obscure any trademarks or any copyright, trademark, patent,
|
* delete, alter, or obscure any trademarks or any copyright, trademark, patent,
|
||||||
* or other intellectual property or proprietary rights notices on or in the
|
* or other intellectual property or proprietary rights notices on or in the
|
||||||
* Software, including any copy thereof. Redistributions in binary or source
|
* Software, including any copy thereof. Redistributions in binary or source
|
||||||
* form must include this license and terms.
|
* form must include this license and terms.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
|
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
|
||||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||||
* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
* EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, BUSINESS INTERRUPTION, OR LOSS OF
|
||||||
* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
* USE, DATA, OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
|
||||||
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
* 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
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
#ifndef SPINE_SFML_H_
|
#ifndef Spine_Object_h
|
||||||
#define SPINE_SFML_H_
|
#define Spine_Object_h
|
||||||
|
|
||||||
#include <spine/spine.h>
|
#include <new>
|
||||||
#include <spine/extension.h>
|
|
||||||
#include <SFML/Graphics/Vertex.hpp>
|
namespace Spine {
|
||||||
#include <SFML/Graphics/VertexArray.hpp>
|
class SpineObject {
|
||||||
#include <SFML/Graphics/Texture.hpp>
|
public:
|
||||||
#include <SFML/Graphics/RenderTarget.hpp>
|
void* operator new(size_t sz);
|
||||||
#include <SFML/Graphics/RenderStates.hpp>
|
void* operator new(size_t sz, void* p);
|
||||||
|
void operator delete(void* p);
|
||||||
_SP_ARRAY_DECLARE_TYPE(spColorArray, spColor)
|
};
|
||||||
|
}
|
||||||
namespace spine {
|
|
||||||
|
#endif
|
||||||
class SkeletonDrawable: public sf::Drawable {
|
|
||||||
public:
|
|
||||||
spSkeleton* skeleton;
|
|
||||||
spAnimationState* state;
|
|
||||||
float timeScale;
|
|
||||||
sf::VertexArray* vertexArray;
|
|
||||||
spVertexEffect* vertexEffect;
|
|
||||||
|
|
||||||
SkeletonDrawable (spSkeletonData* skeleton, spAnimationStateData* stateData = 0);
|
|
||||||
~SkeletonDrawable ();
|
|
||||||
|
|
||||||
void update (float deltaTime);
|
|
||||||
|
|
||||||
virtual void draw (sf::RenderTarget& target, sf::RenderStates states) const;
|
|
||||||
|
|
||||||
void setUsePremultipliedAlpha(bool usePMA) { usePremultipliedAlpha = usePMA; };
|
|
||||||
bool getUsePremultipliedAlpha() { return usePremultipliedAlpha; };
|
|
||||||
private:
|
|
||||||
bool ownsAnimationStateData;
|
|
||||||
float* worldVertices;
|
|
||||||
spFloatArray* tempUvs;
|
|
||||||
spColorArray* tempColors;
|
|
||||||
spSkeletonClipping* clipper;
|
|
||||||
bool usePremultipliedAlpha;
|
|
||||||
};
|
|
||||||
|
|
||||||
} /* namespace spine */
|
|
||||||
#endif /* SPINE_SFML_H_ */
|
|
||||||
@ -31,12 +31,14 @@
|
|||||||
#ifndef Spine_TextureLoader_h
|
#ifndef Spine_TextureLoader_h
|
||||||
#define Spine_TextureLoader_h
|
#define Spine_TextureLoader_h
|
||||||
|
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
class AtlasPage;
|
class AtlasPage;
|
||||||
|
|
||||||
class TextureLoader {
|
class TextureLoader : public SpineObject {
|
||||||
public:
|
public:
|
||||||
TextureLoader();
|
TextureLoader();
|
||||||
|
|
||||||
|
|||||||
@ -35,12 +35,13 @@
|
|||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
#include <spine/MixPose.h>
|
#include <spine/MixPose.h>
|
||||||
#include <spine/MixDirection.h>
|
#include <spine/MixDirection.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
class Skeleton;
|
class Skeleton;
|
||||||
class Event;
|
class Event;
|
||||||
|
|
||||||
class Timeline {
|
class Timeline : public SpineObject {
|
||||||
RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -32,13 +32,14 @@
|
|||||||
#define Spine_TransformConstraintData_h
|
#define Spine_TransformConstraintData_h
|
||||||
|
|
||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
class BoneData;
|
class BoneData;
|
||||||
|
|
||||||
class TransformConstraintData {
|
class TransformConstraintData : public SpineObject {
|
||||||
friend class SkeletonBinary;
|
friend class SkeletonBinary;
|
||||||
friend class SkeletonJson;
|
friend class SkeletonJson;
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@
|
|||||||
#include <spine/Pool.h>
|
#include <spine/Pool.h>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
class Triangulator {
|
class Triangulator : public SpineObject {
|
||||||
public:
|
public:
|
||||||
Vector<int>& triangulate(Vector<float>& vertices);
|
Vector<int>& triangulate(Vector<float>& vertices);
|
||||||
|
|
||||||
|
|||||||
@ -32,9 +32,10 @@
|
|||||||
#define Spine_Updatable_h
|
#define Spine_Updatable_h
|
||||||
|
|
||||||
#include <spine/RTTI.h>
|
#include <spine/RTTI.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
class Updatable {
|
class Updatable : public SpineObject {
|
||||||
RTTI_DECL;
|
RTTI_DECL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -32,6 +32,7 @@
|
|||||||
#define Spine_Vector_h
|
#define Spine_Vector_h
|
||||||
|
|
||||||
#include <spine/Extension.h>
|
#include <spine/Extension.h>
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -39,7 +40,7 @@
|
|||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class Vector {
|
class Vector : public SpineObject {
|
||||||
public:
|
public:
|
||||||
Vector() : _size(0), _capacity(0), _buffer(NULL) {
|
Vector() : _size(0), _capacity(0), _buffer(NULL) {
|
||||||
// Empty
|
// Empty
|
||||||
@ -157,7 +158,7 @@ namespace Spine {
|
|||||||
void reserve(size_t inCapacity = 0) {
|
void reserve(size_t inCapacity = 0) {
|
||||||
size_t newCapacity = inCapacity > 0 ? inCapacity : _capacity > 0 ? _capacity * 2 : 1;
|
size_t newCapacity = inCapacity > 0 ? inCapacity : _capacity > 0 ? _capacity * 2 : 1;
|
||||||
if (newCapacity > _capacity) {
|
if (newCapacity > _capacity) {
|
||||||
_buffer = REALLOC(_buffer, T, newCapacity);
|
_buffer = (T*)SpineExtension::realloc<T>(_buffer, newCapacity, __FILE__, __LINE__);
|
||||||
_capacity = newCapacity;
|
_capacity = newCapacity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,7 +203,7 @@ namespace Spine {
|
|||||||
T* allocate(size_t n) {
|
T* allocate(size_t n) {
|
||||||
assert(n > 0);
|
assert(n > 0);
|
||||||
|
|
||||||
T* ptr = MALLOC(T, n);
|
T* ptr = (T*)SpineExtension::alloc<T>(n, __FILE__, __LINE__);
|
||||||
|
|
||||||
assert(ptr);
|
assert(ptr);
|
||||||
|
|
||||||
@ -211,7 +212,7 @@ namespace Spine {
|
|||||||
|
|
||||||
void deallocate(T* buffer) {
|
void deallocate(T* buffer) {
|
||||||
if (_buffer) {
|
if (_buffer) {
|
||||||
FREE(buffer);
|
SpineExtension::free<T>(buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@
|
|||||||
#include <spine/Vector.h>
|
#include <spine/Vector.h>
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
class Vertices {
|
class Vertices : public SpineObject {
|
||||||
public:
|
public:
|
||||||
Vector<int> _bones;
|
Vector<int> _bones;
|
||||||
Vector<float> _vertices;
|
Vector<float> _vertices;
|
||||||
|
|||||||
@ -216,17 +216,11 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EventQueue* EventQueue::newEventQueue(AnimationState& state, Pool<TrackEntry>& trackEntryPool) {
|
EventQueue* EventQueue::newEventQueue(AnimationState& state, Pool<TrackEntry>& trackEntryPool) {
|
||||||
EventQueue* ret = NEW(EventQueue);
|
return new EventQueue(state, trackEntryPool);
|
||||||
new (ret) EventQueue(state, trackEntryPool);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EventQueueEntry* EventQueue::newEventQueueEntry(EventType eventType, TrackEntry* entry, Event* event) {
|
EventQueueEntry* EventQueue::newEventQueueEntry(EventType eventType, TrackEntry* entry, Event* event) {
|
||||||
EventQueueEntry* ret = NEW(EventQueueEntry);
|
return new EventQueueEntry(eventType, entry, event);
|
||||||
new (ret) EventQueueEntry(eventType, entry, event);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EventQueue::EventQueue(AnimationState& state, Pool<TrackEntry>& trackEntryPool) : _state(state), _trackEntryPool(trackEntryPool), _drainDisabled(false) {
|
EventQueue::EventQueue(AnimationState& state, Pool<TrackEntry>& trackEntryPool) : _state(state), _trackEntryPool(trackEntryPool), _drainDisabled(false) {
|
||||||
@ -321,7 +315,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AnimationState::~AnimationState() {
|
AnimationState::~AnimationState() {
|
||||||
DESTROY(EventQueue, _queue);
|
delete _queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationState::update(float delta) {
|
void AnimationState::update(float delta) {
|
||||||
|
|||||||
@ -49,17 +49,17 @@ namespace Spine {
|
|||||||
const char* lastSlash = lastForwardSlash > lastBackwardSlash ? lastForwardSlash : lastBackwardSlash;
|
const char* lastSlash = lastForwardSlash > lastBackwardSlash ? lastForwardSlash : lastBackwardSlash;
|
||||||
if (lastSlash == path) lastSlash++; /* Never drop starting slash. */
|
if (lastSlash == path) lastSlash++; /* Never drop starting slash. */
|
||||||
dirLength = (int)(lastSlash ? lastSlash - path : 0);
|
dirLength = (int)(lastSlash ? lastSlash - path : 0);
|
||||||
dir = MALLOC(char, dirLength + 1);
|
dir = SpineExtension::alloc<char>(dirLength + 1, __FILE__, __LINE__);
|
||||||
memcpy(dir, path, dirLength);
|
memcpy(dir, path, dirLength);
|
||||||
dir[dirLength] = '\0';
|
dir[dirLength] = '\0';
|
||||||
|
|
||||||
data = SPINE_EXTENSION->spineReadFile(path, &length);
|
data = SpineExtension::readFile(path, &length);
|
||||||
if (data) {
|
if (data) {
|
||||||
load(data, length, dir);
|
load(data, length, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
FREE(data);
|
SpineExtension::free(data);
|
||||||
FREE(dir);
|
SpineExtension::free(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
Atlas::Atlas(const char* data, int length, const char* dir, TextureLoader& textureLoader) : _textureLoader(textureLoader) {
|
Atlas::Atlas(const char* data, int length, const char* dir, TextureLoader& textureLoader) : _textureLoader(textureLoader) {
|
||||||
@ -116,17 +116,16 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
else if (!page) {
|
else if (!page) {
|
||||||
char* name = mallocString(&str);
|
char* name = mallocString(&str);
|
||||||
char* path = MALLOC(char, dirLength + needsSlash + strlen(name) + 1);
|
char* path = SpineExtension::alloc<char>(dirLength + needsSlash + strlen(name) + 1, __FILE__, __LINE__);
|
||||||
memcpy(path, dir, dirLength);
|
memcpy(path, dir, dirLength);
|
||||||
if (needsSlash) {
|
if (needsSlash) {
|
||||||
path[dirLength] = '/';
|
path[dirLength] = '/';
|
||||||
}
|
}
|
||||||
strcpy(path + dirLength + needsSlash, name);
|
strcpy(path + dirLength + needsSlash, name);
|
||||||
|
|
||||||
page = NEW(AtlasPage);
|
page = new AtlasPage(std::string(name));
|
||||||
new (page) AtlasPage(std::string(name));
|
|
||||||
|
|
||||||
FREE(name);
|
SpineExtension::free(name);
|
||||||
|
|
||||||
int tupleVal = readTuple(&begin, end, tuple);
|
int tupleVal = readTuple(&begin, end, tuple);
|
||||||
assert(tupleVal == 2);
|
assert(tupleVal == 2);
|
||||||
@ -163,13 +162,12 @@ namespace Spine {
|
|||||||
|
|
||||||
_textureLoader.load(*page, std::string(path));
|
_textureLoader.load(*page, std::string(path));
|
||||||
|
|
||||||
FREE(path);
|
SpineExtension::free(path);
|
||||||
|
|
||||||
_pages.push_back(page);
|
_pages.push_back(page);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
AtlasRegion* region = NEW(AtlasRegion);
|
AtlasRegion* region = new AtlasRegion();
|
||||||
new (region) AtlasRegion();
|
|
||||||
|
|
||||||
region->page = page;
|
region->page = page;
|
||||||
region->name = mallocString(&str);
|
region->name = mallocString(&str);
|
||||||
@ -333,7 +331,7 @@ namespace Spine {
|
|||||||
|
|
||||||
char* Atlas::mallocString(Str* str) {
|
char* Atlas::mallocString(Str* str) {
|
||||||
int length = (int)(str->end - str->begin);
|
int length = (int)(str->end - str->begin);
|
||||||
char* string = MALLOC(char, length + 1);
|
char* string = SpineExtension::alloc<char>(length + 1, __FILE__, __LINE__);
|
||||||
memcpy(string, str->begin, length);
|
memcpy(string, str->begin, length);
|
||||||
string[length] = '\0';
|
string[length] = '\0';
|
||||||
return string;
|
return string;
|
||||||
|
|||||||
@ -43,7 +43,7 @@
|
|||||||
namespace Spine {
|
namespace Spine {
|
||||||
RTTI_IMPL(AtlasAttachmentLoader, AttachmentLoader);
|
RTTI_IMPL(AtlasAttachmentLoader, AttachmentLoader);
|
||||||
|
|
||||||
AtlasAttachmentLoader::AtlasAttachmentLoader(Vector<Atlas*>& inAtlasArray) : AttachmentLoader(), _atlasArray(inAtlasArray) {
|
AtlasAttachmentLoader::AtlasAttachmentLoader(Atlas& atlas) : AttachmentLoader(), _atlas(atlas) {
|
||||||
// Empty
|
// Empty
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,8 +53,7 @@ namespace Spine {
|
|||||||
|
|
||||||
AtlasRegion& region = *regionP;
|
AtlasRegion& region = *regionP;
|
||||||
|
|
||||||
RegionAttachment* attachmentP = NEW(RegionAttachment);
|
RegionAttachment* attachmentP = new RegionAttachment(name);
|
||||||
new (attachmentP) RegionAttachment(name);
|
|
||||||
|
|
||||||
RegionAttachment& attachment = *attachmentP;
|
RegionAttachment& attachment = *attachmentP;
|
||||||
attachment._rendererObject = regionP;
|
attachment._rendererObject = regionP;
|
||||||
@ -75,8 +74,7 @@ namespace Spine {
|
|||||||
|
|
||||||
AtlasRegion& region = *regionP;
|
AtlasRegion& region = *regionP;
|
||||||
|
|
||||||
MeshAttachment* attachmentP = NEW(MeshAttachment);
|
MeshAttachment* attachmentP = new MeshAttachment(name);
|
||||||
new (attachmentP) MeshAttachment(name);
|
|
||||||
|
|
||||||
MeshAttachment& attachment = *attachmentP;
|
MeshAttachment& attachment = *attachmentP;
|
||||||
attachment._rendererObject = regionP;
|
attachment._rendererObject = regionP;
|
||||||
@ -96,43 +94,23 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BoundingBoxAttachment* AtlasAttachmentLoader::newBoundingBoxAttachment(Skin& skin, std::string name) {
|
BoundingBoxAttachment* AtlasAttachmentLoader::newBoundingBoxAttachment(Skin& skin, std::string name) {
|
||||||
BoundingBoxAttachment* attachmentP = NEW(BoundingBoxAttachment);
|
return new BoundingBoxAttachment(name);
|
||||||
new (attachmentP) BoundingBoxAttachment(name);
|
|
||||||
|
|
||||||
return attachmentP;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PathAttachment* AtlasAttachmentLoader::newPathAttachment(Skin& skin, std::string name) {
|
PathAttachment* AtlasAttachmentLoader::newPathAttachment(Skin& skin, std::string name) {
|
||||||
PathAttachment* attachmentP = NEW(PathAttachment);
|
return new PathAttachment(name);
|
||||||
new (attachmentP) PathAttachment(name);
|
|
||||||
|
|
||||||
return attachmentP;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PointAttachment* AtlasAttachmentLoader::newPointAttachment(Skin& skin, std::string name) {
|
PointAttachment* AtlasAttachmentLoader::newPointAttachment(Skin& skin, std::string name) {
|
||||||
PointAttachment* attachmentP = NEW(PointAttachment);
|
return new PointAttachment(name);
|
||||||
new (attachmentP) PointAttachment(name);
|
|
||||||
|
|
||||||
return attachmentP;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClippingAttachment* AtlasAttachmentLoader::newClippingAttachment(Skin& skin, std::string name) {
|
ClippingAttachment* AtlasAttachmentLoader::newClippingAttachment(Skin& skin, std::string name) {
|
||||||
ClippingAttachment* attachmentP = NEW(ClippingAttachment);
|
return new ClippingAttachment(name);
|
||||||
new (attachmentP) ClippingAttachment(name);
|
|
||||||
|
|
||||||
return attachmentP;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AtlasRegion* AtlasAttachmentLoader::findRegion(std::string name) {
|
AtlasRegion* AtlasAttachmentLoader::findRegion(std::string name) {
|
||||||
AtlasRegion* ret;
|
AtlasRegion* ret;
|
||||||
|
return _atlas.findRegion(name);
|
||||||
for (int i = 0; i < _atlasArray.size(); i++) {
|
|
||||||
ret = _atlasArray[i]->findRegion(name);
|
|
||||||
if (ret != NULL) {
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,7 +53,7 @@ namespace Spine {
|
|||||||
// Empty
|
// Empty
|
||||||
}
|
}
|
||||||
|
|
||||||
char* SpineExtension::spineReadFile(const char* path, int* length) {
|
char* SpineExtension::_readFile(const char* path, int* length) {
|
||||||
char *data;
|
char *data;
|
||||||
FILE *file = fopen(path, "rb");
|
FILE *file = fopen(path, "rb");
|
||||||
if (!file) return 0;
|
if (!file) return 0;
|
||||||
@ -62,7 +62,7 @@ namespace Spine {
|
|||||||
*length = (int)ftell(file);
|
*length = (int)ftell(file);
|
||||||
fseek(file, 0, SEEK_SET);
|
fseek(file, 0, SEEK_SET);
|
||||||
|
|
||||||
data = MALLOC(char, *length);
|
data = SpineExtension::alloc<char>(*length, __FILE__, __LINE__);
|
||||||
fread(data, 1, *length, file);
|
fread(data, 1, *length, file);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
@ -73,33 +73,28 @@ namespace Spine {
|
|||||||
// Empty
|
// Empty
|
||||||
}
|
}
|
||||||
|
|
||||||
DefaultSpineExtension* DefaultSpineExtension::getInstance() {
|
|
||||||
static DefaultSpineExtension ret;
|
|
||||||
return &ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
DefaultSpineExtension::~DefaultSpineExtension() {
|
DefaultSpineExtension::~DefaultSpineExtension() {
|
||||||
// Empty
|
// Empty
|
||||||
}
|
}
|
||||||
|
|
||||||
void* DefaultSpineExtension::spineAlloc(size_t size, const char* file, int line) {
|
void* DefaultSpineExtension::_alloc(size_t size, const char* file, int line) {
|
||||||
return malloc(size);
|
return ::malloc(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* DefaultSpineExtension::spineCalloc(size_t num, size_t size, const char* file, int line) {
|
void* DefaultSpineExtension::_calloc(size_t size, const char* file, int line) {
|
||||||
void* ptr = spineAlloc(num * size, file, line);
|
void* ptr = _alloc(size, file, line);
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
memset(ptr, 0, num * size);
|
memset(ptr, 0, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* DefaultSpineExtension::spineRealloc(void* ptr, size_t size, const char* file, int line) {
|
void* DefaultSpineExtension::_realloc(void* ptr, size_t size, const char* file, int line) {
|
||||||
return realloc(ptr, size);
|
return ::realloc(ptr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultSpineExtension::spineFree(void* mem) {
|
void DefaultSpineExtension::_free(void* mem) {
|
||||||
free(mem);
|
free(mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -115,19 +115,19 @@ namespace Spine {
|
|||||||
|
|
||||||
Json::~Json() {
|
Json::~Json() {
|
||||||
if (_child) {
|
if (_child) {
|
||||||
DESTROY(Json, _child);
|
delete _child;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_valueString) {
|
if (_valueString) {
|
||||||
FREE(_valueString);
|
SpineExtension::free(_valueString);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_name) {
|
if (_name) {
|
||||||
FREE(_name);
|
SpineExtension::free(_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_next) {
|
if (_next) {
|
||||||
DESTROY(Json, _next);
|
delete _next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
out = MALLOC(char, len + 1); /* The length needed for the string, roughly. */
|
out = (char*)SpineExtension::alloc<char>(len + 1, __FILE__, __LINE__); /* The length needed for the string, roughly. */
|
||||||
if (!out) {
|
if (!out) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -313,7 +313,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*ptr2 = NULL;
|
*ptr2 = 0;
|
||||||
|
|
||||||
if (*ptr == '\"') {
|
if (*ptr == '\"') {
|
||||||
ptr++; /* TODO error handling if not \" or \0 ? */
|
ptr++; /* TODO error handling if not \" or \0 ? */
|
||||||
@ -415,8 +415,7 @@ namespace Spine {
|
|||||||
return value + 1; /* empty array. */
|
return value + 1; /* empty array. */
|
||||||
}
|
}
|
||||||
|
|
||||||
item->_child = child = NEW(Json);
|
item->_child = child = new Json(NULL);
|
||||||
new (item->_child) Json(NULL);
|
|
||||||
if (!item->_child) {
|
if (!item->_child) {
|
||||||
return NULL; /* memory fail */
|
return NULL; /* memory fail */
|
||||||
}
|
}
|
||||||
@ -430,8 +429,7 @@ namespace Spine {
|
|||||||
item->_size = 1;
|
item->_size = 1;
|
||||||
|
|
||||||
while (*value == ',') {
|
while (*value == ',') {
|
||||||
Json *new_item = NEW(Json);
|
Json *new_item = new Json(NULL);
|
||||||
new (new_item) Json(NULL);
|
|
||||||
if (!new_item) {
|
if (!new_item) {
|
||||||
return NULL; /* memory fail */
|
return NULL; /* memory fail */
|
||||||
}
|
}
|
||||||
@ -473,8 +471,7 @@ namespace Spine {
|
|||||||
return value + 1; /* empty array. */
|
return value + 1; /* empty array. */
|
||||||
}
|
}
|
||||||
|
|
||||||
item->_child = child = NEW(Json);
|
item->_child = child = new Json(NULL);
|
||||||
new (item->_child) Json(NULL);
|
|
||||||
if (!item->_child) {
|
if (!item->_child) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -497,8 +494,7 @@ namespace Spine {
|
|||||||
item->_size = 1;
|
item->_size = 1;
|
||||||
|
|
||||||
while (*value == ',') {
|
while (*value == ',') {
|
||||||
Json *new_item = NEW(Json);
|
Json *new_item = new Json(NULL);
|
||||||
new (new_item) Json(NULL);
|
|
||||||
if (!new_item) {
|
if (!new_item) {
|
||||||
return NULL; /* memory fail */
|
return NULL; /* memory fail */
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,13 +71,11 @@ namespace Spine {
|
|||||||
|
|
||||||
Bone* bone;
|
Bone* bone;
|
||||||
if (data->getParent() == NULL) {
|
if (data->getParent() == NULL) {
|
||||||
bone = NEW(Bone);
|
bone = new Bone(*data, *this, NULL);
|
||||||
new (bone) Bone(*data, *this, NULL);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Bone* parent = _bones[data->getParent()->getIndex()];
|
Bone* parent = _bones[data->getParent()->getIndex()];
|
||||||
bone = NEW(Bone);
|
bone = new Bone(*data, *this, parent);
|
||||||
new (bone) Bone(*data, *this, parent);
|
|
||||||
parent->getChildren().push_back(bone);
|
parent->getChildren().push_back(bone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,8 +88,7 @@ namespace Spine {
|
|||||||
SlotData* data = (*i);
|
SlotData* data = (*i);
|
||||||
|
|
||||||
Bone* bone = _bones[data->getBoneData().getIndex()];
|
Bone* bone = _bones[data->getBoneData().getIndex()];
|
||||||
Slot* slot = NEW(Slot);
|
Slot* slot = new Slot(*data, *bone);
|
||||||
new (slot) Slot(*data, *bone);
|
|
||||||
|
|
||||||
_slots.push_back(slot);
|
_slots.push_back(slot);
|
||||||
_drawOrder.push_back(slot);
|
_drawOrder.push_back(slot);
|
||||||
@ -101,8 +98,7 @@ namespace Spine {
|
|||||||
for (IkConstraintData** i = _data.getIkConstraints().begin(); i != _data.getIkConstraints().end(); ++i) {
|
for (IkConstraintData** i = _data.getIkConstraints().begin(); i != _data.getIkConstraints().end(); ++i) {
|
||||||
IkConstraintData* data = (*i);
|
IkConstraintData* data = (*i);
|
||||||
|
|
||||||
IkConstraint* constraint = NEW(IkConstraint);
|
IkConstraint* constraint = new IkConstraint(*data, *this);
|
||||||
new (constraint) IkConstraint(*data, *this);
|
|
||||||
|
|
||||||
_ikConstraints.push_back(constraint);
|
_ikConstraints.push_back(constraint);
|
||||||
}
|
}
|
||||||
@ -111,8 +107,7 @@ namespace Spine {
|
|||||||
for (TransformConstraintData** i = _data.getTransformConstraints().begin(); i != _data.getTransformConstraints().end(); ++i) {
|
for (TransformConstraintData** i = _data.getTransformConstraints().begin(); i != _data.getTransformConstraints().end(); ++i) {
|
||||||
TransformConstraintData* data = (*i);
|
TransformConstraintData* data = (*i);
|
||||||
|
|
||||||
TransformConstraint* constraint = NEW(TransformConstraint);
|
TransformConstraint* constraint = new TransformConstraint(*data, *this);
|
||||||
new (constraint) TransformConstraint(*data, *this);
|
|
||||||
|
|
||||||
_transformConstraints.push_back(constraint);
|
_transformConstraints.push_back(constraint);
|
||||||
}
|
}
|
||||||
@ -121,8 +116,7 @@ namespace Spine {
|
|||||||
for (PathConstraintData** i = _data.getPathConstraints().begin(); i != _data.getPathConstraints().end(); ++i) {
|
for (PathConstraintData** i = _data.getPathConstraints().begin(); i != _data.getPathConstraints().end(); ++i) {
|
||||||
PathConstraintData* data = (*i);
|
PathConstraintData* data = (*i);
|
||||||
|
|
||||||
PathConstraint* constraint = NEW(PathConstraint);
|
PathConstraint* constraint = new PathConstraint(*data, *this);
|
||||||
new (constraint) PathConstraint(*data, *this);
|
|
||||||
|
|
||||||
_pathConstraints.push_back(constraint);
|
_pathConstraints.push_back(constraint);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -106,8 +106,8 @@ namespace Spine {
|
|||||||
TransformMode_NoScaleOrReflection
|
TransformMode_NoScaleOrReflection
|
||||||
};
|
};
|
||||||
|
|
||||||
SkeletonBinary::SkeletonBinary(Vector<Atlas*>& atlasArray) : _attachmentLoader(NEW(AtlasAttachmentLoader)), _error(), _scale(1), _ownsLoader(true) {
|
SkeletonBinary::SkeletonBinary(Atlas& atlasArray) : _attachmentLoader(new AtlasAttachmentLoader(atlasArray)), _error(), _scale(1), _ownsLoader(true) {
|
||||||
new (_attachmentLoader) AtlasAttachmentLoader(atlasArray);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SkeletonBinary::SkeletonBinary(AttachmentLoader* attachmentLoader) : _attachmentLoader(attachmentLoader), _error(), _scale(1), _ownsLoader(false) {
|
SkeletonBinary::SkeletonBinary(AttachmentLoader* attachmentLoader) : _attachmentLoader(attachmentLoader), _error(), _scale(1), _ownsLoader(false) {
|
||||||
@ -118,7 +118,7 @@ namespace Spine {
|
|||||||
ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes);
|
ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes);
|
||||||
|
|
||||||
if (_ownsLoader) {
|
if (_ownsLoader) {
|
||||||
DESTROY(AttachmentLoader, _attachmentLoader);
|
delete _attachmentLoader;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,22 +126,21 @@ namespace Spine {
|
|||||||
int i, ii, nonessential;
|
int i, ii, nonessential;
|
||||||
SkeletonData* skeletonData;
|
SkeletonData* skeletonData;
|
||||||
|
|
||||||
DataInput* input = CALLOC(DataInput, 1);
|
DataInput* input = new DataInput();
|
||||||
input->cursor = binary;
|
input->cursor = binary;
|
||||||
input->end = binary + length;
|
input->end = binary + length;
|
||||||
|
|
||||||
_linkedMeshes.clear();
|
_linkedMeshes.clear();
|
||||||
|
|
||||||
skeletonData = NEW(SkeletonData);
|
skeletonData = new SkeletonData();
|
||||||
new (skeletonData) SkeletonData();
|
|
||||||
|
|
||||||
char* skeletonData_hash = readString(input);
|
char* skeletonData_hash = readString(input);
|
||||||
skeletonData->_hash = std::string(skeletonData_hash);
|
skeletonData->_hash = std::string(skeletonData_hash);
|
||||||
FREE(skeletonData_hash);
|
SpineExtension::free(skeletonData_hash);
|
||||||
|
|
||||||
char* skeletonData_version = readString(input);
|
char* skeletonData_version = readString(input);
|
||||||
skeletonData->_version = std::string(skeletonData_version);
|
skeletonData->_version = std::string(skeletonData_version);
|
||||||
FREE(skeletonData_version);
|
SpineExtension::free(skeletonData_version);
|
||||||
|
|
||||||
skeletonData->_width = readFloat(input);
|
skeletonData->_width = readFloat(input);
|
||||||
skeletonData->_height = readFloat(input);
|
skeletonData->_height = readFloat(input);
|
||||||
@ -151,7 +150,7 @@ namespace Spine {
|
|||||||
if (nonessential) {
|
if (nonessential) {
|
||||||
/* Skip images path & fps */
|
/* Skip images path & fps */
|
||||||
readFloat(input);
|
readFloat(input);
|
||||||
FREE(readString(input));
|
SpineExtension::free(readString(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bones. */
|
/* Bones. */
|
||||||
@ -164,10 +163,9 @@ namespace Spine {
|
|||||||
const char* name = readString(input);
|
const char* name = readString(input);
|
||||||
BoneData* parent = i == 0 ? 0 : skeletonData->_bones[readVarint(input, 1)];
|
BoneData* parent = i == 0 ? 0 : skeletonData->_bones[readVarint(input, 1)];
|
||||||
|
|
||||||
data = NEW(BoneData);
|
data = new BoneData(i, std::string(name), parent);
|
||||||
new (data) BoneData(i, std::string(name), parent);
|
|
||||||
|
SpineExtension::free(name);
|
||||||
FREE(name);
|
|
||||||
|
|
||||||
data->_rotation = readFloat(input);
|
data->_rotation = readFloat(input);
|
||||||
data->_x = readFloat(input) * _scale;
|
data->_x = readFloat(input) * _scale;
|
||||||
@ -214,10 +212,9 @@ namespace Spine {
|
|||||||
const char* slotName = readString(input);
|
const char* slotName = readString(input);
|
||||||
BoneData* boneData = skeletonData->_bones[readVarint(input, 1)];
|
BoneData* boneData = skeletonData->_bones[readVarint(input, 1)];
|
||||||
|
|
||||||
SlotData* slotData = NEW(SlotData);
|
SlotData* slotData = new SlotData(i, std::string(slotName), *boneData);
|
||||||
new (slotData) SlotData(i, std::string(slotName), *boneData);
|
|
||||||
|
SpineExtension::free(slotName);
|
||||||
FREE(slotName);
|
|
||||||
readColor(input, &slotData->_r, &slotData->_g, &slotData->_b, &slotData->_a);
|
readColor(input, &slotData->_r, &slotData->_g, &slotData->_b, &slotData->_a);
|
||||||
r = readByte(input);
|
r = readByte(input);
|
||||||
g = readByte(input);
|
g = readByte(input);
|
||||||
@ -230,7 +227,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
char* slotData_attachmentName = readString(input);
|
char* slotData_attachmentName = readString(input);
|
||||||
slotData->_attachmentName = std::string(slotData_attachmentName);
|
slotData->_attachmentName = std::string(slotData_attachmentName);
|
||||||
FREE(slotData_attachmentName);
|
SpineExtension::free(slotData_attachmentName);
|
||||||
slotData->_blendMode = static_cast<BlendMode>(readVarint(input, 1));
|
slotData->_blendMode = static_cast<BlendMode>(readVarint(input, 1));
|
||||||
|
|
||||||
skeletonData->_slots[i] = slotData;
|
skeletonData->_slots[i] = slotData;
|
||||||
@ -243,12 +240,11 @@ namespace Spine {
|
|||||||
for (i = 0; i < ikConstraintsCount; ++i) {
|
for (i = 0; i < ikConstraintsCount; ++i) {
|
||||||
const char* name = readString(input);
|
const char* name = readString(input);
|
||||||
|
|
||||||
IkConstraintData* data = NEW(IkConstraintData);
|
IkConstraintData* data = new IkConstraintData(std::string(name));
|
||||||
new (data) IkConstraintData(std::string(name));
|
|
||||||
|
|
||||||
data->_order = readVarint(input, 1);
|
data->_order = readVarint(input, 1);
|
||||||
|
|
||||||
FREE(name);
|
SpineExtension::free(name);
|
||||||
int bonesCount = readVarint(input, 1);
|
int bonesCount = readVarint(input, 1);
|
||||||
data->_bones.reserve(bonesCount);
|
data->_bones.reserve(bonesCount);
|
||||||
data->_bones.setSize(bonesCount);
|
data->_bones.setSize(bonesCount);
|
||||||
@ -269,11 +265,10 @@ namespace Spine {
|
|||||||
for (i = 0; i < transformConstraintsCount; ++i) {
|
for (i = 0; i < transformConstraintsCount; ++i) {
|
||||||
const char* name = readString(input);
|
const char* name = readString(input);
|
||||||
|
|
||||||
TransformConstraintData* data = NEW(TransformConstraintData);
|
TransformConstraintData* data = new TransformConstraintData(std::string(name));
|
||||||
new (data) TransformConstraintData(std::string(name));
|
|
||||||
|
|
||||||
data->_order = readVarint(input, 1);
|
data->_order = readVarint(input, 1);
|
||||||
FREE(name);
|
SpineExtension::free(name);
|
||||||
int bonesCount = readVarint(input, 1);
|
int bonesCount = readVarint(input, 1);
|
||||||
data->_bones.reserve(bonesCount);
|
data->_bones.reserve(bonesCount);
|
||||||
data->_bones.setSize(bonesCount);
|
data->_bones.setSize(bonesCount);
|
||||||
@ -304,11 +299,10 @@ namespace Spine {
|
|||||||
for (i = 0; i < pathConstraintsCount; ++i) {
|
for (i = 0; i < pathConstraintsCount; ++i) {
|
||||||
const char* name = readString(input);
|
const char* name = readString(input);
|
||||||
|
|
||||||
PathConstraintData* data = NEW(PathConstraintData);
|
PathConstraintData* data = new PathConstraintData(std::string(name));
|
||||||
new (data) PathConstraintData(std::string(name));
|
|
||||||
|
|
||||||
data->_order = readVarint(input, 1);
|
data->_order = readVarint(input, 1);
|
||||||
FREE(name);
|
SpineExtension::free(name);
|
||||||
|
|
||||||
int bonesCount = readVarint(input, 1);
|
int bonesCount = readVarint(input, 1);
|
||||||
data->_bones.reserve(bonesCount);
|
data->_bones.reserve(bonesCount);
|
||||||
@ -355,7 +349,7 @@ namespace Spine {
|
|||||||
for (i = skeletonData->_defaultSkin ? 1 : 0; i < skeletonData->_skins.size(); ++i) {
|
for (i = skeletonData->_defaultSkin ? 1 : 0; i < skeletonData->_skins.size(); ++i) {
|
||||||
const char* skinName = readString(input);
|
const char* skinName = readString(input);
|
||||||
skeletonData->_skins[i] = readSkin(input, skinName, skeletonData, nonessential);
|
skeletonData->_skins[i] = readSkin(input, skinName, skeletonData, nonessential);
|
||||||
FREE(skinName);
|
SpineExtension::free(skinName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Linked meshes. */
|
/* Linked meshes. */
|
||||||
@ -363,15 +357,15 @@ namespace Spine {
|
|||||||
LinkedMesh* linkedMesh = _linkedMeshes[i];
|
LinkedMesh* linkedMesh = _linkedMeshes[i];
|
||||||
Skin* skin = linkedMesh->_skin.length() == 0 ? skeletonData->getDefaultSkin() : skeletonData->findSkin(linkedMesh->_skin);
|
Skin* skin = linkedMesh->_skin.length() == 0 ? skeletonData->getDefaultSkin() : skeletonData->findSkin(linkedMesh->_skin);
|
||||||
if (skin == NULL) {
|
if (skin == NULL) {
|
||||||
FREE(input);
|
delete input;
|
||||||
DESTROY(SkeletonData, skeletonData);
|
delete skeletonData;
|
||||||
setError("Skin not found: ", linkedMesh->_skin.c_str());
|
setError("Skin not found: ", linkedMesh->_skin.c_str());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
Attachment* parent = skin->getAttachment(linkedMesh->_slotIndex, linkedMesh->_parent);
|
Attachment* parent = skin->getAttachment(linkedMesh->_slotIndex, linkedMesh->_parent);
|
||||||
if (parent == NULL) {
|
if (parent == NULL) {
|
||||||
FREE(input);
|
delete input;
|
||||||
DESTROY(SkeletonData, skeletonData);
|
delete skeletonData;
|
||||||
setError("Parent mesh not found: ", linkedMesh->_parent.c_str());
|
setError("Parent mesh not found: ", linkedMesh->_parent.c_str());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -386,14 +380,13 @@ namespace Spine {
|
|||||||
skeletonData->_events.setSize(eventsCount);
|
skeletonData->_events.setSize(eventsCount);
|
||||||
for (i = 0; i < eventsCount; ++i) {
|
for (i = 0; i < eventsCount; ++i) {
|
||||||
const char* name = readString(input);
|
const char* name = readString(input);
|
||||||
EventData* eventData = NEW(EventData);
|
EventData* eventData = new EventData(std::string(name));
|
||||||
new (eventData) EventData(std::string(name));
|
SpineExtension::free(name);
|
||||||
FREE(name);
|
|
||||||
eventData->_intValue = readVarint(input, 0);
|
eventData->_intValue = readVarint(input, 0);
|
||||||
eventData->_floatValue = readFloat(input);
|
eventData->_floatValue = readFloat(input);
|
||||||
const char* eventData_stringValue = readString(input);
|
const char* eventData_stringValue = readString(input);
|
||||||
eventData->_stringValue = std::string(eventData_stringValue);
|
eventData->_stringValue = std::string(eventData_stringValue);
|
||||||
FREE(eventData_stringValue);
|
SpineExtension::free(eventData_stringValue);
|
||||||
skeletonData->_events[i] = eventData;
|
skeletonData->_events[i] = eventData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -404,16 +397,16 @@ namespace Spine {
|
|||||||
for (i = 0; i < animationsCount; ++i) {
|
for (i = 0; i < animationsCount; ++i) {
|
||||||
const char* name = readString(input);
|
const char* name = readString(input);
|
||||||
Animation* animation = readAnimation(name, input, skeletonData);
|
Animation* animation = readAnimation(name, input, skeletonData);
|
||||||
FREE(name);
|
SpineExtension::free(name);
|
||||||
if (!animation) {
|
if (!animation) {
|
||||||
FREE(input);
|
delete input;
|
||||||
DESTROY(SkeletonData, skeletonData);
|
delete skeletonData;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
skeletonData->_animations[i] = animation;
|
skeletonData->_animations[i] = animation;
|
||||||
}
|
}
|
||||||
|
|
||||||
FREE(input);
|
delete input;
|
||||||
|
|
||||||
return skeletonData;
|
return skeletonData;
|
||||||
}
|
}
|
||||||
@ -421,13 +414,13 @@ namespace Spine {
|
|||||||
SkeletonData* SkeletonBinary::readSkeletonDataFile(const char* path) {
|
SkeletonData* SkeletonBinary::readSkeletonDataFile(const char* path) {
|
||||||
int length;
|
int length;
|
||||||
SkeletonData* skeletonData;
|
SkeletonData* skeletonData;
|
||||||
const char* binary = SPINE_EXTENSION->spineReadFile(path, &length);
|
const char* binary = SpineExtension::readFile(path, &length);
|
||||||
if (length == 0 || !binary) {
|
if (length == 0 || !binary) {
|
||||||
setError("Unable to read skeleton file: ", path);
|
setError("Unable to read skeleton file: ", path);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
skeletonData = readSkeletonData((unsigned char*)binary, length);
|
skeletonData = readSkeletonData((unsigned char*)binary, length);
|
||||||
FREE(binary);
|
SpineExtension::free(binary);
|
||||||
return skeletonData;
|
return skeletonData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,7 +442,7 @@ namespace Spine {
|
|||||||
if (length == 0) {
|
if (length == 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
string = MALLOC(char, length);
|
string = SpineExtension::alloc<char>(length, __FILE__, __LINE__);
|
||||||
memcpy(string, input->cursor, length - 1);
|
memcpy(string, input->cursor, length - 1);
|
||||||
input->cursor += length - 1;
|
input->cursor += length - 1;
|
||||||
string[length - 1] = '\0';
|
string[length - 1] = '\0';
|
||||||
@ -529,8 +522,7 @@ namespace Spine {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
skin = NEW(Skin);
|
skin = new Skin(std::string(skinName));
|
||||||
new (skin) Skin(std::string(skinName));
|
|
||||||
|
|
||||||
for (i = 0; i < slotCount; ++i) {
|
for (i = 0; i < slotCount; ++i) {
|
||||||
int slotIndex = readVarint(input, 1);
|
int slotIndex = readVarint(input, 1);
|
||||||
@ -540,7 +532,7 @@ namespace Spine {
|
|||||||
if (attachment) {
|
if (attachment) {
|
||||||
skin->addAttachment(slotIndex, std::string(name), attachment);
|
skin->addAttachment(slotIndex, std::string(name), attachment);
|
||||||
}
|
}
|
||||||
FREE(name);
|
SpineExtension::free(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -579,7 +571,7 @@ namespace Spine {
|
|||||||
region->updateOffset();
|
region->updateOffset();
|
||||||
|
|
||||||
if (freeName) {
|
if (freeName) {
|
||||||
FREE(name);
|
SpineExtension::free(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return region;
|
return region;
|
||||||
@ -593,7 +585,7 @@ namespace Spine {
|
|||||||
readInt(input);
|
readInt(input);
|
||||||
}
|
}
|
||||||
if (freeName) {
|
if (freeName) {
|
||||||
FREE(name);
|
SpineExtension::free(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return box;
|
return box;
|
||||||
@ -628,7 +620,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (freeName) {
|
if (freeName) {
|
||||||
FREE(name);
|
SpineExtension::free(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mesh;
|
return mesh;
|
||||||
@ -653,16 +645,15 @@ namespace Spine {
|
|||||||
mesh->_height = readFloat(input) * _scale;
|
mesh->_height = readFloat(input) * _scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
LinkedMesh* linkedMesh = NEW(LinkedMesh);
|
LinkedMesh* linkedMesh = new LinkedMesh(mesh, std::string(skinName), slotIndex, std::string(parent));
|
||||||
new (linkedMesh) LinkedMesh(mesh, std::string(skinName), slotIndex, std::string(parent));
|
|
||||||
_linkedMeshes.push_back(linkedMesh);
|
_linkedMeshes.push_back(linkedMesh);
|
||||||
|
|
||||||
if (freeName) {
|
if (freeName) {
|
||||||
FREE(name);
|
SpineExtension::free(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
FREE(skinName);
|
SpineExtension::free(skinName);
|
||||||
FREE(parent);
|
SpineExtension::free(parent);
|
||||||
|
|
||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
@ -686,7 +677,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (freeName) {
|
if (freeName) {
|
||||||
FREE(name);
|
SpineExtension::free(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
@ -718,7 +709,7 @@ namespace Spine {
|
|||||||
clip->_endSlot = skeletonData->_slots[endSlotIndex];
|
clip->_endSlot = skeletonData->_slots[endSlotIndex];
|
||||||
|
|
||||||
if (freeName) {
|
if (freeName) {
|
||||||
FREE(name);
|
SpineExtension::free(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return clip;
|
return clip;
|
||||||
@ -726,7 +717,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (freeName) {
|
if (freeName) {
|
||||||
FREE(name);
|
SpineExtension::free(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -809,21 +800,19 @@ namespace Spine {
|
|||||||
int frameCount = readVarint(input, true);
|
int frameCount = readVarint(input, true);
|
||||||
switch (timelineType) {
|
switch (timelineType) {
|
||||||
case SLOT_ATTACHMENT: {
|
case SLOT_ATTACHMENT: {
|
||||||
AttachmentTimeline* timeline = NEW(AttachmentTimeline);
|
AttachmentTimeline* timeline = new AttachmentTimeline(frameCount);
|
||||||
new(timeline) AttachmentTimeline(frameCount);
|
|
||||||
timeline->_slotIndex = slotIndex;
|
timeline->_slotIndex = slotIndex;
|
||||||
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
||||||
const char* attachmentName = readString(input);
|
const char* attachmentName = readString(input);
|
||||||
timeline->setFrame(frameIndex, readFloat(input), std::string(attachmentName));
|
timeline->setFrame(frameIndex, readFloat(input), std::string(attachmentName));
|
||||||
FREE(attachmentName);
|
SpineExtension::free(attachmentName);
|
||||||
}
|
}
|
||||||
timelines.push_back(timeline);
|
timelines.push_back(timeline);
|
||||||
duration = MAX(duration, timeline->_frames[frameCount - 1]);
|
duration = MAX(duration, timeline->_frames[frameCount - 1]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SLOT_COLOR: {
|
case SLOT_COLOR: {
|
||||||
ColorTimeline* timeline = NEW(ColorTimeline);
|
ColorTimeline* timeline = new ColorTimeline(frameCount);
|
||||||
new(timeline) ColorTimeline(frameCount);
|
|
||||||
timeline->_slotIndex = slotIndex;
|
timeline->_slotIndex = slotIndex;
|
||||||
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
||||||
float time = readFloat(input);
|
float time = readFloat(input);
|
||||||
@ -842,8 +831,7 @@ namespace Spine {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SLOT_TWO_COLOR: {
|
case SLOT_TWO_COLOR: {
|
||||||
TwoColorTimeline* timeline = NEW(TwoColorTimeline);
|
TwoColorTimeline* timeline = new TwoColorTimeline(frameCount);
|
||||||
new(timeline) TwoColorTimeline(frameCount);
|
|
||||||
timeline->_slotIndex = slotIndex;
|
timeline->_slotIndex = slotIndex;
|
||||||
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
||||||
float time = readFloat(input);
|
float time = readFloat(input);
|
||||||
@ -883,8 +871,7 @@ namespace Spine {
|
|||||||
int frameCount = readVarint(input, true);
|
int frameCount = readVarint(input, true);
|
||||||
switch (timelineType) {
|
switch (timelineType) {
|
||||||
case BONE_ROTATE: {
|
case BONE_ROTATE: {
|
||||||
RotateTimeline* timeline = NEW(RotateTimeline);
|
RotateTimeline* timeline = new RotateTimeline(frameCount);
|
||||||
new(timeline) RotateTimeline(frameCount);
|
|
||||||
timeline->_boneIndex = boneIndex;
|
timeline->_boneIndex = boneIndex;
|
||||||
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
||||||
timeline->setFrame(frameIndex, readFloat(input), readFloat(input));
|
timeline->setFrame(frameIndex, readFloat(input), readFloat(input));
|
||||||
@ -902,16 +889,13 @@ namespace Spine {
|
|||||||
TranslateTimeline* timeline;
|
TranslateTimeline* timeline;
|
||||||
float timelineScale = 1;
|
float timelineScale = 1;
|
||||||
if (timelineType == BONE_SCALE) {
|
if (timelineType == BONE_SCALE) {
|
||||||
timeline = NEW(ScaleTimeline);
|
timeline = new ScaleTimeline(frameCount);
|
||||||
new(timeline) ScaleTimeline(frameCount);
|
|
||||||
}
|
}
|
||||||
else if (timelineType == BONE_SHEAR) {
|
else if (timelineType == BONE_SHEAR) {
|
||||||
timeline = NEW(ShearTimeline);
|
timeline = new ShearTimeline(frameCount);
|
||||||
new(timeline) ShearTimeline(frameCount);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
timeline = NEW(TranslateTimeline);
|
timeline = new TranslateTimeline(frameCount);
|
||||||
new(timeline) TranslateTimeline(frameCount);
|
|
||||||
timelineScale = scale;
|
timelineScale = scale;
|
||||||
}
|
}
|
||||||
timeline->_boneIndex = boneIndex;
|
timeline->_boneIndex = boneIndex;
|
||||||
@ -938,8 +922,7 @@ namespace Spine {
|
|||||||
for (int i = 0, n = readVarint(input, true); i < n; ++i) {
|
for (int i = 0, n = readVarint(input, true); i < n; ++i) {
|
||||||
int index = readVarint(input, true);
|
int index = readVarint(input, true);
|
||||||
int frameCount = readVarint(input, true);
|
int frameCount = readVarint(input, true);
|
||||||
IkConstraintTimeline* timeline = NEW(IkConstraintTimeline);
|
IkConstraintTimeline* timeline = new IkConstraintTimeline(frameCount);
|
||||||
new(timeline) IkConstraintTimeline(frameCount);
|
|
||||||
timeline->_ikConstraintIndex = index;
|
timeline->_ikConstraintIndex = index;
|
||||||
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
||||||
timeline->setFrame(frameIndex, readFloat(input), readFloat(input), readSByte(input));
|
timeline->setFrame(frameIndex, readFloat(input), readFloat(input), readSByte(input));
|
||||||
@ -955,8 +938,7 @@ namespace Spine {
|
|||||||
for (int i = 0, n = readVarint(input, true); i < n; ++i) {
|
for (int i = 0, n = readVarint(input, true); i < n; ++i) {
|
||||||
int index = readVarint(input, true);
|
int index = readVarint(input, true);
|
||||||
int frameCount = readVarint(input, true);
|
int frameCount = readVarint(input, true);
|
||||||
TransformConstraintTimeline* timeline = NEW(TransformConstraintTimeline);
|
TransformConstraintTimeline* timeline = new TransformConstraintTimeline(frameCount);
|
||||||
new(timeline) TransformConstraintTimeline(frameCount);
|
|
||||||
timeline->_transformConstraintIndex = index;
|
timeline->_transformConstraintIndex = index;
|
||||||
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
||||||
timeline->setFrame(frameIndex, readFloat(input), readFloat(input), readFloat(input), readFloat(input), readFloat(input));
|
timeline->setFrame(frameIndex, readFloat(input), readFloat(input), readFloat(input), readFloat(input), readFloat(input));
|
||||||
@ -981,16 +963,14 @@ namespace Spine {
|
|||||||
PathConstraintPositionTimeline* timeline;
|
PathConstraintPositionTimeline* timeline;
|
||||||
float timelineScale = 1;
|
float timelineScale = 1;
|
||||||
if (timelineType == PATH_SPACING) {
|
if (timelineType == PATH_SPACING) {
|
||||||
timeline = NEW(PathConstraintSpacingTimeline);
|
timeline = new PathConstraintSpacingTimeline(frameCount);
|
||||||
new(timeline) PathConstraintSpacingTimeline(frameCount);
|
|
||||||
|
|
||||||
if (data->_spacingMode == SpacingMode_Length || data->_spacingMode == SpacingMode_Fixed) {
|
if (data->_spacingMode == SpacingMode_Length || data->_spacingMode == SpacingMode_Fixed) {
|
||||||
timelineScale = scale;
|
timelineScale = scale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
timeline = NEW(PathConstraintPositionTimeline);
|
timeline = new PathConstraintPositionTimeline(frameCount);
|
||||||
new(timeline) PathConstraintPositionTimeline(frameCount);
|
|
||||||
|
|
||||||
if (data->_positionMode == PositionMode_Fixed) {
|
if (data->_positionMode == PositionMode_Fixed) {
|
||||||
timelineScale = scale;
|
timelineScale = scale;
|
||||||
@ -1008,8 +988,7 @@ namespace Spine {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PATH_MIX: {
|
case PATH_MIX: {
|
||||||
PathConstraintMixTimeline* timeline = NEW(PathConstraintMixTimeline);
|
PathConstraintMixTimeline* timeline = new PathConstraintMixTimeline(frameCount);
|
||||||
new(timeline) PathConstraintMixTimeline(frameCount);
|
|
||||||
|
|
||||||
timeline->_pathConstraintIndex = index;
|
timeline->_pathConstraintIndex = index;
|
||||||
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
||||||
@ -1038,11 +1017,11 @@ namespace Spine {
|
|||||||
if (!baseAttachment) {
|
if (!baseAttachment) {
|
||||||
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
ContainerUtil::cleanUpVectorOfPointers(timelines);
|
||||||
setError("Attachment not found: ", attachmentName);
|
setError("Attachment not found: ", attachmentName);
|
||||||
FREE(attachmentName);
|
SpineExtension::free(attachmentName);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
FREE(attachmentName);
|
SpineExtension::free(attachmentName);
|
||||||
|
|
||||||
VertexAttachment* attachment = static_cast<VertexAttachment*>(baseAttachment);
|
VertexAttachment* attachment = static_cast<VertexAttachment*>(baseAttachment);
|
||||||
|
|
||||||
@ -1052,8 +1031,7 @@ namespace Spine {
|
|||||||
|
|
||||||
int frameCount = readVarint(input, true);
|
int frameCount = readVarint(input, true);
|
||||||
|
|
||||||
DeformTimeline* timeline = NEW(DeformTimeline);
|
DeformTimeline* timeline = new DeformTimeline(frameCount);
|
||||||
new(timeline) DeformTimeline(frameCount);
|
|
||||||
|
|
||||||
timeline->_slotIndex = slotIndex;
|
timeline->_slotIndex = slotIndex;
|
||||||
timeline->_attachment = attachment;
|
timeline->_attachment = attachment;
|
||||||
@ -1110,8 +1088,7 @@ namespace Spine {
|
|||||||
// Draw order timeline.
|
// Draw order timeline.
|
||||||
int drawOrderCount = readVarint(input, true);
|
int drawOrderCount = readVarint(input, true);
|
||||||
if (drawOrderCount > 0) {
|
if (drawOrderCount > 0) {
|
||||||
DrawOrderTimeline* timeline = NEW(DrawOrderTimeline);
|
DrawOrderTimeline* timeline = new DrawOrderTimeline(drawOrderCount);
|
||||||
new(timeline) DrawOrderTimeline(drawOrderCount);
|
|
||||||
|
|
||||||
int slotCount = static_cast<int>(skeletonData->_slots.size());
|
int slotCount = static_cast<int>(skeletonData->_slots.size());
|
||||||
for (int i = 0; i < drawOrderCount; ++i) {
|
for (int i = 0; i < drawOrderCount; ++i) {
|
||||||
@ -1158,14 +1135,12 @@ namespace Spine {
|
|||||||
// Event timeline.
|
// Event timeline.
|
||||||
int eventCount = readVarint(input, true);
|
int eventCount = readVarint(input, true);
|
||||||
if (eventCount > 0) {
|
if (eventCount > 0) {
|
||||||
EventTimeline* timeline = NEW(EventTimeline);
|
EventTimeline* timeline =new EventTimeline(eventCount);
|
||||||
new(timeline) EventTimeline(eventCount);
|
|
||||||
|
|
||||||
for (int i = 0; i < eventCount; ++i) {
|
for (int i = 0; i < eventCount; ++i) {
|
||||||
float time = readFloat(input);
|
float time = readFloat(input);
|
||||||
EventData* eventData = skeletonData->_events[readVarint(input, true)];
|
EventData* eventData = skeletonData->_events[readVarint(input, true)];
|
||||||
Event* event = NEW(Event);
|
Event* event = new Event(time, *eventData);
|
||||||
new(event) Event(time, *eventData);
|
|
||||||
|
|
||||||
event->_intValue = readVarint(input, false);
|
event->_intValue = readVarint(input, false);
|
||||||
event->_floatValue = readFloat(input);
|
event->_floatValue = readFloat(input);
|
||||||
@ -1173,7 +1148,7 @@ namespace Spine {
|
|||||||
const char* event_stringValue = freeString ? readString(input) : eventData->_stringValue.c_str();
|
const char* event_stringValue = freeString ? readString(input) : eventData->_stringValue.c_str();
|
||||||
event->_stringValue = std::string(event_stringValue);
|
event->_stringValue = std::string(event_stringValue);
|
||||||
if (freeString) {
|
if (freeString) {
|
||||||
FREE(event_stringValue);
|
SpineExtension::free(event_stringValue);
|
||||||
}
|
}
|
||||||
timeline->setFrame(i, event);
|
timeline->setFrame(i, event);
|
||||||
}
|
}
|
||||||
@ -1182,10 +1157,7 @@ namespace Spine {
|
|||||||
duration = MAX(duration, timeline->_frames[eventCount - 1]);
|
duration = MAX(duration, timeline->_frames[eventCount - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Animation* ret = NEW(Animation);
|
return new Animation(std::string(name), timelines, duration);
|
||||||
new (ret) Animation(std::string(name), timelines, duration);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonBinary::readCurve(DataInput* input, int frameIndex, CurveTimeline* timeline) {
|
void SkeletonBinary::readCurve(DataInput* input, int frameIndex, CurveTimeline* timeline) {
|
||||||
|
|||||||
@ -68,8 +68,7 @@ namespace Spine {
|
|||||||
_polygonPool.erase(poolCount - 1);
|
_polygonPool.erase(poolCount - 1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Polygon* polygonP = NEW(Polygon);
|
Polygon* polygonP = new Polygon();
|
||||||
new (polygonP) Polygon();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_polygons.push_back(polygonP);
|
_polygons.push_back(polygonP);
|
||||||
|
|||||||
@ -86,8 +86,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace Spine {
|
namespace Spine {
|
||||||
SkeletonJson::SkeletonJson(Vector<Atlas*>& atlasArray) : _attachmentLoader(NEW(AtlasAttachmentLoader)), _scale(1), _ownsLoader(true) {
|
SkeletonJson::SkeletonJson(Atlas& atlas) : _attachmentLoader(new AtlasAttachmentLoader(atlas)), _scale(1), _ownsLoader(true) {
|
||||||
new (_attachmentLoader) AtlasAttachmentLoader(atlasArray);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SkeletonJson::SkeletonJson(AttachmentLoader* attachmentLoader) : _attachmentLoader(attachmentLoader), _scale(1), _ownsLoader(false) {
|
SkeletonJson::SkeletonJson(AttachmentLoader* attachmentLoader) : _attachmentLoader(attachmentLoader), _scale(1), _ownsLoader(false) {
|
||||||
@ -98,14 +97,14 @@ namespace Spine {
|
|||||||
ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes);
|
ContainerUtil::cleanUpVectorOfPointers(_linkedMeshes);
|
||||||
|
|
||||||
if (_ownsLoader) {
|
if (_ownsLoader) {
|
||||||
DESTROY(AttachmentLoader, _attachmentLoader);
|
delete _attachmentLoader;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SkeletonData* SkeletonJson::readSkeletonDataFile(const char* path) {
|
SkeletonData* SkeletonJson::readSkeletonDataFile(const char* path) {
|
||||||
int length;
|
int length;
|
||||||
SkeletonData* skeletonData;
|
SkeletonData* skeletonData;
|
||||||
const char* json = SPINE_EXTENSION->spineReadFile(path, &length);
|
const char* json = SpineExtension::readFile(path, &length);
|
||||||
if (length == 0 || !json) {
|
if (length == 0 || !json) {
|
||||||
setError(NULL, "Unable to read skeleton file: ", path);
|
setError(NULL, "Unable to read skeleton file: ", path);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -113,7 +112,7 @@ namespace Spine {
|
|||||||
|
|
||||||
skeletonData = readSkeletonData(json);
|
skeletonData = readSkeletonData(json);
|
||||||
|
|
||||||
FREE(json);
|
SpineExtension::free(json);
|
||||||
|
|
||||||
return skeletonData;
|
return skeletonData;
|
||||||
}
|
}
|
||||||
@ -126,16 +125,14 @@ namespace Spine {
|
|||||||
_error.clear();
|
_error.clear();
|
||||||
_linkedMeshes.clear();
|
_linkedMeshes.clear();
|
||||||
|
|
||||||
root = NEW(Json);
|
root = new Json(json);
|
||||||
new (root) Json(json);
|
|
||||||
|
|
||||||
if (!root) {
|
if (!root) {
|
||||||
setError(NULL, "Invalid skeleton JSON: ", Json::getError());
|
setError(NULL, "Invalid skeleton JSON: ", Json::getError());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
skeletonData = NEW(SkeletonData);
|
skeletonData = new SkeletonData();
|
||||||
new (skeletonData) SkeletonData();
|
|
||||||
|
|
||||||
skeleton = Json::getItem(root, "skeleton");
|
skeleton = Json::getItem(root, "skeleton");
|
||||||
if (skeleton) {
|
if (skeleton) {
|
||||||
@ -159,14 +156,13 @@ namespace Spine {
|
|||||||
if (parentName) {
|
if (parentName) {
|
||||||
parent = skeletonData->findBone(parentName);
|
parent = skeletonData->findBone(parentName);
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
DESTROY(SkeletonData, skeletonData);
|
delete skeletonData;
|
||||||
setError(root, "Parent bone not found: ", parentName);
|
setError(root, "Parent bone not found: ", parentName);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data = NEW(BoneData);
|
data = new BoneData(bonesCount, Json::getString(boneMap, "name", 0), parent);
|
||||||
new (data) BoneData(bonesCount, Json::getString(boneMap, "name", 0), parent);
|
|
||||||
|
|
||||||
data->_length = Json::getFloat(boneMap, "length", 0) * _scale;
|
data->_length = Json::getFloat(boneMap, "length", 0) * _scale;
|
||||||
data->_x = Json::getFloat(boneMap, "x", 0) * _scale;
|
data->_x = Json::getFloat(boneMap, "x", 0) * _scale;
|
||||||
@ -213,13 +209,12 @@ namespace Spine {
|
|||||||
const char* boneName = Json::getString(slotMap, "bone", 0);
|
const char* boneName = Json::getString(slotMap, "bone", 0);
|
||||||
BoneData* boneData = skeletonData->findBone(boneName);
|
BoneData* boneData = skeletonData->findBone(boneName);
|
||||||
if (!boneData) {
|
if (!boneData) {
|
||||||
DESTROY(SkeletonData, skeletonData);
|
delete skeletonData;
|
||||||
setError(root, "Slot bone not found: ", boneName);
|
setError(root, "Slot bone not found: ", boneName);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
data = NEW(SlotData);
|
data = new SlotData(i, Json::getString(slotMap, "name", 0), *boneData);
|
||||||
new (data) SlotData(i, Json::getString(slotMap, "name", 0), *boneData);
|
|
||||||
|
|
||||||
color = Json::getString(slotMap, "color", 0);
|
color = Json::getString(slotMap, "color", 0);
|
||||||
if (color) {
|
if (color) {
|
||||||
@ -269,8 +264,7 @@ namespace Spine {
|
|||||||
for (constraintMap = ik->_child, i = 0; constraintMap; constraintMap = constraintMap->_next, ++i) {
|
for (constraintMap = ik->_child, i = 0; constraintMap; constraintMap = constraintMap->_next, ++i) {
|
||||||
const char* targetName;
|
const char* targetName;
|
||||||
|
|
||||||
IkConstraintData* data = NEW(IkConstraintData);
|
IkConstraintData* data = new IkConstraintData(Json::getString(constraintMap, "name", 0));
|
||||||
new (data) IkConstraintData(Json::getString(constraintMap, "name", 0));
|
|
||||||
|
|
||||||
data->_order = Json::getInt(constraintMap, "order", 0);
|
data->_order = Json::getInt(constraintMap, "order", 0);
|
||||||
|
|
||||||
@ -280,7 +274,7 @@ namespace Spine {
|
|||||||
for (boneMap = boneMap->_child, ii = 0; boneMap; boneMap = boneMap->_next, ++ii) {
|
for (boneMap = boneMap->_child, ii = 0; boneMap; boneMap = boneMap->_next, ++ii) {
|
||||||
data->_bones[ii] = skeletonData->findBone(boneMap->_valueString);
|
data->_bones[ii] = skeletonData->findBone(boneMap->_valueString);
|
||||||
if (!data->_bones[ii]) {
|
if (!data->_bones[ii]) {
|
||||||
DESTROY(SkeletonData, skeletonData);
|
delete skeletonData;
|
||||||
setError(root, "IK bone not found: ", boneMap->_valueString);
|
setError(root, "IK bone not found: ", boneMap->_valueString);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -289,7 +283,7 @@ namespace Spine {
|
|||||||
targetName = Json::getString(constraintMap, "target", 0);
|
targetName = Json::getString(constraintMap, "target", 0);
|
||||||
data->_target = skeletonData->findBone(targetName);
|
data->_target = skeletonData->findBone(targetName);
|
||||||
if (!data->_target) {
|
if (!data->_target) {
|
||||||
DESTROY(SkeletonData, skeletonData);
|
delete skeletonData;
|
||||||
setError(root, "Target bone not found: ", targetName);
|
setError(root, "Target bone not found: ", targetName);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -310,8 +304,7 @@ namespace Spine {
|
|||||||
for (constraintMap = transform->_child, i = 0; constraintMap; constraintMap = constraintMap->_next, ++i) {
|
for (constraintMap = transform->_child, i = 0; constraintMap; constraintMap = constraintMap->_next, ++i) {
|
||||||
const char* name;
|
const char* name;
|
||||||
|
|
||||||
TransformConstraintData* data = NEW(TransformConstraintData);
|
TransformConstraintData* data = new TransformConstraintData(Json::getString(constraintMap, "name", 0));
|
||||||
new (data) TransformConstraintData(Json::getString(constraintMap, "name", 0));
|
|
||||||
|
|
||||||
data->_order = Json::getInt(constraintMap, "order", 0);
|
data->_order = Json::getInt(constraintMap, "order", 0);
|
||||||
|
|
||||||
@ -321,7 +314,7 @@ namespace Spine {
|
|||||||
for (boneMap = boneMap->_child, ii = 0; boneMap; boneMap = boneMap->_next, ++ii) {
|
for (boneMap = boneMap->_child, ii = 0; boneMap; boneMap = boneMap->_next, ++ii) {
|
||||||
data->_bones[ii] = skeletonData->findBone(boneMap->_valueString);
|
data->_bones[ii] = skeletonData->findBone(boneMap->_valueString);
|
||||||
if (!data->_bones[ii]) {
|
if (!data->_bones[ii]) {
|
||||||
DESTROY(SkeletonData, skeletonData);
|
delete skeletonData;
|
||||||
setError(root, "Transform bone not found: ", boneMap->_valueString);
|
setError(root, "Transform bone not found: ", boneMap->_valueString);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -330,7 +323,7 @@ namespace Spine {
|
|||||||
name = Json::getString(constraintMap, "target", 0);
|
name = Json::getString(constraintMap, "target", 0);
|
||||||
data->_target = skeletonData->findBone(name);
|
data->_target = skeletonData->findBone(name);
|
||||||
if (!data->_target) {
|
if (!data->_target) {
|
||||||
DESTROY(SkeletonData, skeletonData);
|
delete skeletonData;
|
||||||
setError(root, "Target bone not found: ", name);
|
setError(root, "Target bone not found: ", name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -363,8 +356,7 @@ namespace Spine {
|
|||||||
const char* name;
|
const char* name;
|
||||||
const char* item;
|
const char* item;
|
||||||
|
|
||||||
PathConstraintData* data = NEW(PathConstraintData);
|
PathConstraintData* data = new PathConstraintData(Json::getString(constraintMap, "name", 0));
|
||||||
new (data) PathConstraintData(Json::getString(constraintMap, "name", 0));
|
|
||||||
|
|
||||||
data->_order = Json::getInt(constraintMap, "order", 0);
|
data->_order = Json::getInt(constraintMap, "order", 0);
|
||||||
|
|
||||||
@ -374,7 +366,7 @@ namespace Spine {
|
|||||||
for (boneMap = boneMap->_child, ii = 0; boneMap; boneMap = boneMap->_next, ++ii) {
|
for (boneMap = boneMap->_child, ii = 0; boneMap; boneMap = boneMap->_next, ++ii) {
|
||||||
data->_bones[ii] = skeletonData->findBone(boneMap->_valueString);
|
data->_bones[ii] = skeletonData->findBone(boneMap->_valueString);
|
||||||
if (!data->_bones[ii]) {
|
if (!data->_bones[ii]) {
|
||||||
DESTROY(SkeletonData, skeletonData);
|
delete skeletonData;
|
||||||
setError(root, "Path bone not found: ", boneMap->_valueString);
|
setError(root, "Path bone not found: ", boneMap->_valueString);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -383,7 +375,7 @@ namespace Spine {
|
|||||||
name = Json::getString(constraintMap, "target", 0);
|
name = Json::getString(constraintMap, "target", 0);
|
||||||
data->_target = skeletonData->findSlot(name);
|
data->_target = skeletonData->findSlot(name);
|
||||||
if (!data->_target) {
|
if (!data->_target) {
|
||||||
DESTROY(SkeletonData, skeletonData);
|
delete skeletonData;
|
||||||
setError(root, "Target slot not found: ", name);
|
setError(root, "Target slot not found: ", name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -445,8 +437,7 @@ namespace Spine {
|
|||||||
Json *attachmentsMap;
|
Json *attachmentsMap;
|
||||||
Json *curves;
|
Json *curves;
|
||||||
|
|
||||||
Skin* skin = NEW(Skin);
|
Skin* skin = new Skin(skinMap->_name);
|
||||||
new (skin) Skin(skinMap->_name);
|
|
||||||
|
|
||||||
skeletonData->_skins[skinsIndex++] = skin;
|
skeletonData->_skins[skinsIndex++] = skin;
|
||||||
if (strcmp(skinMap->_name, "default") == 0) {
|
if (strcmp(skinMap->_name, "default") == 0) {
|
||||||
@ -486,7 +477,7 @@ namespace Spine {
|
|||||||
type = AttachmentType_Clipping;
|
type = AttachmentType_Clipping;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DESTROY(SkeletonData, skeletonData);
|
delete skeletonData;
|
||||||
setError(root, "Unknown attachment type: ", typeString);
|
setError(root, "Unknown attachment type: ", typeString);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -495,7 +486,7 @@ namespace Spine {
|
|||||||
case AttachmentType_Region: {
|
case AttachmentType_Region: {
|
||||||
attachment = _attachmentLoader->newRegionAttachment(*skin, attachmentName, attachmentPath);
|
attachment = _attachmentLoader->newRegionAttachment(*skin, attachmentName, attachmentPath);
|
||||||
if (!attachment) {
|
if (!attachment) {
|
||||||
DESTROY(SkeletonData, skeletonData);
|
delete skeletonData;
|
||||||
setError(root, "Error reading attachment: ", skinAttachmentName);
|
setError(root, "Error reading attachment: ", skinAttachmentName);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -576,8 +567,7 @@ namespace Spine {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mesh->_inheritDeform = Json::getInt(attachmentMap, "deform", 1);
|
mesh->_inheritDeform = Json::getInt(attachmentMap, "deform", 1);
|
||||||
LinkedMesh* linkedMesh = NEW(LinkedMesh);
|
LinkedMesh* linkedMesh = new LinkedMesh(mesh, std::string(Json::getString(attachmentMap, "skin", 0)), slotIndex, std::string(entry->_valueString));
|
||||||
new (linkedMesh) LinkedMesh(mesh, std::string(Json::getString(attachmentMap, "skin", 0)), slotIndex, std::string(entry->_valueString));
|
|
||||||
_linkedMeshes.push_back(linkedMesh);
|
_linkedMeshes.push_back(linkedMesh);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -649,13 +639,13 @@ namespace Spine {
|
|||||||
LinkedMesh* linkedMesh = _linkedMeshes[i];
|
LinkedMesh* linkedMesh = _linkedMeshes[i];
|
||||||
Skin* skin = linkedMesh->_skin.length() == 0 ? skeletonData->getDefaultSkin() : skeletonData->findSkin(linkedMesh->_skin);
|
Skin* skin = linkedMesh->_skin.length() == 0 ? skeletonData->getDefaultSkin() : skeletonData->findSkin(linkedMesh->_skin);
|
||||||
if (skin == NULL) {
|
if (skin == NULL) {
|
||||||
DESTROY(SkeletonData, skeletonData);
|
delete skeletonData;
|
||||||
setError(root, "Skin not found: ", linkedMesh->_skin.c_str());
|
setError(root, "Skin not found: ", linkedMesh->_skin.c_str());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
Attachment* parent = skin->getAttachment(linkedMesh->_slotIndex, linkedMesh->_parent);
|
Attachment* parent = skin->getAttachment(linkedMesh->_slotIndex, linkedMesh->_parent);
|
||||||
if (parent == NULL) {
|
if (parent == NULL) {
|
||||||
DESTROY(SkeletonData, skeletonData);
|
delete skeletonData;
|
||||||
setError(root, "Parent mesh not found: ", linkedMesh->_parent.c_str());
|
setError(root, "Parent mesh not found: ", linkedMesh->_parent.c_str());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -671,8 +661,7 @@ namespace Spine {
|
|||||||
skeletonData->_events.reserve(events->_size);
|
skeletonData->_events.reserve(events->_size);
|
||||||
skeletonData->_events.setSize(events->_size);
|
skeletonData->_events.setSize(events->_size);
|
||||||
for (eventMap = events->_child, i = 0; eventMap; eventMap = eventMap->_next, ++i) {
|
for (eventMap = events->_child, i = 0; eventMap; eventMap = eventMap->_next, ++i) {
|
||||||
EventData* eventData = NEW(EventData);
|
EventData* eventData = new EventData(std::string(eventMap->_name));
|
||||||
new (eventData) EventData(std::string(eventMap->_name));
|
|
||||||
|
|
||||||
eventData->_intValue = Json::getInt(eventMap, "int", 0);
|
eventData->_intValue = Json::getInt(eventMap, "int", 0);
|
||||||
eventData->_floatValue = Json::getFloat(eventMap, "float", 0);
|
eventData->_floatValue = Json::getFloat(eventMap, "float", 0);
|
||||||
@ -692,15 +681,15 @@ namespace Spine {
|
|||||||
for (animationMap = animations->_child; animationMap; animationMap = animationMap->_next) {
|
for (animationMap = animations->_child; animationMap; animationMap = animationMap->_next) {
|
||||||
Animation* animation = readAnimation(animationMap, skeletonData);
|
Animation* animation = readAnimation(animationMap, skeletonData);
|
||||||
if (!animation) {
|
if (!animation) {
|
||||||
DESTROY(SkeletonData, skeletonData);
|
delete skeletonData;
|
||||||
DESTROY(Json, root);
|
delete root;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
skeletonData->_animations[animationsIndex++] = animation;
|
skeletonData->_animations[animationsIndex++] = animation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DESTROY(Json, root);
|
delete root;
|
||||||
|
|
||||||
return skeletonData;
|
return skeletonData;
|
||||||
}
|
}
|
||||||
@ -807,8 +796,7 @@ namespace Spine {
|
|||||||
|
|
||||||
for (timelineMap = slotMap->_child; timelineMap; timelineMap = timelineMap->_next) {
|
for (timelineMap = slotMap->_child; timelineMap; timelineMap = timelineMap->_next) {
|
||||||
if (strcmp(timelineMap->_name, "attachment") == 0) {
|
if (strcmp(timelineMap->_name, "attachment") == 0) {
|
||||||
AttachmentTimeline *timeline = NEW(AttachmentTimeline);
|
AttachmentTimeline *timeline = new AttachmentTimeline(timelineMap->_size);
|
||||||
new (timeline) AttachmentTimeline(timelineMap->_size);
|
|
||||||
|
|
||||||
timeline->_slotIndex = slotIndex;
|
timeline->_slotIndex = slotIndex;
|
||||||
|
|
||||||
@ -823,8 +811,7 @@ namespace Spine {
|
|||||||
|
|
||||||
}
|
}
|
||||||
else if (strcmp(timelineMap->_name, "color") == 0) {
|
else if (strcmp(timelineMap->_name, "color") == 0) {
|
||||||
ColorTimeline *timeline = NEW(ColorTimeline);
|
ColorTimeline *timeline = new ColorTimeline(timelineMap->_size);
|
||||||
new (timeline) ColorTimeline(timelineMap->_size);
|
|
||||||
|
|
||||||
timeline->_slotIndex = slotIndex;
|
timeline->_slotIndex = slotIndex;
|
||||||
|
|
||||||
@ -839,8 +826,7 @@ namespace Spine {
|
|||||||
|
|
||||||
}
|
}
|
||||||
else if (strcmp(timelineMap->_name, "twoColor") == 0) {
|
else if (strcmp(timelineMap->_name, "twoColor") == 0) {
|
||||||
TwoColorTimeline *timeline = NEW(TwoColorTimeline);
|
TwoColorTimeline *timeline = new TwoColorTimeline(timelineMap->_size);
|
||||||
new (timeline) TwoColorTimeline(timelineMap->_size);
|
|
||||||
|
|
||||||
timeline->_slotIndex = slotIndex;
|
timeline->_slotIndex = slotIndex;
|
||||||
|
|
||||||
@ -876,8 +862,7 @@ namespace Spine {
|
|||||||
|
|
||||||
for (timelineMap = boneMap->_child; timelineMap; timelineMap = timelineMap->_next) {
|
for (timelineMap = boneMap->_child; timelineMap; timelineMap = timelineMap->_next) {
|
||||||
if (strcmp(timelineMap->_name, "rotate") == 0) {
|
if (strcmp(timelineMap->_name, "rotate") == 0) {
|
||||||
RotateTimeline *timeline = NEW(RotateTimeline);
|
RotateTimeline *timeline = new RotateTimeline(timelineMap->_size);
|
||||||
new (timeline) RotateTimeline(timelineMap->_size);
|
|
||||||
|
|
||||||
timeline->_boneIndex = boneIndex;
|
timeline->_boneIndex = boneIndex;
|
||||||
|
|
||||||
@ -897,16 +882,13 @@ namespace Spine {
|
|||||||
float timelineScale = isTranslate ? _scale: 1;
|
float timelineScale = isTranslate ? _scale: 1;
|
||||||
TranslateTimeline *timeline = 0;
|
TranslateTimeline *timeline = 0;
|
||||||
if (isScale) {
|
if (isScale) {
|
||||||
timeline = NEW(ScaleTimeline);
|
timeline = new ScaleTimeline(timelineMap->_size);
|
||||||
new (timeline) ScaleTimeline(timelineMap->_size);
|
|
||||||
}
|
}
|
||||||
else if (isTranslate) {
|
else if (isTranslate) {
|
||||||
timeline = NEW(TranslateTimeline);
|
timeline = new TranslateTimeline(timelineMap->_size);
|
||||||
new (timeline) TranslateTimeline(timelineMap->_size);
|
|
||||||
}
|
}
|
||||||
else if (isShear) {
|
else if (isShear) {
|
||||||
timeline = NEW(ShearTimeline);
|
timeline = new ShearTimeline(timelineMap->_size);
|
||||||
new (timeline) ShearTimeline(timelineMap->_size);
|
|
||||||
}
|
}
|
||||||
timeline->_boneIndex = boneIndex;
|
timeline->_boneIndex = boneIndex;
|
||||||
|
|
||||||
@ -931,8 +913,7 @@ namespace Spine {
|
|||||||
/** IK constraint timelines. */
|
/** IK constraint timelines. */
|
||||||
for (constraintMap = ik ? ik->_child : 0; constraintMap; constraintMap = constraintMap->_next) {
|
for (constraintMap = ik ? ik->_child : 0; constraintMap; constraintMap = constraintMap->_next) {
|
||||||
IkConstraintData* constraint = skeletonData->findIkConstraint(constraintMap->_name);
|
IkConstraintData* constraint = skeletonData->findIkConstraint(constraintMap->_name);
|
||||||
IkConstraintTimeline *timeline = NEW(IkConstraintTimeline);
|
IkConstraintTimeline *timeline = new IkConstraintTimeline(constraintMap->_size);
|
||||||
new (timeline) IkConstraintTimeline(constraintMap->_size);
|
|
||||||
|
|
||||||
for (frameIndex = 0; frameIndex < static_cast<int>(skeletonData->_ikConstraints.size()); ++frameIndex) {
|
for (frameIndex = 0; frameIndex < static_cast<int>(skeletonData->_ikConstraints.size()); ++frameIndex) {
|
||||||
if (constraint == skeletonData->_ikConstraints[frameIndex]) {
|
if (constraint == skeletonData->_ikConstraints[frameIndex]) {
|
||||||
@ -952,8 +933,7 @@ namespace Spine {
|
|||||||
/** Transform constraint timelines. */
|
/** Transform constraint timelines. */
|
||||||
for (constraintMap = transform ? transform->_child : 0; constraintMap; constraintMap = constraintMap->_next) {
|
for (constraintMap = transform ? transform->_child : 0; constraintMap; constraintMap = constraintMap->_next) {
|
||||||
TransformConstraintData* constraint = skeletonData->findTransformConstraint(constraintMap->_name);
|
TransformConstraintData* constraint = skeletonData->findTransformConstraint(constraintMap->_name);
|
||||||
TransformConstraintTimeline *timeline = NEW(TransformConstraintTimeline);
|
TransformConstraintTimeline *timeline = new TransformConstraintTimeline(constraintMap->_size);
|
||||||
new (timeline) TransformConstraintTimeline(constraintMap->_size);
|
|
||||||
|
|
||||||
for (frameIndex = 0; frameIndex < skeletonData->_transformConstraints.size(); ++frameIndex) {
|
for (frameIndex = 0; frameIndex < skeletonData->_transformConstraints.size(); ++frameIndex) {
|
||||||
if (constraint == skeletonData->_transformConstraints[frameIndex]) {
|
if (constraint == skeletonData->_transformConstraints[frameIndex]) {
|
||||||
@ -995,16 +975,14 @@ namespace Spine {
|
|||||||
PathConstraintPositionTimeline* timeline;
|
PathConstraintPositionTimeline* timeline;
|
||||||
float timelineScale = 1;
|
float timelineScale = 1;
|
||||||
if (strcmp(timelineName, "spacing") == 0) {
|
if (strcmp(timelineName, "spacing") == 0) {
|
||||||
timeline = NEW(PathConstraintSpacingTimeline);
|
timeline = new PathConstraintSpacingTimeline(timelineMap->_size);
|
||||||
new (timeline) PathConstraintSpacingTimeline(timelineMap->_size);
|
|
||||||
|
|
||||||
if (data->_spacingMode == SpacingMode_Length || data->_spacingMode == SpacingMode_Fixed) {
|
if (data->_spacingMode == SpacingMode_Length || data->_spacingMode == SpacingMode_Fixed) {
|
||||||
timelineScale = _scale;
|
timelineScale = _scale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
timeline = NEW(PathConstraintPositionTimeline);
|
timeline = new PathConstraintPositionTimeline(timelineMap->_size);
|
||||||
new (timeline) PathConstraintPositionTimeline(timelineMap->_size);
|
|
||||||
|
|
||||||
if (data->_positionMode == PositionMode_Fixed) {
|
if (data->_positionMode == PositionMode_Fixed) {
|
||||||
timelineScale = _scale;
|
timelineScale = _scale;
|
||||||
@ -1021,8 +999,7 @@ namespace Spine {
|
|||||||
duration = MAX(duration, timeline->_frames[(timelineMap->_size - 1) * PathConstraintPositionTimeline::ENTRIES]);
|
duration = MAX(duration, timeline->_frames[(timelineMap->_size - 1) * PathConstraintPositionTimeline::ENTRIES]);
|
||||||
}
|
}
|
||||||
else if (strcmp(timelineName, "mix") == 0) {
|
else if (strcmp(timelineName, "mix") == 0) {
|
||||||
PathConstraintMixTimeline* timeline = NEW(PathConstraintMixTimeline);
|
PathConstraintMixTimeline* timeline = new PathConstraintMixTimeline(timelineMap->_size);
|
||||||
new (timeline) PathConstraintMixTimeline(timelineMap->_size);
|
|
||||||
timeline->_pathConstraintIndex = constraintIndex;
|
timeline->_pathConstraintIndex = constraintIndex;
|
||||||
for (valueMap = timelineMap->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) {
|
for (valueMap = timelineMap->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) {
|
||||||
timeline->setFrame(frameIndex, Json::getFloat(valueMap, "time", 0), Json::getFloat(valueMap, "rotateMix", 1), Json::getFloat(valueMap, "translateMix", 1));
|
timeline->setFrame(frameIndex, Json::getFloat(valueMap, "time", 0), Json::getFloat(valueMap, "rotateMix", 1), Json::getFloat(valueMap, "translateMix", 1));
|
||||||
@ -1064,8 +1041,7 @@ namespace Spine {
|
|||||||
tempDeform.push_back(0);
|
tempDeform.push_back(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
timeline = NEW(DeformTimeline);
|
timeline = new DeformTimeline(timelineMap->_size);
|
||||||
new (timeline) DeformTimeline(timelineMap->_size);
|
|
||||||
|
|
||||||
timeline->_slotIndex = slotIndex;
|
timeline->_slotIndex = slotIndex;
|
||||||
timeline->_attachment = attachment;
|
timeline->_attachment = attachment;
|
||||||
@ -1115,8 +1091,7 @@ namespace Spine {
|
|||||||
|
|
||||||
/** Draw order timeline. */
|
/** Draw order timeline. */
|
||||||
if (drawOrder) {
|
if (drawOrder) {
|
||||||
DrawOrderTimeline* timeline = NEW(DrawOrderTimeline);
|
DrawOrderTimeline* timeline = new DrawOrderTimeline(drawOrder->_size);
|
||||||
new (timeline) DrawOrderTimeline(drawOrder->_size);
|
|
||||||
|
|
||||||
for (valueMap = drawOrder->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) {
|
for (valueMap = drawOrder->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) {
|
||||||
int ii;
|
int ii;
|
||||||
@ -1170,8 +1145,7 @@ namespace Spine {
|
|||||||
|
|
||||||
/** Event timeline. */
|
/** Event timeline. */
|
||||||
if (events) {
|
if (events) {
|
||||||
EventTimeline* timeline = NEW(EventTimeline);
|
EventTimeline* timeline = new EventTimeline(events->_size);
|
||||||
new (timeline) EventTimeline(events->_size);
|
|
||||||
|
|
||||||
for (valueMap = events->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) {
|
for (valueMap = events->_child, frameIndex = 0; valueMap; valueMap = valueMap->_next, ++frameIndex) {
|
||||||
Event* event;
|
Event* event;
|
||||||
@ -1182,8 +1156,7 @@ namespace Spine {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
event = NEW(Event);
|
event = new Event(Json::getFloat(valueMap, "time", 0), *eventData);
|
||||||
new (event) Event(Json::getFloat(valueMap, "time", 0), *eventData);
|
|
||||||
event->_intValue = Json::getInt(valueMap, "int", eventData->_intValue);
|
event->_intValue = Json::getInt(valueMap, "int", eventData->_intValue);
|
||||||
event->_floatValue = Json::getFloat(valueMap, "float", eventData->_floatValue);
|
event->_floatValue = Json::getFloat(valueMap, "float", eventData->_floatValue);
|
||||||
event->_stringValue = Json::getString(valueMap, "string", eventData->_stringValue.c_str());
|
event->_stringValue = Json::getString(valueMap, "string", eventData->_stringValue.c_str());
|
||||||
@ -1194,10 +1167,7 @@ namespace Spine {
|
|||||||
duration = MAX(duration, timeline->_frames[events->_size - 1]);
|
duration = MAX(duration, timeline->_frames[events->_size - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Animation* ret = NEW(Animation);
|
return new Animation(std::string(root->_name), timelines, duration);
|
||||||
new (ret) Animation(std::string(root->_name), timelines, duration);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonJson::readVertices(Json* attachmentMap, VertexAttachment* attachment, int verticesLength) {
|
void SkeletonJson::readVertices(Json* attachmentMap, VertexAttachment* attachment, int verticesLength) {
|
||||||
@ -1257,7 +1227,7 @@ namespace Spine {
|
|||||||
_error = std::string(message);
|
_error = std::string(message);
|
||||||
|
|
||||||
if (root) {
|
if (root) {
|
||||||
DESTROY(Json, root);
|
delete root;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
35
spine-cpp/spine-cpp/src/spine/SpineObject.cpp
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/******************************************************************************
|
||||||
|
* Spine Runtimes Software License v2.5
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013-2016, Esoteric Software
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* You are granted a perpetual, non-exclusive, non-sublicensable, and
|
||||||
|
* non-transferable license to use, install, execute, and perform the Spine
|
||||||
|
* Runtimes software and derivative works solely for personal or internal
|
||||||
|
* use. Without the written permission of Esoteric Software (see Section 2 of
|
||||||
|
* the Spine Software License Agreement), you may not (a) modify, translate,
|
||||||
|
* adapt, or develop new applications using the Spine Runtimes or otherwise
|
||||||
|
* create derivative works or improvements of the Spine Runtimes or (b) remove,
|
||||||
|
* delete, alter, or obscure any trademarks or any copyright, trademark, patent,
|
||||||
|
* or other intellectual property or proprietary rights notices on or in the
|
||||||
|
* Software, including any copy thereof. Redistributions in binary or source
|
||||||
|
* form must include this license and terms.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "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 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.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include <spine/SpineObject.h>
|
||||||
|
|
||||||
|
namespace Spine {
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,87 +0,0 @@
|
|||||||
cmake_minimum_required(VERSION 2.8.9)
|
|
||||||
#
|
|
||||||
# First download and extract SFML 2.3.2 for the respective OS we are on
|
|
||||||
#
|
|
||||||
set(DEPS_DIR "${CMAKE_CURRENT_LIST_DIR}/dependencies/")
|
|
||||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
||||||
set(SFML_URL "http://www.sfml-dev.org/files/SFML-2.4.1-osx-clang.tar.gz")
|
|
||||||
set(SFML_DIR ${DEPS_DIR}/SFML-2.4.1-osx-clang)
|
|
||||||
if (NOT EXISTS "${SFML_DIR}")
|
|
||||||
message("Downloading SFML for Mac OS X")
|
|
||||||
file(DOWNLOAD "${SFML_URL}" "${DEPS_DIR}/sfml.tar.gz")
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E tar xzf ${DEPS_DIR}/sfml.tar.gz
|
|
||||||
WORKING_DIRECTORY ${DEPS_DIR}
|
|
||||||
)
|
|
||||||
# copy freetype over to Frameworks/ so rpath resoultion works
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${SFML_DIR}/extlibs/freetype.framework ${SFML_DIR}/Frameworks/freetype.framework
|
|
||||||
WORKING_DIRECTORY ${SFML_DIR}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
||||||
set(SFML_URL "http://www.sfml-dev.org/files/SFML-2.4.1-linux-gcc-64-bit.tar.gz")
|
|
||||||
set(SFML_DIR ${DEPS_DIR}/SFML-2.4.1)
|
|
||||||
if (NOT EXISTS ${SFML_DIR})
|
|
||||||
message("Downloading SFML for Linux 64-bit")
|
|
||||||
file(DOWNLOAD "${SFML_URL}" "${DEPS_DIR}/sfml.tar.gz")
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E tar xzf ${DEPS_DIR}/sfml.tar.gz
|
|
||||||
WORKING_DIRECTORY ${DEPS_DIR}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
set(SFML_URL "http://www.sfml-dev.org/files/SFML-2.4.1-windows-vc14-32-bit.zip")
|
|
||||||
set(SFML_DIR ${DEPS_DIR}/SFML-2.4.1)
|
|
||||||
if (NOT EXISTS ${SFML_DIR})
|
|
||||||
message("Downloading SFML for Windows 32-bit")
|
|
||||||
file(DOWNLOAD "${SFML_URL}" "${DEPS_DIR}/sfml.zip")
|
|
||||||
execute_process(
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E tar x ${DEPS_DIR}/sfml.zip
|
|
||||||
WORKING_DIRECTORY ${DEPS_DIR}
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Define spine-sfml library
|
|
||||||
include_directories(src ${SFML_DIR}/include)
|
|
||||||
file(GLOB INCLUDES "src/**/*.h")
|
|
||||||
file(GLOB SOURCES "src/**/*.cpp")
|
|
||||||
add_library(spine-sfml STATIC ${SOURCES} ${INCLUDES})
|
|
||||||
target_link_libraries(spine-sfml LINK_PUBLIC spine-c)
|
|
||||||
install(TARGETS spine-sfml DESTINATION dist/lib)
|
|
||||||
install(FILES ${INCLUDES} DESTINATION dist/include)
|
|
||||||
|
|
||||||
# Define spine-sfml example executable
|
|
||||||
add_executable(spine-sfml-example example/main.cpp)
|
|
||||||
|
|
||||||
# Link in SFML libraries and OS dependencies like OpenGL
|
|
||||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
|
||||||
find_library(SFML SFML PATHS ${SFML_DIR}/Frameworks)
|
|
||||||
find_library(SFML_SYSTEM "sfml-system" PATHS ${SFML_DIR}/Frameworks)
|
|
||||||
find_library(SFML_WINDOW sfml-window PATHS ${SFML_DIR}/Frameworks)
|
|
||||||
find_library(SFML_GRAPHICS sfml-graphics PATHS ${SFML_DIR}/Frameworks)
|
|
||||||
target_link_libraries(spine-sfml-example ${SFML} ${SFML_SYSTEM} ${SFML_WINDOW} ${SFML_GRAPHICS})
|
|
||||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
||||||
target_link_libraries(spine-sfml-example sfml-graphics sfml-window sfml-system)
|
|
||||||
else()
|
|
||||||
set(SFML_LIBS ${SFML_DIR}/lib)
|
|
||||||
target_link_libraries(spine-sfml-example ${SFML_LIBS}/sfml-main-d.lib)
|
|
||||||
target_link_libraries(spine-sfml-example ${SFML_LIBS}/sfml-graphics-s-d.lib)
|
|
||||||
target_link_libraries(spine-sfml-example ${SFML_LIBS}/sfml-window-s-d.lib)
|
|
||||||
target_link_libraries(spine-sfml-example ${SFML_LIBS}/sfml-system-s-d.lib)
|
|
||||||
target_link_libraries(spine-sfml-example ${SFML_LIBS}/freetype.lib)
|
|
||||||
target_link_libraries(spine-sfml-example ${SFML_LIBS}/jpeg.lib)
|
|
||||||
target_link_libraries(spine-sfml-example opengl32)
|
|
||||||
target_link_libraries(spine-sfml-example gdi32)
|
|
||||||
target_link_libraries(spine-sfml-example winmm)
|
|
||||||
add_definitions(-DSFML_STATIC)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# copy data to build directory
|
|
||||||
add_custom_command(TARGET spine-sfml-example PRE_BUILD
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
||||||
${CMAKE_CURRENT_LIST_DIR}/data $<TARGET_FILE_DIR:spine-sfml-example>/data)
|
|
||||||
|
|
||||||
target_link_libraries(spine-sfml-example spine-c)
|
|
||||||
target_link_libraries(spine-sfml-example spine-sfml)
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
Spine Runtimes Software License v2.5
|
|
||||||
|
|
||||||
Copyright (c) 2013-2016, Esoteric Software
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
You are granted a perpetual, non-exclusive, non-sublicensable, and
|
|
||||||
non-transferable license to use, install, execute, and perform the Spine
|
|
||||||
Runtimes software and derivative works solely for personal or internal
|
|
||||||
use. Without the written permission of Esoteric Software (see Section 2 of
|
|
||||||
the Spine Software License Agreement), you may not (a) modify, translate,
|
|
||||||
adapt, or develop new applications using the Spine Runtimes or otherwise
|
|
||||||
create derivative works or improvements of the Spine Runtimes or (b) remove,
|
|
||||||
delete, alter, or obscure any trademarks or any copyright, trademark, patent,
|
|
||||||
or other intellectual property or proprietary rights notices on or in the
|
|
||||||
Software, including any copy thereof. Redistributions in binary or source
|
|
||||||
form must include this license and terms.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "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 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.
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
# spine-sfml
|
|
||||||
|
|
||||||
The spine-sfml runtime provides functionality to load, manipulate and render [Spine](http://esotericsoftware.com) skeletal animation data using [SFML](http://www.sfml-dev.org/). spine-sfml is based on [spine-c](../spine-c).
|
|
||||||
|
|
||||||
## Licensing
|
|
||||||
|
|
||||||
This Spine Runtime may only be used for personal or internal use, typically to evaluate Spine before purchasing. If you would like to incorporate a Spine Runtime into your applications, distribute software containing a Spine Runtime, or modify a Spine Runtime, then you will need a valid [Spine license](https://esotericsoftware.com/spine-purchase). Please see the [Spine Runtimes Software License](http://esotericsoftware.com/git/spine-runtimes/blob/LICENSE) for detailed information.
|
|
||||||
|
|
||||||
The Spine Runtimes are developed with the intent to be used with data exported from Spine. By purchasing Spine, `Section 2` of the [Spine Software License](https://esotericsoftware.com/files/license.txt) grants the right to create and distribute derivative works of the Spine Runtimes.
|
|
||||||
|
|
||||||
## Spine version
|
|
||||||
|
|
||||||
spine-sfml works with data exported from Spine 3.6.xx.
|
|
||||||
|
|
||||||
spine-sfml supports all Spine features.
|
|
||||||
|
|
||||||
spine-sfml does not yet support loading the binary format.
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
1. Create a new SFML project. See the [SFML documentation](http://www.sfml-dev.org/tutorials/2.1/) or have a look at the example in this repository.
|
|
||||||
2. Download the Spine Runtimes source using git (`git clone https://github.com/esotericsoftware/spine-runtimes`) or download it as a zip via the download button above.
|
|
||||||
3. Add the sources from `spine-c/spine-c/src/spine` and `spine-sfml/src/spine` to your project
|
|
||||||
4. Add the folder `spine-c/spine-c/include` to your header search path. Note that includes are specified as `#inclue <spine/file.h>`, so the `spine` directory cannot be omitted when copying the source files.
|
|
||||||
|
|
||||||
See the [Spine Runtimes documentation](http://esotericsoftware.com/spine-documentation#runtimesTitle) on how to use the APIs or check out the Spine SFML example.
|
|
||||||
|
|
||||||
## Example
|
|
||||||
The Spine SFML example works on Windows, Linux and Mac OS X.
|
|
||||||
|
|
||||||
### Windows
|
|
||||||
1. Install [Visual Studio 2015 Community](https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx). Make sure you install support for C++ as well as th Windows SDK for XP/7/8.
|
|
||||||
2. Install CMake via the [Windows installer package](https://cmake.org/download/).
|
|
||||||
3. Download the Spine Runtimes repository using git (`git clone https://github.com/esotericsoftware/spine-runtimes`) or download it as a zip via the download button above.
|
|
||||||
4. Run CMake GUI from the start menu
|
|
||||||
5. Click `Browse Source` and select the directory `spine-runtimes`
|
|
||||||
6. Click `Browse Build` and select the `spine-runtimes/spine-sfml/build` directory. You can create the `build` folder directly in the file dialog via `New Folder`.
|
|
||||||
7. Click `Configure`. Then click `Generate`. This will create a Visual Studio 2015 solution file called `spine.sln` in `spine-runtimes/spine-sfml/build` and also download the SFML dependencies.
|
|
||||||
8. Open the `spine.sln` file in Visual Studio 2015
|
|
||||||
9. Right click the `spine-sfml-example` project in the solution explorer and select `Set as Startup Project` from the context menu
|
|
||||||
10. Right click the `spine-sfml-example` project in the solution explorer and select `Properties` from the context menu
|
|
||||||
11. Select `Debugging` in the left-hand list, then set `Working Directory` to `$(OutputPath)`
|
|
||||||
12. Click `Local Windows Debugger` to run the example
|
|
||||||
|
|
||||||
The entire example code is contained in [main.cpp](example/main.cpp#L61)
|
|
||||||
|
|
||||||
### Linux
|
|
||||||
1. Install the SFML dependencies, e.g. on Ubuntu/Debian via `sudo apt install libsfml-dev`
|
|
||||||
2. Install CMake, e.g. on Ubuntu/Debian via `sudo apt-get install -y cmake`
|
|
||||||
3. Download the Spine Runtimes repository using git (`git clone https://github.com/esotericsoftware/spine-runtimes`) or download it as a zip via the download button above.
|
|
||||||
4. Open a terminal, and `cd` into the `spine-runtimes/spine-sfml` folder
|
|
||||||
5. Type `mkdir build && cd build && cmake ../..` to generate Make files
|
|
||||||
6. Type `make` to compile the example
|
|
||||||
7. Run the example by `cd spine-sfml && ./spine-sfml-example`
|
|
||||||
|
|
||||||
### Mac OS X
|
|
||||||
1. Install [Xcode](https://developer.apple.com/xcode/)
|
|
||||||
2. Install [Homebrew](http://brew.sh/)
|
|
||||||
3. Open a terminal and install CMake via `brew install cmake`
|
|
||||||
3. Download the Spine Runtimes repository using git (`git clone https://github.com/esotericsoftware/spine-runtimes`) or download it as a zip via the download button above.
|
|
||||||
4. Open a terminal, and `cd` into the `spine-runtimes/spine-sfml` folder
|
|
||||||
5. Type `mkdir build && cd build && cmake -G Xcode ../..` to generate an Xcode project called `spine.xcodeproj`
|
|
||||||
6. Open the Xcode project in `spine-runtimes/spine-sfml/build/`
|
|
||||||
7. In Xcode, set the active scheme from `ALL_BUILD` to `spine-sfml-example`
|
|
||||||
8. Click the `Run` button or type `CMD+R` to run the example
|
|
||||||
|
|
||||||
## Notes
|
|
||||||
|
|
||||||
- Atlas images should not use premultiplied alpha.
|
|
||||||
@ -1,178 +0,0 @@
|
|||||||
{
|
|
||||||
"skeleton": {
|
|
||||||
"hash": "lfmnIwRt8cjfHaBQWvT0v4odYdY",
|
|
||||||
"spine": "3.7.08-beta",
|
|
||||||
"width": 260,
|
|
||||||
"height": 359.92,
|
|
||||||
"images": "./images/",
|
|
||||||
"audio": ""
|
|
||||||
},
|
|
||||||
"bones": [
|
|
||||||
{ "name": "root" },
|
|
||||||
{ "name": "coin-root", "parent": "root", "y": 300, "color": "ff0000ff" },
|
|
||||||
{ "name": "coin", "parent": "coin-root", "color": "ffe037ff" },
|
|
||||||
{ "name": "clipping", "parent": "coin", "x": 7.25, "scaleX": 0.96, "scaleY": 0.967, "color": "ffe037ff" },
|
|
||||||
{ "name": "shine", "parent": "coin-root", "rotation": -24.17, "scaleY": 1.478, "color": "ffffffff" }
|
|
||||||
],
|
|
||||||
"slots": [
|
|
||||||
{ "name": "images/coin", "bone": "coin", "attachment": "coin" },
|
|
||||||
{ "name": "clipping", "bone": "clipping", "attachment": "clipping" },
|
|
||||||
{ "name": "images/shine", "bone": "shine", "color": "ffffff93", "attachment": "shine", "blend": "additive" }
|
|
||||||
],
|
|
||||||
"skins": {
|
|
||||||
"default": {
|
|
||||||
"clipping": {
|
|
||||||
"clipping": {
|
|
||||||
"type": "clipping",
|
|
||||||
"end": "images/coin",
|
|
||||||
"vertexCount": 36,
|
|
||||||
"vertices": [ 0.82, 120.87, 25.27, 118.4, 49.23, 110.99, 71.46, 98.15, 88.25, 83.08, 102.58, 64.8, 112.21, 46.03, 117.89, 28, 121.35, 9.23, 120.61, -11.52, 117.65, -30.29, 111.72, -48.08, 102.33, -65.61, 89.47, -82.23, 76.24, -94.71, 61.33, -105.13, 46.26, -112.54, 28.73, -118.22, 8.73, -120.89, -12.27, -120.89, -32.03, -116.94, -51.04, -110.27, -67.59, -101.63, -82.91, -88.78, -96.25, -74.21, -108.35, -55.68, -116.5, -35.43, -120.7, -14.19, -121.69, 5.57, -118.97, 27.56, -111.56, 49.04, -100.43, 69.69, -84.38, 87.47, -66.1, 102.29, -45.6, 112.67, -23.62, 118.59 ],
|
|
||||||
"color": "ce3a3aff"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"images/coin": {
|
|
||||||
"coin": {
|
|
||||||
"type": "mesh",
|
|
||||||
"uvs": [ 1, 1, 0.51662, 0.99661, 0.38311, 0.99567, 0.29957, 0.96664, 0.22817, 0.93237, 0.16736, 0.88777, 0.11597, 0.83202, 0.06732, 0.76058, 0.03288, 0.69072, 0.00816, 0.61391, 0, 0.52843, 0, 0.43778, 0.02307, 0.33992, 0.06544, 0.24204, 0.11924, 0.16659, 0.17691, 0.10919, 0.24399, 0.06252, 0.31853, 0.02742, 0.41818, 0.0076, 0.52609, 1.0E-5, 1, 0, 0.45994, 0.99066, 0.37873, 0.97119, 0.30719, 0.94057, 0.24626, 0.89841, 0.19491, 0.85157, 0.14893, 0.79961, 0.11299, 0.73943, 0.08595, 0.67565, 0.06609, 0.60105, 0.05753, 0.52647, 0.05856, 0.44906, 0.07176, 0.36094, 0.10407, 0.28078, 0.15657, 0.19211, 0.22811, 0.1162, 0.29907, 0.0658, 0.38388, 0.02814, 0.46119, 0.00993 ],
|
|
||||||
"triangles": [ 38, 18, 19, 37, 17, 18, 37, 18, 38, 36, 16, 17, 36, 17, 37, 35, 15, 16, 35, 16, 36, 34, 14, 15, 34, 15, 35, 34, 33, 13, 34, 13, 14, 12, 13, 33, 32, 12, 33, 11, 12, 32, 31, 11, 32, 31, 10, 11, 30, 10, 31, 31, 33, 30, 29, 30, 33, 29, 9, 10, 29, 10, 30, 32, 33, 31, 34, 28, 29, 8, 9, 29, 8, 29, 28, 33, 34, 29, 25, 26, 27, 7, 8, 28, 7, 28, 27, 27, 28, 25, 26, 7, 27, 6, 7, 26, 34, 36, 28, 28, 36, 25, 6, 26, 25, 5, 6, 25, 34, 35, 36, 37, 24, 25, 5, 25, 24, 4, 5, 24, 36, 37, 25, 22, 23, 24, 4, 24, 23, 3, 4, 23, 24, 21, 22, 3, 23, 22, 38, 24, 37, 24, 1, 21, 2, 22, 21, 3, 22, 2, 1, 38, 19, 1, 24, 38, 2, 21, 1, 19, 20, 0, 1, 19, 0 ],
|
|
||||||
"vertices": [ 130, -123.5, 4.32, -122.66, -30.39, -122.43, -52.11, -115.26, -70.68, -106.8, -86.49, -95.78, -99.85, -82.01, -112.5, -64.36, -121.45, -47.11, -127.88, -28.14, -130, -7.02, -130, 15.37, -124, 39.54, -112.99, 63.72, -99, 82.35, -84, 96.53, -66.56, 108.06, -47.18, 116.73, -21.27, 121.62, 6.78, 123.5, 130, 123.5, -10.42, -121.19, -31.53, -116.39, -50.13, -108.82, -65.97, -98.41, -79.32, -86.84, -91.28, -74, -100.62, -59.14, -107.65, -43.39, -112.82, -24.96, -115.04, -6.54, -114.77, 12.58, -111.34, 34.35, -102.94, 54.15, -89.29, 76.05, -70.69, 94.8, -52.24, 107.25, -30.19, 116.55, -10.09, 121.05 ],
|
|
||||||
"hull": 21,
|
|
||||||
"edges": [ 0, 40, 42, 44, 44, 46, 46, 48, 48, 50, 50, 52, 52, 54, 54, 56, 56, 58, 58, 60, 60, 62, 62, 64, 64, 66, 66, 68, 68, 70, 70, 72, 72, 74, 74, 76, 36, 34, 34, 32, 32, 30, 30, 28, 28, 26, 26, 24, 24, 22, 20, 22, 20, 18, 18, 16, 16, 14, 14, 12, 12, 10, 10, 8, 8, 6, 6, 4, 0, 2, 2, 4, 42, 2, 38, 40, 36, 38, 76, 38, 2, 38 ],
|
|
||||||
"width": 259,
|
|
||||||
"height": 245
|
|
||||||
},
|
|
||||||
"coin-invert": {
|
|
||||||
"type": "mesh",
|
|
||||||
"uvs": [ 0.61921, 0.00932, 0.70137, 0.03058, 0.76675, 0.06301, 0.82357, 0.10192, 0.86533, 0.14084, 0.90128, 0.1866, 0.92763, 0.22768, 0.95707, 0.28353, 0.97795, 0.33937, 0.99074, 0.38663, 1, 0.45194, 1, 0.50671, 1, 0.56148, 0.98993, 0.62238, 0.97282, 0.6757, 0.95125, 0.73083, 0.91771, 0.78704, 0.88283, 0.83498, 0.84141, 0.87966, 0.79349, 0.91785, 0.73701, 0.95172, 0.65999, 0.98127, 0.60659, 0.991, 0.51662, 0.99661, 0, 1, 0, 0, 0.52609, 1.0E-5, 0.57849, 0.98348, 0.64806, 0.96162, 0.70899, 0.92882, 0.75987, 0.89639, 0.80219, 0.85685, 0.83745, 0.81722, 0.86381, 0.77794, 0.89445, 0.72582, 0.9167, 0.67213, 0.93142, 0.61628, 0.94164, 0.56011, 0.94506, 0.50823, 0.9437, 0.45454, 0.93514, 0.39905, 0.91905, 0.34031, 0.89748, 0.28194, 0.8691, 0.2284, 0.83932, 0.18768, 0.79995, 0.143, 0.76298, 0.10841, 0.71814, 0.07598, 0.66748, 0.04824, 0.61408, 0.0277, 0.5665, 0.01437 ],
|
|
||||||
"triangles": [ 50, 26, 0, 49, 50, 0, 48, 0, 1, 49, 0, 48, 47, 1, 2, 48, 1, 47, 46, 47, 2, 46, 2, 3, 45, 46, 3, 45, 3, 4, 44, 45, 4, 44, 4, 5, 43, 44, 5, 43, 5, 6, 42, 43, 6, 42, 6, 7, 41, 42, 7, 41, 7, 8, 40, 41, 8, 40, 8, 9, 39, 40, 9, 10, 39, 9, 39, 10, 11, 38, 39, 11, 41, 40, 38, 38, 40, 39, 38, 11, 12, 37, 38, 12, 38, 36, 41, 37, 36, 38, 13, 37, 12, 36, 37, 13, 36, 43, 41, 41, 43, 42, 14, 36, 13, 35, 36, 14, 44, 43, 36, 35, 34, 36, 15, 35, 14, 34, 35, 15, 44, 36, 45, 34, 33, 36, 16, 34, 15, 33, 34, 16, 48, 47, 49, 36, 33, 45, 17, 33, 16, 32, 33, 17, 32, 31, 33, 18, 32, 17, 31, 32, 18, 33, 29, 45, 45, 47, 46, 31, 30, 33, 19, 30, 31, 19, 31, 18, 49, 47, 45, 30, 29, 33, 20, 29, 30, 20, 30, 19, 50, 49, 29, 45, 29, 49, 21, 28, 29, 21, 29, 20, 29, 27, 50, 28, 27, 29, 22, 27, 28, 22, 28, 21, 23, 25, 26, 23, 26, 50, 23, 50, 27, 23, 27, 22, 24, 25, 23 ],
|
|
||||||
"vertices": [ 42.18, 121.2, 63.54, 115.95, 80.54, 107.94, 95.31, 98.32, 106.17, 88.71, 115.51, 77.41, 122.37, 67.26, 130.02, 53.47, 135.45, 39.68, 138.77, 28, 141.18, 11.87, 141.18, -1.66, 141.18, -15.19, 138.56, -30.23, 134.11, -43.4, 128.51, -57.02, 119.79, -70.9, 110.72, -82.74, 99.95, -93.78, 87.49, -103.21, 72.8, -111.58, 52.78, -118.87, 38.9, -121.28, 15.5, -122.66, -118.82, -123.5, -118.82, 123.5, 17.97, 123.5, 31.59, -119.42, 49.68, -114.02, 65.52, -105.92, 78.75, -97.91, 89.75, -88.14, 98.92, -78.35, 105.77, -68.65, 113.74, -55.78, 119.52, -42.52, 123.35, -28.72, 126.01, -14.85, 126.9, -2.03, 126.54, 11.23, 124.32, 24.94, 120.13, 39.44, 114.53, 53.86, 107.15, 67.09, 99.4, 77.14, 89.17, 88.18, 79.56, 96.72, 67.9, 104.73, 54.73, 111.59, 40.84, 116.66, 28.47, 119.95 ],
|
|
||||||
"hull": 27,
|
|
||||||
"edges": [ 46, 52, 46, 54, 54, 56, 56, 58, 58, 60, 60, 62, 62, 64, 64, 66, 66, 68, 68, 70, 70, 72, 72, 74, 74, 76, 76, 78, 78, 80, 80, 82, 82, 84, 84, 86, 86, 88, 88, 90, 90, 92, 92, 94, 94, 96, 96, 98, 98, 100, 100, 52, 52, 0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, 16, 20, 22, 22, 24, 24, 26, 26, 28, 28, 30, 30, 32, 32, 34, 34, 36, 36, 38, 38, 40, 40, 42, 42, 44, 44, 46, 48, 50, 50, 52, 46, 48, 16, 18, 18, 20 ],
|
|
||||||
"width": 259,
|
|
||||||
"height": 245
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"images/shine": {
|
|
||||||
"shine": { "width": 72, "height": 245 }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"animations": {
|
|
||||||
"rotate": {
|
|
||||||
"slots": {
|
|
||||||
"images/coin": {
|
|
||||||
"attachment": [
|
|
||||||
{ "time": 0.5, "name": "coin-invert" }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"images/shine": {
|
|
||||||
"color": [
|
|
||||||
{ "time": 0, "color": "ffffff00" },
|
|
||||||
{ "time": 0.2667, "color": "ffffffbc" },
|
|
||||||
{ "time": 0.5, "color": "ffffff00" },
|
|
||||||
{ "time": 0.7333, "color": "ffffffbc" },
|
|
||||||
{ "time": 1, "color": "ffffff00" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"bones": {
|
|
||||||
"shine": {
|
|
||||||
"translate": [
|
|
||||||
{
|
|
||||||
"time": 0,
|
|
||||||
"x": 175.08,
|
|
||||||
"y": 0,
|
|
||||||
"curve": [ 0.213, 0.65, 0.931, 0.67 ]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"time": 0.5,
|
|
||||||
"x": -127.2,
|
|
||||||
"y": 0,
|
|
||||||
"curve": [ 0.55, 0.09, 0.931, 0.67 ]
|
|
||||||
},
|
|
||||||
{ "time": 1, "x": 175.08, "y": 0 }
|
|
||||||
],
|
|
||||||
"scale": [
|
|
||||||
{
|
|
||||||
"time": 0,
|
|
||||||
"x": 1,
|
|
||||||
"y": 1,
|
|
||||||
"curve": [ 0.213, 0.65, 0.931, 0.67 ]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"time": 0.5,
|
|
||||||
"x": 2,
|
|
||||||
"y": 1,
|
|
||||||
"curve": [ 0.55, 0.09, 0.931, 0.67 ]
|
|
||||||
},
|
|
||||||
{ "time": 1, "x": 1, "y": 1 }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"coin": {
|
|
||||||
"translate": [
|
|
||||||
{ "time": 0, "x": 0, "y": 0 },
|
|
||||||
{ "time": 0.5, "x": 0.93, "y": 0 },
|
|
||||||
{ "time": 0.5011, "x": -9.18, "y": 0 },
|
|
||||||
{ "time": 1, "x": 2, "y": 0 }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"clipping": {
|
|
||||||
"translate": [
|
|
||||||
{ "time": 0, "x": -0.41, "y": 0 },
|
|
||||||
{ "time": 0.2667, "x": 1.2, "y": 1.21 },
|
|
||||||
{ "time": 0.5, "x": 0, "y": 0 },
|
|
||||||
{ "time": 0.7333, "x": -4.15, "y": 0 },
|
|
||||||
{ "time": 1, "x": -3.16, "y": 0 }
|
|
||||||
],
|
|
||||||
"scale": [
|
|
||||||
{ "time": 0, "x": 1, "y": 1 },
|
|
||||||
{ "time": 0.2667, "x": 0.464, "y": 1.014 },
|
|
||||||
{ "time": 0.4667, "x": 0.067, "y": 1.002 },
|
|
||||||
{ "time": 0.5, "x": 0.033, "y": 1 },
|
|
||||||
{ "time": 0.7333, "x": 0.492, "y": 1.014 },
|
|
||||||
{ "time": 1, "x": 1, "y": 1 }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"deform": {
|
|
||||||
"default": {
|
|
||||||
"images/coin": {
|
|
||||||
"coin": [
|
|
||||||
{
|
|
||||||
"time": 0,
|
|
||||||
"offset": 4,
|
|
||||||
"vertices": [ 15.75598, 0, 15.75598, 0, 15.75598, 0, 15.75598, 0, 15.75598, 0, 15.75598, 0, 15.75598, 0, 15.75598, 0, 15.75598, 0, 15.75598, 0, 15.75598, 0, 15.75598, 0, 15.75598, 0, 15.75598, 0, 15.75598, 0, 15.75598, 0, 15.75598 ]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"time": 0.2333,
|
|
||||||
"vertices": [ -57.61087, 0, 1.15225, 0, 15.20888, 0, 24.26007, 0, 31.99586, 0, 38.58396, 0, 44.15197, 0, 49.42246, 0, 53.15465, 0, 55.83239, 0, 56.71656, 0, 56.71656, 0, 54.21722, 0, 49.62682, 0, 43.79747, 0, 37.5494, 0, 30.28123, 0, 22.2055, 0, 11.40953, 0, 0, 0, -57.61087, 0, 8.04186, 0, 17.91416, 0, 26.61125, 0, 34.01835, 0, 40.26029, 0, 45.85036, 0, 50.21972, 0, 53.50714, 0, 55.9207, 0, 56.96101, 0, 56.83617, 0, 55.23131, 0, 51.30379, 0, 44.9216, 0, 36.22496, 0, 27.59846, 0, 17.28874, 0, 7.89076 ]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"time": 0.4667,
|
|
||||||
"vertices": [ -115.22174, 0, 2.3045, 0, 20.08046, 0, 40.51821, 0, 57.98577, 0, 72.86182, 0, 85.43448, 0, 97.33535, 0, 105.76271, 0, 111.80908, 0, 113.80557, 0, 113.80557, 0, 108.16202, 0, 97.7968, 0, 84.63402, 0, 70.52576, 0, 54.11411, 0, 35.87894, 0, 11.50145, 1.74997, 0, 0, -115.22174, 0, 16.08371, 0, 35.82832, 0, 53.2225, 0, 68.0367, 0, 80.52058, 0, 91.70073, 0, 100.43944, 0, 107.01427, 0, 111.84139, 0, 113.92201, 0, 113.67234, 0, 110.46262, 0, 102.60757, 0, 89.84319, 0, 72.44992, 0, 55.19692, 0, 34.57748, 0, 15.78153 ]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"time": 0.5,
|
|
||||||
"vertices": [ -123.45187, 0, 2.46911, 0, 21.49595, 0, 43.40345, 0, 62.12716, 0, 78.07299, 0, 91.54979, 0, 104.3065, 0, 113.33989, 0, 119.82108, 0, 121.96114, 0, 121.96114, 0, 115.91174, 0, 104.80113, 0, 90.69177, 0, 75.56894, 0, 57.97707, 0, 38.43056, 0, 12.3, 0, 0, 0, -123.45187, 0, 17.23255, 0, 38.38749, 0, 57.02411, 0, 72.89646, 0, 86.27205, 0, 98.25078, 0, 107.61369, 0, 114.65815, 0, 119.83006, 0, 122.0593, 0, 121.79179, 0, 118.35281, 0, 109.93669, 0, 96.26056, 0, 77.62492, 0, 59.13956, 0, 37.0473, 0, 16.90878 ]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"coin-invert": [
|
|
||||||
{
|
|
||||||
"time": 0.5,
|
|
||||||
"vertices": [ -23.47706, 1.27002, -43.40744, 0, -59.7846, 0, -74.77602, 0, -85.79382, 0, -95.27632, 0, -102.23021, 0, -109.99683, 0, -115.50598, 0, -118.87909, 0, -121.32259, 0, -121.32259, 0, -121.32258, 0, -118.66653, 0, -114.15101, 0, -108.4615, 0, -99.61115, 0, -90.41013, 0, -79.48267, 0, -66.83928, 0, -51.93813, 0, -31.61855, 0, -19.56224, -1.52396, -12.52719, 0, 120.72772, 0, 120.72777, 0, -14.97203, 0, -28.48602, 0, -46.43241, 0, -62.14667, 0, -75.27165, 0, -86.18799, 0, -95.28229, 0, -102.08092, 0, -109.98608, 0, -115.7252, 0, -119.52184, 0, -122.15746, 0, -123.04041, 0, -122.68725, 0, -120.4799, 0, -116.33008, 0, -110.76754, 0, -103.44593, 0, -95.76433, 0, -85.61052, 0, -76.07477, 0, -64.50826, 0, -51.44074, 0, -37.66688, 0, -25.39402 ]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"time": 0.7667,
|
|
||||||
"vertices": [ -12.2558, 0, -21.82668, 0, -29.4435, 0, -36.06335, 0, -40.92855, 0, -45.1158, 0, -48.18647, 0, -51.61602, 0, -54.04874, 0, -55.53822, 0, -56.61722, 0, -56.61722, 0, -56.61721, 0, -55.44436, 0, -53.45041, 0, -50.93806, 0, -47.02994, 0, -42.967, 0, -38.1417, 0, -32.55868, 0, -25.97868, 0, -17.00604, 0, -10.78498, 0, -5.84602, 0, 56.33961, 0, 56.33963, 0, -6.98695, 0, -13.29348, 0, -21.66846, 0, -29.00178, 0, -35.12677, 0, -40.22107, 0, -44.46507, 0, -47.63776, 0, -51.32684, 0, -54.0051, 0, -55.77686, 0, -57.00682, 0, -57.41886, 0, -57.25405, 0, -56.22396, 0, -54.28737, 0, -51.69152, 0, -48.27477, 0, -44.69002, 0, -39.95158, 0, -35.50156, 0, -30.10386, 0, -24.00568, 0, -17.57788, 0, -11.85054 ]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"time": 1,
|
|
||||||
"vertices": [ -17.76001, 0, -17.76001, 0, -17.76001, 0, -17.76001, 0, -17.76001, 0, -17.76001, 0, -17.76001, 0, -17.76001, 0, -17.76001, 0, -17.76001, 0, -17.76001, 0, -17.76001, 0, -17.76001, 0, -17.76001, 0, -17.76001, 0, -17.76001, 0, -17.76001, 0, -17.76001, 0, -17.76001, 0, -17.76001, 0, -17.76001, 0, -17.76001, 0, -17.76001 ]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
|
|
||||||
coin.png
|
|
||||||
size: 1024,256
|
|
||||||
format: RGBA8888
|
|
||||||
filter: Linear,Linear
|
|
||||||
repeat: none
|
|
||||||
coin
|
|
||||||
rotate: false
|
|
||||||
xy: 2, 2
|
|
||||||
size: 259, 245
|
|
||||||
orig: 259, 245
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
coin-invert
|
|
||||||
rotate: false
|
|
||||||
xy: 263, 2
|
|
||||||
size: 259, 245
|
|
||||||
orig: 259, 245
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
shine
|
|
||||||
rotate: false
|
|
||||||
xy: 524, 2
|
|
||||||
size: 72, 245
|
|
||||||
orig: 72, 245
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
|
Before Width: | Height: | Size: 55 KiB |
@ -1,293 +0,0 @@
|
|||||||
|
|
||||||
goblins.png
|
|
||||||
size: 1024,128
|
|
||||||
format: RGBA8888
|
|
||||||
filter: Linear,Linear
|
|
||||||
repeat: none
|
|
||||||
dagger
|
|
||||||
rotate: true
|
|
||||||
xy: 372, 100
|
|
||||||
size: 26, 108
|
|
||||||
orig: 26, 108
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblin/eyes-closed
|
|
||||||
rotate: false
|
|
||||||
xy: 2, 7
|
|
||||||
size: 34, 12
|
|
||||||
orig: 34, 12
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblin/head
|
|
||||||
rotate: false
|
|
||||||
xy: 107, 36
|
|
||||||
size: 103, 66
|
|
||||||
orig: 103, 66
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblin/left-arm
|
|
||||||
rotate: false
|
|
||||||
xy: 901, 56
|
|
||||||
size: 37, 35
|
|
||||||
orig: 37, 35
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblin/left-foot
|
|
||||||
rotate: false
|
|
||||||
xy: 929, 95
|
|
||||||
size: 65, 31
|
|
||||||
orig: 65, 31
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblin/left-hand
|
|
||||||
rotate: false
|
|
||||||
xy: 452, 2
|
|
||||||
size: 36, 41
|
|
||||||
orig: 36, 41
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblin/left-lower-leg
|
|
||||||
rotate: true
|
|
||||||
xy: 713, 93
|
|
||||||
size: 33, 70
|
|
||||||
orig: 33, 70
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblin/left-shoulder
|
|
||||||
rotate: false
|
|
||||||
xy: 610, 44
|
|
||||||
size: 29, 44
|
|
||||||
orig: 29, 44
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblin/left-upper-leg
|
|
||||||
rotate: true
|
|
||||||
xy: 638, 93
|
|
||||||
size: 33, 73
|
|
||||||
orig: 33, 73
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblin/neck
|
|
||||||
rotate: false
|
|
||||||
xy: 490, 2
|
|
||||||
size: 36, 41
|
|
||||||
orig: 36, 41
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblin/pelvis
|
|
||||||
rotate: false
|
|
||||||
xy: 482, 45
|
|
||||||
size: 62, 43
|
|
||||||
orig: 62, 43
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblin/right-arm
|
|
||||||
rotate: true
|
|
||||||
xy: 690, 2
|
|
||||||
size: 23, 50
|
|
||||||
orig: 23, 50
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblin/right-foot
|
|
||||||
rotate: false
|
|
||||||
xy: 771, 58
|
|
||||||
size: 63, 33
|
|
||||||
orig: 63, 33
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblin/right-hand
|
|
||||||
rotate: false
|
|
||||||
xy: 940, 56
|
|
||||||
size: 36, 37
|
|
||||||
orig: 36, 37
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblin/right-lower-leg
|
|
||||||
rotate: true
|
|
||||||
xy: 482, 90
|
|
||||||
size: 36, 76
|
|
||||||
orig: 36, 76
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblin/right-shoulder
|
|
||||||
rotate: true
|
|
||||||
xy: 602, 3
|
|
||||||
size: 39, 45
|
|
||||||
orig: 39, 45
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblin/right-upper-leg
|
|
||||||
rotate: true
|
|
||||||
xy: 641, 57
|
|
||||||
size: 34, 63
|
|
||||||
orig: 34, 63
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblin/torso
|
|
||||||
rotate: true
|
|
||||||
xy: 212, 34
|
|
||||||
size: 68, 96
|
|
||||||
orig: 68, 96
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblin/undie-straps
|
|
||||||
rotate: false
|
|
||||||
xy: 380, 5
|
|
||||||
size: 55, 19
|
|
||||||
orig: 55, 19
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblin/undies
|
|
||||||
rotate: false
|
|
||||||
xy: 174, 5
|
|
||||||
size: 36, 29
|
|
||||||
orig: 36, 29
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblingirl/eyes-closed
|
|
||||||
rotate: false
|
|
||||||
xy: 269, 11
|
|
||||||
size: 37, 21
|
|
||||||
orig: 37, 21
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblingirl/head
|
|
||||||
rotate: false
|
|
||||||
xy: 2, 21
|
|
||||||
size: 103, 81
|
|
||||||
orig: 103, 81
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblingirl/left-arm
|
|
||||||
rotate: true
|
|
||||||
xy: 978, 56
|
|
||||||
size: 37, 35
|
|
||||||
orig: 37, 35
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblingirl/left-foot
|
|
||||||
rotate: false
|
|
||||||
xy: 107, 3
|
|
||||||
size: 65, 31
|
|
||||||
orig: 65, 31
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblingirl/left-hand
|
|
||||||
rotate: false
|
|
||||||
xy: 565, 2
|
|
||||||
size: 35, 40
|
|
||||||
orig: 35, 40
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblingirl/left-lower-leg
|
|
||||||
rotate: true
|
|
||||||
xy: 785, 93
|
|
||||||
size: 33, 70
|
|
||||||
orig: 33, 70
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblingirl/left-shoulder
|
|
||||||
rotate: true
|
|
||||||
xy: 690, 27
|
|
||||||
size: 28, 46
|
|
||||||
orig: 28, 46
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblingirl/left-upper-leg
|
|
||||||
rotate: true
|
|
||||||
xy: 857, 93
|
|
||||||
size: 33, 70
|
|
||||||
orig: 33, 70
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblingirl/neck
|
|
||||||
rotate: false
|
|
||||||
xy: 528, 2
|
|
||||||
size: 35, 41
|
|
||||||
orig: 35, 41
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblingirl/pelvis
|
|
||||||
rotate: false
|
|
||||||
xy: 546, 45
|
|
||||||
size: 62, 43
|
|
||||||
orig: 62, 43
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblingirl/right-arm
|
|
||||||
rotate: false
|
|
||||||
xy: 452, 48
|
|
||||||
size: 28, 50
|
|
||||||
orig: 28, 50
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblingirl/right-foot
|
|
||||||
rotate: false
|
|
||||||
xy: 836, 58
|
|
||||||
size: 63, 33
|
|
||||||
orig: 63, 33
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblingirl/right-hand
|
|
||||||
rotate: true
|
|
||||||
xy: 771, 20
|
|
||||||
size: 36, 37
|
|
||||||
orig: 36, 37
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblingirl/right-lower-leg
|
|
||||||
rotate: true
|
|
||||||
xy: 560, 90
|
|
||||||
size: 36, 76
|
|
||||||
orig: 36, 76
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblingirl/right-shoulder
|
|
||||||
rotate: false
|
|
||||||
xy: 649, 10
|
|
||||||
size: 39, 45
|
|
||||||
orig: 39, 45
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblingirl/right-upper-leg
|
|
||||||
rotate: true
|
|
||||||
xy: 706, 57
|
|
||||||
size: 34, 63
|
|
||||||
orig: 34, 63
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblingirl/torso
|
|
||||||
rotate: false
|
|
||||||
xy: 310, 2
|
|
||||||
size: 68, 96
|
|
||||||
orig: 68, 96
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblingirl/undie-straps
|
|
||||||
rotate: false
|
|
||||||
xy: 212, 13
|
|
||||||
size: 55, 19
|
|
||||||
orig: 55, 19
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goblingirl/undies
|
|
||||||
rotate: false
|
|
||||||
xy: 810, 27
|
|
||||||
size: 36, 29
|
|
||||||
orig: 36, 29
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
shield
|
|
||||||
rotate: false
|
|
||||||
xy: 380, 26
|
|
||||||
size: 70, 72
|
|
||||||
orig: 70, 72
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
spear
|
|
||||||
rotate: true
|
|
||||||
xy: 2, 104
|
|
||||||
size: 22, 368
|
|
||||||
orig: 22, 368
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
|
Before Width: | Height: | Size: 206 KiB |
@ -1,195 +0,0 @@
|
|||||||
|
|
||||||
owl.png
|
|
||||||
size: 1024,512
|
|
||||||
format: RGBA8888
|
|
||||||
filter: Linear,Linear
|
|
||||||
repeat: none
|
|
||||||
L_eye-closed
|
|
||||||
rotate: false
|
|
||||||
xy: 508, 115
|
|
||||||
size: 90, 86
|
|
||||||
orig: 90, 86
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
L_eye-iris
|
|
||||||
rotate: false
|
|
||||||
xy: 826, 183
|
|
||||||
size: 90, 86
|
|
||||||
orig: 90, 86
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
L_eye-light
|
|
||||||
rotate: false
|
|
||||||
xy: 1001, 488
|
|
||||||
size: 21, 20
|
|
||||||
orig: 21, 20
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
L_eye-pupil
|
|
||||||
rotate: false
|
|
||||||
xy: 752, 154
|
|
||||||
size: 63, 60
|
|
||||||
orig: 63, 60
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
L_foot
|
|
||||||
rotate: false
|
|
||||||
xy: 817, 133
|
|
||||||
size: 64, 48
|
|
||||||
orig: 64, 48
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
L_wing
|
|
||||||
rotate: false
|
|
||||||
xy: 342, 91
|
|
||||||
size: 81, 110
|
|
||||||
orig: 81, 110
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
R_eye-closed
|
|
||||||
rotate: false
|
|
||||||
xy: 508, 27
|
|
||||||
size: 90, 86
|
|
||||||
orig: 90, 86
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
R_eye-iris
|
|
||||||
rotate: true
|
|
||||||
xy: 600, 111
|
|
||||||
size: 90, 86
|
|
||||||
orig: 90, 86
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
R_eye-light
|
|
||||||
rotate: false
|
|
||||||
xy: 1001, 466
|
|
||||||
size: 21, 20
|
|
||||||
orig: 21, 20
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
R_eye-pupil
|
|
||||||
rotate: true
|
|
||||||
xy: 691, 72
|
|
||||||
size: 63, 60
|
|
||||||
orig: 63, 60
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
R_foot
|
|
||||||
rotate: false
|
|
||||||
xy: 814, 83
|
|
||||||
size: 64, 48
|
|
||||||
orig: 64, 48
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
R_wing
|
|
||||||
rotate: false
|
|
||||||
xy: 425, 91
|
|
||||||
size: 81, 110
|
|
||||||
orig: 81, 110
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
beak
|
|
||||||
rotate: false
|
|
||||||
xy: 883, 140
|
|
||||||
size: 39, 41
|
|
||||||
orig: 39, 41
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
beak-down
|
|
||||||
rotate: true
|
|
||||||
xy: 753, 53
|
|
||||||
size: 37, 40
|
|
||||||
orig: 37, 40
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
body
|
|
||||||
rotate: false
|
|
||||||
xy: 2, 5
|
|
||||||
size: 248, 196
|
|
||||||
orig: 248, 196
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
feather-1
|
|
||||||
rotate: false
|
|
||||||
xy: 753, 92
|
|
||||||
size: 59, 60
|
|
||||||
orig: 59, 60
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
feather-2
|
|
||||||
rotate: false
|
|
||||||
xy: 688, 137
|
|
||||||
size: 62, 65
|
|
||||||
orig: 62, 65
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
feather-3
|
|
||||||
rotate: true
|
|
||||||
xy: 600, 2
|
|
||||||
size: 56, 76
|
|
||||||
orig: 56, 76
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
head-base
|
|
||||||
rotate: false
|
|
||||||
xy: 621, 271
|
|
||||||
size: 299, 237
|
|
||||||
orig: 299, 237
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
leaf-1
|
|
||||||
rotate: false
|
|
||||||
xy: 922, 273
|
|
||||||
size: 76, 101
|
|
||||||
orig: 76, 101
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
leaf-2
|
|
||||||
rotate: true
|
|
||||||
xy: 621, 204
|
|
||||||
size: 65, 95
|
|
||||||
orig: 65, 95
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
leaf-3
|
|
||||||
rotate: true
|
|
||||||
xy: 922, 376
|
|
||||||
size: 132, 77
|
|
||||||
orig: 132, 77
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
leaf-4
|
|
||||||
rotate: false
|
|
||||||
xy: 600, 60
|
|
||||||
size: 89, 49
|
|
||||||
orig: 89, 49
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
leaf-5
|
|
||||||
rotate: true
|
|
||||||
xy: 718, 216
|
|
||||||
size: 53, 106
|
|
||||||
orig: 53, 106
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
leaf-6
|
|
||||||
rotate: false
|
|
||||||
xy: 252, 85
|
|
||||||
size: 88, 116
|
|
||||||
orig: 88, 116
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
leaf-7
|
|
||||||
rotate: true
|
|
||||||
xy: 252, 29
|
|
||||||
size: 54, 86
|
|
||||||
orig: 54, 86
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
wood
|
|
||||||
rotate: false
|
|
||||||
xy: 2, 203
|
|
||||||
size: 617, 305
|
|
||||||
orig: 617, 305
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
|
Before Width: | Height: | Size: 416 KiB |
@ -1,300 +0,0 @@
|
|||||||
|
|
||||||
raptor.png
|
|
||||||
size: 1024,1024
|
|
||||||
format: RGBA8888
|
|
||||||
filter: Linear,Linear
|
|
||||||
repeat: none
|
|
||||||
back-arm
|
|
||||||
rotate: true
|
|
||||||
xy: 274, 394
|
|
||||||
size: 46, 29
|
|
||||||
orig: 46, 29
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
back-bracer
|
|
||||||
rotate: true
|
|
||||||
xy: 140, 247
|
|
||||||
size: 39, 28
|
|
||||||
orig: 39, 28
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
back-hand
|
|
||||||
rotate: false
|
|
||||||
xy: 824, 699
|
|
||||||
size: 36, 34
|
|
||||||
orig: 36, 34
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
back-knee
|
|
||||||
rotate: false
|
|
||||||
xy: 360, 507
|
|
||||||
size: 49, 67
|
|
||||||
orig: 49, 67
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
back-thigh
|
|
||||||
rotate: true
|
|
||||||
xy: 140, 206
|
|
||||||
size: 39, 24
|
|
||||||
orig: 39, 24
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
dust01
|
|
||||||
rotate: false
|
|
||||||
xy: 219, 299
|
|
||||||
size: 48, 37
|
|
||||||
orig: 48, 37
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
dust02
|
|
||||||
rotate: false
|
|
||||||
xy: 895, 833
|
|
||||||
size: 43, 44
|
|
||||||
orig: 43, 44
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
dust03
|
|
||||||
rotate: true
|
|
||||||
xy: 167, 445
|
|
||||||
size: 31, 26
|
|
||||||
orig: 31, 26
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
eyes-open
|
|
||||||
rotate: true
|
|
||||||
xy: 2, 2
|
|
||||||
size: 47, 45
|
|
||||||
orig: 47, 45
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
front-arm
|
|
||||||
rotate: false
|
|
||||||
xy: 470, 544
|
|
||||||
size: 48, 30
|
|
||||||
orig: 48, 30
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
front-bracer
|
|
||||||
rotate: true
|
|
||||||
xy: 274, 351
|
|
||||||
size: 41, 29
|
|
||||||
orig: 41, 29
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
front-hand
|
|
||||||
rotate: false
|
|
||||||
xy: 827, 773
|
|
||||||
size: 41, 38
|
|
||||||
orig: 41, 38
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
front-open-hand
|
|
||||||
rotate: false
|
|
||||||
xy: 360, 461
|
|
||||||
size: 43, 44
|
|
||||||
orig: 43, 44
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
front-thigh
|
|
||||||
rotate: false
|
|
||||||
xy: 411, 545
|
|
||||||
size: 57, 29
|
|
||||||
orig: 57, 29
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
gun
|
|
||||||
rotate: false
|
|
||||||
xy: 195, 442
|
|
||||||
size: 107, 103
|
|
||||||
orig: 107, 103
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
gun-nohand
|
|
||||||
rotate: false
|
|
||||||
xy: 167, 338
|
|
||||||
size: 105, 102
|
|
||||||
orig: 105, 102
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
head
|
|
||||||
rotate: false
|
|
||||||
xy: 2, 137
|
|
||||||
size: 136, 149
|
|
||||||
orig: 136, 149
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
lower-leg
|
|
||||||
rotate: true
|
|
||||||
xy: 648, 667
|
|
||||||
size: 73, 98
|
|
||||||
orig: 73, 98
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
mouth-grind
|
|
||||||
rotate: true
|
|
||||||
xy: 49, 2
|
|
||||||
size: 47, 30
|
|
||||||
orig: 47, 30
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
mouth-smile
|
|
||||||
rotate: true
|
|
||||||
xy: 81, 2
|
|
||||||
size: 47, 30
|
|
||||||
orig: 47, 30
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
neck
|
|
||||||
rotate: false
|
|
||||||
xy: 626, 631
|
|
||||||
size: 18, 21
|
|
||||||
orig: 18, 21
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
raptor-arm-back
|
|
||||||
rotate: true
|
|
||||||
xy: 538, 570
|
|
||||||
size: 82, 86
|
|
||||||
orig: 82, 86
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
raptor-body
|
|
||||||
rotate: false
|
|
||||||
xy: 2, 737
|
|
||||||
size: 632, 285
|
|
||||||
orig: 632, 285
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
raptor-front-arm
|
|
||||||
rotate: true
|
|
||||||
xy: 544, 654
|
|
||||||
size: 81, 102
|
|
||||||
orig: 81, 102
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
raptor-front-leg
|
|
||||||
rotate: false
|
|
||||||
xy: 2, 478
|
|
||||||
size: 191, 257
|
|
||||||
orig: 191, 257
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
raptor-hindleg-back
|
|
||||||
rotate: false
|
|
||||||
xy: 636, 807
|
|
||||||
size: 169, 215
|
|
||||||
orig: 169, 215
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
raptor-horn
|
|
||||||
rotate: false
|
|
||||||
xy: 360, 655
|
|
||||||
size: 182, 80
|
|
||||||
orig: 182, 80
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
raptor-horn-back
|
|
||||||
rotate: false
|
|
||||||
xy: 360, 576
|
|
||||||
size: 176, 77
|
|
||||||
orig: 176, 77
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
raptor-jaw
|
|
||||||
rotate: false
|
|
||||||
xy: 807, 879
|
|
||||||
size: 153, 143
|
|
||||||
orig: 153, 143
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
raptor-jaw-tooth
|
|
||||||
rotate: true
|
|
||||||
xy: 940, 840
|
|
||||||
size: 37, 48
|
|
||||||
orig: 37, 48
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
raptor-mouth-inside
|
|
||||||
rotate: true
|
|
||||||
xy: 827, 735
|
|
||||||
size: 36, 41
|
|
||||||
orig: 36, 41
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
raptor-saddle-noshadow
|
|
||||||
rotate: false
|
|
||||||
xy: 2, 288
|
|
||||||
size: 163, 188
|
|
||||||
orig: 163, 188
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
raptor-saddle-strap-front
|
|
||||||
rotate: false
|
|
||||||
xy: 962, 927
|
|
||||||
size: 57, 95
|
|
||||||
orig: 57, 95
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
raptor-saddle-strap-rear
|
|
||||||
rotate: true
|
|
||||||
xy: 748, 686
|
|
||||||
size: 54, 74
|
|
||||||
orig: 54, 74
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
raptor-saddle-w-shadow
|
|
||||||
rotate: false
|
|
||||||
xy: 195, 547
|
|
||||||
size: 163, 188
|
|
||||||
orig: 163, 188
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
raptor-tail-shadow
|
|
||||||
rotate: false
|
|
||||||
xy: 636, 742
|
|
||||||
size: 189, 63
|
|
||||||
orig: 189, 63
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
raptor-tongue
|
|
||||||
rotate: false
|
|
||||||
xy: 807, 813
|
|
||||||
size: 86, 64
|
|
||||||
orig: 86, 64
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
stirrup-back
|
|
||||||
rotate: false
|
|
||||||
xy: 411, 508
|
|
||||||
size: 44, 35
|
|
||||||
orig: 44, 35
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
stirrup-front
|
|
||||||
rotate: true
|
|
||||||
xy: 167, 291
|
|
||||||
size: 45, 50
|
|
||||||
orig: 45, 50
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
stirrup-strap
|
|
||||||
rotate: false
|
|
||||||
xy: 962, 879
|
|
||||||
size: 49, 46
|
|
||||||
orig: 49, 46
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
torso
|
|
||||||
rotate: false
|
|
||||||
xy: 304, 454
|
|
||||||
size: 54, 91
|
|
||||||
orig: 54, 91
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
visor
|
|
||||||
rotate: false
|
|
||||||
xy: 2, 51
|
|
||||||
size: 131, 84
|
|
||||||
orig: 131, 84
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
|
Before Width: | Height: | Size: 510 KiB |
@ -1,307 +0,0 @@
|
|||||||
|
|
||||||
spineboy.png
|
|
||||||
size: 1024,512
|
|
||||||
format: RGBA8888
|
|
||||||
filter: Linear,Linear
|
|
||||||
repeat: none
|
|
||||||
crosshair
|
|
||||||
rotate: false
|
|
||||||
xy: 794, 167
|
|
||||||
size: 45, 45
|
|
||||||
orig: 45, 45
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
dust01
|
|
||||||
rotate: false
|
|
||||||
xy: 960, 190
|
|
||||||
size: 48, 37
|
|
||||||
orig: 48, 37
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
dust02
|
|
||||||
rotate: false
|
|
||||||
xy: 392, 2
|
|
||||||
size: 43, 44
|
|
||||||
orig: 43, 44
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
dust03
|
|
||||||
rotate: false
|
|
||||||
xy: 841, 163
|
|
||||||
size: 31, 26
|
|
||||||
orig: 31, 26
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
eye-indifferent
|
|
||||||
rotate: false
|
|
||||||
xy: 960, 229
|
|
||||||
size: 47, 45
|
|
||||||
orig: 47, 45
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
eye-surprised
|
|
||||||
rotate: false
|
|
||||||
xy: 745, 167
|
|
||||||
size: 47, 45
|
|
||||||
orig: 47, 45
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
front-bracer
|
|
||||||
rotate: false
|
|
||||||
xy: 547, 2
|
|
||||||
size: 29, 40
|
|
||||||
orig: 29, 40
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
front-fist-closed
|
|
||||||
rotate: false
|
|
||||||
xy: 920, 190
|
|
||||||
size: 38, 41
|
|
||||||
orig: 38, 41
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
front-fist-open
|
|
||||||
rotate: false
|
|
||||||
xy: 437, 2
|
|
||||||
size: 43, 44
|
|
||||||
orig: 43, 44
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
front-foot
|
|
||||||
rotate: false
|
|
||||||
xy: 482, 11
|
|
||||||
size: 63, 35
|
|
||||||
orig: 63, 35
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
front-shin
|
|
||||||
rotate: true
|
|
||||||
xy: 866, 233
|
|
||||||
size: 41, 92
|
|
||||||
orig: 41, 92
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
front-thigh
|
|
||||||
rotate: false
|
|
||||||
xy: 719, 155
|
|
||||||
size: 24, 56
|
|
||||||
orig: 24, 56
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
front-upper-arm
|
|
||||||
rotate: false
|
|
||||||
xy: 719, 104
|
|
||||||
size: 27, 49
|
|
||||||
orig: 27, 49
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
goggles
|
|
||||||
rotate: false
|
|
||||||
xy: 881, 276
|
|
||||||
size: 131, 83
|
|
||||||
orig: 131, 83
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
gun
|
|
||||||
rotate: false
|
|
||||||
xy: 612, 109
|
|
||||||
size: 105, 102
|
|
||||||
orig: 105, 102
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
head
|
|
||||||
rotate: false
|
|
||||||
xy: 881, 361
|
|
||||||
size: 136, 149
|
|
||||||
orig: 136, 149
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
hoverboard-board
|
|
||||||
rotate: false
|
|
||||||
xy: 2, 38
|
|
||||||
size: 246, 76
|
|
||||||
orig: 246, 76
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
hoverboard-thruster
|
|
||||||
rotate: true
|
|
||||||
xy: 578, 12
|
|
||||||
size: 30, 32
|
|
||||||
orig: 30, 32
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
hoverglow-small
|
|
||||||
rotate: true
|
|
||||||
xy: 572, 44
|
|
||||||
size: 137, 38
|
|
||||||
orig: 137, 38
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
mouth-grind
|
|
||||||
rotate: true
|
|
||||||
xy: 713, 55
|
|
||||||
size: 47, 30
|
|
||||||
orig: 47, 30
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
mouth-oooo
|
|
||||||
rotate: true
|
|
||||||
xy: 713, 6
|
|
||||||
size: 47, 30
|
|
||||||
orig: 47, 30
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
mouth-smile
|
|
||||||
rotate: false
|
|
||||||
xy: 748, 135
|
|
||||||
size: 47, 30
|
|
||||||
orig: 47, 30
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
muzzle-glow
|
|
||||||
rotate: false
|
|
||||||
xy: 612, 8
|
|
||||||
size: 99, 99
|
|
||||||
orig: 99, 99
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
muzzle-ring
|
|
||||||
rotate: false
|
|
||||||
xy: 302, 190
|
|
||||||
size: 25, 105
|
|
||||||
orig: 25, 105
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
muzzle01
|
|
||||||
rotate: false
|
|
||||||
xy: 336, 335
|
|
||||||
size: 271, 175
|
|
||||||
orig: 271, 175
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
muzzle02
|
|
||||||
rotate: false
|
|
||||||
xy: 609, 341
|
|
||||||
size: 270, 169
|
|
||||||
orig: 270, 169
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
muzzle03
|
|
||||||
rotate: false
|
|
||||||
xy: 2, 297
|
|
||||||
size: 332, 213
|
|
||||||
orig: 332, 213
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
muzzle04
|
|
||||||
rotate: false
|
|
||||||
xy: 2, 116
|
|
||||||
size: 298, 179
|
|
||||||
orig: 298, 179
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
muzzle05
|
|
||||||
rotate: false
|
|
||||||
xy: 336, 183
|
|
||||||
size: 269, 150
|
|
||||||
orig: 269, 150
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
neck
|
|
||||||
rotate: false
|
|
||||||
xy: 841, 191
|
|
||||||
size: 18, 21
|
|
||||||
orig: 18, 21
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
portal-bg
|
|
||||||
rotate: false
|
|
||||||
xy: 302, 48
|
|
||||||
size: 133, 133
|
|
||||||
orig: 133, 133
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
portal-flare1
|
|
||||||
rotate: false
|
|
||||||
xy: 180, 6
|
|
||||||
size: 56, 30
|
|
||||||
orig: 56, 30
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
portal-flare2
|
|
||||||
rotate: false
|
|
||||||
xy: 2, 5
|
|
||||||
size: 57, 31
|
|
||||||
orig: 57, 31
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
portal-flare3
|
|
||||||
rotate: false
|
|
||||||
xy: 61, 6
|
|
||||||
size: 58, 30
|
|
||||||
orig: 58, 30
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
portal-shade
|
|
||||||
rotate: false
|
|
||||||
xy: 437, 48
|
|
||||||
size: 133, 133
|
|
||||||
orig: 133, 133
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
portal-streaks1
|
|
||||||
rotate: true
|
|
||||||
xy: 609, 213
|
|
||||||
size: 126, 128
|
|
||||||
orig: 126, 128
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
portsl-streaks2
|
|
||||||
rotate: false
|
|
||||||
xy: 739, 214
|
|
||||||
size: 125, 125
|
|
||||||
orig: 125, 125
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
rear-bracer
|
|
||||||
rotate: true
|
|
||||||
xy: 797, 137
|
|
||||||
size: 28, 36
|
|
||||||
orig: 28, 36
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
rear-foot
|
|
||||||
rotate: false
|
|
||||||
xy: 121, 6
|
|
||||||
size: 57, 30
|
|
||||||
orig: 57, 30
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
rear-shin
|
|
||||||
rotate: true
|
|
||||||
xy: 301, 8
|
|
||||||
size: 38, 89
|
|
||||||
orig: 38, 89
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
rear-thigh
|
|
||||||
rotate: true
|
|
||||||
xy: 866, 198
|
|
||||||
size: 33, 52
|
|
||||||
orig: 33, 52
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
rear-upper-arm
|
|
||||||
rotate: true
|
|
||||||
xy: 748, 109
|
|
||||||
size: 24, 44
|
|
||||||
orig: 24, 44
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
torso
|
|
||||||
rotate: false
|
|
||||||
xy: 250, 24
|
|
||||||
size: 49, 90
|
|
||||||
orig: 49, 90
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
|
Before Width: | Height: | Size: 572 KiB |
@ -1,41 +0,0 @@
|
|||||||
|
|
||||||
stretchyman.png
|
|
||||||
size: 1024,256
|
|
||||||
format: RGBA8888
|
|
||||||
filter: Linear,Linear
|
|
||||||
repeat: none
|
|
||||||
back-arm
|
|
||||||
rotate: true
|
|
||||||
xy: 679, 173
|
|
||||||
size: 72, 202
|
|
||||||
orig: 72, 202
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
back-leg
|
|
||||||
rotate: true
|
|
||||||
xy: 2, 2
|
|
||||||
size: 100, 318
|
|
||||||
orig: 100, 318
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
body
|
|
||||||
rotate: true
|
|
||||||
xy: 2, 104
|
|
||||||
size: 141, 452
|
|
||||||
orig: 141, 452
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
front-arm
|
|
||||||
rotate: true
|
|
||||||
xy: 456, 100
|
|
||||||
size: 145, 221
|
|
||||||
orig: 145, 221
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
head
|
|
||||||
rotate: true
|
|
||||||
xy: 322, 15
|
|
||||||
size: 87, 102
|
|
||||||
orig: 87, 102
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
|
Before Width: | Height: | Size: 131 KiB |
@ -1,174 +0,0 @@
|
|||||||
|
|
||||||
tank.png
|
|
||||||
size: 1024,1024
|
|
||||||
format: RGBA8888
|
|
||||||
filter: Linear,Linear
|
|
||||||
repeat: none
|
|
||||||
antenna
|
|
||||||
rotate: true
|
|
||||||
xy: 650, 857
|
|
||||||
size: 11, 152
|
|
||||||
orig: 11, 152
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
cannon
|
|
||||||
rotate: true
|
|
||||||
xy: 434, 376
|
|
||||||
size: 466, 29
|
|
||||||
orig: 466, 29
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
cannon-connector
|
|
||||||
rotate: true
|
|
||||||
xy: 349, 241
|
|
||||||
size: 56, 68
|
|
||||||
orig: 56, 68
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
ground
|
|
||||||
rotate: true
|
|
||||||
xy: 255, 330
|
|
||||||
size: 512, 177
|
|
||||||
orig: 512, 177
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
guntower
|
|
||||||
rotate: false
|
|
||||||
xy: 650, 870
|
|
||||||
size: 365, 145
|
|
||||||
orig: 365, 145
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
machinegun
|
|
||||||
rotate: false
|
|
||||||
xy: 255, 299
|
|
||||||
size: 166, 29
|
|
||||||
orig: 166, 29
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
machinegun-mount
|
|
||||||
rotate: true
|
|
||||||
xy: 2, 2
|
|
||||||
size: 36, 48
|
|
||||||
orig: 36, 48
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
rock
|
|
||||||
rotate: true
|
|
||||||
xy: 465, 552
|
|
||||||
size: 290, 64
|
|
||||||
orig: 290, 64
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
smoke-glow
|
|
||||||
rotate: false
|
|
||||||
xy: 531, 563
|
|
||||||
size: 50, 50
|
|
||||||
orig: 50, 50
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
smoke-puff01-bg
|
|
||||||
rotate: true
|
|
||||||
xy: 465, 458
|
|
||||||
size: 92, 62
|
|
||||||
orig: 92, 62
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
smoke-puff01-fg
|
|
||||||
rotate: false
|
|
||||||
xy: 115, 138
|
|
||||||
size: 88, 59
|
|
||||||
orig: 88, 59
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
smoke-puff02-fg
|
|
||||||
rotate: false
|
|
||||||
xy: 255, 235
|
|
||||||
size: 92, 62
|
|
||||||
orig: 92, 62
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
smoke-puff03-fg
|
|
||||||
rotate: false
|
|
||||||
xy: 531, 685
|
|
||||||
size: 92, 62
|
|
||||||
orig: 92, 62
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
smoke-puff04-fg
|
|
||||||
rotate: true
|
|
||||||
xy: 465, 378
|
|
||||||
size: 78, 48
|
|
||||||
orig: 78, 48
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
tank-bottom
|
|
||||||
rotate: true
|
|
||||||
xy: 115, 199
|
|
||||||
size: 643, 138
|
|
||||||
orig: 643, 138
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
tank-bottom-shadow
|
|
||||||
rotate: false
|
|
||||||
xy: 2, 844
|
|
||||||
size: 646, 171
|
|
||||||
orig: 646, 171
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
tank-top
|
|
||||||
rotate: true
|
|
||||||
xy: 2, 138
|
|
||||||
size: 704, 111
|
|
||||||
orig: 704, 111
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
tread
|
|
||||||
rotate: true
|
|
||||||
xy: 626, 794
|
|
||||||
size: 48, 15
|
|
||||||
orig: 48, 15
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
tread-inside
|
|
||||||
rotate: false
|
|
||||||
xy: 434, 360
|
|
||||||
size: 13, 14
|
|
||||||
orig: 13, 14
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
wheel-big
|
|
||||||
rotate: false
|
|
||||||
xy: 2, 40
|
|
||||||
size: 96, 96
|
|
||||||
orig: 96, 96
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
wheel-big-overlay
|
|
||||||
rotate: false
|
|
||||||
xy: 531, 749
|
|
||||||
size: 93, 93
|
|
||||||
orig: 93, 93
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
wheel-mid
|
|
||||||
rotate: false
|
|
||||||
xy: 100, 68
|
|
||||||
size: 68, 68
|
|
||||||
orig: 68, 68
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
wheel-mid-overlay
|
|
||||||
rotate: false
|
|
||||||
xy: 531, 615
|
|
||||||
size: 68, 68
|
|
||||||
orig: 68, 68
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
wheel-small
|
|
||||||
rotate: false
|
|
||||||
xy: 205, 161
|
|
||||||
size: 36, 36
|
|
||||||
orig: 36, 36
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
|
Before Width: | Height: | Size: 580 KiB |
@ -1,13 +0,0 @@
|
|||||||
|
|
||||||
vine.png
|
|
||||||
size: 128,1024
|
|
||||||
format: RGBA8888
|
|
||||||
filter: Linear,Linear
|
|
||||||
repeat: none
|
|
||||||
vine
|
|
||||||
rotate: false
|
|
||||||
xy: 2, 2
|
|
||||||
size: 68, 962
|
|
||||||
orig: 68, 962
|
|
||||||
offset: 0, 0
|
|
||||||
index: -1
|
|
||||||
|
Before Width: | Height: | Size: 156 KiB |
@ -1,461 +0,0 @@
|
|||||||
/******************************************************************************
|
|
||||||
* Spine Runtimes Software License v2.5
|
|
||||||
*
|
|
||||||
* Copyright (c) 2013-2016, Esoteric Software
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* You are granted a perpetual, non-exclusive, non-sublicensable, and
|
|
||||||
* non-transferable license to use, install, execute, and perform the Spine
|
|
||||||
* Runtimes software and derivative works solely for personal or internal
|
|
||||||
* use. Without the written permission of Esoteric Software (see Section 2 of
|
|
||||||
* the Spine Software License Agreement), you may not (a) modify, translate,
|
|
||||||
* adapt, or develop new applications using the Spine Runtimes or otherwise
|
|
||||||
* create derivative works or improvements of the Spine Runtimes or (b) remove,
|
|
||||||
* delete, alter, or obscure any trademarks or any copyright, trademark, patent,
|
|
||||||
* or other intellectual property or proprietary rights notices on or in the
|
|
||||||
* Software, including any copy thereof. Redistributions in binary or source
|
|
||||||
* form must include this license and terms.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "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 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.
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include <string.h>
|
|
||||||
#define SPINE_SHORT_NAMES
|
|
||||||
#include <spine/spine-sfml.h>
|
|
||||||
#include <SFML/Graphics.hpp>
|
|
||||||
#include <SFML/Window/Mouse.hpp>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace spine;
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
void callback (AnimationState* state, EventType type, TrackEntry* entry, Event* event) {
|
|
||||||
const char* animationName = (entry && entry->animation) ? entry->animation->name : 0;
|
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case ANIMATION_START:
|
|
||||||
printf("%d start: %s\n", entry->trackIndex, animationName);
|
|
||||||
break;
|
|
||||||
case ANIMATION_INTERRUPT:
|
|
||||||
printf("%d interrupt: %s\n", entry->trackIndex, animationName);
|
|
||||||
break;
|
|
||||||
case ANIMATION_END:
|
|
||||||
printf("%d end: %s\n", entry->trackIndex, animationName);
|
|
||||||
break;
|
|
||||||
case ANIMATION_COMPLETE:
|
|
||||||
printf("%d complete: %s\n", entry->trackIndex, animationName);
|
|
||||||
break;
|
|
||||||
case ANIMATION_DISPOSE:
|
|
||||||
printf("%d dispose: %s\n", entry->trackIndex, animationName);
|
|
||||||
break;
|
|
||||||
case ANIMATION_EVENT:
|
|
||||||
printf("%d event: %s, %s: %d, %f, %s\n", entry->trackIndex, animationName, event->data->name, event->intValue, event->floatValue,
|
|
||||||
event->stringValue);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
|
||||||
|
|
||||||
SkeletonData* readSkeletonJsonData (const char* filename, Atlas* atlas, float scale) {
|
|
||||||
SkeletonJson* json = SkeletonJson_create(atlas);
|
|
||||||
json->scale = scale;
|
|
||||||
SkeletonData* skeletonData = SkeletonJson_readSkeletonDataFile(json, filename);
|
|
||||||
if (!skeletonData) {
|
|
||||||
printf("%s\n", json->error);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
SkeletonJson_dispose(json);
|
|
||||||
return skeletonData;
|
|
||||||
}
|
|
||||||
|
|
||||||
SkeletonData* readSkeletonBinaryData (const char* filename, Atlas* atlas, float scale) {
|
|
||||||
SkeletonBinary* binary = SkeletonBinary_create(atlas);
|
|
||||||
binary->scale = scale;
|
|
||||||
SkeletonData *skeletonData = SkeletonBinary_readSkeletonDataFile(binary, filename);
|
|
||||||
if (!skeletonData) {
|
|
||||||
printf("%s\n", binary->error);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
SkeletonBinary_dispose(binary);
|
|
||||||
return skeletonData;
|
|
||||||
}
|
|
||||||
|
|
||||||
void testcase (void func(SkeletonData* skeletonData, Atlas* atlas),
|
|
||||||
const char* jsonName, const char* binaryName, const char* atlasName,
|
|
||||||
float scale) {
|
|
||||||
Atlas* atlas = Atlas_createFromFile(atlasName, 0);
|
|
||||||
|
|
||||||
SkeletonData* skeletonData = readSkeletonJsonData(jsonName, atlas, scale);
|
|
||||||
func(skeletonData, atlas);
|
|
||||||
SkeletonData_dispose(skeletonData);
|
|
||||||
|
|
||||||
skeletonData = readSkeletonBinaryData(binaryName, atlas, scale);
|
|
||||||
func(skeletonData, atlas);
|
|
||||||
SkeletonData_dispose(skeletonData);
|
|
||||||
|
|
||||||
Atlas_dispose(atlas);
|
|
||||||
}
|
|
||||||
|
|
||||||
void spineboy (SkeletonData* skeletonData, Atlas* atlas) {
|
|
||||||
SkeletonBounds* bounds = SkeletonBounds_create();
|
|
||||||
|
|
||||||
// Configure mixing.
|
|
||||||
AnimationStateData* stateData = AnimationStateData_create(skeletonData);
|
|
||||||
AnimationStateData_setMixByName(stateData, "walk", "jump", 0.2f);
|
|
||||||
AnimationStateData_setMixByName(stateData, "jump", "run", 0.2f);
|
|
||||||
|
|
||||||
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData, stateData);
|
|
||||||
drawable->timeScale = 1;
|
|
||||||
|
|
||||||
Skeleton* skeleton = drawable->skeleton;
|
|
||||||
skeleton->flipX = false;
|
|
||||||
skeleton->flipY = false;
|
|
||||||
Skeleton_setToSetupPose(skeleton);
|
|
||||||
|
|
||||||
skeleton->x = 320;
|
|
||||||
skeleton->y = 590;
|
|
||||||
Skeleton_updateWorldTransform(skeleton);
|
|
||||||
|
|
||||||
Slot* headSlot = Skeleton_findSlot(skeleton, "head");
|
|
||||||
|
|
||||||
drawable->state->listener = callback;
|
|
||||||
AnimationState_addAnimationByName(drawable->state, 0, "walk", true, 0);
|
|
||||||
AnimationState_addAnimationByName(drawable->state, 0, "jump", false, 3);
|
|
||||||
AnimationState_addAnimationByName(drawable->state, 0, "run", true, 0);
|
|
||||||
|
|
||||||
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - spineboy");
|
|
||||||
window.setFramerateLimit(60);
|
|
||||||
sf::Event event;
|
|
||||||
sf::Clock deltaClock;
|
|
||||||
while (window.isOpen()) {
|
|
||||||
while (window.pollEvent(event))
|
|
||||||
if (event.type == sf::Event::Closed) window.close();
|
|
||||||
|
|
||||||
float delta = deltaClock.getElapsedTime().asSeconds();
|
|
||||||
deltaClock.restart();
|
|
||||||
|
|
||||||
SkeletonBounds_update(bounds, skeleton, true);
|
|
||||||
sf::Vector2i position = sf::Mouse::getPosition(window);
|
|
||||||
if (SkeletonBounds_containsPoint(bounds, position.x, position.y)) {
|
|
||||||
headSlot->color.g = 0;
|
|
||||||
headSlot->color.b = 0;
|
|
||||||
} else {
|
|
||||||
headSlot->color.g = 1;
|
|
||||||
headSlot->color.b = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
drawable->update(delta);
|
|
||||||
|
|
||||||
window.clear();
|
|
||||||
window.draw(*drawable);
|
|
||||||
window.display();
|
|
||||||
}
|
|
||||||
|
|
||||||
SkeletonBounds_dispose(bounds);
|
|
||||||
}
|
|
||||||
|
|
||||||
void goblins (SkeletonData* skeletonData, Atlas* atlas) {
|
|
||||||
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData);
|
|
||||||
drawable->timeScale = 1;
|
|
||||||
|
|
||||||
Skeleton* skeleton = drawable->skeleton;
|
|
||||||
skeleton->flipX = false;
|
|
||||||
skeleton->flipY = false;
|
|
||||||
Skeleton_setSkinByName(skeleton, "goblin");
|
|
||||||
Skeleton_setSlotsToSetupPose(skeleton);
|
|
||||||
//Skeleton_setAttachment(skeleton, "left hand item", "dagger");
|
|
||||||
|
|
||||||
skeleton->x = 320;
|
|
||||||
skeleton->y = 590;
|
|
||||||
Skeleton_updateWorldTransform(skeleton);
|
|
||||||
|
|
||||||
AnimationState_setAnimationByName(drawable->state, 0, "walk", true);
|
|
||||||
|
|
||||||
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - goblins");
|
|
||||||
window.setFramerateLimit(60);
|
|
||||||
sf::Event event;
|
|
||||||
sf::Clock deltaClock;
|
|
||||||
while (window.isOpen()) {
|
|
||||||
while (window.pollEvent(event))
|
|
||||||
if (event.type == sf::Event::Closed) window.close();
|
|
||||||
|
|
||||||
float delta = deltaClock.getElapsedTime().asSeconds();
|
|
||||||
deltaClock.restart();
|
|
||||||
|
|
||||||
drawable->update(delta);
|
|
||||||
|
|
||||||
window.clear();
|
|
||||||
window.draw(*drawable);
|
|
||||||
window.display();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void raptor (SkeletonData* skeletonData, Atlas* atlas) {
|
|
||||||
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData);
|
|
||||||
drawable->timeScale = 1;
|
|
||||||
|
|
||||||
spSwirlVertexEffect* effect = spSwirlVertexEffect_create(400);
|
|
||||||
effect->centerY = -200;
|
|
||||||
drawable->vertexEffect = &effect->super;
|
|
||||||
|
|
||||||
Skeleton* skeleton = drawable->skeleton;
|
|
||||||
skeleton->x = 320;
|
|
||||||
skeleton->y = 590;
|
|
||||||
Skeleton_updateWorldTransform(skeleton);
|
|
||||||
|
|
||||||
AnimationState_setAnimationByName(drawable->state, 0, "walk", true);
|
|
||||||
AnimationState_addAnimationByName(drawable->state, 1, "gun-grab", false, 2);
|
|
||||||
|
|
||||||
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - raptor");
|
|
||||||
window.setFramerateLimit(60);
|
|
||||||
sf::Event event;
|
|
||||||
sf::Clock deltaClock;
|
|
||||||
float swirlTime = 0;
|
|
||||||
while (window.isOpen()) {
|
|
||||||
while (window.pollEvent(event))
|
|
||||||
if (event.type == sf::Event::Closed) window.close();
|
|
||||||
|
|
||||||
float delta = deltaClock.getElapsedTime().asSeconds();
|
|
||||||
deltaClock.restart();
|
|
||||||
|
|
||||||
swirlTime += delta;
|
|
||||||
float percent = fmod(swirlTime, 2);
|
|
||||||
if (percent > 1) percent = 1 - (percent - 1);
|
|
||||||
effect->angle = _spMath_interpolate(_spMath_pow2_apply, -60, 60, percent);
|
|
||||||
|
|
||||||
drawable->update(delta);
|
|
||||||
|
|
||||||
window.clear();
|
|
||||||
window.draw(*drawable);
|
|
||||||
window.display();
|
|
||||||
}
|
|
||||||
spSwirlVertexEffect_dispose(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
void tank (SkeletonData* skeletonData, Atlas* atlas) {
|
|
||||||
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData);
|
|
||||||
drawable->timeScale = 1;
|
|
||||||
|
|
||||||
Skeleton* skeleton = drawable->skeleton;
|
|
||||||
skeleton->x = 500;
|
|
||||||
skeleton->y = 590;
|
|
||||||
Skeleton_updateWorldTransform(skeleton);
|
|
||||||
|
|
||||||
AnimationState_setAnimationByName(drawable->state, 0, "drive", true);
|
|
||||||
|
|
||||||
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - tank");
|
|
||||||
window.setFramerateLimit(60);
|
|
||||||
sf::Event event;
|
|
||||||
sf::Clock deltaClock;
|
|
||||||
|
|
||||||
while (window.isOpen()) {
|
|
||||||
while (window.pollEvent(event))
|
|
||||||
if (event.type == sf::Event::Closed) window.close();
|
|
||||||
|
|
||||||
float delta = deltaClock.getElapsedTime().asSeconds();
|
|
||||||
deltaClock.restart();
|
|
||||||
drawable->update(delta);
|
|
||||||
window.clear();
|
|
||||||
window.draw(*drawable);
|
|
||||||
window.display();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void vine (SkeletonData* skeletonData, Atlas* atlas) {
|
|
||||||
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData);
|
|
||||||
drawable->timeScale = 1;
|
|
||||||
|
|
||||||
Skeleton* skeleton = drawable->skeleton;
|
|
||||||
skeleton->x = 320;
|
|
||||||
skeleton->y = 590;
|
|
||||||
Skeleton_updateWorldTransform(skeleton);
|
|
||||||
|
|
||||||
AnimationState_setAnimationByName(drawable->state, 0, "grow", true);
|
|
||||||
|
|
||||||
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - vine");
|
|
||||||
window.setFramerateLimit(60);
|
|
||||||
sf::Event event;
|
|
||||||
sf::Clock deltaClock;
|
|
||||||
while (window.isOpen()) {
|
|
||||||
while (window.pollEvent(event))
|
|
||||||
if (event.type == sf::Event::Closed) window.close();
|
|
||||||
|
|
||||||
float delta = deltaClock.getElapsedTime().asSeconds();
|
|
||||||
deltaClock.restart();
|
|
||||||
|
|
||||||
drawable->update(delta);
|
|
||||||
|
|
||||||
window.clear();
|
|
||||||
window.draw(*drawable);
|
|
||||||
window.display();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void stretchyman (SkeletonData* skeletonData, Atlas* atlas) {
|
|
||||||
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData);
|
|
||||||
drawable->timeScale = 1;
|
|
||||||
|
|
||||||
Skeleton* skeleton = drawable->skeleton;
|
|
||||||
skeleton->flipX = false;
|
|
||||||
skeleton->flipY = false;
|
|
||||||
|
|
||||||
skeleton->x = 100;
|
|
||||||
skeleton->y = 590;
|
|
||||||
Skeleton_updateWorldTransform(skeleton);
|
|
||||||
|
|
||||||
AnimationState_setAnimationByName(drawable->state, 0, "sneak", true);
|
|
||||||
|
|
||||||
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - Streatchyman");
|
|
||||||
window.setFramerateLimit(60);
|
|
||||||
sf::Event event;
|
|
||||||
sf::Clock deltaClock;
|
|
||||||
while (window.isOpen()) {
|
|
||||||
while (window.pollEvent(event))
|
|
||||||
if (event.type == sf::Event::Closed) window.close();
|
|
||||||
|
|
||||||
float delta = deltaClock.getElapsedTime().asSeconds();
|
|
||||||
deltaClock.restart();
|
|
||||||
|
|
||||||
drawable->update(delta);
|
|
||||||
|
|
||||||
window.clear();
|
|
||||||
window.draw(*drawable);
|
|
||||||
window.display();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void coin (SkeletonData* skeletonData, Atlas* atlas) {
|
|
||||||
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData);
|
|
||||||
drawable->timeScale = 1;
|
|
||||||
|
|
||||||
Skeleton* skeleton = drawable->skeleton;
|
|
||||||
skeleton->x = 320;
|
|
||||||
skeleton->y = 590;
|
|
||||||
Skeleton_updateWorldTransform(skeleton);
|
|
||||||
|
|
||||||
AnimationState_setAnimationByName(drawable->state, 0, "rotate", true);
|
|
||||||
|
|
||||||
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - vine");
|
|
||||||
window.setFramerateLimit(60);
|
|
||||||
sf::Event event;
|
|
||||||
sf::Clock deltaClock;
|
|
||||||
float swirlTime = 0;
|
|
||||||
while (window.isOpen()) {
|
|
||||||
while (window.pollEvent(event))
|
|
||||||
if (event.type == sf::Event::Closed) window.close();
|
|
||||||
|
|
||||||
float delta = deltaClock.getElapsedTime().asSeconds();
|
|
||||||
deltaClock.restart();
|
|
||||||
|
|
||||||
drawable->update(delta);
|
|
||||||
|
|
||||||
window.clear();
|
|
||||||
window.draw(*drawable);
|
|
||||||
window.display();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void owl (SkeletonData* skeletonData, Atlas* atlas) {
|
|
||||||
SkeletonDrawable* drawable = new SkeletonDrawable(skeletonData);
|
|
||||||
drawable->timeScale = 1;
|
|
||||||
|
|
||||||
Skeleton* skeleton = drawable->skeleton;
|
|
||||||
skeleton->x = 320;
|
|
||||||
skeleton->y = 400;
|
|
||||||
Skeleton_updateWorldTransform(skeleton);
|
|
||||||
|
|
||||||
AnimationState_setAnimationByName(drawable->state, 0, "idle", true);
|
|
||||||
AnimationState_setAnimationByName(drawable->state, 1, "blink", true);
|
|
||||||
spTrackEntry* left = AnimationState_setAnimationByName(drawable->state, 2, "left", true);
|
|
||||||
spTrackEntry* right = AnimationState_setAnimationByName(drawable->state, 3, "right", true);
|
|
||||||
spTrackEntry* up = AnimationState_setAnimationByName(drawable->state, 4, "up", true);
|
|
||||||
spTrackEntry* down = AnimationState_setAnimationByName(drawable->state, 5, "down", true);
|
|
||||||
|
|
||||||
left->alpha = 0;
|
|
||||||
left->mixBlend = SP_MIX_BLEND_ADD;
|
|
||||||
right->alpha = 0;
|
|
||||||
right->mixBlend = SP_MIX_BLEND_ADD;
|
|
||||||
up->alpha = 0;
|
|
||||||
up->mixBlend = SP_MIX_BLEND_ADD;
|
|
||||||
down->alpha = 0;
|
|
||||||
down->mixBlend = SP_MIX_BLEND_ADD;
|
|
||||||
|
|
||||||
sf::RenderWindow window(sf::VideoMode(640, 640), "Spine SFML - owl");
|
|
||||||
window.setFramerateLimit(60);
|
|
||||||
sf::Event event;
|
|
||||||
sf::Clock deltaClock;
|
|
||||||
while (window.isOpen()) {
|
|
||||||
while (window.pollEvent(event)) {
|
|
||||||
if (event.type == sf::Event::Closed) window.close();
|
|
||||||
if (event.type == sf::Event::MouseMoved) {
|
|
||||||
float x = event.mouseMove.x / 640.0f;
|
|
||||||
left->alpha = (MAX(x, 0.5f) - 0.5f) * 2;
|
|
||||||
right->alpha = (0.5 - MIN(x, 0.5)) * 2;
|
|
||||||
|
|
||||||
float y = event.mouseMove.y / 640.0f;
|
|
||||||
down->alpha = (MAX(y, 0.5f) - 0.5f) * 2;
|
|
||||||
up->alpha = (0.5 - MIN(y, 0.5)) * 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float delta = deltaClock.getElapsedTime().asSeconds();
|
|
||||||
deltaClock.restart();
|
|
||||||
|
|
||||||
drawable->update(delta);
|
|
||||||
|
|
||||||
window.clear();
|
|
||||||
window.draw(*drawable);
|
|
||||||
window.display();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used for debugging purposes during runtime development
|
|
||||||
*/
|
|
||||||
void test (SkeletonData* skeletonData, Atlas* atlas) {
|
|
||||||
spSkeleton* skeleton = Skeleton_create(skeletonData);
|
|
||||||
spAnimationStateData* animData = spAnimationStateData_create(skeletonData);
|
|
||||||
spAnimationState* animState = spAnimationState_create(animData);
|
|
||||||
spAnimationState_setAnimationByName(animState, 0, "drive", true);
|
|
||||||
|
|
||||||
|
|
||||||
float d = 3;
|
|
||||||
for (int i = 0; i < 1; i++) {
|
|
||||||
spSkeleton_update(skeleton, d);
|
|
||||||
spAnimationState_update(animState, d);
|
|
||||||
spAnimationState_apply(animState, skeleton);
|
|
||||||
spSkeleton_updateWorldTransform(skeleton);
|
|
||||||
for (int ii = 0; ii < skeleton->bonesCount; ii++) {
|
|
||||||
spBone* bone = skeleton->bones[ii];
|
|
||||||
printf("%s %f %f %f %f %f %f\n", bone->data->name, bone->a, bone->b, bone->c, bone->d, bone->worldX, bone->worldY);
|
|
||||||
}
|
|
||||||
printf("========================================\n");
|
|
||||||
d += 0.1f;
|
|
||||||
}
|
|
||||||
|
|
||||||
Skeleton_dispose(skeleton);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main () {
|
|
||||||
testcase(test, "data/tank-pro.json", "data/tank-pro.skel", "data/tank.atlas", 1.0f);
|
|
||||||
testcase(owl, "data/owl-pro.json", "data/owl-pro.skel", "data/owl.atlas", 0.5f);
|
|
||||||
testcase(coin, "data/coin-pro.json", "data/coin-pro.skel", "data/coin.atlas", 0.5f);
|
|
||||||
testcase(vine, "data/vine-pro.json", "data/vine-pro.skel", "data/vine.atlas", 0.5f);
|
|
||||||
testcase(tank, "data/tank-pro.json", "data/tank-pro.skel", "data/tank.atlas", 0.2f);
|
|
||||||
testcase(raptor, "data/raptor-pro.json", "data/raptor-pro.skel", "data/raptor.atlas", 0.5f);
|
|
||||||
testcase(spineboy, "data/spineboy-ess.json", "data/spineboy-ess.skel", "data/spineboy.atlas", 0.6f);
|
|
||||||
testcase(goblins, "data/goblins-pro.json", "data/goblins-pro.skel", "data/goblins.atlas", 1.4f);
|
|
||||||
testcase(stretchyman, "data/stretchyman-pro.json", "data/stretchyman-pro.skel", "data/stretchyman.atlas", 0.6f);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@ -1,285 +0,0 @@
|
|||||||
/******************************************************************************
|
|
||||||
* Spine Runtimes Software License v2.5
|
|
||||||
*
|
|
||||||
* Copyright (c) 2013-2016, Esoteric Software
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* You are granted a perpetual, non-exclusive, non-sublicensable, and
|
|
||||||
* non-transferable license to use, install, execute, and perform the Spine
|
|
||||||
* Runtimes software and derivative works solely for personal or internal
|
|
||||||
* use. Without the written permission of Esoteric Software (see Section 2 of
|
|
||||||
* the Spine Software License Agreement), you may not (a) modify, translate,
|
|
||||||
* adapt, or develop new applications using the Spine Runtimes or otherwise
|
|
||||||
* create derivative works or improvements of the Spine Runtimes or (b) remove,
|
|
||||||
* delete, alter, or obscure any trademarks or any copyright, trademark, patent,
|
|
||||||
* or other intellectual property or proprietary rights notices on or in the
|
|
||||||
* Software, including any copy thereof. Redistributions in binary or source
|
|
||||||
* form must include this license and terms.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "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 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.
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
#define SPINE_SHORT_NAMES
|
|
||||||
#include <spine/spine-sfml.h>
|
|
||||||
|
|
||||||
#ifndef SPINE_MESH_VERTEX_COUNT_MAX
|
|
||||||
#define SPINE_MESH_VERTEX_COUNT_MAX 1000
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace sf;
|
|
||||||
|
|
||||||
sf::BlendMode normal = sf::BlendMode(sf::BlendMode::SrcAlpha, sf::BlendMode::OneMinusSrcAlpha);
|
|
||||||
sf::BlendMode additive = sf::BlendMode(sf::BlendMode::SrcAlpha, sf::BlendMode::One);
|
|
||||||
sf::BlendMode multiply = sf::BlendMode(sf::BlendMode::DstColor, sf::BlendMode::OneMinusSrcAlpha);
|
|
||||||
sf::BlendMode screen = sf::BlendMode(sf::BlendMode::One, sf::BlendMode::OneMinusSrcColor);
|
|
||||||
|
|
||||||
sf::BlendMode normalPma = sf::BlendMode(sf::BlendMode::One, sf::BlendMode::OneMinusSrcAlpha);
|
|
||||||
sf::BlendMode additivePma = sf::BlendMode(sf::BlendMode::One, sf::BlendMode::One);
|
|
||||||
sf::BlendMode multiplyPma = sf::BlendMode(sf::BlendMode::DstColor, sf::BlendMode::OneMinusSrcAlpha);
|
|
||||||
sf::BlendMode screenPma = sf::BlendMode(sf::BlendMode::One, sf::BlendMode::OneMinusSrcColor);
|
|
||||||
|
|
||||||
_SP_ARRAY_IMPLEMENT_TYPE(spColorArray, spColor)
|
|
||||||
|
|
||||||
void _AtlasPage_createTexture (AtlasPage* self, const char* path){
|
|
||||||
Texture* texture = new Texture();
|
|
||||||
if (!texture->loadFromFile(path)) return;
|
|
||||||
|
|
||||||
if (self->magFilter == SP_ATLAS_LINEAR) texture->setSmooth(true);
|
|
||||||
if (self->uWrap == SP_ATLAS_REPEAT && self->vWrap == SP_ATLAS_REPEAT) texture->setRepeated(true);
|
|
||||||
|
|
||||||
self->rendererObject = texture;
|
|
||||||
Vector2u size = texture->getSize();
|
|
||||||
self->width = size.x;
|
|
||||||
self->height = size.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _AtlasPage_disposeTexture (AtlasPage* self){
|
|
||||||
delete (Texture*)self->rendererObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
char* _Util_readFile (const char* path, int* length){
|
|
||||||
return _spReadFile(path, length);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**/
|
|
||||||
|
|
||||||
namespace spine {
|
|
||||||
|
|
||||||
SkeletonDrawable::SkeletonDrawable (SkeletonData* skeletonData, AnimationStateData* stateData) :
|
|
||||||
timeScale(1),
|
|
||||||
vertexArray(new VertexArray(Triangles, skeletonData->bonesCount * 4)),
|
|
||||||
vertexEffect(0),
|
|
||||||
worldVertices(0), clipper(0) {
|
|
||||||
Bone_setYDown(true);
|
|
||||||
worldVertices = MALLOC(float, SPINE_MESH_VERTEX_COUNT_MAX);
|
|
||||||
skeleton = Skeleton_create(skeletonData);
|
|
||||||
tempUvs = spFloatArray_create(16);
|
|
||||||
tempColors = spColorArray_create(16);
|
|
||||||
|
|
||||||
ownsAnimationStateData = stateData == 0;
|
|
||||||
if (ownsAnimationStateData) stateData = AnimationStateData_create(skeletonData);
|
|
||||||
|
|
||||||
state = AnimationState_create(stateData);
|
|
||||||
|
|
||||||
clipper = spSkeletonClipping_create();
|
|
||||||
}
|
|
||||||
|
|
||||||
SkeletonDrawable::~SkeletonDrawable () {
|
|
||||||
delete vertexArray;
|
|
||||||
FREE(worldVertices);
|
|
||||||
if (ownsAnimationStateData) AnimationStateData_dispose(state->data);
|
|
||||||
AnimationState_dispose(state);
|
|
||||||
Skeleton_dispose(skeleton);
|
|
||||||
spSkeletonClipping_dispose(clipper);
|
|
||||||
spFloatArray_dispose(tempUvs);
|
|
||||||
spColorArray_dispose(tempColors);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SkeletonDrawable::update (float deltaTime) {
|
|
||||||
Skeleton_update(skeleton, deltaTime);
|
|
||||||
AnimationState_update(state, deltaTime * timeScale);
|
|
||||||
AnimationState_apply(state, skeleton);
|
|
||||||
Skeleton_updateWorldTransform(skeleton);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SkeletonDrawable::draw (RenderTarget& target, RenderStates states) const {
|
|
||||||
vertexArray->clear();
|
|
||||||
states.texture = 0;
|
|
||||||
unsigned short quadIndices[6] = { 0, 1, 2, 2, 3, 0 };
|
|
||||||
|
|
||||||
if (vertexEffect != 0) vertexEffect->begin(vertexEffect, skeleton);
|
|
||||||
|
|
||||||
sf::Vertex vertex;
|
|
||||||
Texture* texture = 0;
|
|
||||||
for (int i = 0; i < skeleton->slotsCount; ++i) {
|
|
||||||
Slot* slot = skeleton->drawOrder[i];
|
|
||||||
Attachment* attachment = slot->attachment;
|
|
||||||
if (!attachment) continue;
|
|
||||||
|
|
||||||
float* vertices = worldVertices;
|
|
||||||
int verticesCount = 0;
|
|
||||||
float* uvs = 0;
|
|
||||||
unsigned short* indices = 0;
|
|
||||||
int indicesCount = 0;
|
|
||||||
spColor* attachmentColor;
|
|
||||||
|
|
||||||
if (attachment->type == ATTACHMENT_REGION) {
|
|
||||||
RegionAttachment* regionAttachment = (RegionAttachment*)attachment;
|
|
||||||
spRegionAttachment_computeWorldVertices(regionAttachment, slot->bone, vertices, 0, 2);
|
|
||||||
verticesCount = 4;
|
|
||||||
uvs = regionAttachment->uvs;
|
|
||||||
indices = quadIndices;
|
|
||||||
indicesCount = 6;
|
|
||||||
texture = (Texture*)((AtlasRegion*)regionAttachment->rendererObject)->page->rendererObject;
|
|
||||||
attachmentColor = ®ionAttachment->color;
|
|
||||||
|
|
||||||
} else if (attachment->type == ATTACHMENT_MESH) {
|
|
||||||
MeshAttachment* mesh = (MeshAttachment*)attachment;
|
|
||||||
if (mesh->super.worldVerticesLength > SPINE_MESH_VERTEX_COUNT_MAX) continue;
|
|
||||||
texture = (Texture*)((AtlasRegion*)mesh->rendererObject)->page->rendererObject;
|
|
||||||
spVertexAttachment_computeWorldVertices(SUPER(mesh), slot, 0, mesh->super.worldVerticesLength, worldVertices, 0, 2);
|
|
||||||
verticesCount = mesh->super.worldVerticesLength >> 1;
|
|
||||||
uvs = mesh->uvs;
|
|
||||||
indices = mesh->triangles;
|
|
||||||
indicesCount = mesh->trianglesCount;
|
|
||||||
attachmentColor = &mesh->color;
|
|
||||||
} else if (attachment->type == SP_ATTACHMENT_CLIPPING) {
|
|
||||||
spClippingAttachment* clip = (spClippingAttachment*)slot->attachment;
|
|
||||||
spSkeletonClipping_clipStart(clipper, slot, clip);
|
|
||||||
continue;
|
|
||||||
} else continue;
|
|
||||||
|
|
||||||
Uint8 r = static_cast<Uint8>(skeleton->color.r * slot->color.r * attachmentColor->r * 255);
|
|
||||||
Uint8 g = static_cast<Uint8>(skeleton->color.g * slot->color.g * attachmentColor->g * 255);
|
|
||||||
Uint8 b = static_cast<Uint8>(skeleton->color.b * slot->color.b * attachmentColor->b * 255);
|
|
||||||
Uint8 a = static_cast<Uint8>(skeleton->color.a * slot->color.a * attachmentColor->a * 255);
|
|
||||||
vertex.color.r = r;
|
|
||||||
vertex.color.g = g;
|
|
||||||
vertex.color.b = b;
|
|
||||||
vertex.color.a = a;
|
|
||||||
|
|
||||||
spColor light;
|
|
||||||
light.r = r / 255.0f;
|
|
||||||
light.g = g / 255.0f;
|
|
||||||
light.b = b / 255.0f;
|
|
||||||
light.a = a / 255.0f;
|
|
||||||
|
|
||||||
sf::BlendMode blend;
|
|
||||||
if (!usePremultipliedAlpha) {
|
|
||||||
switch (slot->data->blendMode) {
|
|
||||||
case BLEND_MODE_NORMAL:
|
|
||||||
blend = normal;
|
|
||||||
break;
|
|
||||||
case BLEND_MODE_ADDITIVE:
|
|
||||||
blend = additive;
|
|
||||||
break;
|
|
||||||
case BLEND_MODE_MULTIPLY:
|
|
||||||
blend = multiply;
|
|
||||||
break;
|
|
||||||
case BLEND_MODE_SCREEN:
|
|
||||||
blend = screen;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
blend = normal;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch (slot->data->blendMode) {
|
|
||||||
case BLEND_MODE_NORMAL:
|
|
||||||
blend = normalPma;
|
|
||||||
break;
|
|
||||||
case BLEND_MODE_ADDITIVE:
|
|
||||||
blend = additivePma;
|
|
||||||
break;
|
|
||||||
case BLEND_MODE_MULTIPLY:
|
|
||||||
blend = multiplyPma;
|
|
||||||
break;
|
|
||||||
case BLEND_MODE_SCREEN:
|
|
||||||
blend = screenPma;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
blend = normalPma;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (states.texture == 0) states.texture = texture;
|
|
||||||
|
|
||||||
if (states.blendMode != blend || states.texture != texture) {
|
|
||||||
target.draw(*vertexArray, states);
|
|
||||||
vertexArray->clear();
|
|
||||||
states.blendMode = blend;
|
|
||||||
states.texture = texture;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (spSkeletonClipping_isClipping(clipper)) {
|
|
||||||
spSkeletonClipping_clipTriangles(clipper, vertices, verticesCount << 1, indices, indicesCount, uvs, 2);
|
|
||||||
vertices = clipper->clippedVertices->items;
|
|
||||||
verticesCount = clipper->clippedVertices->size >> 1;
|
|
||||||
uvs = clipper->clippedUVs->items;
|
|
||||||
indices = clipper->clippedTriangles->items;
|
|
||||||
indicesCount = clipper->clippedTriangles->size;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector2u size = texture->getSize();
|
|
||||||
|
|
||||||
if (vertexEffect != 0) {
|
|
||||||
spFloatArray_clear(tempUvs);
|
|
||||||
spColorArray_clear(tempColors);
|
|
||||||
for (int i = 0; i < verticesCount; i++) {
|
|
||||||
spColor vertexColor = light;
|
|
||||||
spColor dark;
|
|
||||||
dark.r = dark.g = dark.b = dark.a = 0;
|
|
||||||
int index = i << 1;
|
|
||||||
float x = vertices[index];
|
|
||||||
float y = vertices[index + 1];
|
|
||||||
float u = uvs[index];
|
|
||||||
float v = uvs[index + 1];
|
|
||||||
vertexEffect->transform(vertexEffect, &x, &y, &u, &v, &vertexColor, &dark);
|
|
||||||
vertices[index] = x;
|
|
||||||
vertices[index + 1] = y;
|
|
||||||
spFloatArray_add(tempUvs, u);
|
|
||||||
spFloatArray_add(tempUvs, v);
|
|
||||||
spColorArray_add(tempColors, vertexColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < indicesCount; ++i) {
|
|
||||||
int index = indices[i] << 1;
|
|
||||||
vertex.position.x = vertices[index];
|
|
||||||
vertex.position.y = vertices[index + 1];
|
|
||||||
vertex.texCoords.x = uvs[index] * size.x;
|
|
||||||
vertex.texCoords.y = uvs[index + 1] * size.y;
|
|
||||||
spColor vertexColor = tempColors->items[index >> 1];
|
|
||||||
vertex.color.r = static_cast<Uint8>(vertexColor.r * 255);
|
|
||||||
vertex.color.g = static_cast<Uint8>(vertexColor.g * 255);
|
|
||||||
vertex.color.b = static_cast<Uint8>(vertexColor.b * 255);
|
|
||||||
vertex.color.a = static_cast<Uint8>(vertexColor.a * 255);
|
|
||||||
vertexArray->append(vertex);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i = 0; i < indicesCount; ++i) {
|
|
||||||
int index = indices[i] << 1;
|
|
||||||
vertex.position.x = vertices[index];
|
|
||||||
vertex.position.y = vertices[index + 1];
|
|
||||||
vertex.texCoords.x = uvs[index] * size.x;
|
|
||||||
vertex.texCoords.y = uvs[index + 1] * size.y;
|
|
||||||
vertexArray->append(vertex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
spSkeletonClipping_clipEnd(clipper, slot);
|
|
||||||
}
|
|
||||||
target.draw(*vertexArray, states);
|
|
||||||
spSkeletonClipping_clipEnd2(clipper);
|
|
||||||
|
|
||||||
if (vertexEffect != 0) vertexEffect->end(vertexEffect);
|
|
||||||
}
|
|
||||||
|
|
||||||
} /* namespace spine */
|
|
||||||