mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
Fixed crashes on MSVC.
This commit is contained in:
parent
b60f21e6d8
commit
b7ae63f743
@ -1,6 +1,15 @@
|
|||||||
cmake_minimum_required(VERSION 2.8.9)
|
cmake_minimum_required(VERSION 2.8.9)
|
||||||
project(spine)
|
project(spine)
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
message("MSCV detected")
|
||||||
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
|
||||||
|
set (CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
|
||||||
|
else()
|
||||||
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c89")
|
||||||
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wnon-virtual-dtor -pedantic -std=c++03 -fno-exceptions -fno-rtti")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(CMAKE_INSTALL_PREFIX "./")
|
set(CMAKE_INSTALL_PREFIX "./")
|
||||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||||
set(SPINE_SFML FALSE CACHE BOOL FALSE)
|
set(SPINE_SFML FALSE CACHE BOOL FALSE)
|
||||||
|
|||||||
@ -2,7 +2,6 @@ include_directories(include)
|
|||||||
file(GLOB INCLUDES "spine-c/include/**/*.h")
|
file(GLOB INCLUDES "spine-c/include/**/*.h")
|
||||||
file(GLOB SOURCES "spine-c/src/**/*.c" "spine-c/src/**/*.cpp")
|
file(GLOB SOURCES "spine-c/src/**/*.c" "spine-c/src/**/*.cpp")
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=c89 -pedantic")
|
|
||||||
add_library(spine-c STATIC ${SOURCES} ${INCLUDES})
|
add_library(spine-c STATIC ${SOURCES} ${INCLUDES})
|
||||||
target_include_directories(spine-c PUBLIC spine-c/include)
|
target_include_directories(spine-c PUBLIC spine-c/include)
|
||||||
install(TARGETS spine-c DESTINATION dist/lib)
|
install(TARGETS spine-c DESTINATION dist/lib)
|
||||||
|
|||||||
@ -3,7 +3,7 @@ project(spine_unit_test)
|
|||||||
|
|
||||||
set(CMAKE_INSTALL_PREFIX "./")
|
set(CMAKE_INSTALL_PREFIX "./")
|
||||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -DKANJI_MEMTRACE -DUSE_CPP11_MUTEX -std=c++11")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DKANJI_MEMTRACE -DUSE_CPP11_MUTEX")
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
# set includes
|
# set includes
|
||||||
|
|||||||
@ -307,13 +307,13 @@ void MemoryTestFixture::skeletonClipper() {
|
|||||||
|
|
||||||
spSkeletonClipping_clipTriangles(clipping, vertices->items, vertices->size, indices->items, indices->size, uvs->items, 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 };
|
float expectedVertices[8] = { 83.333328f, 50.000000f, 76.666664f, 70.000000f, 23.333334f, 70.000000f, 16.666672f, 50.000000f };
|
||||||
ASSERT(clipping->clippedVertices->size == 8);
|
ASSERT(clipping->clippedVertices->size == 8);
|
||||||
for (int i = 0; i < clipping->clippedVertices->size; i++) {
|
for (int i = 0; i < clipping->clippedVertices->size; i++) {
|
||||||
ASSERT(ABS(clipping->clippedVertices->items[i] - expectedVertices[i]) < 0.001);
|
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 };
|
float expectedUVs[8] = { 0.833333f, 0.333333f, 0.766667f, 0.466667f, 0.233333f, 0.466667f, 0.166667f, 0.333333f };
|
||||||
ASSERT(clipping->clippedUVs->size == 8);
|
ASSERT(clipping->clippedUVs->size == 8);
|
||||||
for (int i = 0; i < clipping->clippedUVs->size; i++) {
|
for (int i = 0; i < clipping->clippedUVs->size; i++) {
|
||||||
ASSERT(ABS(clipping->clippedUVs->items[i] - expectedUVs[i]) < 0.001);
|
ASSERT(ABS(clipping->clippedUVs->items[i] - expectedUVs[i]) < 0.001);
|
||||||
|
|||||||
@ -1,8 +1,16 @@
|
|||||||
|
if(MSVC)
|
||||||
|
message("MSCV detected")
|
||||||
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
|
||||||
|
set (CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
|
||||||
|
else()
|
||||||
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c89")
|
||||||
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wnon-virtual-dtor -pedantic -std=c++03 -fno-exceptions -fno-rtti")
|
||||||
|
endif()
|
||||||
|
|
||||||
include_directories(include)
|
include_directories(include)
|
||||||
file(GLOB INCLUDES "spine-cpp/include/**/*.h")
|
file(GLOB INCLUDES "spine-cpp/include/**/*.h")
|
||||||
file(GLOB SOURCES "spine-cpp/src/**/*.cpp")
|
file(GLOB SOURCES "spine-cpp/src/**/*.cpp")
|
||||||
|
|
||||||
set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -Wall -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -std=c++03 -fno-exceptions -fno-rtti")
|
|
||||||
add_library(spine-cpp STATIC ${SOURCES} ${INCLUDES})
|
add_library(spine-cpp STATIC ${SOURCES} ${INCLUDES})
|
||||||
target_include_directories(spine-cpp PUBLIC spine-cpp/include)
|
target_include_directories(spine-cpp PUBLIC spine-cpp/include)
|
||||||
install(TARGETS spine-cpp DESTINATION dist/lib)
|
install(TARGETS spine-cpp DESTINATION dist/lib)
|
||||||
|
|||||||
@ -3,8 +3,6 @@ project(spine_cpp_unit_test)
|
|||||||
|
|
||||||
set(CMAKE_INSTALL_PREFIX "./")
|
set(CMAKE_INSTALL_PREFIX "./")
|
||||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -std=c++03 -fno-exceptions -fno-rtti")
|
|
||||||
set(CMAKE_CPP_FLAGS "${CMAKE_CPP_FLAGS} -Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic -std=c++03 -fno-exceptions -fno-rtti")
|
|
||||||
|
|
||||||
include_directories(../spine-cpp/include teamcity minicppunit tests memory)
|
include_directories(../spine-cpp/include teamcity minicppunit tests memory)
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,8 @@
|
|||||||
#include <spine/spine.h>
|
#include <spine/spine.h>
|
||||||
#include <spine/Debug.h>
|
#include <spine/Debug.h>
|
||||||
|
|
||||||
|
#pragma warning ( disable : 4710 )
|
||||||
|
|
||||||
using namespace Spine;
|
using namespace Spine;
|
||||||
|
|
||||||
void loadBinary(const String &binaryFile, const String &atlasFile, Atlas *&atlas, SkeletonData *&skeletonData,
|
void loadBinary(const String &binaryFile, const String &atlasFile, Atlas *&atlas, SkeletonData *&skeletonData,
|
||||||
@ -92,16 +94,16 @@ struct TestData {
|
|||||||
|
|
||||||
void testLoading() {
|
void testLoading() {
|
||||||
Vector<TestData> testData;
|
Vector<TestData> testData;
|
||||||
/*testData.add(TestData("testdata/coin/coin-pro.json", "testdata/coin/coin-pro.skel", "testdata/coin/coin.atlas"));
|
testData.add(TestData("testdata/coin/coin-pro.json", "testdata/coin/coin-pro.skel", "testdata/coin/coin.atlas"));
|
||||||
testData.add(TestData("testdata/goblins/goblins-pro.json", "testdata/goblins/goblins-pro.skel",
|
/*testData.add(TestData("testdata/goblins/goblins-pro.json", "testdata/goblins/goblins-pro.skel",
|
||||||
"testdata/goblins/goblins.atlas"));
|
"testdata/goblins/goblins.atlas"));
|
||||||
testData.add(TestData("testdata/raptor/raptor-pro.json", "testdata/raptor/raptor-pro.skel",
|
testData.add(TestData("testdata/raptor/raptor-pro.json", "testdata/raptor/raptor-pro.skel",
|
||||||
"testdata/raptor/raptor.atlas"));
|
"testdata/raptor/raptor.atlas"));
|
||||||
testData.add(TestData("testdata/spineboy/spineboy-pro.json", "testdata/spineboy/spineboy-pro.skel",
|
testData.add(TestData("testdata/spineboy/spineboy-pro.json", "testdata/spineboy/spineboy-pro.skel",
|
||||||
"testdata/spineboy/spineboy.atlas"));
|
"testdata/spineboy/spineboy.atlas"));
|
||||||
testData.add(TestData("testdata/stretchyman/stretchyman-pro.json", "testdata/stretchyman/stretchyman-pro.skel",
|
testData.add(TestData("testdata/stretchyman/stretchyman-pro.json", "testdata/stretchyman/stretchyman-pro.skel",
|
||||||
"testdata/stretchyman/stretchyman.atlas"));*/
|
"testdata/stretchyman/stretchyman.atlas"));
|
||||||
testData.add(TestData("testdata/tank/tank-pro.json", "testdata/tank/tank-pro.skel", "testdata/tank/tank.atlas"));
|
testData.add(TestData("testdata/tank/tank-pro.json", "testdata/tank/tank-pro.skel", "testdata/tank/tank.atlas"));*/
|
||||||
|
|
||||||
for (size_t i = 0; i < testData.size(); i++) {
|
for (size_t i = 0; i < testData.size(); i++) {
|
||||||
TestData &data = testData[i];
|
TestData &data = testData[i];
|
||||||
|
|||||||
@ -85,8 +85,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
~HashMap() {
|
~HashMap() {
|
||||||
for (Entry *entry = _head; entry != NULL; entry = entry->next) {
|
for (Entry *entry = _head; entry != NULL;) {
|
||||||
|
Entry* next = entry->next;
|
||||||
delete entry;
|
delete entry;
|
||||||
|
entry = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -34,6 +34,8 @@
|
|||||||
|
|
||||||
#include <spine/ContainerUtil.h>
|
#include <spine/ContainerUtil.h>
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
using namespace Spine;
|
using namespace Spine;
|
||||||
|
|
||||||
Atlas::Atlas(const String &path, TextureLoader *textureLoader) : _textureLoader(textureLoader) {
|
Atlas::Atlas(const String &path, TextureLoader *textureLoader) : _textureLoader(textureLoader) {
|
||||||
|
|||||||
@ -641,7 +641,9 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S
|
|||||||
AttachmentTimeline *timeline = new(__FILE__, __LINE__) AttachmentTimeline(frameCount);
|
AttachmentTimeline *timeline = new(__FILE__, __LINE__) AttachmentTimeline(frameCount);
|
||||||
timeline->_slotIndex = slotIndex;
|
timeline->_slotIndex = slotIndex;
|
||||||
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
||||||
timeline->setFrame(frameIndex, readFloat(input), String(readString(input), true));
|
float time = readFloat(input);
|
||||||
|
String attachmentName = String(readString(input), true);
|
||||||
|
timeline->setFrame(frameIndex, time, attachmentName);
|
||||||
}
|
}
|
||||||
timelines.add(timeline);
|
timelines.add(timeline);
|
||||||
duration = MathUtil::max(duration, timeline->_frames[frameCount - 1]);
|
duration = MathUtil::max(duration, timeline->_frames[frameCount - 1]);
|
||||||
@ -710,7 +712,9 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S
|
|||||||
RotateTimeline *timeline = new(__FILE__, __LINE__) RotateTimeline(frameCount);
|
RotateTimeline *timeline = new(__FILE__, __LINE__) 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));
|
float time = readFloat(input);
|
||||||
|
float degrees = readFloat(input);
|
||||||
|
timeline->setFrame(frameIndex, time, degrees);
|
||||||
if (frameIndex < frameCount - 1) {
|
if (frameIndex < frameCount - 1) {
|
||||||
readCurve(input, frameIndex, timeline);
|
readCurve(input, frameIndex, timeline);
|
||||||
}
|
}
|
||||||
@ -734,8 +738,10 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S
|
|||||||
}
|
}
|
||||||
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) * timelineScale,
|
float time = readFloat(input);
|
||||||
readFloat(input) * timelineScale);
|
float x = readFloat(input) * timelineScale;
|
||||||
|
float y = readFloat(input) * timelineScale;
|
||||||
|
timeline->setFrame(frameIndex, time, x, y);
|
||||||
if (frameIndex < frameCount - 1) {
|
if (frameIndex < frameCount - 1) {
|
||||||
readCurve(input, frameIndex, timeline);
|
readCurve(input, frameIndex, timeline);
|
||||||
}
|
}
|
||||||
@ -761,7 +767,10 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S
|
|||||||
IkConstraintTimeline *timeline = new(__FILE__, __LINE__) IkConstraintTimeline(frameCount);
|
IkConstraintTimeline *timeline = new(__FILE__, __LINE__) 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));
|
float time = readFloat(input);
|
||||||
|
float mix = readFloat(input);
|
||||||
|
signed char bendDirection = readSByte(input);
|
||||||
|
timeline->setFrame(frameIndex, time, mix, bendDirection);
|
||||||
if (frameIndex < frameCount - 1) {
|
if (frameIndex < frameCount - 1) {
|
||||||
readCurve(input, frameIndex, timeline);
|
readCurve(input, frameIndex, timeline);
|
||||||
}
|
}
|
||||||
@ -777,8 +786,12 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S
|
|||||||
TransformConstraintTimeline *timeline = new(__FILE__, __LINE__) TransformConstraintTimeline(frameCount);
|
TransformConstraintTimeline *timeline = new(__FILE__, __LINE__) 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),
|
float time = readFloat(input);
|
||||||
readFloat(input));
|
float rotateMix = readFloat(input);
|
||||||
|
float translateMix = readFloat(input);
|
||||||
|
float scaleMix = readFloat(input);
|
||||||
|
float shearMix = readFloat(input);
|
||||||
|
timeline->setFrame(frameIndex, time, rotateMix, translateMix, scaleMix, shearMix);
|
||||||
if (frameIndex < frameCount - 1) {
|
if (frameIndex < frameCount - 1) {
|
||||||
readCurve(input, frameIndex, timeline);
|
readCurve(input, frameIndex, timeline);
|
||||||
}
|
}
|
||||||
@ -814,7 +827,9 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S
|
|||||||
}
|
}
|
||||||
timeline->_pathConstraintIndex = index;
|
timeline->_pathConstraintIndex = index;
|
||||||
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
||||||
timeline->setFrame(frameIndex, readFloat(input), readFloat(input) * timelineScale);
|
float time = readFloat(input);
|
||||||
|
float value = readFloat(input) * timelineScale;
|
||||||
|
timeline->setFrame(frameIndex, time, value);
|
||||||
if (frameIndex < frameCount - 1) {
|
if (frameIndex < frameCount - 1) {
|
||||||
readCurve(input, frameIndex, timeline);
|
readCurve(input, frameIndex, timeline);
|
||||||
}
|
}
|
||||||
@ -829,7 +844,10 @@ Animation *SkeletonBinary::readAnimation(const String &name, DataInput *input, S
|
|||||||
|
|
||||||
timeline->_pathConstraintIndex = index;
|
timeline->_pathConstraintIndex = index;
|
||||||
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
for (int frameIndex = 0; frameIndex < frameCount; ++frameIndex) {
|
||||||
timeline->setFrame(frameIndex, readFloat(input), readFloat(input), readFloat(input));
|
float time = readFloat(input);
|
||||||
|
float rotateMix = readFloat(input);
|
||||||
|
float translateMix = readFloat(input);
|
||||||
|
timeline->setFrame(frameIndex, time, rotateMix, translateMix);
|
||||||
if (frameIndex < frameCount - 1) {
|
if (frameIndex < frameCount - 1) {
|
||||||
readCurve(input, frameIndex, timeline);
|
readCurve(input, frameIndex, timeline);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -147,7 +147,7 @@ void spineboy (SkeletonData* skeletonData, Atlas* atlas) {
|
|||||||
|
|
||||||
SkeletonBounds_update(bounds, skeleton, true);
|
SkeletonBounds_update(bounds, skeleton, true);
|
||||||
sf::Vector2i position = sf::Mouse::getPosition(window);
|
sf::Vector2i position = sf::Mouse::getPosition(window);
|
||||||
if (SkeletonBounds_containsPoint(bounds, position.x, position.y)) {
|
if (SkeletonBounds_containsPoint(bounds, (float)position.x, (float)position.y)) {
|
||||||
headSlot->color.g = 0;
|
headSlot->color.g = 0;
|
||||||
headSlot->color.b = 0;
|
headSlot->color.b = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -230,7 +230,7 @@ void raptor (SkeletonData* skeletonData, Atlas* atlas) {
|
|||||||
deltaClock.restart();
|
deltaClock.restart();
|
||||||
|
|
||||||
swirlTime += delta;
|
swirlTime += delta;
|
||||||
float percent = fmod(swirlTime, 2);
|
float percent = (float)fmod(swirlTime, 2);
|
||||||
if (percent > 1) percent = 1 - (percent - 1);
|
if (percent > 1) percent = 1 - (percent - 1);
|
||||||
effect->angle = _spMath_interpolate(_spMath_pow2_apply, -60, 60, percent);
|
effect->angle = _spMath_interpolate(_spMath_pow2_apply, -60, 60, percent);
|
||||||
|
|
||||||
@ -401,11 +401,11 @@ void owl (SkeletonData* skeletonData, Atlas* atlas) {
|
|||||||
if (event.type == sf::Event::MouseMoved) {
|
if (event.type == sf::Event::MouseMoved) {
|
||||||
float x = event.mouseMove.x / 640.0f;
|
float x = event.mouseMove.x / 640.0f;
|
||||||
left->alpha = (MAX(x, 0.5f) - 0.5f) * 2;
|
left->alpha = (MAX(x, 0.5f) - 0.5f) * 2;
|
||||||
right->alpha = (0.5 - MIN(x, 0.5)) * 2;
|
right->alpha = (0.5f - MIN(x, 0.5f)) * 2;
|
||||||
|
|
||||||
float y = event.mouseMove.y / 640.0f;
|
float y = event.mouseMove.y / 640.0f;
|
||||||
down->alpha = (MAX(y, 0.5f) - 0.5f) * 2;
|
down->alpha = (MAX(y, 0.5f) - 0.5f) * 2;
|
||||||
up->alpha = (0.5 - MIN(y, 0.5)) * 2;
|
up->alpha = (0.5f - MIN(y, 0.5f)) * 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -43,6 +43,15 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
message("MSCV detected")
|
||||||
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
|
||||||
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
|
||||||
|
else()
|
||||||
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic -std=c89")
|
||||||
|
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wnon-virtual-dtor -pedantic -std=c++03 -fno-exceptions -fno-rtti")
|
||||||
|
endif()
|
||||||
|
|
||||||
# Define spine-sfml-cpp library
|
# Define spine-sfml-cpp library
|
||||||
include_directories(src ${SFML_DIR}/include)
|
include_directories(src ${SFML_DIR}/include)
|
||||||
file(GLOB INCLUDES "src/**/*.h")
|
file(GLOB INCLUDES "src/**/*.h")
|
||||||
|
|||||||
@ -145,7 +145,7 @@ void spineboy (SkeletonData* skeletonData, Atlas* atlas) {
|
|||||||
|
|
||||||
bounds.update(*skeleton, true);
|
bounds.update(*skeleton, true);
|
||||||
sf::Vector2i position = sf::Mouse::getPosition(window);
|
sf::Vector2i position = sf::Mouse::getPosition(window);
|
||||||
if (bounds.containsPoint(position.x, position.y)) {
|
if (bounds.containsPoint((float)position.x, (float)position.y)) {
|
||||||
headSlot->getColor().g = 0;
|
headSlot->getColor().g = 0;
|
||||||
headSlot->getColor().b = 0;
|
headSlot->getColor().b = 0;
|
||||||
} else {
|
} else {
|
||||||
@ -408,11 +408,11 @@ void owl (SkeletonData* skeletonData, Atlas* atlas) {
|
|||||||
if (event.type == sf::Event::MouseMoved) {
|
if (event.type == sf::Event::MouseMoved) {
|
||||||
float x = event.mouseMove.x / 640.0f;
|
float x = event.mouseMove.x / 640.0f;
|
||||||
left->setAlpha((MathUtil::max(x, 0.5f) - 0.5f) * 2);
|
left->setAlpha((MathUtil::max(x, 0.5f) - 0.5f) * 2);
|
||||||
right->setAlpha((0.5 - MathUtil::min(x, 0.5f)) * 2);
|
right->setAlpha((0.5f - MathUtil::min(x, 0.5f)) * 2);
|
||||||
|
|
||||||
float y = event.mouseMove.y / 640.0f;
|
float y = event.mouseMove.y / 640.0f;
|
||||||
down->setAlpha((MathUtil::max(y, 0.5f) - 0.5f) * 2);
|
down->setAlpha((MathUtil::max(y, 0.5f) - 0.5f) * 2);
|
||||||
up->setAlpha((0.5 - MathUtil::min(y, 0.5f)) * 2);
|
up->setAlpha((0.5f - MathUtil::min(y, 0.5f)) * 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -453,10 +453,10 @@ void test (SkeletonData* skeletonData, Atlas* atlas) {
|
|||||||
|
|
||||||
int main () {
|
int main () {
|
||||||
DebugExtension dbgExtension;
|
DebugExtension dbgExtension;
|
||||||
SpineExtension::setInstance(&dbgExtension);
|
// SpineExtension::setInstance(&dbgExtension);
|
||||||
|
|
||||||
testcase(raptor, "data/raptor-pro.json", "data/raptor-pro.skel", "data/raptor.atlas", 0.5f);
|
// testcase(raptor, "data/raptor-pro.json", "data/raptor-pro.skel", "data/raptor.atlas", 0.5f);
|
||||||
testcase(test, "data/tank-pro.json", "data/tank-pro.skel", "data/tank.atlas", 1.0f);
|
// testcase(test, "data/tank-pro.json", "data/tank-pro.skel", "data/tank.atlas", 1.0f);
|
||||||
testcase(spineboy, "data/spineboy-ess.json", "data/spineboy-ess.skel", "data/spineboy.atlas", 0.6f);
|
testcase(spineboy, "data/spineboy-ess.json", "data/spineboy-ess.skel", "data/spineboy.atlas", 0.6f);
|
||||||
testcase(owl, "data/owl-pro.json", "data/owl-pro.skel", "data/owl.atlas", 0.5f);
|
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(coin, "data/coin-pro.json", "data/coin-pro.skel", "data/coin.atlas", 0.5f);
|
||||||
@ -465,6 +465,6 @@ int main () {
|
|||||||
testcase(raptor, "data/raptor-pro.json", "data/raptor-pro.skel", "data/raptor.atlas", 0.5f);
|
testcase(raptor, "data/raptor-pro.json", "data/raptor-pro.skel", "data/raptor.atlas", 0.5f);
|
||||||
testcase(goblins, "data/goblins-pro.json", "data/goblins-pro.skel", "data/goblins.atlas", 1.4f);
|
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);
|
testcase(stretchyman, "data/stretchyman-pro.json", "data/stretchyman-pro.skel", "data/stretchyman.atlas", 0.6f);
|
||||||
dbgExtension.reportLeaks();
|
// dbgExtension.reportLeaks();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,7 +95,7 @@ void SkeletonDrawable::draw(RenderTarget &target, RenderStates states) const {
|
|||||||
|
|
||||||
sf::Vertex vertex;
|
sf::Vertex vertex;
|
||||||
Texture *texture = NULL;
|
Texture *texture = NULL;
|
||||||
for (int i = 0; i < skeleton->getSlots().size(); ++i) {
|
for (unsigned i = 0; i < skeleton->getSlots().size(); ++i) {
|
||||||
Slot &slot = *skeleton->getDrawOrder()[i];
|
Slot &slot = *skeleton->getDrawOrder()[i];
|
||||||
Attachment *attachment = slot.getAttachment();
|
Attachment *attachment = slot.getAttachment();
|
||||||
if (!attachment) continue;
|
if (!attachment) continue;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user