[sfml] Added cpp backend, refactored build.

This commit is contained in:
badlogic 2018-02-05 13:52:37 +01:00
parent 7180f17af2
commit 2137dddf3b
76 changed files with 29573 additions and 0 deletions

View File

@ -0,0 +1,88 @@
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/")
message(${DEPS_DIR})
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)

27
spine-sfml/c/LICENSE Normal file
View File

@ -0,0 +1,27 @@
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.

68
spine-sfml/c/README.md Normal file
View File

@ -0,0 +1,68 @@
# 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.

View File

@ -0,0 +1,178 @@
{
"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 ]
}
]
}
}
}
}
}
}

Binary file not shown.

View File

@ -0,0 +1,27 @@
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

BIN
spine-sfml/c/data/coin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -0,0 +1,293 @@
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

195
spine-sfml/c/data/owl.atlas Normal file
View File

@ -0,0 +1,195 @@
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

BIN
spine-sfml/c/data/owl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,300 @@
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -0,0 +1,307 @@
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,41 @@
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -0,0 +1,174 @@
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

BIN
spine-sfml/c/data/tank.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,13 @@
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

BIN
spine-sfml/c/data/vine.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

View File

@ -0,0 +1,461 @@
/******************************************************************************
* 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;
}

View File

@ -0,0 +1,285 @@
/******************************************************************************
* 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 = &regionAttachment->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 */

View File

@ -0,0 +1,73 @@
/******************************************************************************
* 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.
*****************************************************************************/
#ifndef SPINE_SFML_H_
#define SPINE_SFML_H_
#include <spine/spine.h>
#include <spine/extension.h>
#include <SFML/Graphics/Vertex.hpp>
#include <SFML/Graphics/VertexArray.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <SFML/Graphics/RenderTarget.hpp>
#include <SFML/Graphics/RenderStates.hpp>
_SP_ARRAY_DECLARE_TYPE(spColorArray, spColor)
namespace spine {
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_ */

View File

@ -0,0 +1,87 @@
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-cpp library
include_directories(src ${SFML_DIR}/include)
file(GLOB INCLUDES "src/**/*.h")
file(GLOB SOURCES "src/**/*.cpp")
add_library(spine-sfml-cpp STATIC ${SOURCES} ${INCLUDES})
target_link_libraries(spine-sfml-cpp LINK_PUBLIC spine-cpp)
install(TARGETS spine-sfml-cpp DESTINATION dist/lib)
install(FILES ${INCLUDES} DESTINATION dist/include)
# Define spine-sfml example executable
add_executable(spine-sfml-cpp-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-cpp-example ${SFML} ${SFML_SYSTEM} ${SFML_WINDOW} ${SFML_GRAPHICS})
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries(spine-sfml-cpp-example sfml-graphics sfml-window sfml-system)
else()
set(SFML_LIBS ${SFML_DIR}/lib)
target_link_libraries(spine-sfml-cpp-example ${SFML_LIBS}/sfml-main-d.lib)
target_link_libraries(spine-sfml-cpp-example ${SFML_LIBS}/sfml-graphics-s-d.lib)
target_link_libraries(spine-sfml-cpp-example ${SFML_LIBS}/sfml-window-s-d.lib)
target_link_libraries(spine-sfml-cpp-example ${SFML_LIBS}/sfml-system-s-d.lib)
target_link_libraries(spine-sfml-cpp-example ${SFML_LIBS}/freetype.lib)
target_link_libraries(spine-sfml-cpp-example ${SFML_LIBS}/jpeg.lib)
target_link_libraries(spine-sfml-cpp-example opengl32)
target_link_libraries(spine-sfml-cpp-example gdi32)
target_link_libraries(spine-sfml-cpp-example winmm)
add_definitions(-DSFML_STATIC)
endif()
# copy data to build directory
add_custom_command(TARGET spine-sfml-cpp-example PRE_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_LIST_DIR}/data $<TARGET_FILE_DIR:spine-sfml-cpp-example>/data)
target_link_libraries(spine-sfml-cpp-example spine-cpp)
target_link_libraries(spine-sfml-cpp-example spine-sfml-cpp)

27
spine-sfml/cpp/LICENSE Normal file
View File

@ -0,0 +1,27 @@
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.

68
spine-sfml/cpp/README.md Normal file
View File

@ -0,0 +1,68 @@
# 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.

View File

@ -0,0 +1,178 @@
{
"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 ]
}
]
}
}
}
}
}
}

Binary file not shown.

View File

@ -0,0 +1,27 @@
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -0,0 +1,293 @@
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,195 @@
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

BIN
spine-sfml/cpp/data/owl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,300 @@
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -0,0 +1,307 @@
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,41 @@
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -0,0 +1,174 @@
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,13 @@
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

View File

@ -0,0 +1,461 @@
/******************************************************************************
* 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;
}

View File

@ -0,0 +1,285 @@
/******************************************************************************
* 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 = &regionAttachment->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 */

View File

@ -0,0 +1,73 @@
/******************************************************************************
* 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.
*****************************************************************************/
#ifndef SPINE_SFML_H_
#define SPINE_SFML_H_
#include <spine/spine.h>
#include <spine/extension.h>
#include <SFML/Graphics/Vertex.hpp>
#include <SFML/Graphics/VertexArray.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <SFML/Graphics/RenderTarget.hpp>
#include <SFML/Graphics/RenderStates.hpp>
_SP_ARRAY_DECLARE_TYPE(spColorArray, spColor)
namespace spine {
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_ */