mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-10 00:58:43 +08:00
[c] Removed old spine-c, removed spine-cpp-lite, replaced with new spine-c
This commit is contained in:
parent
a5029e13e0
commit
c651e74924
1
.gitignore
vendored
1
.gitignore
vendored
@ -243,3 +243,4 @@ spine-c-new/codegen/dist
|
||||
spine-c-new/codegen/all-spine-types.json
|
||||
spine-c-new/codegen/spine-cpp-types.json
|
||||
docs/spine-runtimes-types.md
|
||||
spine-c/codegen/dist
|
||||
|
||||
@ -1,46 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(spine-c-new C CXX)
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
# Include the common flags (including -fno-rtti)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../flags.cmake)
|
||||
|
||||
# Include spine-cpp
|
||||
add_subdirectory(../spine-cpp ${CMAKE_CURRENT_BINARY_DIR}/spine-cpp)
|
||||
|
||||
# Collect all source files
|
||||
file(GLOB SOURCES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.c"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp"
|
||||
)
|
||||
file(GLOB GENERATED_SOURCES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/generated/*.cpp"
|
||||
)
|
||||
list(APPEND SOURCES ${GENERATED_SOURCES})
|
||||
|
||||
# Create the library
|
||||
add_library(spine-c-new STATIC ${SOURCES})
|
||||
|
||||
# Include directories
|
||||
target_include_directories(spine-c-new PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Link with spine-cpp
|
||||
target_link_libraries(spine-c-new PRIVATE spine-cpp)
|
||||
|
||||
# Add spine-cpp include directories
|
||||
target_include_directories(spine-c-new PRIVATE
|
||||
../spine-cpp/spine-cpp/include
|
||||
)
|
||||
|
||||
# Export compile commands for better IDE support
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Create test executable
|
||||
add_executable(spine-c-test test/test.c)
|
||||
target_link_libraries(spine-c-test spine-c-new)
|
||||
target_include_directories(spine-c-test PRIVATE include)
|
||||
@ -1,150 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
|
||||
<storageModule moduleId="org.eclipse.cdt.core.settings">
|
||||
<cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.debug.784427509">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.debug.784427509" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactExtension="a" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.exe.debug.784427509" name="Debug" parent="cdt.managedbuild.config.gnu.mingw.exe.debug">
|
||||
<folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.debug.784427509." name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.exe.debug.1244859277" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.exe.debug">
|
||||
<targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.exe.debug.2141344127" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.exe.debug"/>
|
||||
<builder buildPath="${workspace_loc:/spine-ctest/Debug}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.2012621380" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base">
|
||||
<outputEntries>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name="Debug"/>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="outputPath" name="Release"/>
|
||||
</outputEntries>
|
||||
</builder>
|
||||
<tool command="as" id="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug.1379375071" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug">
|
||||
<option id="gnu.both.asm.option.include.paths.1680140054" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/spine-c/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/spine-c/include}""/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1840963518" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.1581759609" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.1773467815" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug">
|
||||
<option id="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level.541156248" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level.393447411" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.option.include.paths.1471448443" name="Include paths (-I)" superClass="gnu.cpp.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/spine-c/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/spine-c/include}""/>
|
||||
</option>
|
||||
<option id="gnu.cpp.compiler.option.other.other.1185307642" name="Other flags" superClass="gnu.cpp.compiler.option.other.other" value="-c -fmessage-length=0" valueType="string"/>
|
||||
<option id="gnu.cpp.compiler.option.dialect.std.341459864" name="Language standard" superClass="gnu.cpp.compiler.option.dialect.std" value="gnu.cpp.compiler.dialect.default" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.option.warnings.extrawarn.764877222" name="Extra warnings (-Wextra)" superClass="gnu.cpp.compiler.option.warnings.extrawarn" value="false" valueType="boolean"/>
|
||||
<option id="gnu.cpp.compiler.option.warnings.pedantic.1836643567" name="Pedantic (-pedantic)" superClass="gnu.cpp.compiler.option.warnings.pedantic" value="false" valueType="boolean"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.564303729" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.613741168" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug">
|
||||
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.exe.debug.option.optimization.level.71579608" name="Optimization Level" superClass="gnu.c.compiler.mingw.exe.debug.option.optimization.level" value="gnu.c.optimization.level.none" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.mingw.exe.debug.option.debugging.level.2068803714" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.include.paths.2051361089" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/spine-c/src}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/spine-c/include}""/>
|
||||
</option>
|
||||
<option id="gnu.c.compiler.option.misc.other.1829716988" name="Other flags" superClass="gnu.c.compiler.option.misc.other" value="-c -fmessage-length=0 -std=c89" valueType="string"/>
|
||||
<option id="gnu.c.compiler.option.dialect.std.849400720" name="Language standard" superClass="gnu.c.compiler.option.dialect.std" value="gnu.c.compiler.dialect.default" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.option.warnings.extrawarn.343205818" name="Extra warnings (-Wextra)" superClass="gnu.c.compiler.option.warnings.extrawarn" value="true" valueType="boolean"/>
|
||||
<option id="gnu.c.compiler.option.warnings.pedantic.2135414314" name="Pedantic (-pedantic)" superClass="gnu.c.compiler.option.warnings.pedantic" value="true" valueType="boolean"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.603555848" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug.1030541714" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug.1176451976" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug">
|
||||
<option id="gnu.cpp.link.option.libs.1686926703" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.365190259" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="cdt.managedbuild.config.gnu.mingw.exe.release.486571591">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.release.486571591" moduleId="org.eclipse.cdt.core.settings" name="Release">
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.release" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.exe.release.486571591" name="Release" parent="cdt.managedbuild.config.gnu.mingw.exe.release">
|
||||
<folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.release.486571591." name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.mingw.exe.release.547801112" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.exe.release">
|
||||
<targetPlatform id="cdt.managedbuild.target.gnu.platform.mingw.exe.release.1049429369" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.exe.release"/>
|
||||
<builder buildPath="${workspace_loc:/spine-ctest/Release}" id="cdt.managedbuild.tool.gnu.builder.mingw.base.1315046895" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.assembler.mingw.exe.release.1856824863" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.exe.release">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.708953425" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.178989121" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.release.1784931142" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.release">
|
||||
<option id="gnu.cpp.compiler.mingw.exe.release.option.optimization.level.206313849" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.exe.release.option.optimization.level" value="gnu.cpp.compiler.optimization.level.most" valueType="enumerated"/>
|
||||
<option id="gnu.cpp.compiler.mingw.exe.release.option.debugging.level.1678928207" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.release.option.debugging.level" value="gnu.cpp.compiler.debugging.level.none" valueType="enumerated"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1028062039" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release.582721725" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release">
|
||||
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.mingw.exe.release.option.optimization.level.286982170" name="Optimization Level" superClass="gnu.c.compiler.mingw.exe.release.option.optimization.level" valueType="enumerated"/>
|
||||
<option id="gnu.c.compiler.mingw.exe.release.option.debugging.level.1168053493" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.575877567" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.release.1145816016" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.release"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.release.372884406" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.release">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.17549823" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
<sourceEntries>
|
||||
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/>
|
||||
</sourceEntries>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<project id="spine-ctest.cdt.managedbuild.target.gnu.mingw.exe.1872348731" name="Executable" projectType="cdt.managedbuild.target.gnu.mingw.exe"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||
<configuration configurationName="Debug">
|
||||
<resource resourceType="PROJECT" workspacePath="/spine-ctest"/>
|
||||
</configuration>
|
||||
<configuration configurationName="Release">
|
||||
<resource resourceType="PROJECT" workspacePath="/spine-ctest"/>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.486571591;cdt.managedbuild.config.gnu.mingw.exe.release.486571591.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.release.1784931142;cdt.managedbuild.tool.gnu.cpp.compiler.input.1028062039">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.784427509;cdt.managedbuild.config.gnu.mingw.exe.debug.784427509.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.613741168;cdt.managedbuild.tool.gnu.c.compiler.input.603555848">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.784427509;cdt.managedbuild.config.gnu.mingw.exe.debug.784427509.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.1773467815;cdt.managedbuild.tool.gnu.cpp.compiler.input.564303729">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP"/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.486571591;cdt.managedbuild.config.gnu.mingw.exe.release.486571591.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release.582721725;cdt.managedbuild.tool.gnu.c.compiler.input.575877567">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId="org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC"/>
|
||||
</scannerConfigBuildInfo>
|
||||
</storageModule>
|
||||
</cproject>
|
||||
@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>spine-c</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@ -1,68 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.cdt.codan.checkers.errnoreturn=Warning
|
||||
org.eclipse.cdt.codan.checkers.errnoreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false}
|
||||
org.eclipse.cdt.codan.checkers.errreturnvalue=Error
|
||||
org.eclipse.cdt.codan.checkers.errreturnvalue.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.checkers.noreturn=Error
|
||||
org.eclipse.cdt.codan.checkers.noreturn.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},implicit\=>false}
|
||||
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.AbstractClassCreation.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.AmbiguousProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.AssignmentInConditionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.AssignmentToItselfProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem=-Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.CaseBreakProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},no_break_comment\=>"no break",last_case_param\=>true,empty_case_param\=>false}
|
||||
org.eclipse.cdt.codan.internal.checkers.CatchByReference=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.CatchByReference.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},unknown\=>false,exceptions\=>()}
|
||||
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.CircularReferenceProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.ClassMembersInitialization.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},skip\=>true}
|
||||
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.FieldResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.FunctionResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.InvalidArguments=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.InvalidArguments.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.InvalidTemplateArgumentsProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.LabelStatementNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.MemberDeclarationNotFoundProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.MethodResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker=-Info
|
||||
org.eclipse.cdt.codan.internal.checkers.NamingConventionFunctionChecker.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},pattern\=>"^[a-z]",macro\=>true,exceptions\=>()}
|
||||
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.NonVirtualDestructorProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.OverloadProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.OverloadProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.RedeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.RedefinitionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem=-Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.ReturnStyleProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem=-Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.ScanfFormatStringSecurityProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.StatementHasNoEffectProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>()}
|
||||
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.SuggestedParenthesisProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},paramNot\=>false}
|
||||
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.SuspiciousSemicolonProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},else\=>false,afterelse\=>false}
|
||||
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.TypeResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.UnusedFunctionDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true}
|
||||
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.UnusedStaticFunctionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true}
|
||||
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem=Warning
|
||||
org.eclipse.cdt.codan.internal.checkers.UnusedVariableDeclarationProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true},macro\=>true,exceptions\=>("@(\#)","$Id")}
|
||||
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem=Error
|
||||
org.eclipse.cdt.codan.internal.checkers.VariableResolutionProblem.params={launchModes\=>{RUN_ON_FULL_BUILD\=>true,RUN_ON_INC_BUILD\=>true,RUN_ON_FILE_OPEN\=>false,RUN_ON_FILE_SAVE\=>false,RUN_AS_YOU_TYPE\=>true,RUN_ON_DEMAND\=>true}}
|
||||
useParentScope=false
|
||||
@ -1,11 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.784427509/CPATH/delimiter=;
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.784427509/CPATH/operation=remove
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.784427509/CPLUS_INCLUDE_PATH/delimiter=;
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.784427509/CPLUS_INCLUDE_PATH/operation=remove
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.784427509/C_INCLUDE_PATH/delimiter=;
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.784427509/C_INCLUDE_PATH/operation=remove
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.784427509/append=true
|
||||
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.debug.784427509/appendContributed=true
|
||||
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.784427509/append=true
|
||||
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.debug.784427509/appendContributed=true
|
||||
@ -1,14 +1,46 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(spine-c)
|
||||
project(spine-c-new C CXX)
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
# Include the common flags (including -fno-rtti)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../flags.cmake)
|
||||
|
||||
include_directories(include)
|
||||
file(GLOB INCLUDES "spine-c/include/**/*.h")
|
||||
file(GLOB SOURCES "spine-c/src/**/*.c")
|
||||
# Include spine-cpp
|
||||
add_subdirectory(../spine-cpp ${CMAKE_CURRENT_BINARY_DIR}/spine-cpp)
|
||||
|
||||
add_library(spine-c STATIC ${SOURCES} ${INCLUDES})
|
||||
target_include_directories(spine-c PUBLIC spine-c/include)
|
||||
# Collect all source files
|
||||
file(GLOB SOURCES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.c"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp"
|
||||
)
|
||||
file(GLOB GENERATED_SOURCES
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/generated/*.cpp"
|
||||
)
|
||||
list(APPEND SOURCES ${GENERATED_SOURCES})
|
||||
|
||||
install(TARGETS spine-c DESTINATION dist/lib)
|
||||
install(FILES ${INCLUDES} DESTINATION dist/include)
|
||||
# Create the library
|
||||
add_library(spine-c-new STATIC ${SOURCES})
|
||||
|
||||
# Include directories
|
||||
target_include_directories(spine-c-new PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
)
|
||||
|
||||
# Link with spine-cpp
|
||||
target_link_libraries(spine-c-new PRIVATE spine-cpp)
|
||||
|
||||
# Add spine-cpp include directories
|
||||
target_include_directories(spine-c-new PRIVATE
|
||||
../spine-cpp/spine-cpp/include
|
||||
)
|
||||
|
||||
# Export compile commands for better IDE support
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Create test executable
|
||||
add_executable(spine-c-test test/test.c)
|
||||
target_link_libraries(spine-c-test spine-c-new)
|
||||
target_include_directories(spine-c-test PRIVATE include)
|
||||
@ -1,26 +0,0 @@
|
||||
Spine Runtimes License Agreement
|
||||
Last updated April 5, 2025. Replaces all prior versions.
|
||||
|
||||
Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
|
||||
Integration of the Spine Runtimes into software or otherwise creating
|
||||
derivative works of the Spine Runtimes is permitted under the terms and
|
||||
conditions of Section 2 of the Spine Editor License Agreement:
|
||||
http://esotericsoftware.com/spine-editor-license
|
||||
|
||||
Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
"Products"), provided that each user of the Products must obtain their own
|
||||
Spine Editor license and redistribution of the Products in any form must
|
||||
include this license and copyright notice.
|
||||
|
||||
THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@ -1,51 +0,0 @@
|
||||
# spine-c
|
||||
|
||||
The spine-c runtime provides basic functionality to load and manipulate [Spine](http://esotericsoftware.com) skeletal animation data using ANSI C89. It does not perform rendering but can be extended to enable Spine animations for other C-based projects, including C++ or Objective-C projects.
|
||||
|
||||
## Licensing
|
||||
|
||||
You are welcome to evaluate the Spine Runtimes and the examples we provide in this repository free of charge.
|
||||
|
||||
You can integrate the Spine Runtimes into your software free of charge, but users of your software must have their own [Spine license](https://esotericsoftware.com/spine-purchase). Please make your users aware of this requirement! This option is often chosen by those making development tools, such as an SDK, game toolkit, or software library.
|
||||
|
||||
In order to distribute your software containing the Spine Runtimes to others that don't have a Spine license, you need a [Spine license](https://esotericsoftware.com/spine-purchase) at the time of integration. Then you can distribute your software containing the Spine Runtimes however you like, provided others don't modify it or use it to create new software. If others want to do that, they'll need their own Spine license.
|
||||
|
||||
For the official legal terms governing the Spine Runtimes, please read the [Spine Runtimes License Agreement](http://esotericsoftware.com/spine-runtimes-license) and Section 2 of the [Spine Editor License Agreement](http://esotericsoftware.com/spine-editor-license#s2).
|
||||
|
||||
## Spine version
|
||||
|
||||
spine-c works with data exported from Spine 4.2.xx.
|
||||
|
||||
spine-c supports all Spine features.
|
||||
|
||||
## Setup
|
||||
|
||||
1. Download the Spine Runtimes source using [git](https://help.github.com/articles/set-up-git) or by downloading it as a zip via the download button above.
|
||||
1. Copy the contents of the `spine-c/spine-c/src` and `spine-c/spine-c/include` directories into your project. Be sure your header search is configured to find the contents of the `spine-c/spine-c/include` directory. Note that the includes use `spine/Xxx.h`, so the `spine` directory cannot be omitted when copying the files.
|
||||
|
||||
If `SPINE_SHORT_NAMES` is defined, the `sp` prefix for all structs and functions is optional. Only use this if the spine-c names won't cause a conflict.
|
||||
|
||||
## Usage
|
||||
|
||||
### [Please see the spine-c guide for full documentation](http://esotericsoftware.com/spine-c)
|
||||
|
||||
## Extension
|
||||
|
||||
Extending spine-c requires implementing three methods:
|
||||
|
||||
- `_spAtlasPage_createTexture` Loads a texture and stores it and its size in the `void* rendererObject`, `width` and `height` fields of an `spAtlasPage` struct.
|
||||
- `_spAtlasPage_disposeTexture` Disposes of a texture loaded with `_spAtlasPage_createTexture`.
|
||||
- `_spUtil_readFile` Reads a file. If this doesn't need to be customized, `_readFile` is provided which reads a file using `fopen`.
|
||||
|
||||
With these implemented, the spine-c API can then be used to load Spine animation data. Rendering is done by enumerating the slots for a skeleton and rendering the attachment for each slot. Each attachment has a `rendererObject` field that is set when the attachment is loaded.
|
||||
|
||||
For example, `AtlasAttachmentLoader` is typically used to load attachments when using a Spine texture atlas. When `AtlasAttachmentLoader` loads a `RegionAttachment`, the attachment's `void* rendererObject` is set to an `AtlasRegion`. Rendering code can then obtain the `AtlasRegion` from the attachment, get the `AtlasPage` it belongs to, and get the page's `void* rendererObject`. This is the renderer specific texture object set by `_spAtlasPage_createTexture`. Attachment loading can be [customized](http://esotericsoftware.com/spine-using-runtimes/#attachmentloader) if not using `AtlasAttachmentLoader` or to provider different renderer specific data.
|
||||
|
||||
[spine-sfml](../spine-sfml/src/c/spine/spine-sfml.cpp#L39) serves as a simple example of extending spine-c.
|
||||
|
||||
spine-c uses an OOP style of programming where each "class" is made up of a struct and a number of functions prefixed with the struct name. More detals about how this works are available in [extension.h](spine-c/include/spine/extension.h#L2). This mechanism allows you to provide your own implementations for `spAttachmentLoader`, `spAttachment` and `spTimeline`, if necessary.
|
||||
|
||||
## Runtimes extending spine-c
|
||||
|
||||
- [spine-sdl](../spine-sdl)
|
||||
- [spine-sfml](../spine-sfml)
|
||||
36067
spine-c/codegen/spine-cpp-types.json
Normal file
36067
spine-c/codegen/spine-cpp-types.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,61 +0,0 @@
|
||||
cmake_minimum_required(VERSION 2.8.9)
|
||||
project(spine_unit_test)
|
||||
|
||||
set(CMAKE_INSTALL_PREFIX "./")
|
||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
if(MSVC)
|
||||
set (CMAKE_CXX_FLAGS "-Wall -Wextra -Wnon-virtual-dtor -pedantic -std=c++11 -fno-rtti -DKANJI_MEMTRACE -DUSE_CPP11_MUTEX")
|
||||
endif()
|
||||
|
||||
|
||||
#########################################################
|
||||
# set includes
|
||||
#########################################################
|
||||
include_directories(teamcity minicppunit tests memory)
|
||||
|
||||
#########################################################
|
||||
# Add Sources
|
||||
#########################################################
|
||||
set(MINICPP_SRC
|
||||
minicppunit/MiniCppUnit.cxx
|
||||
)
|
||||
|
||||
set(TEAMCITY_SRC
|
||||
teamcity/teamcity_cppunit.cpp
|
||||
teamcity/teamcity_messages.cpp
|
||||
)
|
||||
|
||||
set(TEST_SRC
|
||||
tests/SpineEventMonitor.cpp
|
||||
tests/EmptyTestFixture.cpp
|
||||
tests/C_InterfaceTestFixture.cpp
|
||||
tests/CPP_InterfaceTestFixture.cpp
|
||||
tests/MemoryTestFixture.cpp
|
||||
)
|
||||
|
||||
set(MEMLEAK_SRC
|
||||
memory/KMemory.cpp
|
||||
memory/KString.cpp
|
||||
)
|
||||
|
||||
#########################################################
|
||||
# setup main project
|
||||
#########################################################
|
||||
add_executable(spine_unit_test main.cpp ${MINICPP_SRC} ${TEAMCITY_SRC} ${TEST_SRC} ${MEMLEAK_SRC})
|
||||
target_link_libraries(spine_unit_test spine-c)
|
||||
|
||||
|
||||
#########################################################
|
||||
# copy resources to build output directory
|
||||
#########################################################
|
||||
add_custom_command(TARGET spine_unit_test PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${CMAKE_CURRENT_LIST_DIR}/../../examples/spineboy/export $<TARGET_FILE_DIR:spine_unit_test>/testdata/spineboy)
|
||||
|
||||
add_custom_command(TARGET spine_unit_test PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${CMAKE_CURRENT_LIST_DIR}/../../examples/raptor/export $<TARGET_FILE_DIR:spine_unit_test>/testdata/raptor)
|
||||
|
||||
add_custom_command(TARGET spine_unit_test PRE_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
${CMAKE_CURRENT_LIST_DIR}/../../examples/goblins/export $<TARGET_FILE_DIR:spine_unit_test>/testdata/goblins)
|
||||
@ -1,65 +0,0 @@
|
||||
# spine-c-unit-tests
|
||||
|
||||
The spine-c-unit-tests project is to test the [Spine](http://esotericsoftware.com) skeletal animation system. It does not perform rendering. It is primarily used for regression testing and leak detection. It is designed to be run from a Continuous Integration server and to passively verify changes automatically on check-in.
|
||||
|
||||
## Mini CPP Unit Testing
|
||||
[MiniCppUnit](https://sourceforge.net/p/minicppunit/wiki/Home/) is a minimal unit testing framework similar to JUnit. It is used here to avoid large dependancies.
|
||||
|
||||
Tests are sorted into Suites, Fixtures and Cases. There is one suite, it contains many fixtures and each fixture contains test cases. To turn off a fixture, edit "TestOptions.h". To turn off specific test cases, comment out the TEST_CASE() line in the fixture's header.
|
||||
|
||||
## Memory Leak Detection
|
||||
This project includes a very minimal memory leak detector. It is based roughly on the leak detector in the [Popcap Framework](https://sourceforge.net/projects/popcapframework/?source=directory), but has been modified over the years.
|
||||
|
||||
## Continuous Integration
|
||||
The test runner includes the ability to format output messages to signal a CI server. An example interface for [Teamcity](https://www.jetbrains.com/teamcity/) is included. To implement for another server, determine the wireformat for the messages and duplicate/edit the teamcity_messages class. [Teamcity Wire Format](https://confluence.jetbrains.com/display/TCD10/Build+Script+Interaction+with+TeamCity)
|
||||
|
||||
### Trigger
|
||||
Your CI server should trigger on VCS check-in.
|
||||
|
||||
### CMake Build Step
|
||||
The first build step for the CI server should be to run CMake on the 'spine-c-unit-tests' folder. Follow the usage directions below.
|
||||
|
||||
### Compile Build Step
|
||||
This build step should not execute if the previous step did not successfully complete.
|
||||
Depending on the test agent build environment, you should build the output solution or project from the cmake step. Debug is fine.
|
||||
|
||||
### Test Runner Build Step
|
||||
This build step should not execute if the previous step did not successfully complete.
|
||||
Again, depending on the test agent build environment, you should have produced an executable. Run this executable.
|
||||
|
||||
## Usage
|
||||
Make sure [CMake](https://cmake.org/download/) is installed.
|
||||
|
||||
Create a 'build' directory in the 'spine-c-unit-tests' folder. Then switch to that folder and execute cmake:
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
|
||||
### Win32 build
|
||||
msbuild spine_unit_test.sln /t:spine_unit_test /p:Configuration="Debug" /p:Platform="Win32"
|
||||
|
||||
## 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](https://github.com/EsotericSoftware/spine-runtimes/blob/master/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.
|
||||
|
||||
original "walk"": 330
|
||||
second "walk": 0d0
|
||||
|
||||
queue interrupt for original walk
|
||||
queue start for second walk
|
||||
drain interrupt and start
|
||||
|
||||
0d0 is interrupted
|
||||
0d0 is ended
|
||||
|
||||
"run": 0c0
|
||||
0d0 is interrupted
|
||||
second walk becomes mixingFrom of run
|
||||
0c0 is started
|
||||
|
||||
queue is drained
|
||||
|
||||
first walk: 6f0
|
||||
second walk: 9c0
|
||||
@ -1,79 +0,0 @@
|
||||
// SexyKanjiTestSuite.cpp : Defines the entry point for the console application.
|
||||
//
|
||||
|
||||
#include "MiniCppUnit.hxx"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <direct.h>
|
||||
#else
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#endif // WIN32
|
||||
|
||||
#include <ctime>
|
||||
#include "KString.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "spine/extension.h"
|
||||
#include "spine/spine.h"
|
||||
|
||||
#include "KMemory.h" // last include
|
||||
|
||||
void RegisterMemoryLeakDetector() {
|
||||
// Register our malloc and free functions to track memory leaks
|
||||
#ifdef KANJI_MEMTRACE
|
||||
_spSetDebugMalloc(_kanjimalloc);
|
||||
#endif
|
||||
_spSetMalloc(_kanjimalloc);
|
||||
_spSetRealloc(_kanjirealloc);
|
||||
_spSetFree(_kanjifree);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
RegisterMemoryLeakDetector();
|
||||
|
||||
// Start Timing
|
||||
time_t start_time, end_time;
|
||||
time(&start_time);
|
||||
|
||||
|
||||
/* Set working directory to current location for opening test data */
|
||||
#ifdef WIN32
|
||||
_chdir( GetFileDir(argv[0], false).c_str() );
|
||||
#else
|
||||
chdir(GetFileDir(argv[0], false).c_str());
|
||||
#endif
|
||||
|
||||
// Run Test Suite
|
||||
if (JetBrains::underTeamcity()) gTeamCityListener.startSuite("Spine-C Test Suite");
|
||||
int ret_val = TestFixtureFactory::theInstance().runTests() ? 0 : -1;
|
||||
if (JetBrains::underTeamcity()) gTeamCityListener.endSuite("Spine-C Test Suite");
|
||||
|
||||
// End Timing
|
||||
time(&end_time);
|
||||
double secs = difftime(end_time, start_time);
|
||||
printf("\n\n%i minutes and %i seconds of your life taken from you by these tests.\n", ((int) secs) / 60,
|
||||
((int) secs) % 60);
|
||||
|
||||
spAnimationState_disposeStatics(); // Fix for #775
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
||||
|
||||
extern "C" { // probably unnecessary
|
||||
|
||||
void _spAtlasPage_createTexture(spAtlasPage *self, const char *path) {
|
||||
self->rendererObject = 0;
|
||||
self->width = 2048;
|
||||
self->height = 2048;
|
||||
}
|
||||
|
||||
void _spAtlasPage_disposeTexture(spAtlasPage *self) {
|
||||
}
|
||||
|
||||
char *_spUtil_readFile(const char *path, int *length) {
|
||||
return _spReadFile(path, length);
|
||||
}
|
||||
}
|
||||
@ -1,300 +0,0 @@
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <stdarg.h>
|
||||
#include <string>
|
||||
#include <time.h>
|
||||
|
||||
#include "KString.h"
|
||||
|
||||
#include "KMemory.h" // last include
|
||||
|
||||
#pragma warning(disable:4996)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// KANJI_DUMP_LEAKED_MEM will print out the memory block that was leaked.
|
||||
// This is helpful when leaked objects have string identifiers.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//#define KANJI_DUMP_LEAKED_MEM
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// KANJI_TRACK_MEM_USAGE will print out all memory allocations.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//#define KANJI_TRACK_MEM_USAGE
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Our memory system is thread-safe, but instead of linking massive libraries,
|
||||
// we attempt to use C++11 std::mutex.
|
||||
#ifdef USE_CPP11_MUTEX_DISABLED
|
||||
#include <mutex>
|
||||
typedef std::recursive_mutex KSysLock; // rentrant
|
||||
struct KAutoLock {
|
||||
KAutoLock(KSysLock& lock) :mLock(lock) { mLock.lock(); } // acquire
|
||||
~KAutoLock() { mLock.unlock(); } // release
|
||||
|
||||
KSysLock& mLock;
|
||||
};
|
||||
#else // Fallback to unsafe. don't spawn threads
|
||||
typedef int KSysLock;
|
||||
|
||||
struct KAutoLock {
|
||||
KAutoLock(KSysLock) {} // acquire
|
||||
~KAutoLock() {} // release
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
struct KANJI_ALLOC_INFO {
|
||||
size_t size;
|
||||
std::string file;
|
||||
int line;
|
||||
};
|
||||
static bool showLeaks = false;
|
||||
|
||||
class KAllocMap : public std::map<void *, KANJI_ALLOC_INFO> {
|
||||
public:
|
||||
KSysLock crit;
|
||||
static bool allocMapValid;
|
||||
|
||||
public:
|
||||
KAllocMap() { allocMapValid = true; }
|
||||
|
||||
~KAllocMap() {
|
||||
if (showLeaks)
|
||||
KMemoryDumpUnfreed();
|
||||
|
||||
allocMapValid = false;
|
||||
}
|
||||
};
|
||||
|
||||
bool KAllocMap::allocMapValid = false;
|
||||
static KAllocMap allocMap; // once this static object destructs, it dumps unfreed memory
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef KANJI_TRACK_MEM_USAGE
|
||||
void KMemoryDumpUsage(); // forward declaration
|
||||
class KAllocStat
|
||||
{
|
||||
public:
|
||||
typedef std::map<int, int> allocCount; // [size] = count
|
||||
typedef std::map<std::pair<std::string, int>, allocCount> allocInfo; // [file, line] = allocCount
|
||||
|
||||
allocInfo memInfo;
|
||||
static bool allocMapValid;
|
||||
|
||||
public:
|
||||
|
||||
KAllocStat()
|
||||
{
|
||||
allocMapValid = true;
|
||||
}
|
||||
~KAllocStat()
|
||||
{
|
||||
if (showLeaks)
|
||||
KMemoryDumpUsage();
|
||||
|
||||
allocMapValid = false;
|
||||
}
|
||||
void addTrack(const char* fname, int lnum, int asize)
|
||||
{
|
||||
allocCount& info = memInfo[std::pair<std::string, int>(fname, lnum)];
|
||||
info[asize]++;
|
||||
}
|
||||
};
|
||||
bool KAllocStat::allocMapValid = false;
|
||||
static KAllocStat allocStat;
|
||||
#endif // KANJI_TRACK_MEM_USAGE
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
extern void KMemoryAddTrack(void *addr, size_t asize, const char *fname, int lnum) {
|
||||
if (!KAllocMap::allocMapValid || asize == 0)
|
||||
return;
|
||||
|
||||
KAutoLock aCrit(allocMap.crit);
|
||||
showLeaks = true;
|
||||
|
||||
KANJI_ALLOC_INFO &info = allocMap[addr];
|
||||
info.file = fname;
|
||||
info.line = lnum;
|
||||
info.size = asize;
|
||||
|
||||
#ifdef KANJI_TRACK_MEM_USAGE
|
||||
if (KAllocStat::allocMapValid)
|
||||
allocStat.addTrack(fname, lnum, asize);
|
||||
#endif
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void KMemoryRemoveTrack(void *addr) {
|
||||
if (!KAllocMap::allocMapValid)
|
||||
return;
|
||||
|
||||
KAutoLock aCrit(allocMap.crit);
|
||||
KAllocMap::iterator anItr = allocMap.find(addr);
|
||||
if (anItr != allocMap.end())
|
||||
allocMap.erase(anItr);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void KMemoryDumpUnfreed() {
|
||||
if (!KAllocMap::allocMapValid)
|
||||
return;
|
||||
|
||||
KAutoLock aCrit(allocMap.crit); // prevent modification of the map while iterating
|
||||
|
||||
size_t totalSize = 0;
|
||||
char buf[8192];
|
||||
|
||||
FILE *f = fopen("mem_leaks.txt", "wt");
|
||||
if (!f)
|
||||
return;
|
||||
|
||||
time_t aTime = time(NULL);
|
||||
sprintf(buf, "Memory Leak Report for %s\n", asctime(localtime(&aTime)));
|
||||
fprintf(f, "%s", buf);
|
||||
KOutputDebug(DEBUGLVL, "\n");
|
||||
KOutputDebug(INFOLVL, buf);
|
||||
for (KAllocMap::iterator i = allocMap.begin(); i != allocMap.end(); ++i) {
|
||||
sprintf(buf, "%s(%d) : Leak %u byte%s @0x%08X\n", i->second.file.c_str(), i->second.line, i->second.size,
|
||||
i->second.size > 1 ? "s" : "", (size_t) i->first);
|
||||
KOutputDebug(ERRORLVL, buf);
|
||||
fprintf(f, "%s", buf);
|
||||
|
||||
#ifdef KANJI_DUMP_LEAKED_MEM
|
||||
unsigned char* data = (unsigned char*)i->first;
|
||||
int count = 0;
|
||||
char hex_dump[1024];
|
||||
char ascii_dump[1024];
|
||||
|
||||
for (int index = 0; index < i->second.size; index++)
|
||||
{
|
||||
unsigned char _c = *data;
|
||||
|
||||
if (count == 0)
|
||||
sprintf(hex_dump, "\t%02X ", _c);
|
||||
else
|
||||
sprintf(hex_dump, "%s%02X ", hex_dump, _c); // technically, this is undefined behavior
|
||||
|
||||
if ((_c < 32) || (_c > 126))
|
||||
_c = '.';
|
||||
|
||||
if (count == 7)
|
||||
sprintf(ascii_dump, "%s%c ", ascii_dump, _c);
|
||||
else
|
||||
sprintf(ascii_dump, "%s%c", count == 0 ? "\t" : ascii_dump, _c); // technically, this is undefined behavior
|
||||
|
||||
|
||||
if (++count == 16)
|
||||
{
|
||||
count = 0;
|
||||
sprintf(buf, "%s\t%s\n", hex_dump, ascii_dump);
|
||||
fprintf(f, buf);
|
||||
|
||||
memset((void*)hex_dump, 0, 1024);
|
||||
memset((void*)ascii_dump, 0, 1024);
|
||||
}
|
||||
|
||||
data++;
|
||||
}
|
||||
|
||||
if (count != 0)
|
||||
{
|
||||
fprintf(f, hex_dump);
|
||||
for (int index = 0; index < 16 - count; index++)
|
||||
fprintf(f, "\t");
|
||||
|
||||
fprintf(f, ascii_dump);
|
||||
|
||||
for (int index = 0; index < 16 - count; index++)
|
||||
fprintf(f, ".");
|
||||
}
|
||||
|
||||
count = 0;
|
||||
fprintf(f, "\n\n");
|
||||
memset((void*)hex_dump, 0, 1024);
|
||||
memset((void*)ascii_dump, 0, 1024);
|
||||
|
||||
#endif // KANJI_DUMP_LEAKED_MEM
|
||||
|
||||
totalSize += i->second.size;
|
||||
}
|
||||
|
||||
ErrorLevel lvl = (totalSize > 0) ? ERRORLVL : INFOLVL;
|
||||
|
||||
sprintf(buf, "-----------------------------------------------------------\n");
|
||||
fprintf(f, "%s", buf);
|
||||
KOutputDebug(lvl, buf);
|
||||
sprintf(buf, "Total Unfreed: %u bytes (%luKB)\n\n", totalSize, totalSize / 1024);
|
||||
KOutputDebug(lvl, buf);
|
||||
fprintf(f, "%s", buf);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
#ifdef KANJI_TRACK_MEM_USAGE
|
||||
void KMemoryDumpUsage()
|
||||
{
|
||||
if (!KAllocStat::allocMapValid)
|
||||
return;
|
||||
|
||||
char buf[8192];
|
||||
FILE* f = fopen("mem_usage.txt", "wt");
|
||||
|
||||
time_t aTime = time(NULL);
|
||||
sprintf(buf, "Memory Usage Report for %s\n", asctime(localtime(&aTime)));
|
||||
if (f) fprintf(f, "%s", buf);
|
||||
KOutputDebug("\n");
|
||||
KOutputDebug(buf);
|
||||
|
||||
for(KAllocStat::allocInfo::iterator i = allocStat.memInfo.begin(); i != allocStat.memInfo.end(); ++i)
|
||||
{
|
||||
int aBytesTotal = 0;
|
||||
int aCallsTotal = 0;
|
||||
for (KAllocStat::allocCount::iterator index = i->second.begin(); index != i->second.end(); ++index)
|
||||
{
|
||||
aBytesTotal += index->first;
|
||||
aCallsTotal += index->second;
|
||||
sprintf(buf, "%s(%d) : %d bytes (%d %s)\n", i->first.first.c_str(), i->first.second, index->first, index->second, index->second == 1 ? "call" : "calls");
|
||||
if (f) fprintf(f, "%s", buf);
|
||||
KOutputDebug(buf);
|
||||
}
|
||||
|
||||
if (i->second.size() > 1)
|
||||
{
|
||||
sprintf(buf, " %s(%d) : %d KB total (%d calls)\n", i->first.first.c_str(), i->first.second, aBytesTotal / 1024, aCallsTotal);
|
||||
if (f) fprintf(f, "%s", buf);
|
||||
KOutputDebug(buf);
|
||||
}
|
||||
}
|
||||
if (f) fclose(f);
|
||||
}
|
||||
#endif // KANJI_TRACK_MEM_USAGE
|
||||
|
||||
size_t KMemoryAllocated() {
|
||||
if (!KAllocMap::allocMapValid)
|
||||
return 0;
|
||||
|
||||
KAutoLock aCrit(allocMap.crit);
|
||||
|
||||
size_t size = 0;
|
||||
for (auto i = allocMap.begin(); i != allocMap.end(); ++i) {
|
||||
KANJI_ALLOC_INFO &info = i->second;
|
||||
size += info.size;
|
||||
}
|
||||
return size;
|
||||
}
|
||||
@ -1,181 +0,0 @@
|
||||
#ifndef __KANJIMEMORY_H__
|
||||
#define __KANJIMEMORY_H__
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#if defined(_DEBUG) && !defined(KANJI_MEMTRACE)
|
||||
#define KANJI_MEMTRACE
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma warning(disable : 4595)
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// HOW TO USE THIS FILE
|
||||
//
|
||||
// In the desired .CPP file (NOT header file), AFTER ALL of your
|
||||
// #include declarations, do a #include "KMemory.h" or whatever you renamed
|
||||
// this file to. It's very important that you do it only in the .cpp and
|
||||
// after every other include file, otherwise it won't compile. The memory leaks
|
||||
// will appear in a file called mem_leaks.txt and they will also be printed out
|
||||
// in the output window when the program exits.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef SAFE_DELETE
|
||||
#define SAFE_DELETE(pPtr) { if(pPtr) delete pPtr; pPtr = 0; }
|
||||
#endif
|
||||
|
||||
#ifndef SCOPED_AUTO_SAFE_DELETE
|
||||
|
||||
template<typename T>
|
||||
class ScopedAutoDeletePointerHelper {
|
||||
public:
|
||||
ScopedAutoDeletePointerHelper(T pPtr) : _pPtr(pPtr) {}
|
||||
|
||||
~ScopedAutoDeletePointerHelper() {SAFE_DELETE(_pPtr); }
|
||||
|
||||
T _pPtr;
|
||||
};
|
||||
|
||||
#define SCOPED_AUTO_SAFE_DELETE(p) ScopedAutoDeletePointerHelper<decltype(p)> anAutoDelete##p(p);
|
||||
#endif
|
||||
|
||||
#ifndef SAFE_DELETE_ARRAY
|
||||
#define SAFE_DELETE_ARRAY(pPtr) { if(pPtr) delete [] pPtr; pPtr = 0; }
|
||||
#endif
|
||||
|
||||
extern void KMemoryDumpUnfreed();
|
||||
|
||||
extern size_t KMemoryAllocated();
|
||||
|
||||
#ifdef WIN32
|
||||
#define KMEM_CALLTYPE __cdecl
|
||||
#else
|
||||
#define KMEM_CALLTYPE
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define KMEM_THROWSPEC throw(std::bad_alloc)
|
||||
#define KMEM_THROWS_BADALLOC
|
||||
|
||||
#include <new>
|
||||
|
||||
#else
|
||||
#define KMEM_THROWSPEC
|
||||
#endif
|
||||
|
||||
#if defined(KANJI_MEMTRACE)
|
||||
|
||||
/////////////////////////////////////////////
|
||||
// DO NOT CALL THESE TWO METHODS DIRECTLY //
|
||||
/////////////////////////////////////////////
|
||||
|
||||
extern void KMemoryAddTrack(void *addr, size_t asize, const char *fname, int lnum);
|
||||
|
||||
extern void KMemoryRemoveTrack(void *addr);
|
||||
|
||||
//Replacement for the standard malloc/free, records size of allocation and the file/line number it was on
|
||||
inline void *_kanjimalloc(size_t size, const char *file, int line) {
|
||||
void *ptr = (void *) malloc(size);
|
||||
KMemoryAddTrack(ptr, size, file, line);
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
inline void *_kanjimalloc(size_t size) {
|
||||
return _kanjimalloc(size, "", 0);
|
||||
}
|
||||
|
||||
inline void _kanjifree(void *ptr) {
|
||||
KMemoryRemoveTrack(ptr);
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
inline void *_kanjirealloc(void *ptr, size_t size, const char *file, int line) {
|
||||
void *ptr2 = (void *) realloc(ptr, size);
|
||||
if (ptr2) {
|
||||
KMemoryRemoveTrack(ptr);
|
||||
KMemoryAddTrack(ptr2, size, file, line);
|
||||
}
|
||||
return ptr2;
|
||||
}
|
||||
|
||||
inline void *_kanjirealloc(void *ptr, size_t size) {
|
||||
return _kanjirealloc(ptr, size, "", 0);
|
||||
}
|
||||
|
||||
#define kanjimalloc(size) _kanjimalloc((size), __FILE__, __LINE__)
|
||||
#define kanjifree _kanjifree
|
||||
#define kanjirealloc(ptr, size) _kanjirealloc(ptr, size, __FILE__, __LINE__)
|
||||
|
||||
//Replacement for the standard "new" operator, records size of allocation and the file/line number it was on
|
||||
inline void *KMEM_CALLTYPE operator new(size_t size, const char *file, int line) {
|
||||
void *ptr = (void *) malloc(size);
|
||||
KMemoryAddTrack(ptr, size, file, line);
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
//Same as above, but for arrays
|
||||
inline void *KMEM_CALLTYPE operator new[](size_t size, const char *file, int line) {
|
||||
void *ptr = (void *) malloc(size);
|
||||
KMemoryAddTrack(ptr, size, file, line);
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
|
||||
// These single argument new operators allow vc6 apps to compile without errors
|
||||
inline void *KMEM_CALLTYPE operator new(size_t size) KMEM_THROWSPEC {
|
||||
void *ptr = (void *) malloc(size);
|
||||
#ifdef KMEM_THROWS_BADALLOC
|
||||
if (!ptr) throw std::bad_alloc();
|
||||
#endif
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
inline void *KMEM_CALLTYPE operator new[](size_t size) KMEM_THROWSPEC {
|
||||
void *ptr = (void *) malloc(size);
|
||||
#ifdef KMEM_THROWS_BADALLOC
|
||||
if (!ptr) throw std::bad_alloc();
|
||||
#endif // KMEM_THROWS_BADALLOC
|
||||
return (ptr);
|
||||
}
|
||||
|
||||
|
||||
//custom delete operators
|
||||
inline void KMEM_CALLTYPE operator delete(void *p) throw() {
|
||||
KMemoryRemoveTrack(p);
|
||||
free(p);
|
||||
}
|
||||
|
||||
inline void KMEM_CALLTYPE operator delete[](void *p) throw() {
|
||||
KMemoryRemoveTrack(p);
|
||||
free(p);
|
||||
}
|
||||
|
||||
//needed in case in the constructor of the class we're newing, it throws an exception
|
||||
inline void KMEM_CALLTYPE operator delete(void *pMem, const char *file, int line) {
|
||||
free(pMem);
|
||||
}
|
||||
|
||||
inline void KMEM_CALLTYPE operator delete[](void *pMem, const char *file, int line) {
|
||||
free(pMem);
|
||||
}
|
||||
|
||||
#define KDEBUG_NEW new(__FILE__, __LINE__)
|
||||
#define new KDEBUG_NEW
|
||||
|
||||
#else // KANJI_MEMTRACE NOT DEFINED
|
||||
|
||||
#define kanjimalloc malloc
|
||||
#define kanjifree free
|
||||
#define kanjirealloc realloc
|
||||
|
||||
inline void* _kanjimalloc(size_t size) { return malloc(size); }
|
||||
inline void _kanjifree(void* ptr) { free(ptr); }
|
||||
inline void* _kanjirealloc(void* ptr, size_t size) { return realloc(ptr, size); }
|
||||
|
||||
#endif // KANJI_MEMTRACE
|
||||
|
||||
#endif // __KANJIMEMORY_H__
|
||||
@ -1,176 +0,0 @@
|
||||
#include "KString.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "MiniCppUnit.hxx"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// String Helper
|
||||
|
||||
static std::string vasprintf(const char *fmt, va_list argv) {
|
||||
std::string result;
|
||||
va_list argv_copy; // vsnprintf modifies argv, need copy
|
||||
#ifndef va_copy
|
||||
argv_copy = argv;
|
||||
#else
|
||||
va_copy(argv_copy, argv);
|
||||
#endif
|
||||
|
||||
int len = vsnprintf(NULL, 0, fmt, argv_copy);
|
||||
if (len > 0 && len < 255) {
|
||||
// cover 90% of all calls
|
||||
char str[256] = {0};
|
||||
int len2 = vsnprintf(str, 255, fmt, argv);
|
||||
result = str;
|
||||
} else if (len > 0) {
|
||||
char *str = static_cast<char *>(alloca(len + 1)); // alloca on stack, space for null-termination
|
||||
int len2 = vsnprintf(str, len + 1, fmt, argv);
|
||||
result = str;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static void reportWarning(const std::string &warnStr) {
|
||||
if (JetBrains::underTeamcity())
|
||||
gTeamCityListener.messages.messageWarning(warnStr);
|
||||
else
|
||||
fprintf(stderr, "%s", warnStr.c_str());
|
||||
}
|
||||
|
||||
static void reportError(const std::string &errorStr) {
|
||||
if (JetBrains::underTeamcity())
|
||||
gTeamCityListener.messages.messageError(errorStr);
|
||||
else
|
||||
fprintf(stderr, "%s", errorStr.c_str());
|
||||
}
|
||||
|
||||
static void reportInfo(const std::string &infoStr) {
|
||||
if (JetBrains::underTeamcity())
|
||||
gTeamCityListener.messages.messageNormal(infoStr);
|
||||
else
|
||||
fprintf(stderr, "%s", infoStr.c_str());
|
||||
}
|
||||
|
||||
static void reportDebug(const std::string &debugStr) {
|
||||
fprintf(stderr, "%s", debugStr.c_str());
|
||||
}
|
||||
|
||||
static void report(ErrorLevel level, const std::string &Str) {
|
||||
switch (level) {
|
||||
case WARNLVL:
|
||||
reportWarning(Str);
|
||||
break;
|
||||
case ERRORLVL:
|
||||
reportError(Str);
|
||||
break;
|
||||
case INFOLVL:
|
||||
reportInfo(Str);
|
||||
break;
|
||||
case DEBUGLVL:
|
||||
reportDebug(Str);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void KOutputDebug(ErrorLevel lvl, const char *fmt ...) {
|
||||
va_list argList;
|
||||
va_start(argList, fmt);
|
||||
std::string str = vasprintf(fmt, argList);
|
||||
va_end(argList);
|
||||
|
||||
report(lvl, str);
|
||||
}
|
||||
|
||||
#define K_MAX(a, b) ((a>b) ? a : b)
|
||||
|
||||
std::string GetFileName(const std::string &thePath, bool noExtension) {
|
||||
int aLastSlash = K_MAX((int) thePath.rfind('\\'), (int) thePath.rfind('/'));
|
||||
|
||||
if (noExtension) {
|
||||
int aLastDot = (int) thePath.rfind('.');
|
||||
if (aLastDot > aLastSlash)
|
||||
return thePath.substr(aLastSlash + 1, aLastDot - aLastSlash - 1);
|
||||
}
|
||||
|
||||
if (aLastSlash == -1)
|
||||
return thePath;
|
||||
else
|
||||
return thePath.substr(aLastSlash + 1);
|
||||
}
|
||||
|
||||
std::string GetFileDir(const std::string &thePath, bool withSlash) {
|
||||
int aLastSlash = K_MAX((int) thePath.rfind(('\\')), (int) thePath.rfind(('/')));
|
||||
|
||||
if (aLastSlash == -1)
|
||||
return ("");
|
||||
else {
|
||||
if (withSlash)
|
||||
return thePath.substr(0, aLastSlash + 1);
|
||||
else
|
||||
return thePath.substr(0, aLastSlash);
|
||||
}
|
||||
}
|
||||
|
||||
std::string GetFileExt(const std::string &thePath) {
|
||||
std::string::size_type idx = thePath.find_last_of('.');
|
||||
|
||||
if (idx != std::string::npos)
|
||||
return thePath.substr(idx + 1);
|
||||
|
||||
return ("");
|
||||
}
|
||||
|
||||
/**
|
||||
* g_ascii_strcasecmp:
|
||||
* @s1: string to compare with @s2.
|
||||
* @s2: string to compare with @s1.
|
||||
*
|
||||
* Compare two strings, ignoring the case of ASCII characters.
|
||||
*
|
||||
* Unlike the BSD strcasecmp() function, this only recognizes standard
|
||||
* ASCII letters and ignores the locale, treating all non-ASCII
|
||||
* bytes as if they are not letters.
|
||||
*
|
||||
* This function should be used only on strings that are known to be
|
||||
* in encodings where the bytes corresponding to ASCII letters always
|
||||
* represent themselves. This includes UTF-8 and the ISO-8859-*
|
||||
* charsets, but not for instance double-byte encodings like the
|
||||
* Windows Codepage 932, where the trailing bytes of double-byte
|
||||
* characters include all ASCII letters. If you compare two CP932
|
||||
* strings using this function, you will get false matches.
|
||||
*
|
||||
* Return value: an integer less than, equal to, or greater than
|
||||
* zero if @s1 is found, respectively, to be less than,
|
||||
* to match, or to be greater than @s2.
|
||||
**/
|
||||
static int g_ascii_compare_caseless(const char *s1, const char *s2) {
|
||||
#define TOUPPER(c) (((c) >= 'a' && (c) <= 'z') ? (c) - 'a' + 'A' : (c))
|
||||
#define TOLOWER(c) (((c) >= 'A' && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))
|
||||
#define g_return_val_if_fail(expr, val) { if (!(expr)) return (val); }
|
||||
|
||||
int c1, c2;
|
||||
|
||||
g_return_val_if_fail(s1 != NULL, 0);
|
||||
g_return_val_if_fail(s2 != NULL, 0);
|
||||
|
||||
while (*s1 && *s2) {
|
||||
c1 = (int) (unsigned char) TOLOWER(*s1);
|
||||
c2 = (int) (unsigned char) TOLOWER(*s2);
|
||||
if (c1 != c2)
|
||||
return (c1 - c2);
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
|
||||
return (((int) (unsigned char) *s1) - ((int) (unsigned char) *s2));
|
||||
|
||||
#undef g_return_val_if_fail
|
||||
#undef TOUPPER
|
||||
#undef TOLOWER
|
||||
}
|
||||
|
||||
|
||||
int CompareNoCase(const std::string &str1, const std::string &str2) {
|
||||
return g_ascii_compare_caseless(str1.c_str(), str2.c_str());
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
// Error reporting with levels similar to Android and are automatically forwarded to Continuous integration server
|
||||
enum ErrorLevel {
|
||||
WARNLVL,
|
||||
ERRORLVL,
|
||||
INFOLVL,
|
||||
DEBUGLVL
|
||||
};
|
||||
|
||||
extern void KOutputDebug(ErrorLevel lvl, const char *fmt ...);
|
||||
|
||||
extern std::string GetFileName(const std::string &thePath, bool noExtension);
|
||||
|
||||
extern std::string GetFileDir(const std::string &thePath, bool withSlash);
|
||||
|
||||
extern std::string GetFileExt(const std::string &thePath);
|
||||
|
||||
extern int CompareNoCase(const std::string &str1, const std::string &str2);
|
||||
@ -1,261 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2004 Pau Arum<EFBFBD> & David Garc<EFBFBD>a
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include "MiniCppUnit.hxx"
|
||||
|
||||
JetBrains::TeamcityProgressListener gTeamCityListener;
|
||||
bool gUseTeamCity = false;
|
||||
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
#define MIN(a, b) ((a < b) ? a : b)
|
||||
#define MAX(a, b) ((a > b) ? a : b)
|
||||
|
||||
TestsListener::TestsListener() : _currentTestName(0) {
|
||||
_executed = _failed = _exceptions = 0;
|
||||
gUseTeamCity = JetBrains::underTeamcity();
|
||||
}
|
||||
|
||||
TestsListener &TestsListener::theInstance() {
|
||||
static TestsListener instancia;
|
||||
return instancia;
|
||||
}
|
||||
|
||||
std::stringstream &TestsListener::errorsLog() {
|
||||
if (_currentTestName) {
|
||||
_log << "\n" << errmsgTag_nameOfTest() << (*_currentTestName) << "\n";
|
||||
}
|
||||
return _log;
|
||||
}
|
||||
|
||||
std::string TestsListener::logString() {
|
||||
std::string aRetornar = _log.str();
|
||||
_log.str("");
|
||||
return aRetornar;
|
||||
}
|
||||
|
||||
void TestsListener::currentTestName(std::string &name) {
|
||||
_currentTestName = &name;
|
||||
|
||||
if (gUseTeamCity)gTeamCityListener.startTest(name);
|
||||
}
|
||||
|
||||
void TestsListener::testHasRun() // started
|
||||
{
|
||||
std::cout << ".";
|
||||
theInstance()._executed++;
|
||||
}
|
||||
|
||||
void TestsListener::testHasPassed() // finished without errors
|
||||
{
|
||||
if (gUseTeamCity)
|
||||
gTeamCityListener.endTest(*(theInstance()._currentTestName));
|
||||
}
|
||||
|
||||
void TestsListener::testHasFailed(const char *reason, const char *file, int line) {
|
||||
if (gUseTeamCity) {
|
||||
gTeamCityListener.addFailure(
|
||||
JetBrains::TestFailure(*(theInstance()._currentTestName), "", JetBrains::SourceLine(file, line),
|
||||
reason));
|
||||
gTeamCityListener.endTest(*(theInstance()._currentTestName));
|
||||
}
|
||||
|
||||
std::cout << "F";
|
||||
theInstance()._failed++;
|
||||
throw TestFailedException();
|
||||
}
|
||||
|
||||
void TestsListener::testHasThrown() {
|
||||
if (gUseTeamCity) {
|
||||
gTeamCityListener.addFailure(
|
||||
JetBrains::TestFailure(*(theInstance()._currentTestName), "", JetBrains::SourceLine(), "Exception"));
|
||||
gTeamCityListener.endTest(*(theInstance()._currentTestName));
|
||||
}
|
||||
std::cout << "E";
|
||||
theInstance()._exceptions++;
|
||||
}
|
||||
|
||||
std::string TestsListener::summary() {
|
||||
std::ostringstream os;
|
||||
os << "\nSummary:\n"
|
||||
<< Assert::bold() << "\tExecuted Tests: "
|
||||
<< _executed << Assert::normal() << std::endl
|
||||
<< Assert::green() << "\tPassed Tests: "
|
||||
<< (_executed - _failed - _exceptions)
|
||||
<< Assert::normal() << std::endl;
|
||||
if (_failed > 0) {
|
||||
os << Assert::red() << "\tFailed Tests: "
|
||||
<< _failed << Assert::normal() << std::endl;
|
||||
}
|
||||
if (_exceptions > 0) {
|
||||
os << Assert::yellow() << "\tUnexpected exceptions: "
|
||||
<< _exceptions << Assert::normal() << std::endl;
|
||||
}
|
||||
os << std::endl;
|
||||
return os.str();
|
||||
}
|
||||
|
||||
bool TestsListener::allTestsPassed() {
|
||||
return !theInstance()._exceptions && !theInstance()._failed;
|
||||
}
|
||||
|
||||
|
||||
void Assert::assertTrue(char *strExpression, bool expression,
|
||||
const char *file, int linia) {
|
||||
if (!expression) {
|
||||
TestsListener::theInstance().errorsLog() << "\n"
|
||||
<< errmsgTag_testFailedIn() << file
|
||||
<< errmsgTag_inLine() << linia << "\n"
|
||||
<< errmsgTag_failedExpression()
|
||||
<< bold() << strExpression << normal() << "\n";
|
||||
TestsListener::theInstance().testHasFailed(strExpression, file, linia);
|
||||
}
|
||||
}
|
||||
|
||||
void Assert::assertTrueMissatge(char *strExpression, bool expression,
|
||||
const char *missatge, const char *file, int linia) {
|
||||
if (!expression) {
|
||||
TestsListener::theInstance().errorsLog() << "\n"
|
||||
<< errmsgTag_testFailedIn() << file
|
||||
<< errmsgTag_inLine() << linia << "\n"
|
||||
<< errmsgTag_failedExpression()
|
||||
<< bold() << strExpression << "\n"
|
||||
<< missatge << normal() << "\n";
|
||||
TestsListener::theInstance().testHasFailed(strExpression, file, linia);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Assert::assertEquals(const char *expected, const char *result,
|
||||
const char *file, int linia) {
|
||||
assertEquals(std::string(expected), std::string(result),
|
||||
file, linia);
|
||||
|
||||
}
|
||||
|
||||
void Assert::assertEquals(const bool &expected, const bool &result,
|
||||
const char *file, int linia) {
|
||||
assertEquals(
|
||||
(expected ? "true" : "false"),
|
||||
(result ? "true" : "false"),
|
||||
file, linia);
|
||||
}
|
||||
|
||||
// floating point numbers comparisons taken
|
||||
// from c/c++ users journal. dec 04 pag 10
|
||||
bool isNaN(double x) {
|
||||
bool b1 = (x < 0.0);
|
||||
bool b2 = (x >= 0.0);
|
||||
return !(b1 || b2);
|
||||
}
|
||||
|
||||
double scaledEpsilon(const double &expected, const double &fuzzyEpsilon) {
|
||||
const double aa = fabs(expected) + 1;
|
||||
return (std::isinf(aa)) ? fuzzyEpsilon : fuzzyEpsilon * aa;
|
||||
}
|
||||
|
||||
bool fuzzyEquals(double expected, double result, double fuzzyEpsilon) {
|
||||
return (expected == result) || (fabs(expected - result) <= scaledEpsilon(expected, fuzzyEpsilon));
|
||||
}
|
||||
|
||||
void Assert::assertEquals(const double &expected, const double &result,
|
||||
const char *file, int linia) {
|
||||
const double fuzzyEpsilon = 0.000001;
|
||||
assertEqualsEpsilon(expected, result, fuzzyEpsilon, file, linia);
|
||||
}
|
||||
|
||||
void Assert::assertEquals(const float &expected, const float &result,
|
||||
const char *file, int linia) {
|
||||
assertEquals((double) expected, (double) result, file, linia);
|
||||
}
|
||||
|
||||
void Assert::assertEquals(const long double &expected, const long double &result,
|
||||
const char *file, int linia) {
|
||||
assertEquals((double) expected, (double) result, file, linia);
|
||||
}
|
||||
|
||||
void Assert::assertEqualsEpsilon(const double &expected, const double &result, const double &epsilon,
|
||||
const char *file, int linia) {
|
||||
if (isNaN(expected) && isNaN(result)) return;
|
||||
if (!isNaN(expected) && !isNaN(result) && fuzzyEquals(expected, result, epsilon)) return;
|
||||
|
||||
std::stringstream anError;
|
||||
anError
|
||||
<< errmsgTag_testFailedIn() << file
|
||||
<< errmsgTag_inLine() << linia << "\n"
|
||||
<< errmsgTag_expected()
|
||||
<< bold() << expected << normal() << " "
|
||||
<< errmsgTag_butWas()
|
||||
<< bold() << result << normal() << "\n";
|
||||
|
||||
TestsListener::theInstance().errorsLog() << anError.str();
|
||||
|
||||
TestsListener::theInstance().testHasFailed(anError.str().c_str(), file, linia);
|
||||
}
|
||||
|
||||
int Assert::notEqualIndex(const std::string &one, const std::string &other) {
|
||||
int end = MIN(one.length(), other.length());
|
||||
for (int index = 0; index < end; index++)
|
||||
if (one[index] != other[index])
|
||||
return index;
|
||||
return end;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* we overload the assert with string doing colored diffs
|
||||
*
|
||||
* MS Visual6 doesn't allow string by reference :-(
|
||||
*/
|
||||
void Assert::assertEquals(const std::string expected, const std::string result,
|
||||
const char *file, int linia) {
|
||||
if (expected == result)
|
||||
return;
|
||||
|
||||
int indexDiferent = notEqualIndex(expected, result);
|
||||
|
||||
std::stringstream anError;
|
||||
anError
|
||||
<< file << ", linia: " << linia << "\n"
|
||||
<< errmsgTag_expected() << "\n" << blue()
|
||||
<< expected.substr(0, indexDiferent)
|
||||
<< green() << expected.substr(indexDiferent)
|
||||
<< normal() << "\n"
|
||||
<< errmsgTag_butWas() << blue() << "\n"
|
||||
<< result.substr(0, indexDiferent)
|
||||
<< red() << result.substr(indexDiferent)
|
||||
<< normal() << std::endl;
|
||||
|
||||
TestsListener::theInstance().errorsLog() << anError.str();
|
||||
|
||||
TestsListener::theInstance().testHasFailed(anError.str().c_str(), file, linia);
|
||||
}
|
||||
|
||||
void Assert::fail(const char *motiu, const char *file, int linia) {
|
||||
TestsListener::theInstance().errorsLog() <<
|
||||
file << errmsgTag_inLine() << linia << "\n" <<
|
||||
"Reason: " << motiu << "\n";
|
||||
|
||||
TestsListener::theInstance().testHasFailed(motiu, file, linia);
|
||||
}
|
||||
|
||||
|
||||
@ -1,506 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2004 Pau Arum<EFBFBD> & David Garc<EFBFBD>a
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MiniCppUnit_hxx
|
||||
#define MiniCppUnit_hxx
|
||||
|
||||
/**
|
||||
* @mainpage
|
||||
* miniCppUnit
|
||||
* (C) 2003-2006 Pau Arumi & David Garcia
|
||||
*
|
||||
* @version 2.5 2006-03-14
|
||||
* - MS Visual compatibility: SConstruct ccflags, usage example, #ifdefs
|
||||
* @version 2.4 2006-03-14
|
||||
* - exit test case after first failure
|
||||
* - double and float comparison with fuzzy equals (using scalable epsilon)
|
||||
* - have into account not a numbers
|
||||
* - new ASSERT_EQUALS_EPSILON macro
|
||||
* - more colors, and disabled when comiled in MS Visual
|
||||
* - removed catalan location.
|
||||
* - UsageExample.cxx now uses all macros and features
|
||||
* @version 2.3 2006-02-13 added usage example and SConstruct
|
||||
* @version 2.2 2004-11-28 code in english and tests suites
|
||||
* @version 2.1 2004-11-04 char* especialization
|
||||
* @version 2.0 2004-10-26 TestsFactory
|
||||
* @version 1.0 2003-10-28 initial
|
||||
*
|
||||
* Example of use:
|
||||
*
|
||||
* @code
|
||||
* #include "MiniCppUnit.hxx"
|
||||
* class MyTests : public TestFixture<MyTests>
|
||||
* {
|
||||
* public:
|
||||
* TEST_FIXTURE( MyTests )
|
||||
* {
|
||||
* CAS_DE_TEST( testAddition );
|
||||
* // etc
|
||||
* }
|
||||
* void testAddition()
|
||||
* {
|
||||
* ASSERT_EQUALS( 4, 1+1+2 );
|
||||
* }
|
||||
* // etc
|
||||
* };
|
||||
*
|
||||
* REGISTER_FIXTURE( MyTests );
|
||||
* @endcode
|
||||
* @code
|
||||
* int main()
|
||||
* {
|
||||
* return TestFixtureFactory::theInstance().runTests() ? 0 : -1;
|
||||
* }
|
||||
* @endcode
|
||||
* Good things:
|
||||
*
|
||||
* - it's a tiny framework made up of two or three src files.
|
||||
* => no need to install as a library
|
||||
* - object oriented and makes use of several GoF patterns
|
||||
* - very simple usage. Just needs to learn very few C macros
|
||||
* - string asserts are simpler to use than cppunit
|
||||
* - string asserts are enhanced with coloured diffs
|
||||
* - concrete test classes are totally decoupled via static factory
|
||||
* => no src file have to include them all.
|
||||
* - it have test suite hierarchies
|
||||
* - compatible with non-standard compliant VisualC6
|
||||
* (though not necessary good ;)
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <list>
|
||||
|
||||
#if _MSC_VER < 1300
|
||||
/** necesary for Visual 6 which don't define std::min */
|
||||
namespace std {
|
||||
template<typename T>
|
||||
T min(const T &a, const T &b) { return a < b ? a : b; }
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "../teamcity/teamcity_cppunit.h"
|
||||
|
||||
extern JetBrains::TeamcityProgressListener gTeamCityListener;
|
||||
|
||||
/**
|
||||
* A singleton class.
|
||||
* Receives tests results and stores messages to the test log
|
||||
* for later listing.
|
||||
* It's a singleton for an easy global access from the 'Asserts'
|
||||
* methods but it is probably asking for a refactoring in order to limit
|
||||
* access only to TestFixtures
|
||||
*/
|
||||
class TestsListener {
|
||||
public:
|
||||
/** accessor to the global (static) singleton instance */
|
||||
static TestsListener &theInstance();
|
||||
|
||||
std::stringstream &errorsLog();
|
||||
|
||||
std::string logString();
|
||||
|
||||
void currentTestName(std::string &name);
|
||||
|
||||
static void testHasRun();
|
||||
|
||||
static void testHasPassed();
|
||||
|
||||
static void testHasFailed(const char *reason, const char *file, int line);
|
||||
|
||||
static void testHasThrown();
|
||||
|
||||
/** the human readable summary of run tests*/
|
||||
std::string summary();
|
||||
|
||||
/** returns wheather all run tests have passed */
|
||||
static bool allTestsPassed();
|
||||
|
||||
private:
|
||||
static const char *errmsgTag_nameOfTest() { return "Test failed: "; }
|
||||
|
||||
/** constructor private: force the singleton to be wellbehaved ! */
|
||||
TestsListener();
|
||||
|
||||
std::string *_currentTestName;
|
||||
std::stringstream _log;
|
||||
unsigned _executed;
|
||||
unsigned _failed;
|
||||
unsigned _exceptions;
|
||||
};
|
||||
|
||||
class TestFailedException {
|
||||
};
|
||||
|
||||
/**
|
||||
* Abstract class with interface that allows run a test. That is runTest
|
||||
* and name. It is implemented by TestFixture and TestCase
|
||||
*
|
||||
* It does the 'Component' role in the 'Composite' patten
|
||||
**/
|
||||
class Test {
|
||||
public:
|
||||
virtual ~Test() {}
|
||||
|
||||
/** run the test: exercice the code and check results*/
|
||||
virtual void runTest() = 0;
|
||||
|
||||
/** the test human-readable name */
|
||||
virtual std::string name() const = 0;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* This class is just a placeholder for all assert functions --as static methods.
|
||||
* It is meant for being used just by the assert macros
|
||||
*/
|
||||
class Assert {
|
||||
static const char *errmsgTag_testFailedIn() { return "Test failed in "; }
|
||||
|
||||
static const char *errmsgTag_inLine() { return ", line: "; };
|
||||
|
||||
static const char *errmsgTag_failedExpression() { return "Failed expression: "; }
|
||||
|
||||
static const char *errmsgTag_expected() { return "Expected: "; }
|
||||
|
||||
static const char *errmsgTag_butWas() { return "But was: "; }
|
||||
|
||||
public:
|
||||
#ifdef _MSC_VER
|
||||
static const char * blue() { return ""; }
|
||||
static const char * green() { return ""; }
|
||||
static const char * red() { return ""; }
|
||||
static const char * normal() { return ""; }
|
||||
static const char * bold() { return ""; }
|
||||
static const char * yellow() { return ""; }
|
||||
#else
|
||||
|
||||
static const char *blue() { return "\033[36;1m"; }
|
||||
|
||||
static const char *green() { return "\033[32;1m"; }
|
||||
|
||||
static const char *red() { return "\033[31;1m"; }
|
||||
|
||||
static const char *normal() { return "\033[0m"; }
|
||||
|
||||
static const char *bold() { return "\033[" "1m"; }
|
||||
|
||||
static const char *yellow() { return "\033[93;1m"; }
|
||||
|
||||
#endif
|
||||
|
||||
template<typename AType>
|
||||
static void assertEquals(const AType &expected, const AType &result,
|
||||
const char *file = "", int linia = 0) {
|
||||
if (expected != result) {
|
||||
std::stringstream anError;
|
||||
|
||||
anError
|
||||
<< file << ", linia: " << linia << "\n"
|
||||
<< errmsgTag_expected() << " " << expected << " "
|
||||
<< errmsgTag_butWas() << " " << result << "\n";
|
||||
|
||||
// TestsListener::theInstance().errorsLog() << anError;
|
||||
|
||||
TestsListener::theInstance().testHasFailed(anError.str().c_str(), file, linia);
|
||||
}
|
||||
}
|
||||
|
||||
static void assertTrue(char *strExpression, bool expression,
|
||||
const char *file = "", int linia = 0);
|
||||
|
||||
static void assertTrueMissatge(char *strExpression, bool expression,
|
||||
const char *missatge, const char *file = "", int linia = 0);
|
||||
|
||||
static void assertEquals(const char *expected, const char *result,
|
||||
const char *file = "", int linia = 0);
|
||||
|
||||
static void assertEquals(const bool &expected, const bool &result,
|
||||
const char *file = "", int linia = 0);
|
||||
|
||||
static void assertEquals(const double &expected, const double &result,
|
||||
const char *file = "", int linia = 0);
|
||||
|
||||
static void assertEquals(const float &expected, const float &result,
|
||||
const char *file = "", int linia = 0);
|
||||
|
||||
static void assertEquals(const long double &expected, const long double &result,
|
||||
const char *file = "", int linia = 0);
|
||||
|
||||
static void assertEqualsEpsilon(const double &expected, const double &result, const double &epsilon,
|
||||
const char *file = "", int linia = 0);
|
||||
|
||||
static int notEqualIndex(const std::string &one, const std::string &other);
|
||||
|
||||
/**
|
||||
* we overload the assert with string doing colored diffs
|
||||
*
|
||||
* MS Visual6 doesn't allow string by reference :-(
|
||||
*/
|
||||
static void assertEquals(const std::string expected, const std::string result,
|
||||
const char *file = "", int linia = 0);
|
||||
|
||||
static void fail(const char *motiu, const char *file = "", int linia = 0);
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* A TestFixture is a class that contain TestCases --which corresponds to
|
||||
* ConcreteTestFixture methods-- common objects uder tests, and setUp and
|
||||
* tearDown methods which are automatically executed before and after each
|
||||
* test case.
|
||||
*
|
||||
* Is the base class of ConcreteFixtures implemented by the framework user
|
||||
*
|
||||
* It does the 'Composite' role in the 'Composite' GoF pattern.
|
||||
* Its composite children are TestCases, which wrapps the test methods.
|
||||
*
|
||||
* It is a template class parametrized by ConcreteTestFixture so that it can
|
||||
* instantiate TestCase objects templatized with this same parameter: it needs the
|
||||
* concrete class type for calling its non-static methods.
|
||||
*/
|
||||
template<typename ConcreteTestFixture>
|
||||
class TestFixture : public Test {
|
||||
protected:
|
||||
|
||||
typedef ConcreteTestFixture ConcreteFixture;
|
||||
|
||||
typedef void(ConcreteTestFixture::*TestCaseMethod)();
|
||||
|
||||
/**
|
||||
* Wrapper for the test methods of concrete TestFixtures.
|
||||
*
|
||||
* Makes the 'Leave' role in the 'Composite' GoF pattern because can't be
|
||||
* be a composition of other tests.
|
||||
*
|
||||
* It's also a case of 'Command' pattern because it encapsules in an object
|
||||
* certain functionality whose execution depends on some deferred entity.
|
||||
*/
|
||||
class TestCase : public Test {
|
||||
public:
|
||||
TestCase(ConcreteFixture *parent, TestCaseMethod method, const std::string &name) :
|
||||
_parent(parent),
|
||||
_testCaseMethod(method),
|
||||
_name(name) {
|
||||
}
|
||||
|
||||
/** calls TestFixture method. setUp and tearDown methods are called by
|
||||
* its parent TestFixture (in its runTest method).
|
||||
* it is robust to unexpected exceptions (throw) */
|
||||
void runTest() {
|
||||
TestsListener::theInstance().testHasRun();
|
||||
TestsListener::theInstance().currentTestName(_name);
|
||||
try {
|
||||
(_parent->*_testCaseMethod)();
|
||||
TestsListener::theInstance().testHasPassed();
|
||||
}
|
||||
catch (std::exception &error) {
|
||||
TestsListener::theInstance().testHasThrown();
|
||||
TestsListener::theInstance().errorsLog()
|
||||
<< "std::exception catched by MiniCppUnit: \n"
|
||||
<< "what() : "
|
||||
<< Assert::yellow() << error.what()
|
||||
<< Assert::normal() << "\n";
|
||||
}
|
||||
catch (TestFailedException &) //just for skiping current test case
|
||||
{
|
||||
// the assert() calls testHasFailed()
|
||||
}
|
||||
catch (...) {
|
||||
TestsListener::theInstance().testHasThrown();
|
||||
TestsListener::theInstance().errorsLog()
|
||||
<< "non standard exception catched by MiniCppUnit.\n";
|
||||
}
|
||||
}
|
||||
|
||||
/** the TestFixture method hame */
|
||||
std::string name() const {
|
||||
return _name;
|
||||
}
|
||||
|
||||
private:
|
||||
ConcreteFixture *_parent;
|
||||
TestCaseMethod _testCaseMethod;
|
||||
std::string _name;
|
||||
};
|
||||
//------------- end of class TestCase ----------------------------
|
||||
|
||||
private:
|
||||
|
||||
typedef std::list<Test *> TestCases;
|
||||
TestCases _testCases;
|
||||
std::string _name;
|
||||
|
||||
void testsList() const {
|
||||
std::cout << "\n+ " << name() << "\n";
|
||||
for (TestCases::const_iterator it = _testCases.begin();
|
||||
it != _testCases.end(); it++)
|
||||
std::cout << " - " << (*it)->name() << "\n";
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
virtual void setUp() {}
|
||||
|
||||
virtual void tearDown() {}
|
||||
|
||||
std::string name() const {
|
||||
return _name;
|
||||
};
|
||||
|
||||
TestFixture(const std::string &name = "A text fixture") : _name(name) {
|
||||
}
|
||||
|
||||
void afegeixCasDeTest(ConcreteFixture *parent, TestCaseMethod method, const char *name) {
|
||||
TestCase *casDeTest = new TestCase(parent, method, _name + "::" + name);
|
||||
_testCases.push_back(casDeTest);
|
||||
}
|
||||
|
||||
/** calls each test after setUp and tearDown TestFixture methods */
|
||||
void runTest() {
|
||||
testsList();
|
||||
TestCases::iterator it;
|
||||
for (it = _testCases.begin(); it != _testCases.end(); it++) {
|
||||
setUp();
|
||||
(*it)->runTest();
|
||||
tearDown();
|
||||
}
|
||||
}
|
||||
|
||||
/** TestCase that wrapps TestFixture methods are dynamically created and owned by
|
||||
* the TestFixture. So here we clean it up*/
|
||||
virtual ~TestFixture() {
|
||||
TestCases::iterator it;
|
||||
for (it = _testCases.begin(); it != _testCases.end(); it++)
|
||||
delete (*it);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* This class is aimed to hold a creator method for each concrete TestFixture
|
||||
*/
|
||||
class TestFixtureFactory {
|
||||
private:
|
||||
/** Well behaved singleton:
|
||||
* Don't allow instantiation apart from theInstance(), so private ctr.*/
|
||||
TestFixtureFactory() {
|
||||
}
|
||||
|
||||
typedef Test *(*FixtureCreator)();
|
||||
|
||||
std::list<FixtureCreator> _creators;
|
||||
public:
|
||||
/** Accessor to the (static) singleton instance */
|
||||
static TestFixtureFactory &theInstance() {
|
||||
static TestFixtureFactory theFactory;
|
||||
return theFactory;
|
||||
}
|
||||
|
||||
bool runTests() {
|
||||
std::list<FixtureCreator>::iterator it;
|
||||
for (it = _creators.begin(); it != _creators.end(); it++) {
|
||||
FixtureCreator creator = *it;
|
||||
Test *test = creator();
|
||||
test->runTest();
|
||||
delete test;
|
||||
}
|
||||
std::string errors = TestsListener::theInstance().logString();
|
||||
if (errors != "") std::cout << "\n\nError Details:\n" << errors;
|
||||
std::cout << TestsListener::theInstance().summary();
|
||||
|
||||
return TestsListener::theInstance().allTestsPassed();
|
||||
}
|
||||
|
||||
void addFixtureCreator(FixtureCreator creator) {
|
||||
_creators.push_back(creator);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Macro a usar despr<EFBFBD>s de cada classe de test
|
||||
*/
|
||||
#define REGISTER_FIXTURE(ConcreteTestFixture) \
|
||||
\
|
||||
Test* Creador##ConcreteTestFixture() { return new ConcreteTestFixture; } \
|
||||
\
|
||||
class Registrador##ConcreteTestFixture \
|
||||
{ \
|
||||
public: \
|
||||
Registrador##ConcreteTestFixture() \
|
||||
{ \
|
||||
TestFixtureFactory::theInstance().addFixtureCreator( \
|
||||
Creador##ConcreteTestFixture); \
|
||||
} \
|
||||
}; \
|
||||
static Registrador##ConcreteTestFixture estatic##ConcreteTestFixture;
|
||||
|
||||
|
||||
/**
|
||||
* Assert macros to use in test methods. An assert is a test condition
|
||||
* we want to check.
|
||||
*/
|
||||
#define ASSERT_EQUALS(expected, result) \
|
||||
Assert::assertEquals( expected, result, __FILE__, __LINE__ );
|
||||
|
||||
#define ASSERT_EQUALS_EPSILON(expected, result, epsilon) \
|
||||
Assert::assertEqualsEpsilon( expected, result, epsilon, __FILE__, __LINE__ );
|
||||
|
||||
#define ASSERT(exp) \
|
||||
Assert::assertTrue(#exp, exp, __FILE__, __LINE__);
|
||||
|
||||
#define ASSERT_MESSAGE(exp, message) \
|
||||
Assert::assertTrueMissatge(#exp, exp, message, __FILE__, __LINE__);
|
||||
|
||||
#define FAIL(why) \
|
||||
Assert::fail(#why, __FILE__, __LINE__);
|
||||
|
||||
/**
|
||||
* Macros that allows to write the constructor of the concrete TestFixture.
|
||||
* What the constructor does is agregate a wrapper for each test case (method)
|
||||
* As easy to write as this:
|
||||
*
|
||||
* @code
|
||||
* class MyTests : public TestFixture<MyTests>
|
||||
* {
|
||||
* public:
|
||||
* TEST_FIXTURE( MyTests )
|
||||
* {
|
||||
* TEST_CASE( test );
|
||||
* // etc
|
||||
* }
|
||||
* void test()
|
||||
* {
|
||||
* ASSERT_EQUALS( 4, 1+1+2 );
|
||||
* }
|
||||
* @endcode
|
||||
*/
|
||||
|
||||
#define TEST_FIXTURE(ConcreteFixture) \
|
||||
ConcreteFixture() : TestFixture<ConcreteFixture>( #ConcreteFixture )
|
||||
|
||||
#define TEST_CASE(methodName) \
|
||||
afegeixCasDeTest( this, &ConcreteFixture::methodName, #methodName );
|
||||
|
||||
|
||||
#endif // MiniCppUnit_hxx
|
||||
@ -1,30 +0,0 @@
|
||||
CppUnit listener for TeamCity
|
||||
-----------------------------
|
||||
|
||||
To report your tests result to TeamCity server
|
||||
include teamcity_messages.* teamcity_cppunit.*
|
||||
to your project and modify "main" function
|
||||
as shown in example.cpp
|
||||
(around JetBrains::underTeamcity and JetBrains::TeamcityProgressListener)
|
||||
|
||||
Technical details
|
||||
-----------------
|
||||
|
||||
Reporting implemented by writing TeamCity service messages to stdout.
|
||||
|
||||
See
|
||||
http://www.jetbrains.net/confluence/display/TCD3/Build+Script+Interaction+with+TeamCity
|
||||
for more details.
|
||||
|
||||
Contact information
|
||||
-------------------
|
||||
|
||||
Mail to teamcity-feedback@jetbrains.com or see other options at
|
||||
|
||||
http://www.jetbrains.com/support/teamcity
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
Apache, version 2.0
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
@ -1,76 +0,0 @@
|
||||
/* Copyright 2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Revision: 88625 $
|
||||
*/
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "teamcity_cppunit.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JetBrains {
|
||||
|
||||
TeamcityProgressListener::TeamcityProgressListener() {
|
||||
flowid = getFlowIdFromEnvironment();
|
||||
}
|
||||
|
||||
TeamcityProgressListener::TeamcityProgressListener(const std::string &_flowid) {
|
||||
flowid = _flowid;
|
||||
}
|
||||
|
||||
void TeamcityProgressListener::startTest(const std::string &test) {
|
||||
messages.testStarted(test, flowid);
|
||||
}
|
||||
|
||||
static string sourceLine2string(const SourceLine &sline) {
|
||||
stringstream ss;
|
||||
|
||||
ss << sline.fileName << ":" << sline.lineNumber;
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
void TeamcityProgressListener::addFailure(const TestFailure &failure) {
|
||||
|
||||
string details = failure.details;
|
||||
|
||||
if (failure.sourceLine.isValid()) {
|
||||
details.append(" at ");
|
||||
details.append(sourceLine2string(failure.sourceLine));
|
||||
details.append("\n");
|
||||
}
|
||||
|
||||
messages.testFailed(
|
||||
failure.testName,
|
||||
failure.description,
|
||||
details,
|
||||
flowid
|
||||
);
|
||||
}
|
||||
|
||||
void TeamcityProgressListener::endTest(const std::string &test) {
|
||||
messages.testFinished(test, -1, flowid);
|
||||
}
|
||||
|
||||
void TeamcityProgressListener::startSuite(const std::string &test) {
|
||||
messages.suiteStarted(test, flowid);
|
||||
}
|
||||
|
||||
void TeamcityProgressListener::endSuite(const std::string &test) {
|
||||
messages.suiteFinished(test, flowid);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,90 +0,0 @@
|
||||
/* Copyright 2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Revision: 88625 $
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "teamcity_messages.h"
|
||||
|
||||
namespace JetBrains {
|
||||
|
||||
class SourceLine {
|
||||
public:
|
||||
SourceLine() : lineNumber(-1) {}
|
||||
|
||||
SourceLine(const std::string &theFile, int theLineNum) : fileName(theFile), lineNumber(theLineNum) {}
|
||||
|
||||
~SourceLine() {}
|
||||
|
||||
std::string fileName;
|
||||
int lineNumber;
|
||||
|
||||
bool isValid() const { return (!fileName.empty() && lineNumber > -1); }
|
||||
};
|
||||
|
||||
class TestFailure {
|
||||
public:
|
||||
std::string details;
|
||||
SourceLine sourceLine;
|
||||
std::string testName;
|
||||
std::string description;
|
||||
public:
|
||||
TestFailure() {}
|
||||
|
||||
~TestFailure() {}
|
||||
|
||||
TestFailure(const std::string &theTestName, const std::string &theDetails, SourceLine theSourcelLine,
|
||||
const std::string &theDescription) {
|
||||
testName = theTestName;
|
||||
details = theDetails;
|
||||
sourceLine = theSourcelLine;
|
||||
description = theDescription;
|
||||
}
|
||||
};
|
||||
|
||||
class TeamcityProgressListener {
|
||||
public:
|
||||
TeamcityMessages messages;
|
||||
public:
|
||||
TeamcityProgressListener(const std::string &_flowid);
|
||||
|
||||
TeamcityProgressListener();
|
||||
|
||||
~TeamcityProgressListener() {}
|
||||
|
||||
void startTest(const std::string &test);
|
||||
|
||||
void addFailure(const TestFailure &failure);
|
||||
|
||||
void endTest(const std::string &test);
|
||||
|
||||
void startSuite(const std::string &test);
|
||||
|
||||
void endSuite(const std::string &test);
|
||||
|
||||
private:
|
||||
std::string flowid;
|
||||
|
||||
// Prevents the use of the copy constructor.
|
||||
TeamcityProgressListener(const TeamcityProgressListener ©);
|
||||
|
||||
// Prevents the use of the copy operator.
|
||||
void operator=(const TeamcityProgressListener ©);
|
||||
};
|
||||
|
||||
}
|
||||
@ -1,183 +0,0 @@
|
||||
/* Copyright 2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Revision: 88625 $
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sstream>
|
||||
|
||||
#include "teamcity_messages.h"
|
||||
|
||||
#pragma warning(disable:4996)
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace JetBrains {
|
||||
|
||||
std::string getFlowIdFromEnvironment() {
|
||||
const char *flowId = getenv("TEAMCITY_PROCESS_FLOW_ID");
|
||||
return flowId == NULL ? "" : flowId;
|
||||
}
|
||||
|
||||
bool underTeamcity() {
|
||||
return getenv("TEAMCITY_PROJECT_NAME") != NULL;
|
||||
}
|
||||
|
||||
TeamcityMessages::TeamcityMessages()
|
||||
: m_out(&cout) {}
|
||||
|
||||
void TeamcityMessages::setOutput(ostream &out) {
|
||||
m_out = &out;
|
||||
}
|
||||
|
||||
string TeamcityMessages::escape(string s) {
|
||||
string result;
|
||||
|
||||
for (size_t i = 0; i < s.length(); i++) {
|
||||
char c = s[i];
|
||||
|
||||
switch (c) {
|
||||
case '\n':
|
||||
result.append("|n");
|
||||
break;
|
||||
case '\r':
|
||||
result.append("|r");
|
||||
break;
|
||||
case '\'':
|
||||
result.append("|'");
|
||||
break;
|
||||
case '|':
|
||||
result.append("||");
|
||||
break;
|
||||
case ']':
|
||||
result.append("|]");
|
||||
break;
|
||||
default:
|
||||
result.append(&c, 1);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void TeamcityMessages::openMsg(const string &name) {
|
||||
// endl for http://jetbrains.net/tracker/issue/TW-4412
|
||||
*m_out << endl << "##teamcity[" << name;
|
||||
}
|
||||
|
||||
void TeamcityMessages::closeMsg() {
|
||||
*m_out << "]";
|
||||
// endl for http://jetbrains.net/tracker/issue/TW-4412
|
||||
*m_out << endl;
|
||||
m_out->flush();
|
||||
}
|
||||
|
||||
void TeamcityMessages::writeProperty(string name, string value) {
|
||||
*m_out << " " << name << "='" << escape(value) << "'";
|
||||
}
|
||||
|
||||
void TeamcityMessages::suiteStarted(string name, string flowid) {
|
||||
openMsg("testSuiteStarted");
|
||||
writeProperty("name", name);
|
||||
if (flowid.length() > 0) {
|
||||
writeProperty("flowId", flowid);
|
||||
}
|
||||
|
||||
closeMsg();
|
||||
}
|
||||
|
||||
void TeamcityMessages::suiteFinished(string name, string flowid) {
|
||||
openMsg("testSuiteFinished");
|
||||
writeProperty("name", name);
|
||||
if (flowid.length() > 0) {
|
||||
writeProperty("flowId", flowid);
|
||||
}
|
||||
|
||||
closeMsg();
|
||||
}
|
||||
|
||||
void TeamcityMessages::testStarted(string name, string flowid) {
|
||||
openMsg("testStarted");
|
||||
writeProperty("name", name);
|
||||
if (flowid.length() > 0) {
|
||||
writeProperty("flowId", flowid);
|
||||
}
|
||||
|
||||
closeMsg();
|
||||
}
|
||||
|
||||
void TeamcityMessages::testFinished(string name, int durationMs, string flowid) {
|
||||
openMsg("testFinished");
|
||||
|
||||
writeProperty("name", name);
|
||||
|
||||
if (flowid.length() > 0) {
|
||||
writeProperty("flowId", flowid);
|
||||
}
|
||||
|
||||
if (durationMs >= 0) {
|
||||
stringstream out;
|
||||
out << durationMs;
|
||||
writeProperty("duration", out.str());
|
||||
}
|
||||
|
||||
closeMsg();
|
||||
}
|
||||
|
||||
void TeamcityMessages::testFailed(string name, string message, string details, string flowid) {
|
||||
openMsg("testFailed");
|
||||
writeProperty("name", name);
|
||||
writeProperty("message", message);
|
||||
writeProperty("details", details);
|
||||
if (flowid.length() > 0) {
|
||||
writeProperty("flowId", flowid);
|
||||
}
|
||||
|
||||
closeMsg();
|
||||
}
|
||||
|
||||
void TeamcityMessages::testIgnored(std::string name, std::string message, string flowid) {
|
||||
openMsg("testIgnored");
|
||||
writeProperty("name", name);
|
||||
writeProperty("message", message);
|
||||
if (flowid.length() > 0) {
|
||||
writeProperty("flowId", flowid);
|
||||
}
|
||||
|
||||
closeMsg();
|
||||
}
|
||||
|
||||
void TeamcityMessages::messageError(const std::string &text) {
|
||||
openMsg("message");
|
||||
writeProperty("text", text);
|
||||
writeProperty("status", "ERROR");
|
||||
closeMsg();
|
||||
}
|
||||
|
||||
void TeamcityMessages::messageWarning(const std::string &text) {
|
||||
openMsg("message");
|
||||
writeProperty("text", text);
|
||||
writeProperty("status", "WARNING");
|
||||
closeMsg();
|
||||
}
|
||||
|
||||
void TeamcityMessages::messageNormal(const std::string &text) {
|
||||
openMsg("message");
|
||||
writeProperty("text", text);
|
||||
writeProperty("status", "NORMAL");
|
||||
closeMsg();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,68 +0,0 @@
|
||||
/* Copyright 2011 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* $Revision: 88625 $
|
||||
*/
|
||||
|
||||
#ifndef H_TEAMCITY_MESSAGES
|
||||
#define H_TEAMCITY_MESSAGES
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
namespace JetBrains {
|
||||
|
||||
std::string getFlowIdFromEnvironment();
|
||||
|
||||
bool underTeamcity();
|
||||
|
||||
class TeamcityMessages {
|
||||
std::ostream *m_out;
|
||||
|
||||
protected:
|
||||
std::string escape(std::string s);
|
||||
|
||||
void openMsg(const std::string &name);
|
||||
|
||||
void writeProperty(std::string name, std::string value);
|
||||
|
||||
void closeMsg();
|
||||
|
||||
public:
|
||||
TeamcityMessages();
|
||||
|
||||
void setOutput(std::ostream &);
|
||||
|
||||
void suiteStarted(std::string name, std::string flowid = "");
|
||||
|
||||
void suiteFinished(std::string name, std::string flowid = "");
|
||||
|
||||
void testStarted(std::string name, std::string flowid = "");
|
||||
|
||||
void testFailed(std::string name, std::string message, std::string details, std::string flowid = "");
|
||||
|
||||
void testIgnored(std::string name, std::string message, std::string flowid = "");
|
||||
|
||||
void testFinished(std::string name, int durationMs = -1, std::string flowid = "");
|
||||
|
||||
void messageError(const std::string &text);
|
||||
|
||||
void messageWarning(const std::string &text);
|
||||
|
||||
void messageNormal(const std::string &text);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif /* H_TEAMCITY_MESSAGES */
|
||||
@ -1,40 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// filename: C_InterfaceTestFixture.cpp
|
||||
//
|
||||
// notes: There is no C++ interface!
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "CPP_InterfaceTestFixture.h"
|
||||
|
||||
CPP_InterfaceTestFixture::~CPP_InterfaceTestFixture() {
|
||||
finalize();
|
||||
}
|
||||
|
||||
void CPP_InterfaceTestFixture::initialize() {
|
||||
// on a Per- Fixture Basis, before Test execution
|
||||
}
|
||||
|
||||
void CPP_InterfaceTestFixture::finalize() {
|
||||
// on a Per- Fixture Basis, after all tests pass/fail
|
||||
}
|
||||
|
||||
void CPP_InterfaceTestFixture::setUp() {
|
||||
// Setup on Per-Test Basis
|
||||
}
|
||||
|
||||
void CPP_InterfaceTestFixture::tearDown() {
|
||||
// Tear Down on Per-Test Basis
|
||||
}
|
||||
|
||||
void CPP_InterfaceTestFixture::spineboyTestCase() {
|
||||
// There is no C++ interface.
|
||||
}
|
||||
|
||||
void CPP_InterfaceTestFixture::raptorTestCase() {
|
||||
// There is no C++ interface.
|
||||
}
|
||||
|
||||
void CPP_InterfaceTestFixture::goblinsTestCase() {
|
||||
// No c++ interface
|
||||
}
|
||||
@ -1,53 +0,0 @@
|
||||
#pragma once
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// filename: C_InterfaceTestFixture.h
|
||||
//
|
||||
// purpose: Run example animations for regression testing
|
||||
// on "C++" interface to make sure modifications to "C"
|
||||
// interface doesn't cause memory leaks or regression
|
||||
// errors.
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "MiniCppUnit.hxx"
|
||||
#include "TestOptions.h"
|
||||
|
||||
class CPP_InterfaceTestFixture : public TestFixture<CPP_InterfaceTestFixture> {
|
||||
public:
|
||||
TEST_FIXTURE(CPP_InterfaceTestFixture) {
|
||||
TEST_CASE(spineboyTestCase);
|
||||
TEST_CASE(raptorTestCase);
|
||||
TEST_CASE(goblinsTestCase);
|
||||
|
||||
initialize();
|
||||
}
|
||||
|
||||
virtual ~CPP_InterfaceTestFixture();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Test Cases
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
void spineboyTestCase();
|
||||
|
||||
void raptorTestCase();
|
||||
|
||||
void goblinsTestCase();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// test fixture setup
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void initialize();
|
||||
|
||||
void finalize();
|
||||
|
||||
public:
|
||||
virtual void setUp();
|
||||
|
||||
virtual void tearDown();
|
||||
|
||||
};
|
||||
|
||||
#if defined(gForceAllTests) || defined(gCPPInterfaceTestFixture)
|
||||
|
||||
REGISTER_FIXTURE(CPP_InterfaceTestFixture);
|
||||
#endif
|
||||
@ -1,116 +0,0 @@
|
||||
#include "C_InterfaceTestFixture.h"
|
||||
#include "SpineEventMonitor.h"
|
||||
|
||||
#include "spine/spine.h"
|
||||
#include <vector>
|
||||
|
||||
#include "KMemory.h" // last include
|
||||
|
||||
#define SPINEBOY_JSON "testdata/spineboy/spineboy-ess.json"
|
||||
#define SPINEBOY_ATLAS "testdata/spineboy/spineboy.atlas"
|
||||
|
||||
#define RAPTOR_JSON "testdata/raptor/raptor-pro.json"
|
||||
#define RAPTOR_ATLAS "testdata/raptor/raptor.atlas"
|
||||
|
||||
#define GOBLINS_JSON "testdata/goblins/goblins-pro.json"
|
||||
#define GOBLINS_ATLAS "testdata/goblins/goblins.atlas"
|
||||
|
||||
#define MAX_RUN_TIME 6000 // equal to about 100 seconds of execution
|
||||
|
||||
void C_InterfaceTestFixture::setUp() {
|
||||
}
|
||||
|
||||
void C_InterfaceTestFixture::tearDown() {
|
||||
}
|
||||
|
||||
static spSkeletonData *readSkeletonJsonData(const char *filename, spAtlas *atlas) {
|
||||
spSkeletonJson *json = spSkeletonJson_create(atlas);
|
||||
ASSERT(json != 0);
|
||||
|
||||
spSkeletonData *skeletonData = spSkeletonJson_readSkeletonDataFile(json, filename);
|
||||
ASSERT(skeletonData != 0);
|
||||
|
||||
spSkeletonJson_dispose(json);
|
||||
return skeletonData;
|
||||
}
|
||||
|
||||
typedef std::vector<std::string> AnimList;
|
||||
|
||||
static size_t enumerateAnimations(AnimList &outList, spSkeletonData *skeletonData) {
|
||||
if (skeletonData) {
|
||||
|
||||
for (int n = 0; n < skeletonData->animationsCount; n++)
|
||||
outList.push_back(skeletonData->animations[n]->name);
|
||||
}
|
||||
|
||||
return outList.size();
|
||||
}
|
||||
|
||||
static void testRunner(const char *jsonName, const char *atlasName) {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Global Animation Information
|
||||
spAtlas *atlas = spAtlas_createFromFile(atlasName, 0);
|
||||
ASSERT(atlas != 0);
|
||||
|
||||
spSkeletonData *skeletonData = readSkeletonJsonData(jsonName, atlas);
|
||||
ASSERT(skeletonData != 0);
|
||||
|
||||
spAnimationStateData *stateData = spAnimationStateData_create(skeletonData);
|
||||
ASSERT(stateData != 0);
|
||||
stateData->defaultMix = 0.2f; // force mixing
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Animation Instance
|
||||
spSkeleton *skeleton = spSkeleton_create(skeletonData);
|
||||
ASSERT(skeleton != 0);
|
||||
|
||||
spAnimationState *state = spAnimationState_create(stateData);
|
||||
ASSERT(state != 0);
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Run animation
|
||||
spSkeleton_setToSetupPose(skeleton);
|
||||
SpineEventMonitor eventMonitor(state);
|
||||
// eventMonitor.SetDebugLogging(true);
|
||||
|
||||
|
||||
AnimList anims; // Let's chain all the animations together as a test
|
||||
size_t count = enumerateAnimations(anims, skeletonData);
|
||||
if (count > 0) spAnimationState_setAnimationByName(state, 0, anims[0].c_str(), false);
|
||||
for (size_t i = 1; i < count; ++i) {
|
||||
spAnimationState_addAnimationByName(state, 0, anims[i].c_str(), false, 0.0f);
|
||||
}
|
||||
|
||||
// Run Loop
|
||||
for (int i = 0; i < MAX_RUN_TIME && eventMonitor.isAnimationPlaying(); ++i) {
|
||||
const float timeSlice = 1.0f / 60.0f;
|
||||
spSkeleton_update(skeleton, timeSlice);
|
||||
spAnimationState_update(state, timeSlice);
|
||||
spAnimationState_apply(state, skeleton);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Dispose Instance
|
||||
spSkeleton_dispose(skeleton);
|
||||
spAnimationState_dispose(state);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Dispose Global
|
||||
spAnimationStateData_dispose(stateData);
|
||||
spSkeletonData_dispose(skeletonData);
|
||||
spAtlas_dispose(atlas);
|
||||
}
|
||||
|
||||
void C_InterfaceTestFixture::spineboyTestCase() {
|
||||
testRunner(SPINEBOY_JSON, SPINEBOY_ATLAS);
|
||||
}
|
||||
|
||||
void C_InterfaceTestFixture::raptorTestCase() {
|
||||
testRunner(RAPTOR_JSON, RAPTOR_ATLAS);
|
||||
}
|
||||
|
||||
void C_InterfaceTestFixture::goblinsTestCase() {
|
||||
testRunner(GOBLINS_JSON, GOBLINS_ATLAS);
|
||||
}
|
||||
@ -1,36 +0,0 @@
|
||||
#pragma once
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// filename: C_InterfaceTestFixture.h
|
||||
//
|
||||
// purpose: Run example animations for regression testing
|
||||
// on "C" interface
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "TestOptions.h"
|
||||
#include "MiniCppUnit.hxx"
|
||||
|
||||
class C_InterfaceTestFixture : public TestFixture<C_InterfaceTestFixture> {
|
||||
public:
|
||||
TEST_FIXTURE(C_InterfaceTestFixture) {
|
||||
// enable/disable individual tests here
|
||||
TEST_CASE(spineboyTestCase);
|
||||
TEST_CASE(raptorTestCase);
|
||||
TEST_CASE(goblinsTestCase);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void setUp();
|
||||
|
||||
virtual void tearDown();
|
||||
|
||||
void spineboyTestCase();
|
||||
|
||||
void raptorTestCase();
|
||||
|
||||
void goblinsTestCase();
|
||||
};
|
||||
|
||||
#if defined(gForceAllTests) || defined(gCInterfaceTestFixture)
|
||||
|
||||
REGISTER_FIXTURE(C_InterfaceTestFixture);
|
||||
#endif
|
||||
@ -1,20 +0,0 @@
|
||||
#include "EmptyTestFixture.h"
|
||||
|
||||
#include "KMemory.h" // Last include
|
||||
|
||||
|
||||
void EmptyTestFixture::setUp() {
|
||||
}
|
||||
|
||||
void EmptyTestFixture::tearDown() {
|
||||
}
|
||||
|
||||
void EmptyTestFixture::emptyTestCase_1() {
|
||||
// char* pLeak = new char[256]; // test leak detector
|
||||
}
|
||||
|
||||
void EmptyTestFixture::emptyTestCase_2() {
|
||||
}
|
||||
|
||||
void EmptyTestFixture::emptyTestCase_3() {
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "TestOptions.h"
|
||||
#include "MiniCppUnit.hxx"
|
||||
|
||||
class EmptyTestFixture : public TestFixture<EmptyTestFixture> {
|
||||
public:
|
||||
TEST_FIXTURE(EmptyTestFixture) {
|
||||
// enable/disable individual tests here
|
||||
TEST_CASE(emptyTestCase_1);
|
||||
TEST_CASE(emptyTestCase_2);
|
||||
TEST_CASE(emptyTestCase_3);
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void setUp();
|
||||
|
||||
virtual void tearDown();
|
||||
|
||||
void emptyTestCase_1();
|
||||
|
||||
void emptyTestCase_2();
|
||||
|
||||
void emptyTestCase_3();
|
||||
};
|
||||
|
||||
#if defined(gForceAllTests) || defined(gEmptyTestFixture)
|
||||
|
||||
REGISTER_FIXTURE(EmptyTestFixture);
|
||||
#endif
|
||||
@ -1,334 +0,0 @@
|
||||
#include <spine/extension.h>
|
||||
#include "MemoryTestFixture.h"
|
||||
#include "SpineEventMonitor.h"
|
||||
|
||||
#include "spine/spine.h"
|
||||
|
||||
#include "KMemory.h" // last include
|
||||
|
||||
#define SPINEBOY_JSON "testdata/spineboy/spineboy-ess.json"
|
||||
#define SPINEBOY_ATLAS "testdata/spineboy/spineboy.atlas"
|
||||
|
||||
#define MAX_RUN_TIME 6000 // equal to about 100 seconds of execution
|
||||
|
||||
MemoryTestFixture::~MemoryTestFixture() {
|
||||
finalize();
|
||||
}
|
||||
|
||||
void MemoryTestFixture::initialize() {
|
||||
// on a Per- Fixture Basis, before Test execution
|
||||
}
|
||||
|
||||
void MemoryTestFixture::finalize() {
|
||||
// on a Per- Fixture Basis, after all tests pass/fail
|
||||
}
|
||||
|
||||
void MemoryTestFixture::setUp() {
|
||||
// Setup on Per-Test Basis
|
||||
}
|
||||
|
||||
void MemoryTestFixture::tearDown() {
|
||||
// Tear Down on Per-Test Basis
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Helper methods
|
||||
static spSkeletonData *readSkeletonJsonData(const char *filename, spAtlas *atlas) {
|
||||
spSkeletonJson *json = spSkeletonJson_create(atlas);
|
||||
ASSERT(json != 0);
|
||||
|
||||
spSkeletonData *skeletonData = spSkeletonJson_readSkeletonDataFile(json, filename);
|
||||
ASSERT(skeletonData != 0);
|
||||
|
||||
spSkeletonJson_dispose(json);
|
||||
return skeletonData;
|
||||
}
|
||||
|
||||
static void LoadSpineboyExample(spAtlas *&atlas, spSkeletonData *&skeletonData, spAnimationStateData *&stateData,
|
||||
spSkeleton *&skeleton, spAnimationState *&state) {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Global Animation Information
|
||||
atlas = spAtlas_createFromFile(SPINEBOY_ATLAS, 0);
|
||||
ASSERT(atlas != 0);
|
||||
|
||||
skeletonData = readSkeletonJsonData(SPINEBOY_JSON, atlas);
|
||||
ASSERT(skeletonData != 0);
|
||||
|
||||
stateData = spAnimationStateData_create(skeletonData);
|
||||
ASSERT(stateData != 0);
|
||||
stateData->defaultMix = 0.4f; // force mixing
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Animation Instance
|
||||
skeleton = spSkeleton_create(skeletonData);
|
||||
ASSERT(skeleton != 0);
|
||||
|
||||
state = spAnimationState_create(stateData);
|
||||
ASSERT(state != 0);
|
||||
}
|
||||
|
||||
static void
|
||||
DisposeAll(spSkeleton *skeleton, spAnimationState *state, spAnimationStateData *stateData, spSkeletonData *skeletonData,
|
||||
spAtlas *atlas) {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Dispose Instance
|
||||
spSkeleton_dispose(skeleton);
|
||||
spAnimationState_dispose(state);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Dispose Global
|
||||
spAnimationStateData_dispose(stateData);
|
||||
spSkeletonData_dispose(skeletonData);
|
||||
spAtlas_dispose(atlas);
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Reproduce Memory leak as described in Issue #776
|
||||
// https://github.com/EsotericSoftware/spine-runtimes/issues/776
|
||||
void MemoryTestFixture::reproduceIssue_776() {
|
||||
spAtlas *atlas = 0;
|
||||
spSkeletonData *skeletonData = 0;
|
||||
spAnimationStateData *stateData = 0;
|
||||
spSkeleton *skeleton = 0;
|
||||
spAnimationState *state = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Initialize Animations
|
||||
LoadSpineboyExample(atlas, skeletonData, stateData, skeleton, state);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Run animation
|
||||
spSkeleton_setToSetupPose(skeleton);
|
||||
InterruptMonitor eventMonitor(state);
|
||||
//eventMonitor.SetDebugLogging(true);
|
||||
|
||||
// Interrupt the animation on this specific sequence of spEventType(s)
|
||||
eventMonitor
|
||||
.AddInterruptEvent(SP_ANIMATION_INTERRUPT, "jump")
|
||||
.AddInterruptEvent(SP_ANIMATION_START);
|
||||
|
||||
spAnimationState_setAnimationByName(state, 0, "walk", true);
|
||||
spAnimationState_addAnimationByName(state, 0, "jump", false, 0.0f);
|
||||
spAnimationState_addAnimationByName(state, 0, "run", true, 0.0f);
|
||||
spAnimationState_addAnimationByName(state, 0, "jump", false, 3.0f);
|
||||
spAnimationState_addAnimationByName(state, 0, "walk", true, 0.0f);
|
||||
spAnimationState_addAnimationByName(state, 0, "idle", false, 1.0f);
|
||||
|
||||
for (int i = 0; i < MAX_RUN_TIME && eventMonitor.isAnimationPlaying(); ++i) {
|
||||
const float timeSlice = 1.0f / 60.0f;
|
||||
spSkeleton_update(skeleton, timeSlice);
|
||||
spAnimationState_update(state, timeSlice);
|
||||
spAnimationState_apply(state, skeleton);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Cleanup Animations
|
||||
DisposeAll(skeleton, state, stateData, skeletonData, atlas);
|
||||
}
|
||||
|
||||
void MemoryTestFixture::reproduceIssue_777() {
|
||||
spAtlas *atlas = 0;
|
||||
spSkeletonData *skeletonData = 0;
|
||||
spAnimationStateData *stateData = 0;
|
||||
spSkeleton *skeleton = 0;
|
||||
spAnimationState *state = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Initialize Animations
|
||||
LoadSpineboyExample(atlas, skeletonData, stateData, skeleton, state);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Run animation
|
||||
spSkeleton_setToSetupPose(skeleton);
|
||||
SpineEventMonitor eventMonitor(state);
|
||||
//eventMonitor.SetDebugLogging(true);
|
||||
|
||||
// Set Animation and Play for 5 frames
|
||||
spAnimationState_setAnimationByName(state, 0, "walk", true);
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
const float timeSlice = 1.0f / 60.0f;
|
||||
spSkeleton_update(skeleton, timeSlice);
|
||||
spAnimationState_update(state, timeSlice);
|
||||
spAnimationState_apply(state, skeleton);
|
||||
}
|
||||
|
||||
// Change animation twice in a row
|
||||
spAnimationState_setAnimationByName(state, 0, "walk", false);
|
||||
spAnimationState_setAnimationByName(state, 0, "run", false);
|
||||
|
||||
// run normal update
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
const float timeSlice = 1.0f / 60.0f;
|
||||
spSkeleton_update(skeleton, timeSlice);
|
||||
spAnimationState_update(state, timeSlice);
|
||||
spAnimationState_apply(state, skeleton);
|
||||
}
|
||||
|
||||
// Now we'd lose mixingFrom (the first "walk" entry we set above) and should leak
|
||||
spAnimationState_setAnimationByName(state, 0, "run", false);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Cleanup Animations
|
||||
DisposeAll(skeleton, state, stateData, skeletonData, atlas);
|
||||
}
|
||||
|
||||
spSkeleton *skeleton = 0;
|
||||
|
||||
static void spineAnimStateHandler(spAnimationState *state, int type, spTrackEntry *entry, spEvent *event) {
|
||||
if (type == SP_ANIMATION_COMPLETE) {
|
||||
spAnimationState_setAnimationByName(state, 0, "walk", false);
|
||||
spAnimationState_update(state, 0);
|
||||
spAnimationState_apply(state, skeleton);
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryTestFixture::reproduceIssue_Loop() {
|
||||
spAtlas *atlas = 0;
|
||||
spSkeletonData *skeletonData = 0;
|
||||
spAnimationStateData *stateData = 0;
|
||||
spAnimationState *state = 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Initialize Animations
|
||||
LoadSpineboyExample(atlas, skeletonData, stateData, skeleton, state);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
if (state)
|
||||
state->listener = (spAnimationStateListener) &spineAnimStateHandler;
|
||||
|
||||
spAnimationState_setAnimationByName(state, 0, "walk", false);
|
||||
|
||||
// run normal update
|
||||
for (int i = 0; i < 50; ++i) {
|
||||
const float timeSlice = 1.0f / 60.0f;
|
||||
spSkeleton_update(skeleton, timeSlice);
|
||||
spAnimationState_update(state, timeSlice);
|
||||
spAnimationState_apply(state, skeleton);
|
||||
}
|
||||
|
||||
DisposeAll(skeleton, state, stateData, skeletonData, atlas);
|
||||
}
|
||||
|
||||
void MemoryTestFixture::triangulator() {
|
||||
spTriangulator *triangulator = spTriangulator_create();
|
||||
spFloatArray *polygon = spFloatArray_create(16);
|
||||
spFloatArray_add(polygon, 0);
|
||||
spFloatArray_add(polygon, 0);
|
||||
spFloatArray_add(polygon, 100);
|
||||
spFloatArray_add(polygon, 0);
|
||||
spFloatArray_add(polygon, 100);
|
||||
spFloatArray_add(polygon, 100);
|
||||
spFloatArray_add(polygon, 0);
|
||||
spFloatArray_add(polygon, 100);
|
||||
|
||||
spShortArray *triangles = spTriangulator_triangulate(triangulator, polygon);
|
||||
ASSERT(triangles->size == 6);
|
||||
ASSERT(triangles->items[0] == 3);
|
||||
ASSERT(triangles->items[1] == 0);
|
||||
ASSERT(triangles->items[2] == 1);
|
||||
ASSERT(triangles->items[3] == 3);
|
||||
ASSERT(triangles->items[4] == 1);
|
||||
ASSERT(triangles->items[5] == 2);
|
||||
|
||||
spArrayFloatArray *polys = spTriangulator_decompose(triangulator, polygon, triangles);
|
||||
ASSERT(polys->size == 1);
|
||||
ASSERT(polys->items[0]->size == 8);
|
||||
ASSERT(polys->items[0]->items[0] == 0);
|
||||
ASSERT(polys->items[0]->items[1] == 100);
|
||||
ASSERT(polys->items[0]->items[2] == 0);
|
||||
ASSERT(polys->items[0]->items[3] == 0);
|
||||
ASSERT(polys->items[0]->items[4] == 100);
|
||||
ASSERT(polys->items[0]->items[5] == 0);
|
||||
ASSERT(polys->items[0]->items[6] == 100);
|
||||
ASSERT(polys->items[0]->items[7] == 100);
|
||||
|
||||
spFloatArray_dispose(polygon);
|
||||
spTriangulator_dispose(triangulator);
|
||||
}
|
||||
|
||||
void MemoryTestFixture::skeletonClipper() {
|
||||
spSkeletonClipping *clipping = spSkeletonClipping_create();
|
||||
|
||||
spBoneData *boneData = spBoneData_create(0, "bone", 0);
|
||||
spBone *bone = spBone_create(boneData, 0, 0);
|
||||
CONST_CAST(float, bone->a) = 1;
|
||||
CONST_CAST(float, bone->b) = 0;
|
||||
CONST_CAST(float, bone->c) = 0;
|
||||
CONST_CAST(float, bone->d) = 1;
|
||||
CONST_CAST(float, bone->worldX) = 0;
|
||||
CONST_CAST(float, bone->worldY) = 0;
|
||||
spSlotData *slotData = spSlotData_create(0, "slot", 0);
|
||||
spSlot *slot = spSlot_create(slotData, bone);
|
||||
spClippingAttachment *clip = spClippingAttachment_create("clipping");
|
||||
clip->endSlot = slotData;
|
||||
clip->super.worldVerticesLength = 4 * 2;
|
||||
clip->super.verticesCount = 4;
|
||||
clip->super.vertices = MALLOC(float, 4 * 8);
|
||||
clip->super.vertices[0] = 0;
|
||||
clip->super.vertices[1] = 50;
|
||||
clip->super.vertices[2] = 100;
|
||||
clip->super.vertices[3] = 50;
|
||||
clip->super.vertices[4] = 100;
|
||||
clip->super.vertices[5] = 70;
|
||||
clip->super.vertices[6] = 0;
|
||||
clip->super.vertices[7] = 70;
|
||||
|
||||
spSkeletonClipping_clipStart(clipping, slot, clip);
|
||||
|
||||
spFloatArray *vertices = spFloatArray_create(16);
|
||||
spFloatArray_add(vertices, 0);
|
||||
spFloatArray_add(vertices, 0);
|
||||
spFloatArray_add(vertices, 100);
|
||||
spFloatArray_add(vertices, 0);
|
||||
spFloatArray_add(vertices, 50);
|
||||
spFloatArray_add(vertices, 150);
|
||||
spFloatArray *uvs = spFloatArray_create(16);
|
||||
spFloatArray_add(uvs, 0);
|
||||
spFloatArray_add(uvs, 0);
|
||||
spFloatArray_add(uvs, 1);
|
||||
spFloatArray_add(uvs, 0);
|
||||
spFloatArray_add(uvs, 0.5f);
|
||||
spFloatArray_add(uvs, 1);
|
||||
spUnsignedShortArray *indices = spUnsignedShortArray_create(16);
|
||||
spUnsignedShortArray_add(indices, 0);
|
||||
spUnsignedShortArray_add(indices, 1);
|
||||
spUnsignedShortArray_add(indices, 2);
|
||||
|
||||
spSkeletonClipping_clipTriangles(clipping, vertices->items, vertices->size, indices->items, indices->size,
|
||||
uvs->items, 2);
|
||||
|
||||
float expectedVertices[8] = {83.333328f, 50.000000f, 76.666664f, 70.000000f, 23.333334f, 70.000000f, 16.666672f,
|
||||
50.000000f};
|
||||
ASSERT(clipping->clippedVertices->size == 8);
|
||||
for (int i = 0; i < clipping->clippedVertices->size; i++) {
|
||||
ASSERT(ABS(clipping->clippedVertices->items[i] - expectedVertices[i]) < 0.001);
|
||||
}
|
||||
|
||||
float expectedUVs[8] = {0.833333f, 0.333333f, 0.766667f, 0.466667f, 0.233333f, 0.466667f, 0.166667f, 0.333333f};
|
||||
ASSERT(clipping->clippedUVs->size == 8);
|
||||
for (int i = 0; i < clipping->clippedUVs->size; i++) {
|
||||
ASSERT(ABS(clipping->clippedUVs->items[i] - expectedUVs[i]) < 0.001);
|
||||
}
|
||||
|
||||
short expectedIndices[6] = {0, 1, 2, 0, 2, 3};
|
||||
ASSERT(clipping->clippedTriangles->size == 6);
|
||||
for (int i = 0; i < clipping->clippedTriangles->size; i++) {
|
||||
ASSERT(clipping->clippedTriangles->items[i] == expectedIndices[i]);
|
||||
}
|
||||
|
||||
spFloatArray_dispose(vertices);
|
||||
spFloatArray_dispose(uvs);
|
||||
spUnsignedShortArray_dispose(indices);
|
||||
|
||||
spSlotData_dispose(slotData);
|
||||
spSlot_dispose(slot);
|
||||
spBoneData_dispose(boneData);
|
||||
spBone_dispose(bone);
|
||||
_spClippingAttachment_dispose(SUPER(SUPER(clip)));
|
||||
spSkeletonClipping_dispose(clipping);
|
||||
}
|
||||
|
||||
|
||||
@ -1,58 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// filename: MemoryTestFixture.h
|
||||
//
|
||||
// purpose: Reproduce Memory Error/Leak Bugs to help debug
|
||||
// and for regression testing
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "MiniCppUnit.hxx"
|
||||
#include "TestOptions.h"
|
||||
|
||||
class MemoryTestFixture : public TestFixture<MemoryTestFixture> {
|
||||
public:
|
||||
TEST_FIXTURE(MemoryTestFixture) {
|
||||
|
||||
// Comment out here to disable individual test cases
|
||||
TEST_CASE(reproduceIssue_776);
|
||||
TEST_CASE(reproduceIssue_777);
|
||||
TEST_CASE(reproduceIssue_Loop);
|
||||
TEST_CASE(triangulator);
|
||||
TEST_CASE(skeletonClipper);
|
||||
|
||||
initialize();
|
||||
}
|
||||
|
||||
virtual ~MemoryTestFixture();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Test Cases
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
void reproduceIssue_776();
|
||||
|
||||
void reproduceIssue_777();
|
||||
|
||||
void reproduceIssue_Loop(); // https://esotericsoftware.com/forum/d/7451-spine-c-35-animation-jerking
|
||||
void triangulator();
|
||||
|
||||
void skeletonClipper();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// test fixture setup
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void initialize();
|
||||
|
||||
void finalize();
|
||||
|
||||
public:
|
||||
virtual void setUp();
|
||||
|
||||
virtual void tearDown();
|
||||
};
|
||||
|
||||
#if defined(gForceAllTests) || defined(gMemoryTestFixture)
|
||||
|
||||
REGISTER_FIXTURE(MemoryTestFixture);
|
||||
#endif
|
||||
@ -1,163 +0,0 @@
|
||||
#include "SpineEventMonitor.h"
|
||||
|
||||
#include "spine/spine.h"
|
||||
#include "KString.h"
|
||||
|
||||
#include "KMemory.h" // Last include
|
||||
|
||||
SpineEventMonitor::SpineEventMonitor(spAnimationState *_pAnimationState /*= nullptr*/) {
|
||||
bLogging = false;
|
||||
RegisterListener(_pAnimationState);
|
||||
}
|
||||
|
||||
SpineEventMonitor::~SpineEventMonitor() {
|
||||
pAnimState = 0;
|
||||
}
|
||||
|
||||
void SpineEventMonitor::RegisterListener(spAnimationState *_pAnimationState) {
|
||||
if (_pAnimationState) {
|
||||
_pAnimationState->rendererObject = this;
|
||||
_pAnimationState->listener = (spAnimationStateListener) &SpineEventMonitor::spineAnimStateHandler;
|
||||
}
|
||||
pAnimState = _pAnimationState;
|
||||
}
|
||||
|
||||
bool SpineEventMonitor::isAnimationPlaying() {
|
||||
if (pAnimState)
|
||||
return spAnimationState_getCurrent(pAnimState, 0) != 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
void SpineEventMonitor::spineAnimStateHandler(spAnimationState *state, int type, spTrackEntry *entry, spEvent *event) {
|
||||
if (state && state->rendererObject) {
|
||||
SpineEventMonitor *pEventMonitor = (SpineEventMonitor *) state->rendererObject;
|
||||
pEventMonitor->OnSpineAnimationStateEvent(state, type, entry, event);
|
||||
}
|
||||
}
|
||||
|
||||
void SpineEventMonitor::OnSpineAnimationStateEvent(spAnimationState *state, int type, spTrackEntry *trackEntry,
|
||||
spEvent *event) {
|
||||
const char *eventName = 0;
|
||||
if (state == pAnimState) { // only monitor ours
|
||||
switch (type) {
|
||||
case SP_ANIMATION_START:
|
||||
eventName = "SP_ANIMATION_START";
|
||||
break;
|
||||
case SP_ANIMATION_INTERRUPT:
|
||||
eventName = "SP_ANIMATION_INTERRUPT";
|
||||
break;
|
||||
case SP_ANIMATION_END:
|
||||
eventName = "SP_ANIMATION_END";
|
||||
break;
|
||||
case SP_ANIMATION_COMPLETE:
|
||||
eventName = "SP_ANIMATION_COMPLETE";
|
||||
break;
|
||||
case SP_ANIMATION_DISPOSE:
|
||||
eventName = "SP_ANIMATION_DISPOSE";
|
||||
break;
|
||||
case SP_ANIMATION_EVENT:
|
||||
eventName = "SP_ANIMATION_EVENT";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (bLogging && eventName && trackEntry && trackEntry->animation && trackEntry->animation->name)
|
||||
KOutputDebug(DEBUGLVL, "[%s : '%s']\n", eventName, trackEntry->animation->name);//*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
InterruptMonitor::InterruptMonitor(spAnimationState *_pAnimationState) :
|
||||
SpineEventMonitor(_pAnimationState) {
|
||||
bForceInterrupt = false;
|
||||
mEventStackCursor = 0; // cursor used to track events
|
||||
}
|
||||
|
||||
bool InterruptMonitor::isAnimationPlaying() {
|
||||
return !bForceInterrupt && SpineEventMonitor::isAnimationPlaying();
|
||||
}
|
||||
|
||||
// Stops the animation on any occurance of the spEventType
|
||||
InterruptMonitor &InterruptMonitor::AddInterruptEvent(int theEventType) {
|
||||
InterruptEvent ev;
|
||||
ev.mEventType = theEventType;
|
||||
mEventStack.push_back(ev);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Stops the animation when the [spEventType : 'animationName'] occurs
|
||||
InterruptMonitor &InterruptMonitor::AddInterruptEvent(int theEventType, const std::string &theAnimationName) {
|
||||
InterruptEvent ev;
|
||||
ev.mEventType = theEventType;
|
||||
ev.mAnimName = theAnimationName;
|
||||
mEventStack.push_back(ev);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// stops the first encounter of spEventType on the specified TrackEntry
|
||||
InterruptMonitor &InterruptMonitor::AddInterruptEvent(int theEventType, spTrackEntry *theTrackEntry) {
|
||||
InterruptEvent ev;
|
||||
ev.mEventType = theEventType;
|
||||
ev.mTrackEntry = theTrackEntry;
|
||||
mEventStack.push_back(ev);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Stops on the first SP_ANIMATION_EVENT with the string payload of 'theEventTriggerName'
|
||||
InterruptMonitor &InterruptMonitor::AddInterruptEventTrigger(const std::string &theEventTriggerName) {
|
||||
InterruptEvent ev;
|
||||
ev.mEventType = SP_ANIMATION_EVENT;
|
||||
ev.mEventName = theEventTriggerName;
|
||||
mEventStack.push_back(ev);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void InterruptMonitor::OnSpineAnimationStateEvent(spAnimationState *state, int type, spTrackEntry *trackEntry,
|
||||
spEvent *event) {
|
||||
SpineEventMonitor::OnSpineAnimationStateEvent(state, type, trackEntry, event);
|
||||
|
||||
if (mEventStackCursor < mEventStack.size()) {
|
||||
if (mEventStack[mEventStackCursor].matches(state, type, trackEntry, event))
|
||||
++mEventStackCursor;
|
||||
|
||||
if (mEventStackCursor >= mEventStack.size()) {
|
||||
bForceInterrupt = true;
|
||||
OnMatchingComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline bool
|
||||
InterruptMonitor::InterruptEvent::matches(spAnimationState *state, int type, spTrackEntry *trackEntry, spEvent *event) {
|
||||
|
||||
// Must match spEventType {SP_ANIMATION_START, SP_ANIMATION_INTERRUPT, SP_ANIMATION_END, SP_ANIMATION_COMPLETE, SP_ANIMATION_DISPOSE, SP_ANIMATION_EVENT }
|
||||
if (mEventType == type) {
|
||||
|
||||
// Looking for specific TrackEntry by pointer
|
||||
if (mTrackEntry != 0) {
|
||||
return mTrackEntry == trackEntry;
|
||||
}
|
||||
|
||||
// looking for Animation Track by name
|
||||
if (!mAnimName.empty()) {
|
||||
if (trackEntry && trackEntry->animation && trackEntry->animation->name) {
|
||||
if (CompareNoCase(trackEntry->animation->name, mAnimName) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// looking for Event String Text
|
||||
if (!mEventName.empty()) {
|
||||
if (event && event->stringValue) {
|
||||
return (CompareNoCase(event->stringValue, mEventName) == 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true; // waiting for ANY spEventType that matches
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -1,130 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// filename: SpineEventMonitor.h
|
||||
//
|
||||
// purpose: Monitor spAnimationState Events
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
// forward declarations
|
||||
typedef struct spAnimationState spAnimationState;
|
||||
typedef struct spTrackEntry spTrackEntry;
|
||||
typedef struct spEvent spEvent;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// class: SpineEventMonitor
|
||||
//
|
||||
// purpose: Monitor spAnimationState Events and report when there
|
||||
// are no more spTrackEntry(s) waiting to play on track 0;
|
||||
//
|
||||
// Also allows for debug printing of Events to console.
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
class SpineEventMonitor {
|
||||
public:
|
||||
SpineEventMonitor(spAnimationState *_pAnimationState = 0);
|
||||
|
||||
virtual ~SpineEventMonitor();
|
||||
|
||||
void RegisterListener(spAnimationState *_pAnimationState);
|
||||
|
||||
void SetDebugLogging(bool val) { bLogging = val; }
|
||||
|
||||
bool GetDebugLogging() { return bLogging; }
|
||||
|
||||
virtual bool isAnimationPlaying();
|
||||
|
||||
protected:
|
||||
static void spineAnimStateHandler(spAnimationState *state, int type, spTrackEntry *entry, spEvent *event);
|
||||
|
||||
virtual void
|
||||
OnSpineAnimationStateEvent(spAnimationState *state, int type, spTrackEntry *trackEntry, spEvent *event);
|
||||
|
||||
protected:
|
||||
spAnimationState *pAnimState;
|
||||
bool bLogging;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// class: InterruptMonitor
|
||||
//
|
||||
// purpose: Allows a programmer to interrupt/stop the updating
|
||||
// of an animation based on a specific sequence of
|
||||
// events generated by the animation.
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
class InterruptMonitor : public SpineEventMonitor {
|
||||
private:
|
||||
struct InterruptEvent {
|
||||
InterruptEvent() {
|
||||
mEventType = -1; // invalid
|
||||
mTrackEntry = 0;
|
||||
}
|
||||
|
||||
bool matches(spAnimationState *state, int type, spTrackEntry *trackEntry, spEvent *event);
|
||||
|
||||
std::string mAnimName;
|
||||
int mEventType;
|
||||
spTrackEntry *mTrackEntry;
|
||||
std::string mEventName;
|
||||
};
|
||||
|
||||
typedef std::vector<InterruptEvent> InterruptEventStack;
|
||||
|
||||
|
||||
public:
|
||||
InterruptMonitor(spAnimationState *_pAnimationState = 0);
|
||||
|
||||
~InterruptMonitor() {}
|
||||
|
||||
virtual bool isAnimationPlaying() override;
|
||||
|
||||
public:
|
||||
InterruptMonitor &AddInterruptEvent(int theEventType);
|
||||
|
||||
InterruptMonitor &AddInterruptEvent(int theEventType, const std::string &theAnimationName);
|
||||
|
||||
InterruptMonitor &AddInterruptEvent(int theEventType, spTrackEntry *theTrackEntry);
|
||||
|
||||
InterruptMonitor &AddInterruptEventTrigger(const std::string &theEventTriggerName);
|
||||
|
||||
protected:
|
||||
virtual void
|
||||
OnSpineAnimationStateEvent(spAnimationState *state, int type, spTrackEntry *trackEntry, spEvent *event) override;
|
||||
|
||||
virtual void OnMatchingComplete() {}
|
||||
|
||||
protected:
|
||||
bool bForceInterrupt;
|
||||
InterruptEventStack mEventStack; // must match these events in this order
|
||||
size_t mEventStackCursor;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
EXAMPLE
|
||||
=======
|
||||
|
||||
SpineEventMonitor eventMonitor(state);
|
||||
eventMonitor.SetDebugLogging(true);
|
||||
|
||||
while(eventMonitor.isAnimationPlaying()){
|
||||
// update...
|
||||
}
|
||||
|
||||
|
||||
|
||||
EXAMPLE
|
||||
=======
|
||||
|
||||
InterruptMonitor eventMonitor(state);
|
||||
eventMonitor.SetDebugLogging(true);
|
||||
|
||||
// Interrupt the animation on this specific sequence of spEventType(s)
|
||||
eventMonitor
|
||||
.AddInterruptEvent(SP_ANIMATION_INTERRUPT, "jump") // First, wait for INTERRUPT signal on the 'jump' animation spTrackEntry
|
||||
.AddInterruptEvent(SP_ANIMATION_START); // Then, stop on any following START signal
|
||||
|
||||
|
||||
*/
|
||||
@ -1,21 +0,0 @@
|
||||
#include "CPP_InterfaceTestFixture.h"
|
||||
|
||||
CPP_InterfaceTestFixture::~CPP_InterfaceTestFixture() {
|
||||
finalize();
|
||||
}
|
||||
|
||||
void CPP_InterfaceTestFixture::initialize() {
|
||||
// on a Per- Fixture Basis, before Test execution
|
||||
}
|
||||
|
||||
void CPP_InterfaceTestFixture::finalize() {
|
||||
// on a Per- Fixture Basis, after all tests pass/fail
|
||||
}
|
||||
|
||||
void CPP_InterfaceTestFixture::setUp() {
|
||||
// Setup on Per-Test Basis
|
||||
}
|
||||
|
||||
void CPP_InterfaceTestFixture::tearDown() {
|
||||
// Tear Down on Per-Test Basis
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "MiniCppUnit.hxx"
|
||||
|
||||
class CPP_InterfaceTestFixture : public TestFixture<CPP_InterfaceTestFixture> {
|
||||
public:
|
||||
TEST_FIXTURE(CPP_InterfaceTestFixture){
|
||||
//TEST_CASE(parseJSON);
|
||||
|
||||
initialize();
|
||||
}
|
||||
|
||||
virtual ~CPP_InterfaceTestFixture();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Test Cases
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
// void parseJSON();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// test fixture setup
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void initialize();
|
||||
|
||||
void finalize();
|
||||
|
||||
public:
|
||||
virtual void setUp();
|
||||
|
||||
virtual void tearDown();
|
||||
};
|
||||
|
||||
REGISTER_FIXTURE(CPP_InterfaceTestFixture);
|
||||
@ -1,21 +0,0 @@
|
||||
#include "[[FIXTURE_TYPE]].h"
|
||||
|
||||
[[FIXTURE_TYPE]]:: ~[[FIXTURE_TYPE]]() {
|
||||
finalize();
|
||||
}
|
||||
|
||||
void [[FIXTURE_TYPE]]::initialize() {
|
||||
// on a Per- Fixture Basis, before Test execution
|
||||
}
|
||||
|
||||
void [[FIXTURE_TYPE]]::finalize() {
|
||||
// on a Per- Fixture Basis, after all tests pass/fail
|
||||
}
|
||||
|
||||
void [[FIXTURE_TYPE]]::setUp() {
|
||||
// Setup on Per-Test Basis
|
||||
}
|
||||
|
||||
void [[FIXTURE_TYPE]]::tearDown() {
|
||||
// Tear Down on Per-Test Basis
|
||||
}
|
||||
@ -1,39 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "MiniCppUnit.hxx"
|
||||
|
||||
class [[FIXTURE_TYPE]] : public TestFixture< [[FIXTURE_TYPE]]
|
||||
|
||||
>
|
||||
{
|
||||
public:
|
||||
TEST_FIXTURE([[FIXTURE_TYPE]]){
|
||||
//TEST_CASE(parseJSON);
|
||||
|
||||
initialize();
|
||||
|
||||
}
|
||||
|
||||
virtual ~[[FIXTURE_TYPE]]();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Test Cases
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
public:
|
||||
// void parseJSON();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// test fixture setup
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void initialize();
|
||||
|
||||
void finalize();
|
||||
|
||||
public:
|
||||
|
||||
virtual void setUp();
|
||||
|
||||
virtual void tearDown();
|
||||
|
||||
};
|
||||
REGISTER_FIXTURE([[FIXTURE_TYPE]]);
|
||||
Binary file not shown.
@ -1,17 +0,0 @@
|
||||
@echo off
|
||||
if "%1"=="" goto blank
|
||||
|
||||
copy "_TestFixture.cpp" "%1TestFixture.cpp"
|
||||
copy "_TestFixture.h" "%1TestFixture.h"
|
||||
|
||||
|
||||
fnr --cl --find "[[FIXTURE_TYPE]]" --replace "%1TestFixture" --fileMask "%1TestFixture.cpp" --dir %cd%
|
||||
fnr --cl --find "[[FIXTURE_TYPE]]" --replace "%1TestFixture" --fileMask "%1TestFixture.h" --dir %cd%
|
||||
|
||||
goto done
|
||||
|
||||
:blank
|
||||
echo Usage:
|
||||
echo %~n0 FixtureTypeName
|
||||
|
||||
:done
|
||||
@ -1,32 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Force all Tests to 'ON.' Use this for final 'Regression' Testing.
|
||||
|
||||
//#define gForceAllTests
|
||||
|
||||
//#define TURN_ON_ALL_TESTS // Comment this line out to switch to fast testing only
|
||||
|
||||
#ifdef TURN_ON_ALL_TESTS
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// All tests are ON by default, but you can turn off individual tests.
|
||||
|
||||
#define gEmptyTestFixture
|
||||
#define gCInterfaceTestFixture
|
||||
#define gCPPInterfaceTestFixture
|
||||
#define gMemoryTestFixture
|
||||
|
||||
|
||||
#else
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Slow Tests are disabled by default. Use this section to turn on
|
||||
// Individual tests.
|
||||
#define gEmptyTestFixture // Fast
|
||||
|
||||
#define gCInterfaceTestFixture // slow
|
||||
#define gCPPInterfaceTestFixture // fast
|
||||
|
||||
#define gMemoryTestFixture // medium
|
||||
|
||||
#endif
|
||||
@ -1,574 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_ANIMATION_H_
|
||||
#define SPINE_ANIMATION_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/Event.h>
|
||||
#include <spine/Attachment.h>
|
||||
#include <spine/VertexAttachment.h>
|
||||
#include <spine/Sequence.h>
|
||||
#include <spine/Array.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spTimeline spTimeline;
|
||||
struct spSkeleton;
|
||||
typedef uint64_t spPropertyId;
|
||||
|
||||
_SP_ARRAY_DECLARE_TYPE(spPropertyIdArray, spPropertyId)
|
||||
|
||||
_SP_ARRAY_DECLARE_TYPE(spTimelineArray, spTimeline*)
|
||||
|
||||
typedef struct spAnimation {
|
||||
char *name;
|
||||
float duration;
|
||||
|
||||
spTimelineArray *timelines;
|
||||
spPropertyIdArray *timelineIds;
|
||||
} spAnimation;
|
||||
|
||||
typedef enum {
|
||||
SP_MIX_BLEND_SETUP,
|
||||
SP_MIX_BLEND_FIRST,
|
||||
SP_MIX_BLEND_REPLACE,
|
||||
SP_MIX_BLEND_ADD
|
||||
} spMixBlend;
|
||||
|
||||
typedef enum {
|
||||
SP_MIX_DIRECTION_IN,
|
||||
SP_MIX_DIRECTION_OUT
|
||||
} spMixDirection;
|
||||
|
||||
SP_API spAnimation *spAnimation_create(const char *name, spTimelineArray *timelines, float duration);
|
||||
|
||||
SP_API void spAnimation_dispose(spAnimation *self);
|
||||
|
||||
SP_API int /*bool*/ spAnimation_hasTimeline(spAnimation *self, spPropertyId *ids, int idsCount);
|
||||
|
||||
/** Poses the skeleton at the specified time for this animation.
|
||||
* @param lastTime The last time the animation was applied.
|
||||
* @param events Any triggered events are added. May be null.*/
|
||||
SP_API void
|
||||
spAnimation_apply(const spAnimation *self, struct spSkeleton *skeleton, float lastTime, float time, int loop,
|
||||
spEvent **events, int *eventsCount, float alpha, spMixBlend blend, spMixDirection direction);
|
||||
|
||||
/**/
|
||||
typedef enum {
|
||||
SP_TIMELINE_ATTACHMENT,
|
||||
SP_TIMELINE_ALPHA,
|
||||
SP_TIMELINE_PATHCONSTRAINTPOSITION,
|
||||
SP_TIMELINE_PATHCONSTRAINTSPACING,
|
||||
SP_TIMELINE_ROTATE,
|
||||
SP_TIMELINE_SCALEX,
|
||||
SP_TIMELINE_SCALEY,
|
||||
SP_TIMELINE_SHEARX,
|
||||
SP_TIMELINE_SHEARY,
|
||||
SP_TIMELINE_TRANSLATEX,
|
||||
SP_TIMELINE_TRANSLATEY,
|
||||
SP_TIMELINE_SCALE,
|
||||
SP_TIMELINE_SHEAR,
|
||||
SP_TIMELINE_TRANSLATE,
|
||||
SP_TIMELINE_DEFORM,
|
||||
SP_TIMELINE_SEQUENCE,
|
||||
SP_TIMELINE_INHERIT,
|
||||
SP_TIMELINE_IKCONSTRAINT,
|
||||
SP_TIMELINE_PATHCONSTRAINTMIX,
|
||||
SP_TIMELINE_PHYSICSCONSTRAINT_INERTIA,
|
||||
SP_TIMELINE_PHYSICSCONSTRAINT_STRENGTH,
|
||||
SP_TIMELINE_PHYSICSCONSTRAINT_DAMPING,
|
||||
SP_TIMELINE_PHYSICSCONSTRAINT_MASS,
|
||||
SP_TIMELINE_PHYSICSCONSTRAINT_WIND,
|
||||
SP_TIMELINE_PHYSICSCONSTRAINT_GRAVITY,
|
||||
SP_TIMELINE_PHYSICSCONSTRAINT_MIX,
|
||||
SP_TIMELINE_PHYSICSCONSTRAINT_RESET,
|
||||
SP_TIMELINE_RGB2,
|
||||
SP_TIMELINE_RGBA2,
|
||||
SP_TIMELINE_RGBA,
|
||||
SP_TIMELINE_RGB,
|
||||
SP_TIMELINE_TRANSFORMCONSTRAINT,
|
||||
SP_TIMELINE_DRAWORDER,
|
||||
SP_TIMELINE_EVENT
|
||||
} spTimelineType;
|
||||
|
||||
/**/
|
||||
|
||||
typedef enum {
|
||||
SP_PROPERTY_ROTATE = 1 << 0,
|
||||
SP_PROPERTY_X = 1 << 1,
|
||||
SP_PROPERTY_Y = 1 << 2,
|
||||
SP_PROPERTY_SCALEX = 1 << 3,
|
||||
SP_PROPERTY_SCALEY = 1 << 4,
|
||||
SP_PROPERTY_SHEARX = 1 << 5,
|
||||
SP_PROPERTY_SHEARY = 1 << 6,
|
||||
SP_PROPERTY_INHERIT = 1 << 7,
|
||||
SP_PROPERTY_RGB = 1 << 8,
|
||||
SP_PROPERTY_ALPHA = 1 << 9,
|
||||
SP_PROPERTY_RGB2 = 1 << 10,
|
||||
SP_PROPERTY_ATTACHMENT = 1 << 11,
|
||||
SP_PROPERTY_DEFORM = 1 << 12,
|
||||
SP_PROPERTY_EVENT = 1 << 13,
|
||||
SP_PROPERTY_DRAWORDER = 1 << 14,
|
||||
SP_PROPERTY_IKCONSTRAINT = 1 << 15,
|
||||
SP_PROPERTY_TRANSFORMCONSTRAINT = 1 << 16,
|
||||
SP_PROPERTY_PATHCONSTRAINT_POSITION = 1 << 17,
|
||||
SP_PROPERTY_PATHCONSTRAINT_SPACING = 1 << 18,
|
||||
SP_PROPERTY_PATHCONSTRAINT_MIX = 1 << 19,
|
||||
SP_PROPERTY_PHYSICSCONSTRAINT_INERTIA = 1 << 20,
|
||||
SP_PROPERTY_PHYSICSCONSTRAINT_STRENGTH = 1 << 21,
|
||||
SP_PROPERTY_PHYSICSCONSTRAINT_DAMPING = 1 << 22,
|
||||
SP_PROPERTY_PHYSICSCONSTRAINT_MASS = 1 << 23,
|
||||
SP_PROPERTY_PHYSICSCONSTRAINT_WIND = 1 << 24,
|
||||
SP_PROPERTY_PHYSICSCONSTRAINT_GRAVITY = 1 << 25,
|
||||
SP_PROPERTY_PHYSICSCONSTRAINT_MIX = 1 << 26,
|
||||
SP_PROPERTY_PHYSICSCONSTRAINT_RESET = 1 << 27,
|
||||
SP_PROPERTY_SEQUENCE = 1 << 28
|
||||
} spProperty;
|
||||
|
||||
#define SP_MAX_PROPERTY_IDS 3
|
||||
|
||||
typedef struct _spTimelineVtable {
|
||||
void (*apply)(spTimeline *self, struct spSkeleton *skeleton, float lastTime, float time, spEvent **firedEvents,
|
||||
int *eventsCount, float alpha, spMixBlend blend, spMixDirection direction);
|
||||
|
||||
void (*dispose)(spTimeline *self);
|
||||
|
||||
void
|
||||
(*setBezier)(spTimeline *self, int bezier, int frame, float value, float time1, float value1, float cx1, float cy1,
|
||||
float cx2, float cy2, float time2, float value2);
|
||||
} _spTimelineVtable;
|
||||
|
||||
struct spTimeline {
|
||||
_spTimelineVtable vtable;
|
||||
spPropertyId propertyIds[SP_MAX_PROPERTY_IDS];
|
||||
int propertyIdsCount;
|
||||
spFloatArray *frames;
|
||||
int frameCount;
|
||||
int frameEntries;
|
||||
spTimelineType type;
|
||||
};
|
||||
|
||||
SP_API void spTimeline_dispose(spTimeline *self);
|
||||
|
||||
SP_API void
|
||||
spTimeline_apply(spTimeline *self, struct spSkeleton *skeleton, float lastTime, float time, spEvent **firedEvents,
|
||||
int *eventsCount, float alpha, spMixBlend blend, spMixDirection direction);
|
||||
|
||||
SP_API void
|
||||
spTimeline_setBezier(spTimeline *self, int bezier, int frame, float value, float time1, float value1, float cx1,
|
||||
float cy1, float cx2, float cy2, float time2, float value2);
|
||||
|
||||
SP_API float spTimeline_getDuration(const spTimeline *self);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spCurveTimeline {
|
||||
spTimeline super;
|
||||
spFloatArray *curves; /* type, x, y, ... */
|
||||
} spCurveTimeline;
|
||||
|
||||
SP_API void spCurveTimeline_setLinear(spCurveTimeline *self, int frameIndex);
|
||||
|
||||
SP_API void spCurveTimeline_setStepped(spCurveTimeline *self, int frameIndex);
|
||||
|
||||
/* Sets the control handle positions for an interpolation bezier curve used to transition from this keyframe to the next.
|
||||
* cx1 and cx2 are from 0 to 1, representing the percent of time between the two keyframes. cy1 and cy2 are the percent of
|
||||
* the difference between the keyframe's values. */
|
||||
SP_API void spCurveTimeline_setCurve(spCurveTimeline *self, int frameIndex, float cx1, float cy1, float cx2, float cy2);
|
||||
|
||||
SP_API float spCurveTimeline_getCurvePercent(const spCurveTimeline *self, int frameIndex, float percent);
|
||||
|
||||
typedef struct spCurveTimeline spCurveTimeline1;
|
||||
|
||||
SP_API void spCurveTimeline1_setFrame(spCurveTimeline1 *self, int frame, float time, float value);
|
||||
|
||||
SP_API float spCurveTimeline1_getCurveValue(spCurveTimeline1 *self, float time);
|
||||
|
||||
SP_API float spCurveTimeline1_getRelativeValue(spCurveTimeline1 *timeline, float time, float alpha, spMixBlend blend, float current, float setup);
|
||||
|
||||
SP_API float spCurveTimeline1_getAbsoluteValue(spCurveTimeline1 *timeline, float time, float alpha, spMixBlend blend, float current, float setup);
|
||||
|
||||
SP_API float spCurveTimeline1_getAbsoluteValue2(spCurveTimeline1 *timeline, float time, float alpha, spMixBlend blend, float current, float setup, float value);
|
||||
|
||||
SP_API float spCurveTimeline1_getScaleValue (spCurveTimeline1 *timeline, float time, float alpha, spMixBlend blend, spMixDirection direction, float current, float setup);
|
||||
|
||||
typedef struct spCurveTimeline spCurveTimeline2;
|
||||
|
||||
SP_API void spCurveTimeline2_setFrame(spCurveTimeline1 *self, int frame, float time, float value1, float value2);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spRotateTimeline {
|
||||
spCurveTimeline1 super;
|
||||
int boneIndex;
|
||||
} spRotateTimeline;
|
||||
|
||||
SP_API spRotateTimeline *spRotateTimeline_create(int frameCount, int bezierCount, int boneIndex);
|
||||
|
||||
SP_API void spRotateTimeline_setFrame(spRotateTimeline *self, int frameIndex, float time, float angle);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spTranslateTimeline {
|
||||
spCurveTimeline2 super;
|
||||
int boneIndex;
|
||||
} spTranslateTimeline;
|
||||
|
||||
SP_API spTranslateTimeline *spTranslateTimeline_create(int frameCount, int bezierCount, int boneIndex);
|
||||
|
||||
SP_API void spTranslateTimeline_setFrame(spTranslateTimeline *self, int frameIndex, float time, float x, float y);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spTranslateXTimeline {
|
||||
spCurveTimeline1 super;
|
||||
int boneIndex;
|
||||
} spTranslateXTimeline;
|
||||
|
||||
SP_API spTranslateXTimeline *spTranslateXTimeline_create(int frameCount, int bezierCount, int boneIndex);
|
||||
|
||||
SP_API void spTranslateXTimeline_setFrame(spTranslateXTimeline *self, int frame, float time, float x);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spTranslateYTimeline {
|
||||
spCurveTimeline1 super;
|
||||
int boneIndex;
|
||||
} spTranslateYTimeline;
|
||||
|
||||
SP_API spTranslateYTimeline *spTranslateYTimeline_create(int frameCount, int bezierCount, int boneIndex);
|
||||
|
||||
SP_API void spTranslateYTimeline_setFrame(spTranslateYTimeline *self, int frame, float time, float y);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spScaleTimeline {
|
||||
spCurveTimeline2 super;
|
||||
int boneIndex;
|
||||
} spScaleTimeline;
|
||||
|
||||
SP_API spScaleTimeline *spScaleTimeline_create(int frameCount, int bezierCount, int boneIndex);
|
||||
|
||||
SP_API void spScaleTimeline_setFrame(spScaleTimeline *self, int frameIndex, float time, float x, float y);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spScaleXTimeline {
|
||||
spCurveTimeline1 super;
|
||||
int boneIndex;
|
||||
} spScaleXTimeline;
|
||||
|
||||
SP_API spScaleXTimeline *spScaleXTimeline_create(int frameCount, int bezierCount, int boneIndex);
|
||||
|
||||
SP_API void spScaleXTimeline_setFrame(spScaleXTimeline *self, int frame, float time, float x);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spScaleYTimeline {
|
||||
spCurveTimeline1 super;
|
||||
int boneIndex;
|
||||
} spScaleYTimeline;
|
||||
|
||||
SP_API spScaleYTimeline *spScaleYTimeline_create(int frameCount, int bezierCount, int boneIndex);
|
||||
|
||||
SP_API void spScaleYTimeline_setFrame(spScaleYTimeline *self, int frame, float time, float y);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spShearTimeline {
|
||||
spCurveTimeline2 super;
|
||||
int boneIndex;
|
||||
} spShearTimeline;
|
||||
|
||||
SP_API spShearTimeline *spShearTimeline_create(int frameCount, int bezierCount, int boneIndex);
|
||||
|
||||
SP_API void spShearTimeline_setFrame(spShearTimeline *self, int frameIndex, float time, float x, float y);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spShearXTimeline {
|
||||
spCurveTimeline1 super;
|
||||
int boneIndex;
|
||||
} spShearXTimeline;
|
||||
|
||||
SP_API spShearXTimeline *spShearXTimeline_create(int frameCount, int bezierCount, int boneIndex);
|
||||
|
||||
SP_API void spShearXTimeline_setFrame(spShearXTimeline *self, int frame, float time, float x);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spShearYTimeline {
|
||||
spCurveTimeline1 super;
|
||||
int boneIndex;
|
||||
} spShearYTimeline;
|
||||
|
||||
SP_API spShearYTimeline *spShearYTimeline_create(int frameCount, int bezierCount, int boneIndex);
|
||||
|
||||
SP_API void spShearYTimeline_setFrame(spShearYTimeline *self, int frame, float time, float x);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spRGBATimeline {
|
||||
spCurveTimeline2 super;
|
||||
int slotIndex;
|
||||
} spRGBATimeline;
|
||||
|
||||
SP_API spRGBATimeline *spRGBATimeline_create(int framesCount, int bezierCount, int slotIndex);
|
||||
|
||||
SP_API void
|
||||
spRGBATimeline_setFrame(spRGBATimeline *self, int frameIndex, float time, float r, float g, float b, float a);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spRGBTimeline {
|
||||
spCurveTimeline2 super;
|
||||
int slotIndex;
|
||||
} spRGBTimeline;
|
||||
|
||||
SP_API spRGBTimeline *spRGBTimeline_create(int framesCount, int bezierCount, int slotIndex);
|
||||
|
||||
SP_API void spRGBTimeline_setFrame(spRGBTimeline *self, int frameIndex, float time, float r, float g, float b);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spAlphaTimeline {
|
||||
spCurveTimeline1 super;
|
||||
int slotIndex;
|
||||
} spAlphaTimeline;
|
||||
|
||||
SP_API spAlphaTimeline *spAlphaTimeline_create(int frameCount, int bezierCount, int slotIndex);
|
||||
|
||||
SP_API void spAlphaTimeline_setFrame(spAlphaTimeline *self, int frame, float time, float x);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spRGBA2Timeline {
|
||||
spCurveTimeline super;
|
||||
int slotIndex;
|
||||
} spRGBA2Timeline;
|
||||
|
||||
SP_API spRGBA2Timeline *spRGBA2Timeline_create(int framesCount, int bezierCount, int slotIndex);
|
||||
|
||||
SP_API void
|
||||
spRGBA2Timeline_setFrame(spRGBA2Timeline *self, int frameIndex, float time, float r, float g, float b, float a,
|
||||
float r2, float g2, float b2);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spRGB2Timeline {
|
||||
spCurveTimeline super;
|
||||
int slotIndex;
|
||||
} spRGB2Timeline;
|
||||
|
||||
SP_API spRGB2Timeline *spRGB2Timeline_create(int framesCount, int bezierCount, int slotIndex);
|
||||
|
||||
SP_API void
|
||||
spRGB2Timeline_setFrame(spRGB2Timeline *self, int frameIndex, float time, float r, float g, float b, float r2, float g2,
|
||||
float b2);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spAttachmentTimeline {
|
||||
spTimeline super;
|
||||
int slotIndex;
|
||||
char **attachmentNames;
|
||||
} spAttachmentTimeline;
|
||||
|
||||
SP_API spAttachmentTimeline *spAttachmentTimeline_create(int framesCount, int SlotIndex);
|
||||
|
||||
/* @param attachmentName May be 0. */
|
||||
SP_API void
|
||||
spAttachmentTimeline_setFrame(spAttachmentTimeline *self, int frameIndex, float time, const char *attachmentName);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spDeformTimeline {
|
||||
spCurveTimeline super;
|
||||
int frameVerticesCount;
|
||||
float **frameVertices;
|
||||
int slotIndex;
|
||||
spAttachment *attachment;
|
||||
} spDeformTimeline;
|
||||
|
||||
SP_API spDeformTimeline *
|
||||
spDeformTimeline_create(int framesCount, int frameVerticesCount, int bezierCount, int slotIndex,
|
||||
spVertexAttachment *attachment);
|
||||
|
||||
SP_API void spDeformTimeline_setFrame(spDeformTimeline *self, int frameIndex, float time, float *vertices);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spSequenceTimeline {
|
||||
spTimeline super;
|
||||
int slotIndex;
|
||||
spAttachment *attachment;
|
||||
} spSequenceTimeline;
|
||||
|
||||
SP_API spSequenceTimeline *spSequenceTimeline_create(int framesCount, int slotIndex, spAttachment *attachment);
|
||||
|
||||
SP_API void spSequenceTimeline_setFrame(spSequenceTimeline *self, int frameIndex, float time, int mode, int index, float delay);
|
||||
|
||||
/**/
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spEventTimeline {
|
||||
spTimeline super;
|
||||
spEvent **events;
|
||||
} spEventTimeline;
|
||||
|
||||
SP_API spEventTimeline *spEventTimeline_create(int framesCount);
|
||||
|
||||
SP_API void spEventTimeline_setFrame(spEventTimeline *self, int frameIndex, spEvent *event);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spDrawOrderTimeline {
|
||||
spTimeline super;
|
||||
int **drawOrders;
|
||||
int slotsCount;
|
||||
} spDrawOrderTimeline;
|
||||
|
||||
SP_API spDrawOrderTimeline *spDrawOrderTimeline_create(int framesCount, int slotsCount);
|
||||
|
||||
SP_API void spDrawOrderTimeline_setFrame(spDrawOrderTimeline *self, int frameIndex, float time, const int *drawOrder);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spInheritTimeline {
|
||||
spTimeline super;
|
||||
int boneIndex;
|
||||
} spInheritTimeline;
|
||||
|
||||
SP_API spInheritTimeline *spInheritTimeline_create(int framesCount, int boneIndex);
|
||||
|
||||
SP_API void spInheritTimeline_setFrame(spInheritTimeline *self, int frameIndex, float time, spInherit inherit);
|
||||
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spIkConstraintTimeline {
|
||||
spCurveTimeline super;
|
||||
int ikConstraintIndex;
|
||||
} spIkConstraintTimeline;
|
||||
|
||||
SP_API spIkConstraintTimeline *
|
||||
spIkConstraintTimeline_create(int framesCount, int bezierCount, int transformConstraintIndex);
|
||||
|
||||
SP_API void
|
||||
spIkConstraintTimeline_setFrame(spIkConstraintTimeline *self, int frameIndex, float time, float mix, float softness,
|
||||
int bendDirection, int /*boolean*/ compress, int /**boolean**/ stretch);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spTransformConstraintTimeline {
|
||||
spCurveTimeline super;
|
||||
int transformConstraintIndex;
|
||||
} spTransformConstraintTimeline;
|
||||
|
||||
SP_API spTransformConstraintTimeline *
|
||||
spTransformConstraintTimeline_create(int framesCount, int bezierCount, int transformConstraintIndex);
|
||||
|
||||
SP_API void
|
||||
spTransformConstraintTimeline_setFrame(spTransformConstraintTimeline *self, int frameIndex, float time, float mixRotate,
|
||||
float mixX, float mixY, float mixScaleX, float mixScaleY, float mixShearY);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spPathConstraintPositionTimeline {
|
||||
spCurveTimeline super;
|
||||
int pathConstraintIndex;
|
||||
} spPathConstraintPositionTimeline;
|
||||
|
||||
SP_API spPathConstraintPositionTimeline *
|
||||
spPathConstraintPositionTimeline_create(int framesCount, int bezierCount, int pathConstraintIndex);
|
||||
|
||||
SP_API void
|
||||
spPathConstraintPositionTimeline_setFrame(spPathConstraintPositionTimeline *self, int frameIndex, float time,
|
||||
float value);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spPathConstraintSpacingTimeline {
|
||||
spCurveTimeline super;
|
||||
int pathConstraintIndex;
|
||||
} spPathConstraintSpacingTimeline;
|
||||
|
||||
SP_API spPathConstraintSpacingTimeline *
|
||||
spPathConstraintSpacingTimeline_create(int framesCount, int bezierCount, int pathConstraintIndex);
|
||||
|
||||
SP_API void spPathConstraintSpacingTimeline_setFrame(spPathConstraintSpacingTimeline *self, int frameIndex, float time,
|
||||
float value);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spPathConstraintMixTimeline {
|
||||
spCurveTimeline super;
|
||||
int pathConstraintIndex;
|
||||
} spPathConstraintMixTimeline;
|
||||
|
||||
SP_API spPathConstraintMixTimeline *
|
||||
spPathConstraintMixTimeline_create(int framesCount, int bezierCount, int pathConstraintIndex);
|
||||
|
||||
SP_API void
|
||||
spPathConstraintMixTimeline_setFrame(spPathConstraintMixTimeline *self, int frameIndex, float time, float mixRotate,
|
||||
float mixX, float mixY);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spPhysicsConstraintTimeline {
|
||||
spCurveTimeline super;
|
||||
int physicsConstraintIndex;
|
||||
} spPhysicsConstraintTimeline;
|
||||
|
||||
SP_API spPhysicsConstraintTimeline *
|
||||
spPhysicsConstraintTimeline_create(int framesCount, int bezierCount, int physicsConstraintIndex, spTimelineType type);
|
||||
|
||||
SP_API void spPhysicsConstraintTimeline_setFrame(spPhysicsConstraintTimeline *self, int frame, float time, float value);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spPhysicsConstraintResetTimeline {
|
||||
spTimeline super;
|
||||
int physicsConstraintIndex;
|
||||
} spPhysicsConstraintResetTimeline;
|
||||
|
||||
SP_API spPhysicsConstraintResetTimeline *spPhysicsConstraintResetTimeline_create(int framesCount, int boneIndex);
|
||||
|
||||
SP_API void spPhysicsConstraintResetTimeline_setFrame(spPhysicsConstraintResetTimeline *self, int frameIndex, float time);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_ANIMATION_H_ */
|
||||
@ -1,164 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_ANIMATIONSTATE_H_
|
||||
#define SPINE_ANIMATIONSTATE_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/Animation.h>
|
||||
#include <spine/AnimationStateData.h>
|
||||
#include <spine/Event.h>
|
||||
#include <spine/Array.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
SP_ANIMATION_START,
|
||||
SP_ANIMATION_INTERRUPT,
|
||||
SP_ANIMATION_END,
|
||||
SP_ANIMATION_COMPLETE,
|
||||
SP_ANIMATION_DISPOSE,
|
||||
SP_ANIMATION_EVENT
|
||||
} spEventType;
|
||||
|
||||
typedef struct spAnimationState spAnimationState;
|
||||
typedef struct spTrackEntry spTrackEntry;
|
||||
|
||||
typedef void (*spAnimationStateListener)(spAnimationState *state, spEventType type, spTrackEntry *entry,
|
||||
spEvent *event);
|
||||
|
||||
_SP_ARRAY_DECLARE_TYPE(spTrackEntryArray, spTrackEntry*)
|
||||
|
||||
struct spTrackEntry {
|
||||
spAnimation *animation;
|
||||
spTrackEntry *previous;
|
||||
spTrackEntry *next;
|
||||
spTrackEntry *mixingFrom;
|
||||
spTrackEntry *mixingTo;
|
||||
spAnimationStateListener listener;
|
||||
int trackIndex;
|
||||
int /*boolean*/ loop;
|
||||
int /*boolean*/ holdPrevious;
|
||||
int /*boolean*/ reverse;
|
||||
int /*boolean*/ shortestRotation;
|
||||
float eventThreshold, mixAttachmentThreshold, alphaAttachmentThreshold, mixDrawOrderThreshold;
|
||||
float animationStart, animationEnd, animationLast, nextAnimationLast;
|
||||
float delay, trackTime, trackLast, nextTrackLast, trackEnd, timeScale;
|
||||
float alpha, mixTime, mixDuration, interruptAlpha, totalAlpha;
|
||||
spMixBlend mixBlend;
|
||||
spIntArray *timelineMode;
|
||||
spTrackEntryArray *timelineHoldMix;
|
||||
float *timelinesRotation;
|
||||
int timelinesRotationCount;
|
||||
void *rendererObject;
|
||||
void *userData;
|
||||
};
|
||||
|
||||
struct spAnimationState {
|
||||
spAnimationStateData *data;
|
||||
|
||||
int tracksCount;
|
||||
spTrackEntry **tracks;
|
||||
|
||||
spAnimationStateListener listener;
|
||||
|
||||
float timeScale;
|
||||
|
||||
void *rendererObject;
|
||||
void *userData;
|
||||
|
||||
int unkeyedState;
|
||||
};
|
||||
|
||||
/* @param data May be 0 for no mixing. */
|
||||
SP_API spAnimationState *spAnimationState_create(spAnimationStateData *data);
|
||||
|
||||
SP_API void spAnimationState_dispose(spAnimationState *self);
|
||||
|
||||
SP_API void spAnimationState_update(spAnimationState *self, float delta);
|
||||
|
||||
SP_API int /**bool**/ spAnimationState_apply(spAnimationState *self, struct spSkeleton *skeleton);
|
||||
|
||||
SP_API void spAnimationState_clearTracks(spAnimationState *self);
|
||||
|
||||
SP_API void spAnimationState_clearTrack(spAnimationState *self, int trackIndex);
|
||||
|
||||
/** Set the current animation. Any queued animations are cleared. */
|
||||
SP_API spTrackEntry *
|
||||
spAnimationState_setAnimationByName(spAnimationState *self, int trackIndex, const char *animationName,
|
||||
int/*bool*/loop);
|
||||
|
||||
SP_API spTrackEntry *
|
||||
spAnimationState_setAnimation(spAnimationState *self, int trackIndex, spAnimation *animation, int/*bool*/loop);
|
||||
|
||||
/** Adds an animation to be played delay seconds after the current or last queued animation, taking into account any mix
|
||||
* duration. */
|
||||
SP_API spTrackEntry *
|
||||
spAnimationState_addAnimationByName(spAnimationState *self, int trackIndex, const char *animationName,
|
||||
int/*bool*/loop, float delay);
|
||||
|
||||
SP_API spTrackEntry *
|
||||
spAnimationState_addAnimation(spAnimationState *self, int trackIndex, spAnimation *animation, int/*bool*/loop,
|
||||
float delay);
|
||||
|
||||
SP_API spTrackEntry *spAnimationState_setEmptyAnimation(spAnimationState *self, int trackIndex, float mixDuration);
|
||||
|
||||
SP_API spTrackEntry *
|
||||
spAnimationState_addEmptyAnimation(spAnimationState *self, int trackIndex, float mixDuration, float delay);
|
||||
|
||||
SP_API void spAnimationState_setEmptyAnimations(spAnimationState *self, float mixDuration);
|
||||
|
||||
SP_API spTrackEntry *spAnimationState_getCurrent(spAnimationState *self, int trackIndex);
|
||||
|
||||
SP_API void spAnimationState_clearListenerNotifications(spAnimationState *self);
|
||||
|
||||
SP_API float spTrackEntry_getAnimationTime(spTrackEntry *entry);
|
||||
|
||||
SP_API void spTrackEntry_resetRotationDirections(spTrackEntry *entry);
|
||||
|
||||
SP_API float spTrackEntry_getTrackComplete(spTrackEntry *entry);
|
||||
|
||||
SP_API void spTrackEntry_setMixDuration(spTrackEntry *entry, float mixDuration, float delay);
|
||||
|
||||
SP_API int/*bool*/ spTrackEntry_wasApplied(spTrackEntry *entry);
|
||||
|
||||
SP_API int/*bool*/ spTrackEntry_isNextReady(spTrackEntry *entry);
|
||||
|
||||
SP_API void spAnimationState_clearNext(spAnimationState *self, spTrackEntry *entry);
|
||||
|
||||
/** Use this to dispose static memory before your app exits to appease your memory leak detector*/
|
||||
SP_API void spAnimationState_disposeStatics(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_ANIMATIONSTATE_H_ */
|
||||
@ -1,62 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_ANIMATIONSTATEDATA_H_
|
||||
#define SPINE_ANIMATIONSTATEDATA_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/Animation.h>
|
||||
#include <spine/SkeletonData.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spAnimationStateData {
|
||||
spSkeletonData *skeletonData;
|
||||
float defaultMix;
|
||||
const void *entries;
|
||||
} spAnimationStateData;
|
||||
|
||||
SP_API spAnimationStateData *spAnimationStateData_create(spSkeletonData *skeletonData);
|
||||
|
||||
SP_API void spAnimationStateData_dispose(spAnimationStateData *self);
|
||||
|
||||
SP_API void
|
||||
spAnimationStateData_setMixByName(spAnimationStateData *self, const char *fromName, const char *toName, float duration);
|
||||
|
||||
SP_API void spAnimationStateData_setMix(spAnimationStateData *self, spAnimation *from, spAnimation *to, float duration);
|
||||
/* Returns 0 if there is no mixing between the animations. */
|
||||
SP_API float spAnimationStateData_getMix(spAnimationStateData *self, spAnimation *from, spAnimation *to);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_ANIMATIONSTATEDATA_H_ */
|
||||
@ -1,196 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_ARRAY_H
|
||||
#define SPINE_ARRAY_H
|
||||
|
||||
#include <spine/dll.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define _SP_ARRAY_DECLARE_TYPE(name, itemType) \
|
||||
typedef struct name { int size; int capacity; itemType* items; } name; \
|
||||
SP_API name* name##_create(int initialCapacity); \
|
||||
SP_API void name##_dispose(name* self); \
|
||||
SP_API void name##_clear(name* self); \
|
||||
SP_API name* name##_setSize(name* self, int newSize); \
|
||||
SP_API void name##_ensureCapacity(name* self, int newCapacity); \
|
||||
SP_API void name##_add(name* self, itemType value); \
|
||||
SP_API void name##_addAll(name* self, name* other); \
|
||||
SP_API void name##_addAllValues(name* self, itemType* values, int offset, int count); \
|
||||
SP_API void name##_removeAt(name* self, int index); \
|
||||
SP_API int name##_contains(name* self, itemType value); \
|
||||
SP_API itemType name##_pop(name* self); \
|
||||
SP_API itemType name##_peek(name* self);
|
||||
|
||||
#define _SP_ARRAY_IMPLEMENT_TYPE(name, itemType) \
|
||||
name* name##_create(int initialCapacity) { \
|
||||
name* array = CALLOC(name, 1); \
|
||||
array->size = 0; \
|
||||
array->capacity = initialCapacity; \
|
||||
array->items = CALLOC(itemType, initialCapacity); \
|
||||
return array; \
|
||||
} \
|
||||
void name##_dispose(name* self) { \
|
||||
FREE(self->items); \
|
||||
FREE(self); \
|
||||
} \
|
||||
void name##_clear(name* self) { \
|
||||
self->size = 0; \
|
||||
} \
|
||||
name* name##_setSize(name* self, int newSize) { \
|
||||
self->size = newSize; \
|
||||
if (self->capacity < newSize) { \
|
||||
self->capacity = MAX(8, (int)(self->size * 1.75f)); \
|
||||
self->items = REALLOC(self->items, itemType, self->capacity); \
|
||||
} \
|
||||
return self; \
|
||||
} \
|
||||
void name##_ensureCapacity(name* self, int newCapacity) { \
|
||||
if (self->capacity >= newCapacity) return; \
|
||||
self->capacity = newCapacity; \
|
||||
self->items = REALLOC(self->items, itemType, self->capacity); \
|
||||
} \
|
||||
void name##_add(name* self, itemType value) { \
|
||||
if (self->size == self->capacity) { \
|
||||
self->capacity = MAX(8, (int)(self->size * 1.75f)); \
|
||||
self->items = REALLOC(self->items, itemType, self->capacity); \
|
||||
} \
|
||||
self->items[self->size++] = value; \
|
||||
} \
|
||||
void name##_addAll(name* self, name* other) { \
|
||||
int i = 0; \
|
||||
for (; i < other->size; i++) { \
|
||||
name##_add(self, other->items[i]); \
|
||||
} \
|
||||
} \
|
||||
void name##_addAllValues(name* self, itemType* values, int offset, int count) { \
|
||||
int i = offset, n = offset + count; \
|
||||
for (; i < n; i++) { \
|
||||
name##_add(self, values[i]); \
|
||||
} \
|
||||
} \
|
||||
void name##_removeAt(name* self, int index) { \
|
||||
self->size--; \
|
||||
memmove(self->items + index, self->items + index + 1, sizeof(itemType) * (self->size - index)); \
|
||||
} \
|
||||
int name##_contains(name* self, itemType value) { \
|
||||
itemType* items = self->items; \
|
||||
int i, n; \
|
||||
for (i = 0, n = self->size; i < n; i++) { \
|
||||
if (items[i] == value) return -1; \
|
||||
} \
|
||||
return 0; \
|
||||
} \
|
||||
itemType name##_pop(name* self) { \
|
||||
itemType item = self->items[--self->size]; \
|
||||
return item; \
|
||||
} \
|
||||
itemType name##_peek(name* self) { \
|
||||
return self->items[self->size - 1]; \
|
||||
}
|
||||
|
||||
#define _SP_ARRAY_IMPLEMENT_TYPE_NO_CONTAINS(name, itemType) \
|
||||
name* name##_create(int initialCapacity) { \
|
||||
name* array = CALLOC(name, 1); \
|
||||
array->size = 0; \
|
||||
array->capacity = initialCapacity; \
|
||||
array->items = CALLOC(itemType, initialCapacity); \
|
||||
return array; \
|
||||
} \
|
||||
void name##_dispose(name* self) { \
|
||||
FREE(self->items); \
|
||||
FREE(self); \
|
||||
} \
|
||||
void name##_clear(name* self) { \
|
||||
self->size = 0; \
|
||||
} \
|
||||
name* name##_setSize(name* self, int newSize) { \
|
||||
self->size = newSize; \
|
||||
if (self->capacity < newSize) { \
|
||||
self->capacity = MAX(8, (int)(self->size * 1.75f)); \
|
||||
self->items = REALLOC(self->items, itemType, self->capacity); \
|
||||
} \
|
||||
return self; \
|
||||
} \
|
||||
void name##_ensureCapacity(name* self, int newCapacity) { \
|
||||
if (self->capacity >= newCapacity) return; \
|
||||
self->capacity = newCapacity; \
|
||||
self->items = REALLOC(self->items, itemType, self->capacity); \
|
||||
} \
|
||||
void name##_add(name* self, itemType value) { \
|
||||
if (self->size == self->capacity) { \
|
||||
self->capacity = MAX(8, (int)(self->size * 1.75f)); \
|
||||
self->items = REALLOC(self->items, itemType, self->capacity); \
|
||||
} \
|
||||
self->items[self->size++] = value; \
|
||||
} \
|
||||
void name##_addAll(name* self, name* other) { \
|
||||
int i = 0; \
|
||||
for (; i < other->size; i++) { \
|
||||
name##_add(self, other->items[i]); \
|
||||
} \
|
||||
} \
|
||||
void name##_addAllValues(name* self, itemType* values, int offset, int count) { \
|
||||
int i = offset, n = offset + count; \
|
||||
for (; i < n; i++) { \
|
||||
name##_add(self, values[i]); \
|
||||
} \
|
||||
} \
|
||||
void name##_removeAt(name* self, int index) { \
|
||||
self->size--; \
|
||||
memmove(self->items + index, self->items + index + 1, sizeof(itemType) * (self->size - index)); \
|
||||
} \
|
||||
itemType name##_pop(name* self) { \
|
||||
itemType item = self->items[--self->size]; \
|
||||
return item; \
|
||||
} \
|
||||
itemType name##_peek(name* self) { \
|
||||
return self->items[self->size - 1]; \
|
||||
}
|
||||
|
||||
_SP_ARRAY_DECLARE_TYPE(spFloatArray, float)
|
||||
|
||||
_SP_ARRAY_DECLARE_TYPE(spIntArray, int)
|
||||
|
||||
_SP_ARRAY_DECLARE_TYPE(spShortArray, short)
|
||||
|
||||
_SP_ARRAY_DECLARE_TYPE(spUnsignedShortArray, unsigned short)
|
||||
|
||||
_SP_ARRAY_DECLARE_TYPE(spArrayFloatArray, spFloatArray*)
|
||||
|
||||
_SP_ARRAY_DECLARE_TYPE(spArrayShortArray, spShortArray*)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_ARRAY_H */
|
||||
@ -1,140 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_ATLAS_H_
|
||||
#define SPINE_ATLAS_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/Array.h>
|
||||
#include "TextureRegion.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spAtlas spAtlas;
|
||||
|
||||
typedef enum {
|
||||
SP_ATLAS_UNKNOWN_FORMAT,
|
||||
SP_ATLAS_ALPHA,
|
||||
SP_ATLAS_INTENSITY,
|
||||
SP_ATLAS_LUMINANCE_ALPHA,
|
||||
SP_ATLAS_RGB565,
|
||||
SP_ATLAS_RGBA4444,
|
||||
SP_ATLAS_RGB888,
|
||||
SP_ATLAS_RGBA8888
|
||||
} spAtlasFormat;
|
||||
|
||||
typedef enum {
|
||||
SP_ATLAS_UNKNOWN_FILTER,
|
||||
SP_ATLAS_NEAREST,
|
||||
SP_ATLAS_LINEAR,
|
||||
SP_ATLAS_MIPMAP,
|
||||
SP_ATLAS_MIPMAP_NEAREST_NEAREST,
|
||||
SP_ATLAS_MIPMAP_LINEAR_NEAREST,
|
||||
SP_ATLAS_MIPMAP_NEAREST_LINEAR,
|
||||
SP_ATLAS_MIPMAP_LINEAR_LINEAR
|
||||
} spAtlasFilter;
|
||||
|
||||
typedef enum {
|
||||
SP_ATLAS_MIRROREDREPEAT,
|
||||
SP_ATLAS_CLAMPTOEDGE,
|
||||
SP_ATLAS_REPEAT
|
||||
} spAtlasWrap;
|
||||
|
||||
typedef struct spAtlasPage spAtlasPage;
|
||||
struct spAtlasPage {
|
||||
spAtlas *atlas;
|
||||
char *name;
|
||||
spAtlasFormat format;
|
||||
spAtlasFilter minFilter, magFilter;
|
||||
spAtlasWrap uWrap, vWrap;
|
||||
|
||||
void *rendererObject;
|
||||
int width, height;
|
||||
int /*boolean*/ pma;
|
||||
|
||||
spAtlasPage *next;
|
||||
};
|
||||
|
||||
SP_API spAtlasPage *spAtlasPage_create(spAtlas *atlas, const char *name);
|
||||
|
||||
SP_API void spAtlasPage_dispose(spAtlasPage *self);
|
||||
|
||||
/**/
|
||||
typedef struct spKeyValue {
|
||||
char *name;
|
||||
float values[5];
|
||||
} spKeyValue;
|
||||
_SP_ARRAY_DECLARE_TYPE(spKeyValueArray, spKeyValue)
|
||||
|
||||
/**/
|
||||
typedef struct spAtlasRegion spAtlasRegion;
|
||||
struct spAtlasRegion {
|
||||
spTextureRegion super;
|
||||
const char *name;
|
||||
int x, y;
|
||||
int index;
|
||||
int *splits;
|
||||
int *pads;
|
||||
spKeyValueArray *keyValues;
|
||||
|
||||
spAtlasPage *page;
|
||||
|
||||
spAtlasRegion *next;
|
||||
};
|
||||
|
||||
SP_API spAtlasRegion *spAtlasRegion_create(void);
|
||||
|
||||
SP_API void spAtlasRegion_dispose(spAtlasRegion *self);
|
||||
|
||||
/**/
|
||||
|
||||
struct spAtlas {
|
||||
spAtlasPage *pages;
|
||||
spAtlasRegion *regions;
|
||||
|
||||
void *rendererObject;
|
||||
};
|
||||
|
||||
/* Image files referenced in the atlas file will be prefixed with dir. */
|
||||
SP_API spAtlas *spAtlas_create(const char *data, int length, const char *dir, void *rendererObject);
|
||||
/* Image files referenced in the atlas file will be prefixed with the directory containing the atlas file. */
|
||||
SP_API spAtlas *spAtlas_createFromFile(const char *path, void *rendererObject);
|
||||
|
||||
SP_API void spAtlas_dispose(spAtlas *atlas);
|
||||
|
||||
/* Returns 0 if the region was not found. */
|
||||
SP_API spAtlasRegion *spAtlas_findRegion(const spAtlas *self, const char *name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_ATLAS_H_ */
|
||||
@ -1,52 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_ATLASATTACHMENTLOADER_H_
|
||||
#define SPINE_ATLASATTACHMENTLOADER_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/AttachmentLoader.h>
|
||||
#include <spine/Atlas.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spAtlasAttachmentLoader {
|
||||
spAttachmentLoader super;
|
||||
spAtlas *atlas;
|
||||
} spAtlasAttachmentLoader;
|
||||
|
||||
SP_API spAtlasAttachmentLoader *spAtlasAttachmentLoader_create(spAtlas *atlas);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_ATLASATTACHMENTLOADER_H_ */
|
||||
@ -1,67 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_ATTACHMENT_H_
|
||||
#define SPINE_ATTACHMENT_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct spAttachmentLoader;
|
||||
|
||||
typedef enum {
|
||||
SP_ATTACHMENT_REGION,
|
||||
SP_ATTACHMENT_BOUNDING_BOX,
|
||||
SP_ATTACHMENT_MESH,
|
||||
SP_ATTACHMENT_LINKED_MESH,
|
||||
SP_ATTACHMENT_PATH,
|
||||
SP_ATTACHMENT_POINT,
|
||||
SP_ATTACHMENT_CLIPPING
|
||||
} spAttachmentType;
|
||||
|
||||
typedef struct spAttachment {
|
||||
char *name;
|
||||
spAttachmentType type;
|
||||
const void *vtable;
|
||||
int refCount;
|
||||
struct spAttachmentLoader *attachmentLoader;
|
||||
} spAttachment;
|
||||
|
||||
void spAttachment_dispose(spAttachment *self);
|
||||
|
||||
spAttachment *spAttachment_copy(spAttachment *self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_ATTACHMENT_H_ */
|
||||
@ -1,65 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_ATTACHMENTLOADER_H_
|
||||
#define SPINE_ATTACHMENTLOADER_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/Attachment.h>
|
||||
#include <spine/Skin.h>
|
||||
#include <spine/Sequence.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spAttachmentLoader {
|
||||
char *error1;
|
||||
char *error2;
|
||||
|
||||
const void *vtable;
|
||||
} spAttachmentLoader;
|
||||
|
||||
SP_API void spAttachmentLoader_dispose(spAttachmentLoader *self);
|
||||
|
||||
/* Called to create each attachment. Returns 0 to not load an attachment. If 0 is returned and _spAttachmentLoader_setError was
|
||||
* called, an error occurred. */
|
||||
SP_API spAttachment *
|
||||
spAttachmentLoader_createAttachment(spAttachmentLoader *self, spSkin *skin, spAttachmentType type, const char *name,
|
||||
const char *path, spSequence *sequence);
|
||||
/* Called after the attachment has been fully configured. */
|
||||
SP_API void spAttachmentLoader_configureAttachment(spAttachmentLoader *self, spAttachment *attachment);
|
||||
/* Called just before the attachment is disposed. This can release allocations made in spAttachmentLoader_configureAttachment. */
|
||||
SP_API void spAttachmentLoader_disposeAttachment(spAttachmentLoader *self, spAttachment *attachment);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_ATTACHMENTLOADER_H_ */
|
||||
@ -1,108 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_BONE_H_
|
||||
#define SPINE_BONE_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/BoneData.h>
|
||||
#include <spine/Physics.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct spSkeleton;
|
||||
|
||||
typedef struct spBone spBone;
|
||||
struct spBone {
|
||||
spBoneData *data;
|
||||
struct spSkeleton *skeleton;
|
||||
spBone *parent;
|
||||
int childrenCount;
|
||||
spBone **children;
|
||||
float x, y, rotation, scaleX, scaleY, shearX, shearY;
|
||||
float ax, ay, arotation, ascaleX, ascaleY, ashearX, ashearY;
|
||||
|
||||
float a, b, worldX;
|
||||
float c, d, worldY;
|
||||
|
||||
int/*bool*/ sorted;
|
||||
int/*bool*/ active;
|
||||
|
||||
spInherit inherit;
|
||||
};
|
||||
|
||||
SP_API void spBone_setYDown(int/*bool*/yDown);
|
||||
|
||||
SP_API int/*bool*/spBone_isYDown(void);
|
||||
|
||||
/* @param parent May be 0. */
|
||||
SP_API spBone *spBone_create(spBoneData *data, struct spSkeleton *skeleton, spBone *parent);
|
||||
|
||||
SP_API void spBone_dispose(spBone *self);
|
||||
|
||||
SP_API void spBone_setToSetupPose(spBone *self);
|
||||
|
||||
SP_API void spBone_update(spBone *self);
|
||||
|
||||
SP_API void spBone_updateWorldTransform(spBone *self);
|
||||
|
||||
SP_API void spBone_updateWorldTransformWith(spBone *self, float x, float y, float rotation, float scaleX, float scaleY,
|
||||
float shearX, float shearY);
|
||||
|
||||
SP_API float spBone_getWorldRotationX(spBone *self);
|
||||
|
||||
SP_API float spBone_getWorldRotationY(spBone *self);
|
||||
|
||||
SP_API float spBone_getWorldScaleX(spBone *self);
|
||||
|
||||
SP_API float spBone_getWorldScaleY(spBone *self);
|
||||
|
||||
SP_API void spBone_updateAppliedTransform(spBone *self);
|
||||
|
||||
SP_API void spBone_worldToLocal(spBone *self, float worldX, float worldY, float *localX, float *localY);
|
||||
|
||||
SP_API void spBone_worldToParent(spBone *self, float worldX, float worldY, float *parentX, float *parentY);
|
||||
|
||||
SP_API void spBone_localToWorld(spBone *self, float localX, float localY, float *worldX, float *worldY);
|
||||
|
||||
SP_API void spBone_localToParent(spBone *self, float localX, float localY, float *parentX, float *parentY);
|
||||
|
||||
SP_API float spBone_worldToLocalRotation(spBone *self, float worldRotation);
|
||||
|
||||
SP_API float spBone_localToWorldRotation(spBone *self, float localRotation);
|
||||
|
||||
SP_API void spBone_rotateWorld(spBone *self, float degrees);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_BONE_H_ */
|
||||
@ -1,70 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_BONEDATA_H_
|
||||
#define SPINE_BONEDATA_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/Color.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
SP_INHERIT_NORMAL,
|
||||
SP_INHERIT_ONLYTRANSLATION,
|
||||
SP_INHERIT_NOROTATIONORREFLECTION,
|
||||
SP_INHERIT_NOSCALE,
|
||||
SP_INHERIT_NOSCALEORREFLECTION
|
||||
} spInherit;
|
||||
|
||||
typedef struct spBoneData spBoneData;
|
||||
struct spBoneData {
|
||||
int index;
|
||||
char *name;
|
||||
spBoneData *parent;
|
||||
float length;
|
||||
float x, y, rotation, scaleX, scaleY, shearX, shearY;
|
||||
spInherit inherit;
|
||||
int/*bool*/ skinRequired;
|
||||
spColor color;
|
||||
const char *icon;
|
||||
int/*bool*/ visible;
|
||||
};
|
||||
|
||||
SP_API spBoneData *spBoneData_create(int index, const char *name, spBoneData *parent);
|
||||
|
||||
SP_API void spBoneData_dispose(spBoneData *self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_BONEDATA_H_ */
|
||||
@ -1,54 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_BOUNDINGBOXATTACHMENT_H_
|
||||
#define SPINE_BOUNDINGBOXATTACHMENT_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/Attachment.h>
|
||||
#include <spine/VertexAttachment.h>
|
||||
#include <spine/Atlas.h>
|
||||
#include <spine/Slot.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spBoundingBoxAttachment {
|
||||
spVertexAttachment super;
|
||||
spColor color;
|
||||
} spBoundingBoxAttachment;
|
||||
|
||||
SP_API spBoundingBoxAttachment *spBoundingBoxAttachment_create(const char *name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_BOUNDINGBOXATTACHMENT_H_ */
|
||||
@ -1,57 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_CLIPPINGATTACHMENT_H_
|
||||
#define SPINE_CLIPPINGATTACHMENT_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/Attachment.h>
|
||||
#include <spine/VertexAttachment.h>
|
||||
#include <spine/Atlas.h>
|
||||
#include <spine/Slot.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spClippingAttachment {
|
||||
spVertexAttachment super;
|
||||
spSlotData *endSlot;
|
||||
spColor color;
|
||||
} spClippingAttachment;
|
||||
|
||||
SP_API void _spClippingAttachment_dispose(spAttachment *self);
|
||||
|
||||
SP_API spClippingAttachment *spClippingAttachment_create(const char *name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_CLIPPINGATTACHMENT_H_ */
|
||||
@ -1,68 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_COLOR_H_
|
||||
#define SPINE_COLOR_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spColor {
|
||||
float r, g, b, a;
|
||||
} spColor;
|
||||
|
||||
/* @param attachmentName May be 0 for no setup pose attachment. */
|
||||
SP_API spColor *spColor_create(void);
|
||||
|
||||
SP_API void spColor_dispose(spColor *self);
|
||||
|
||||
SP_API void spColor_setFromFloats(spColor *color, float r, float g, float b, float a);
|
||||
|
||||
SP_API void spColor_setFromFloats3(spColor *self, float r, float g, float b);
|
||||
|
||||
SP_API void spColor_setFromColor(spColor *color, spColor *otherColor);
|
||||
|
||||
SP_API void spColor_setFromColor3(spColor *self, spColor *otherColor);
|
||||
|
||||
SP_API void spColor_addFloats(spColor *color, float r, float g, float b, float a);
|
||||
|
||||
SP_API void spColor_addFloats3(spColor *color, float r, float g, float b);
|
||||
|
||||
SP_API void spColor_addColor(spColor *color, spColor *otherColor);
|
||||
|
||||
SP_API void spColor_clamp(spColor *color);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_COLOR_H_ */
|
||||
@ -1,61 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_DEBUG_H_
|
||||
#define SPINE_DEBUG_H_
|
||||
|
||||
#include <spine/spine.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void spDebug_printSkeletonData(spSkeletonData *skeletonData);
|
||||
|
||||
void spDebug_printAnimation(spAnimation *animation);
|
||||
|
||||
void spDebug_printTimeline(spTimeline *timeline);
|
||||
|
||||
void spDebug_printBoneDatas(spBoneData **boneDatas, int numBoneDatas);
|
||||
|
||||
void spDebug_printBoneData(spBoneData *boneData);
|
||||
|
||||
void spDebug_printSkeleton(spSkeleton *skeleton);
|
||||
|
||||
void spDebug_printBones(spBone **bones, int numBones);
|
||||
|
||||
void spDebug_printBone(spBone *bone);
|
||||
|
||||
void spDebug_printFloats(float *values, int numFloats);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,58 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_EVENT_H_
|
||||
#define SPINE_EVENT_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/EventData.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spEvent {
|
||||
spEventData *data;
|
||||
float time;
|
||||
int intValue;
|
||||
float floatValue;
|
||||
char *stringValue;
|
||||
float volume;
|
||||
float balance;
|
||||
} spEvent;
|
||||
|
||||
SP_API spEvent *spEvent_create(float time, spEventData *data);
|
||||
|
||||
SP_API void spEvent_dispose(spEvent *self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_EVENT_H_ */
|
||||
@ -1,57 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_EVENTDATA_H_
|
||||
#define SPINE_EVENTDATA_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spEventData {
|
||||
char *name;
|
||||
int intValue;
|
||||
float floatValue;
|
||||
char *stringValue;
|
||||
char *audioPath;
|
||||
float volume;
|
||||
float balance;
|
||||
} spEventData;
|
||||
|
||||
SP_API spEventData *spEventData_create(const char *name);
|
||||
|
||||
SP_API void spEventData_dispose(spEventData *self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_EVENTDATA_H_ */
|
||||
@ -1,78 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_IKCONSTRAINT_H_
|
||||
#define SPINE_IKCONSTRAINT_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/IkConstraintData.h>
|
||||
#include <spine/Bone.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct spSkeleton;
|
||||
|
||||
typedef struct spIkConstraint {
|
||||
spIkConstraintData *data;
|
||||
|
||||
int bonesCount;
|
||||
spBone **bones;
|
||||
|
||||
spBone *target;
|
||||
int bendDirection;
|
||||
int /*boolean*/ compress;
|
||||
int /*boolean*/ stretch;
|
||||
float mix;
|
||||
float softness;
|
||||
|
||||
int /*boolean*/ active;
|
||||
} spIkConstraint;
|
||||
|
||||
SP_API spIkConstraint *spIkConstraint_create(spIkConstraintData *data, const struct spSkeleton *skeleton);
|
||||
|
||||
SP_API void spIkConstraint_dispose(spIkConstraint *self);
|
||||
|
||||
SP_API void spIkConstraint_update(spIkConstraint *self);
|
||||
|
||||
SP_API void spIkConstraint_setToSetupPose(spIkConstraint *self);
|
||||
|
||||
SP_API void
|
||||
spIkConstraint_apply1(spBone *bone, float targetX, float targetY, int /*boolean*/ compress, int /*boolean*/ stretch,
|
||||
int /*boolean*/ uniform, float alpha);
|
||||
|
||||
SP_API void spIkConstraint_apply2(spBone *parent, spBone *child, float targetX, float targetY, int bendDirection,
|
||||
int /*boolean*/ stretch, int /*boolean*/ uniform, float softness, float alpha);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_IKCONSTRAINT_H_ */
|
||||
@ -1,64 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_IKCONSTRAINTDATA_H_
|
||||
#define SPINE_IKCONSTRAINTDATA_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/BoneData.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spIkConstraintData {
|
||||
char *name;
|
||||
int order;
|
||||
int /*boolean*/ skinRequired;
|
||||
int bonesCount;
|
||||
spBoneData **bones;
|
||||
|
||||
spBoneData *target;
|
||||
int bendDirection;
|
||||
int /*boolean*/ compress;
|
||||
int /*boolean*/ stretch;
|
||||
int /*boolean*/ uniform;
|
||||
float mix;
|
||||
float softness;
|
||||
} spIkConstraintData;
|
||||
|
||||
SP_API spIkConstraintData *spIkConstraintData_create(const char *name);
|
||||
|
||||
SP_API void spIkConstraintData_dispose(spIkConstraintData *self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_IKCONSTRAINTDATA_H_ */
|
||||
@ -1,84 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_MESHATTACHMENT_H_
|
||||
#define SPINE_MESHATTACHMENT_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/Attachment.h>
|
||||
#include <spine/VertexAttachment.h>
|
||||
#include <spine/Atlas.h>
|
||||
#include <spine/Slot.h>
|
||||
#include <spine/Sequence.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spMeshAttachment spMeshAttachment;
|
||||
struct spMeshAttachment {
|
||||
spVertexAttachment super;
|
||||
|
||||
void *rendererObject;
|
||||
spTextureRegion *region;
|
||||
spSequence *sequence;
|
||||
|
||||
char *path;
|
||||
|
||||
float *regionUVs;
|
||||
float *uvs;
|
||||
|
||||
int trianglesCount;
|
||||
unsigned short *triangles;
|
||||
|
||||
spColor color;
|
||||
|
||||
int hullLength;
|
||||
|
||||
spMeshAttachment *parentMesh;
|
||||
|
||||
/* Nonessential. */
|
||||
int edgesCount;
|
||||
unsigned short *edges;
|
||||
float width, height;
|
||||
};
|
||||
|
||||
SP_API spMeshAttachment *spMeshAttachment_create(const char *name);
|
||||
|
||||
SP_API void spMeshAttachment_updateRegion(spMeshAttachment *self);
|
||||
|
||||
SP_API void spMeshAttachment_setParentMesh(spMeshAttachment *self, spMeshAttachment *parentMesh);
|
||||
|
||||
SP_API spMeshAttachment *spMeshAttachment_newLinkedMesh(spMeshAttachment *self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_MESHATTACHMENT_H_ */
|
||||
@ -1,57 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_PATHATTACHMENT_H_
|
||||
#define SPINE_PATHATTACHMENT_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/Attachment.h>
|
||||
#include <spine/VertexAttachment.h>
|
||||
#include <spine/Atlas.h>
|
||||
#include <spine/Slot.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spPathAttachment {
|
||||
spVertexAttachment super;
|
||||
int lengthsLength;
|
||||
float *lengths;
|
||||
int/*bool*/ closed, constantSpeed;
|
||||
spColor color;
|
||||
} spPathAttachment;
|
||||
|
||||
SP_API spPathAttachment *spPathAttachment_create(const char *name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_PATHATTACHMENT_H_ */
|
||||
@ -1,90 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_PATHCONSTRAINT_H_
|
||||
#define SPINE_PATHCONSTRAINT_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/PathConstraintData.h>
|
||||
#include <spine/Bone.h>
|
||||
#include <spine/Slot.h>
|
||||
#include "PathAttachment.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct spSkeleton;
|
||||
|
||||
typedef struct spPathConstraint {
|
||||
spPathConstraintData *data;
|
||||
int bonesCount;
|
||||
spBone **bones;
|
||||
spSlot *target;
|
||||
float position, spacing;
|
||||
float mixRotate, mixX, mixY;
|
||||
|
||||
int spacesCount;
|
||||
float *spaces;
|
||||
|
||||
int positionsCount;
|
||||
float *positions;
|
||||
|
||||
int worldCount;
|
||||
float *world;
|
||||
|
||||
int curvesCount;
|
||||
float *curves;
|
||||
|
||||
int lengthsCount;
|
||||
float *lengths;
|
||||
|
||||
float segments[10];
|
||||
|
||||
int /*boolean*/ active;
|
||||
} spPathConstraint;
|
||||
|
||||
#define SP_PATHCONSTRAINT_
|
||||
|
||||
SP_API spPathConstraint *spPathConstraint_create(spPathConstraintData *data, const struct spSkeleton *skeleton);
|
||||
|
||||
SP_API void spPathConstraint_dispose(spPathConstraint *self);
|
||||
|
||||
SP_API void spPathConstraint_update(spPathConstraint *self);
|
||||
|
||||
SP_API void spPathConstraint_setToSetupPose(spPathConstraint *self);
|
||||
|
||||
SP_API float *spPathConstraint_computeWorldPositions(spPathConstraint *self, spPathAttachment *path, int spacesCount,
|
||||
int/*bool*/ tangents);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_PATHCONSTRAINT_H_ */
|
||||
@ -1,76 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_PATHCONSTRAINTDATA_H_
|
||||
#define SPINE_PATHCONSTRAINTDATA_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/BoneData.h>
|
||||
#include <spine/SlotData.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
SP_POSITION_MODE_FIXED, SP_POSITION_MODE_PERCENT
|
||||
} spPositionMode;
|
||||
|
||||
typedef enum {
|
||||
SP_SPACING_MODE_LENGTH, SP_SPACING_MODE_FIXED, SP_SPACING_MODE_PERCENT, SP_SPACING_MODE_PROPORTIONAL
|
||||
} spSpacingMode;
|
||||
|
||||
typedef enum {
|
||||
SP_ROTATE_MODE_TANGENT, SP_ROTATE_MODE_CHAIN, SP_ROTATE_MODE_CHAIN_SCALE
|
||||
} spRotateMode;
|
||||
|
||||
typedef struct spPathConstraintData {
|
||||
char *name;
|
||||
int order;
|
||||
int/*bool*/ skinRequired;
|
||||
int bonesCount;
|
||||
spBoneData **bones;
|
||||
spSlotData *target;
|
||||
spPositionMode positionMode;
|
||||
spSpacingMode spacingMode;
|
||||
spRotateMode rotateMode;
|
||||
float offsetRotation;
|
||||
float position, spacing;
|
||||
float mixRotate, mixX, mixY;
|
||||
} spPathConstraintData;
|
||||
|
||||
SP_API spPathConstraintData *spPathConstraintData_create(const char *name);
|
||||
|
||||
SP_API void spPathConstraintData_dispose(spPathConstraintData *self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_PATHCONSTRAINTDATA_H_ */
|
||||
@ -1,53 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_PHYSICS_H_
|
||||
#define SPINE_PHYSICS_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Determines how physics and other non-deterministic updates are applied. */
|
||||
typedef enum {
|
||||
/** Physics are not updated or applied. */
|
||||
SP_PHYSICS_NONE,
|
||||
/** Physics are reset to the current pose. */
|
||||
SP_PHYSICS_RESET,
|
||||
/** Physics are updated and the pose from physics is applied. */
|
||||
SP_PHYSICS_UPDATE,
|
||||
/** Physics are not updated but the pose from physics is applied. */
|
||||
SP_PHYSICS_POSE
|
||||
} spPhysics;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,97 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_PHYSICSCONSTRAINT_H_
|
||||
#define SPINE_PHYSICSCONSTRAINT_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/PhysicsConstraintData.h>
|
||||
#include <spine/Bone.h>
|
||||
#include <spine/Physics.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spPhysicsConstraint {
|
||||
spPhysicsConstraintData *data;
|
||||
spBone* bone;
|
||||
|
||||
float inertia;
|
||||
float strength;
|
||||
float damping;
|
||||
float massInverse;
|
||||
float wind;
|
||||
float gravity;
|
||||
float mix;
|
||||
|
||||
int/*bool*/ reset;
|
||||
float ux;
|
||||
float uy;
|
||||
float cx;
|
||||
float cy;
|
||||
float tx;
|
||||
float ty;
|
||||
float xOffset;
|
||||
float xVelocity;
|
||||
float yOffset;
|
||||
float yVelocity;
|
||||
float rotateOffset;
|
||||
float rotateVelocity;
|
||||
float scaleOffset;
|
||||
float scaleVelocity;
|
||||
|
||||
int/*bool*/ active;
|
||||
|
||||
struct spSkeleton *skeleton;
|
||||
float remaining;
|
||||
float lastTime;
|
||||
|
||||
} spPhysicsConstraint;
|
||||
|
||||
SP_API spPhysicsConstraint *
|
||||
spPhysicsConstraint_create(spPhysicsConstraintData *data, struct spSkeleton *skeleton);
|
||||
|
||||
SP_API void spPhysicsConstraint_dispose(spPhysicsConstraint *self);
|
||||
|
||||
SP_API void spPhysicsConstraint_reset(spPhysicsConstraint *self);
|
||||
|
||||
SP_API void spPhysicsConstraint_setToSetupPose(spPhysicsConstraint *self);
|
||||
|
||||
SP_API void spPhysicsConstraint_update(spPhysicsConstraint *self, spPhysics physics);
|
||||
|
||||
SP_API void spPhysicsConstraint_rotate(spPhysicsConstraint *self, float x, float y, float degrees);
|
||||
|
||||
SP_API void spPhysicsConstraint_translate(spPhysicsConstraint *self, float x, float y);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_PHYSICSCONSTRAINT_H_ */
|
||||
@ -1,58 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_PHYSICSCONSTRAINTDATA_H_
|
||||
#define SPINE_PHYSICSCONSTRAINTDATA_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/BoneData.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spPhysicsConstraintData {
|
||||
char *name;
|
||||
int order;
|
||||
int/*bool*/ skinRequired;
|
||||
spBoneData *bone;
|
||||
float x, y, rotate, scaleX, shearX, limit;
|
||||
float step, inertia, strength, damping, massInverse, wind, gravity, mix;
|
||||
int/*bool*/ inertiaGlobal, strengthGlobal, dampingGlobal, massGlobal, windGlobal, gravityGlobal, mixGlobal;
|
||||
} spPhysicsConstraintData;
|
||||
|
||||
SP_API spPhysicsConstraintData *spPhysicsConstraintData_create(const char *name);
|
||||
|
||||
SP_API void spPhysicsConstraintData_dispose(spPhysicsConstraintData *self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_PHYSICSCONSTRAINTDATA_H_ */
|
||||
@ -1,59 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_POINTATTACHMENT_H_
|
||||
#define SPINE_POINTATTACHMENT_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/Attachment.h>
|
||||
#include <spine/VertexAttachment.h>
|
||||
#include <spine/Atlas.h>
|
||||
#include <spine/Slot.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spPointAttachment {
|
||||
spAttachment super;
|
||||
float x, y, rotation;
|
||||
spColor color;
|
||||
} spPointAttachment;
|
||||
|
||||
SP_API spPointAttachment *spPointAttachment_create(const char *name);
|
||||
|
||||
SP_API void spPointAttachment_computeWorldPosition(spPointAttachment *self, spBone *bone, float *x, float *y);
|
||||
|
||||
SP_API float spPointAttachment_computeWorldRotation(spPointAttachment *self, spBone *bone);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_POINTATTACHMENT_H_ */
|
||||
@ -1,68 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_REGIONATTACHMENT_H_
|
||||
#define SPINE_REGIONATTACHMENT_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/Attachment.h>
|
||||
#include <spine/Atlas.h>
|
||||
#include <spine/Slot.h>
|
||||
#include <spine/Sequence.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spRegionAttachment {
|
||||
spAttachment super;
|
||||
char *path;
|
||||
float x, y, scaleX, scaleY, rotation, width, height;
|
||||
spColor color;
|
||||
|
||||
void *rendererObject;
|
||||
spTextureRegion *region;
|
||||
spSequence *sequence;
|
||||
|
||||
float offset[8];
|
||||
float uvs[8];
|
||||
} spRegionAttachment;
|
||||
|
||||
SP_API spRegionAttachment *spRegionAttachment_create(const char *name);
|
||||
|
||||
SP_API void spRegionAttachment_updateRegion(spRegionAttachment *self);
|
||||
|
||||
SP_API void spRegionAttachment_computeWorldVertices(spRegionAttachment *self, spSlot *slot, float *vertices, int offset,
|
||||
int stride);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_REGIONATTACHMENT_H_ */
|
||||
@ -1,75 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_SEQUENCE_H
|
||||
#define SPINE_SEQUENCE_H
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/TextureRegion.h>
|
||||
#include <spine/Atlas.h>
|
||||
#include "Attachment.h"
|
||||
#include "Slot.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
_SP_ARRAY_DECLARE_TYPE(spTextureRegionArray, spTextureRegion*)
|
||||
|
||||
typedef struct spSequence {
|
||||
int id;
|
||||
int start;
|
||||
int digits;
|
||||
int setupIndex;
|
||||
spTextureRegionArray *regions;
|
||||
} spSequence;
|
||||
|
||||
SP_API spSequence *spSequence_create(int numRegions);
|
||||
|
||||
SP_API void spSequence_dispose(spSequence *self);
|
||||
|
||||
SP_API spSequence *spSequence_copy(spSequence *self);
|
||||
|
||||
SP_API void spSequence_apply(spSequence *self, spSlot *slot, spAttachment *attachment);
|
||||
|
||||
SP_API void spSequence_getPath(spSequence *self, const char *basePath, int index, char *path);
|
||||
|
||||
#define SP_SEQUENCE_MODE_HOLD 0
|
||||
#define SP_SEQUENCE_MODE_ONCE 1
|
||||
#define SP_SEQUENCE_MODE_LOOP 2
|
||||
#define SP_SEQUENCE_MODE_PINGPONG 3
|
||||
#define SP_SEQUENCE_MODE_ONCEREVERSE 4
|
||||
#define SP_SEQUENCE_MODE_LOOPREVERSE 5
|
||||
#define SP_SEQUENCE_MODE_PINGPONGREVERSE 6
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,141 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_SKELETON_H_
|
||||
#define SPINE_SKELETON_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/SkeletonData.h>
|
||||
#include <spine/Slot.h>
|
||||
#include <spine/Skin.h>
|
||||
#include <spine/IkConstraint.h>
|
||||
#include <spine/TransformConstraint.h>
|
||||
#include <spine/PathConstraint.h>
|
||||
#include <spine/PhysicsConstraint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spSkeleton {
|
||||
spSkeletonData *data;
|
||||
|
||||
int bonesCount;
|
||||
spBone **bones;
|
||||
spBone *root;
|
||||
|
||||
int slotsCount;
|
||||
spSlot **slots;
|
||||
spSlot **drawOrder;
|
||||
|
||||
int ikConstraintsCount;
|
||||
spIkConstraint **ikConstraints;
|
||||
|
||||
int transformConstraintsCount;
|
||||
spTransformConstraint **transformConstraints;
|
||||
|
||||
int pathConstraintsCount;
|
||||
spPathConstraint **pathConstraints;
|
||||
|
||||
int physicsConstraintsCount;
|
||||
spPhysicsConstraint **physicsConstraints;
|
||||
|
||||
spSkin *skin;
|
||||
spColor color;
|
||||
float scaleX, scaleY;
|
||||
float x, y;
|
||||
|
||||
float time;
|
||||
} spSkeleton;
|
||||
|
||||
SP_API spSkeleton *spSkeleton_create(spSkeletonData *data);
|
||||
|
||||
SP_API void spSkeleton_dispose(spSkeleton *self);
|
||||
|
||||
/* Caches information about bones and constraints. Must be called if bones or constraints, or weighted path attachments
|
||||
* are added or removed. */
|
||||
SP_API void spSkeleton_updateCache(spSkeleton *self);
|
||||
|
||||
SP_API void spSkeleton_updateWorldTransform(const spSkeleton *self, spPhysics physics);
|
||||
|
||||
SP_API void spSkeleton_update(spSkeleton *self, float delta);
|
||||
|
||||
/* Sets the bones, constraints, and slots to their setup pose values. */
|
||||
SP_API void spSkeleton_setToSetupPose(const spSkeleton *self);
|
||||
/* Sets the bones and constraints to their setup pose values. */
|
||||
SP_API void spSkeleton_setBonesToSetupPose(const spSkeleton *self);
|
||||
|
||||
SP_API void spSkeleton_setSlotsToSetupPose(const spSkeleton *self);
|
||||
|
||||
/* Returns 0 if the bone was not found. */
|
||||
SP_API spBone *spSkeleton_findBone(const spSkeleton *self, const char *boneName);
|
||||
|
||||
/* Returns 0 if the slot was not found. */
|
||||
SP_API spSlot *spSkeleton_findSlot(const spSkeleton *self, const char *slotName);
|
||||
|
||||
/* Sets the skin used to look up attachments before looking in the SkeletonData defaultSkin. Attachments from the new skin are
|
||||
* attached if the corresponding attachment from the old skin was attached. If there was no old skin, each slot's setup mode
|
||||
* attachment is attached from the new skin.
|
||||
* @param skin May be 0.*/
|
||||
SP_API void spSkeleton_setSkin(spSkeleton *self, spSkin *skin);
|
||||
/* Returns 0 if the skin was not found. See spSkeleton_setSkin.
|
||||
* @param skinName May be 0. */
|
||||
SP_API int spSkeleton_setSkinByName(spSkeleton *self, const char *skinName);
|
||||
|
||||
/* Returns 0 if the slot or attachment was not found. */
|
||||
SP_API spAttachment *
|
||||
spSkeleton_getAttachmentForSlotName(const spSkeleton *self, const char *slotName, const char *attachmentName);
|
||||
/* Returns 0 if the slot or attachment was not found. */
|
||||
SP_API spAttachment *
|
||||
spSkeleton_getAttachmentForSlotIndex(const spSkeleton *self, int slotIndex, const char *attachmentName);
|
||||
/* Returns 0 if the slot or attachment was not found.
|
||||
* @param attachmentName May be 0. */
|
||||
SP_API int spSkeleton_setAttachment(spSkeleton *self, const char *slotName, const char *attachmentName);
|
||||
|
||||
/* Returns 0 if the IK constraint was not found. */
|
||||
SP_API spIkConstraint *spSkeleton_findIkConstraint(const spSkeleton *self, const char *constraintName);
|
||||
|
||||
/* Returns 0 if the transform constraint was not found. */
|
||||
SP_API spTransformConstraint *spSkeleton_findTransformConstraint(const spSkeleton *self, const char *constraintName);
|
||||
|
||||
/* Returns 0 if the path constraint was not found. */
|
||||
SP_API spPathConstraint *spSkeleton_findPathConstraint(const spSkeleton *self, const char *constraintName);
|
||||
|
||||
/* Returns 0 if the physics constraint was not found. */
|
||||
SP_API spPhysicsConstraint *spSkeleton_findPhysicsConstraint(const spSkeleton *self, const char *constraintName);
|
||||
|
||||
SP_API void spSkeleton_physicsTranslate(spSkeleton *self, float x, float y);
|
||||
|
||||
SP_API void spSkeleton_physicsRotate(spSkeleton *self, float x, float y, float degrees);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_SKELETON_H_*/
|
||||
@ -1,66 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_SKELETONBINARY_H_
|
||||
#define SPINE_SKELETONBINARY_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/Attachment.h>
|
||||
#include <spine/AttachmentLoader.h>
|
||||
#include <spine/SkeletonData.h>
|
||||
#include <spine/Atlas.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct spAtlasAttachmentLoader;
|
||||
|
||||
typedef struct spSkeletonBinary {
|
||||
float scale;
|
||||
spAttachmentLoader *attachmentLoader;
|
||||
char *error;
|
||||
} spSkeletonBinary;
|
||||
|
||||
SP_API spSkeletonBinary *spSkeletonBinary_createWithLoader(spAttachmentLoader *attachmentLoader);
|
||||
|
||||
SP_API spSkeletonBinary *spSkeletonBinary_create(spAtlas *atlas);
|
||||
|
||||
SP_API void spSkeletonBinary_dispose(spSkeletonBinary *self);
|
||||
|
||||
SP_API spSkeletonData *
|
||||
spSkeletonBinary_readSkeletonData(spSkeletonBinary *self, const unsigned char *binary, const int length);
|
||||
|
||||
SP_API spSkeletonData *spSkeletonBinary_readSkeletonDataFile(spSkeletonBinary *self, const char *path);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_SKELETONBINARY_H_ */
|
||||
@ -1,97 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_SKELETONBOUNDS_H_
|
||||
#define SPINE_SKELETONBOUNDS_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/BoundingBoxAttachment.h>
|
||||
#include <spine/Skeleton.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spPolygon {
|
||||
float *vertices;
|
||||
int count;
|
||||
int capacity;
|
||||
} spPolygon;
|
||||
|
||||
SP_API spPolygon *spPolygon_create(int capacity);
|
||||
|
||||
SP_API void spPolygon_dispose(spPolygon *self);
|
||||
|
||||
SP_API int/*bool*/spPolygon_containsPoint(spPolygon *polygon, float x, float y);
|
||||
|
||||
SP_API int/*bool*/spPolygon_intersectsSegment(spPolygon *polygon, float x1, float y1, float x2, float y2);
|
||||
|
||||
/**/
|
||||
|
||||
typedef struct spSkeletonBounds {
|
||||
int count;
|
||||
spBoundingBoxAttachment **boundingBoxes;
|
||||
spPolygon **polygons;
|
||||
|
||||
float minX, minY, maxX, maxY;
|
||||
} spSkeletonBounds;
|
||||
|
||||
SP_API spSkeletonBounds *spSkeletonBounds_create(void);
|
||||
|
||||
SP_API void spSkeletonBounds_dispose(spSkeletonBounds *self);
|
||||
|
||||
SP_API void spSkeletonBounds_update(spSkeletonBounds *self, spSkeleton *skeleton, int/*bool*/updateAabb);
|
||||
|
||||
/** Returns true if the axis aligned bounding box contains the point. */
|
||||
SP_API int/*bool*/spSkeletonBounds_aabbContainsPoint(spSkeletonBounds *self, float x, float y);
|
||||
|
||||
/** Returns true if the axis aligned bounding box intersects the line segment. */
|
||||
SP_API int/*bool*/
|
||||
spSkeletonBounds_aabbIntersectsSegment(spSkeletonBounds *self, float x1, float y1, float x2, float y2);
|
||||
|
||||
/** Returns true if the axis aligned bounding box intersects the axis aligned bounding box of the specified bounds. */
|
||||
SP_API int/*bool*/spSkeletonBounds_aabbIntersectsSkeleton(spSkeletonBounds *self, spSkeletonBounds *bounds);
|
||||
|
||||
/** Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more
|
||||
* efficient to only call this method if spSkeletonBounds_aabbContainsPoint returns true. */
|
||||
SP_API spBoundingBoxAttachment *spSkeletonBounds_containsPoint(spSkeletonBounds *self, float x, float y);
|
||||
|
||||
/** Returns the first bounding box attachment that contains the line segment, or null. When doing many checks, it is usually
|
||||
* more efficient to only call this method if spSkeletonBounds_aabbIntersectsSegment returns true. */
|
||||
SP_API spBoundingBoxAttachment *
|
||||
spSkeletonBounds_intersectsSegment(spSkeletonBounds *self, float x1, float y1, float x2, float y2);
|
||||
|
||||
/** Returns the polygon for the specified bounding box, or null. */
|
||||
SP_API spPolygon *spSkeletonBounds_getPolygon(spSkeletonBounds *self, spBoundingBoxAttachment *boundingBox);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_SKELETONBOUNDS_H_ */
|
||||
@ -1,74 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_SKELETONCLIPPING_H
|
||||
#define SPINE_SKELETONCLIPPING_H
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/Array.h>
|
||||
#include <spine/ClippingAttachment.h>
|
||||
#include <spine/Slot.h>
|
||||
#include <spine/Triangulator.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spSkeletonClipping {
|
||||
spTriangulator *triangulator;
|
||||
spFloatArray *clippingPolygon;
|
||||
spFloatArray *clipOutput;
|
||||
spFloatArray *clippedVertices;
|
||||
spFloatArray *clippedUVs;
|
||||
spUnsignedShortArray *clippedTriangles;
|
||||
spFloatArray *scratch;
|
||||
spClippingAttachment *clipAttachment;
|
||||
spArrayFloatArray *clippingPolygons;
|
||||
} spSkeletonClipping;
|
||||
|
||||
SP_API spSkeletonClipping *spSkeletonClipping_create(void);
|
||||
|
||||
SP_API int spSkeletonClipping_clipStart(spSkeletonClipping *self, spSlot *slot, spClippingAttachment *clip);
|
||||
|
||||
SP_API void spSkeletonClipping_clipEnd(spSkeletonClipping *self, spSlot *slot);
|
||||
|
||||
SP_API void spSkeletonClipping_clipEnd2(spSkeletonClipping *self);
|
||||
|
||||
SP_API int /*boolean*/ spSkeletonClipping_isClipping(spSkeletonClipping *self);
|
||||
|
||||
SP_API void spSkeletonClipping_clipTriangles(spSkeletonClipping *self, float *vertices, int verticesLength,
|
||||
unsigned short *triangles, int trianglesLength, float *uvs, int stride);
|
||||
|
||||
SP_API void spSkeletonClipping_dispose(spSkeletonClipping *self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_SKELETONCLIPPING_H */
|
||||
@ -1,116 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_SKELETONDATA_H_
|
||||
#define SPINE_SKELETONDATA_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/BoneData.h>
|
||||
#include <spine/SlotData.h>
|
||||
#include <spine/Skin.h>
|
||||
#include <spine/EventData.h>
|
||||
#include <spine/Animation.h>
|
||||
#include <spine/IkConstraintData.h>
|
||||
#include <spine/TransformConstraintData.h>
|
||||
#include <spine/PathConstraintData.h>
|
||||
#include <spine/PhysicsConstraintData.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spSkeletonData {
|
||||
char *version;
|
||||
char *hash;
|
||||
float x, y, width, height;
|
||||
float referenceScale;
|
||||
float fps;
|
||||
const char *imagesPath;
|
||||
const char *audioPath;
|
||||
|
||||
int stringsCount;
|
||||
char **strings;
|
||||
|
||||
int bonesCount;
|
||||
spBoneData **bones;
|
||||
|
||||
int slotsCount;
|
||||
spSlotData **slots;
|
||||
|
||||
int skinsCount;
|
||||
spSkin **skins;
|
||||
spSkin *defaultSkin;
|
||||
|
||||
int eventsCount;
|
||||
spEventData **events;
|
||||
|
||||
int animationsCount;
|
||||
spAnimation **animations;
|
||||
|
||||
int ikConstraintsCount;
|
||||
spIkConstraintData **ikConstraints;
|
||||
|
||||
int transformConstraintsCount;
|
||||
spTransformConstraintData **transformConstraints;
|
||||
|
||||
int pathConstraintsCount;
|
||||
spPathConstraintData **pathConstraints;
|
||||
|
||||
int physicsConstraintsCount;
|
||||
spPhysicsConstraintData **physicsConstraints;
|
||||
} spSkeletonData;
|
||||
|
||||
SP_API spSkeletonData *spSkeletonData_create(void);
|
||||
|
||||
SP_API void spSkeletonData_dispose(spSkeletonData *self);
|
||||
|
||||
SP_API spBoneData *spSkeletonData_findBone(const spSkeletonData *self, const char *boneName);
|
||||
|
||||
SP_API spSlotData *spSkeletonData_findSlot(const spSkeletonData *self, const char *slotName);
|
||||
|
||||
SP_API spSkin *spSkeletonData_findSkin(const spSkeletonData *self, const char *skinName);
|
||||
|
||||
SP_API spEventData *spSkeletonData_findEvent(const spSkeletonData *self, const char *eventName);
|
||||
|
||||
SP_API spAnimation *spSkeletonData_findAnimation(const spSkeletonData *self, const char *animationName);
|
||||
|
||||
SP_API spIkConstraintData *spSkeletonData_findIkConstraint(const spSkeletonData *self, const char *constraintName);
|
||||
|
||||
SP_API spTransformConstraintData *
|
||||
spSkeletonData_findTransformConstraint(const spSkeletonData *self, const char *constraintName);
|
||||
|
||||
SP_API spPathConstraintData *spSkeletonData_findPathConstraint(const spSkeletonData *self, const char *constraintName);
|
||||
|
||||
SP_API spPhysicsConstraintData *spSkeletonData_findPhysicsConstraint(const spSkeletonData *self, const char *constraintName);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_SKELETONDATA_H_ */
|
||||
@ -1,66 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_SKELETONJSON_H_
|
||||
#define SPINE_SKELETONJSON_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/Attachment.h>
|
||||
#include <spine/AttachmentLoader.h>
|
||||
#include <spine/SkeletonData.h>
|
||||
#include <spine/Atlas.h>
|
||||
#include <spine/Animation.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct spAtlasAttachmentLoader;
|
||||
|
||||
typedef struct spSkeletonJson {
|
||||
float scale;
|
||||
spAttachmentLoader *attachmentLoader;
|
||||
char *error;
|
||||
} spSkeletonJson;
|
||||
|
||||
SP_API spSkeletonJson *spSkeletonJson_createWithLoader(spAttachmentLoader *attachmentLoader);
|
||||
|
||||
SP_API spSkeletonJson *spSkeletonJson_create(spAtlas *atlas);
|
||||
|
||||
SP_API void spSkeletonJson_dispose(spSkeletonJson *self);
|
||||
|
||||
SP_API spSkeletonData *spSkeletonJson_readSkeletonData(spSkeletonJson *self, const char *json);
|
||||
|
||||
SP_API spSkeletonData *spSkeletonJson_readSkeletonDataFile(spSkeletonJson *self, const char *path);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_SKELETONJSON_H_ */
|
||||
@ -1,124 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_SKIN_H_
|
||||
#define SPINE_SKIN_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/Attachment.h>
|
||||
#include <spine/IkConstraintData.h>
|
||||
#include <spine/TransformConstraintData.h>
|
||||
#include <spine/PathConstraintData.h>
|
||||
#include <spine/PhysicsConstraintData.h>
|
||||
#include <spine/Array.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Size of hashtable used in skin structure for fast attachment lookup. */
|
||||
#define SKIN_ENTRIES_HASH_TABLE_SIZE 100
|
||||
|
||||
struct spSkeleton;
|
||||
|
||||
_SP_ARRAY_DECLARE_TYPE(spBoneDataArray, spBoneData*)
|
||||
|
||||
_SP_ARRAY_DECLARE_TYPE(spIkConstraintDataArray, spIkConstraintData*)
|
||||
|
||||
_SP_ARRAY_DECLARE_TYPE(spTransformConstraintDataArray, spTransformConstraintData*)
|
||||
|
||||
_SP_ARRAY_DECLARE_TYPE(spPathConstraintDataArray, spPathConstraintData*)
|
||||
|
||||
_SP_ARRAY_DECLARE_TYPE(spPhysicsConstraintDataArray, spPhysicsConstraintData*)
|
||||
|
||||
typedef struct spSkin {
|
||||
char *name;
|
||||
|
||||
spBoneDataArray *bones;
|
||||
spIkConstraintDataArray *ikConstraints;
|
||||
spTransformConstraintDataArray *transformConstraints;
|
||||
spPathConstraintDataArray *pathConstraints;
|
||||
spPhysicsConstraintDataArray *physicsConstraints;
|
||||
spColor color;
|
||||
} spSkin;
|
||||
|
||||
/* Private structs, needed by Skeleton */
|
||||
typedef struct _Entry _Entry;
|
||||
typedef struct _Entry spSkinEntry;
|
||||
struct _Entry {
|
||||
int slotIndex;
|
||||
char *name;
|
||||
spAttachment *attachment;
|
||||
_Entry *next;
|
||||
};
|
||||
|
||||
typedef struct _SkinHashTableEntry _SkinHashTableEntry;
|
||||
struct _SkinHashTableEntry {
|
||||
_Entry *entry;
|
||||
_SkinHashTableEntry *next;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
spSkin super;
|
||||
_Entry *entries; /* entries list stored for getting attachment name by attachment index */
|
||||
_SkinHashTableEntry *entriesHashTable[SKIN_ENTRIES_HASH_TABLE_SIZE]; /* hashtable for fast attachment lookup */
|
||||
} _spSkin;
|
||||
|
||||
SP_API spSkin *spSkin_create(const char *name);
|
||||
|
||||
SP_API void spSkin_dispose(spSkin *self);
|
||||
|
||||
/* The Skin owns the attachment. */
|
||||
SP_API void spSkin_setAttachment(spSkin *self, int slotIndex, const char *name, spAttachment *attachment);
|
||||
/* Returns 0 if the attachment was not found. */
|
||||
SP_API spAttachment *spSkin_getAttachment(const spSkin *self, int slotIndex, const char *name);
|
||||
|
||||
/* Returns 0 if the slot or attachment was not found. */
|
||||
SP_API const char *spSkin_getAttachmentName(const spSkin *self, int slotIndex, int attachmentIndex);
|
||||
|
||||
/** Attach each attachment in this skin if the corresponding attachment in oldSkin is currently attached. */
|
||||
SP_API void spSkin_attachAll(const spSkin *self, struct spSkeleton *skeleton, const spSkin *oldspSkin);
|
||||
|
||||
/** Adds all attachments, bones, and constraints from the specified skin to this skin. */
|
||||
SP_API void spSkin_addSkin(spSkin *self, const spSkin *other);
|
||||
|
||||
/** Adds all attachments, bones, and constraints from the specified skin to this skin. Attachments are deep copied. */
|
||||
SP_API void spSkin_copySkin(spSkin *self, const spSkin *other);
|
||||
|
||||
/** Returns all attachments in this skin. */
|
||||
SP_API spSkinEntry *spSkin_getAttachments(const spSkin *self);
|
||||
|
||||
/** Clears all attachments, bones, and constraints. */
|
||||
SP_API void spSkin_clear(spSkin *self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_SKIN_H_ */
|
||||
@ -1,70 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_SLOT_H_
|
||||
#define SPINE_SLOT_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/Bone.h>
|
||||
#include <spine/Attachment.h>
|
||||
#include <spine/SlotData.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spSlot {
|
||||
spSlotData *data;
|
||||
spBone *bone;
|
||||
spColor color;
|
||||
spColor *darkColor;
|
||||
spAttachment *attachment;
|
||||
int attachmentState;
|
||||
|
||||
int deformCapacity;
|
||||
int deformCount;
|
||||
float *deform;
|
||||
|
||||
int sequenceIndex;
|
||||
} spSlot;
|
||||
|
||||
SP_API spSlot *spSlot_create(spSlotData *data, spBone *bone);
|
||||
|
||||
SP_API void spSlot_dispose(spSlot *self);
|
||||
|
||||
/* @param attachment May be 0 to clear the attachment for the slot. */
|
||||
SP_API void spSlot_setAttachment(spSlot *self, spAttachment *attachment);
|
||||
|
||||
SP_API void spSlot_setToSetupPose(spSlot *self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_SLOT_H_ */
|
||||
@ -1,67 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_SLOTDATA_H_
|
||||
#define SPINE_SLOTDATA_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/BoneData.h>
|
||||
#include <spine/Color.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
SP_BLEND_MODE_NORMAL, SP_BLEND_MODE_ADDITIVE, SP_BLEND_MODE_MULTIPLY, SP_BLEND_MODE_SCREEN
|
||||
} spBlendMode;
|
||||
|
||||
typedef struct spSlotData {
|
||||
int index;
|
||||
char *name;
|
||||
spBoneData *boneData;
|
||||
char *attachmentName;
|
||||
spColor color;
|
||||
spColor *darkColor;
|
||||
spBlendMode blendMode;
|
||||
int/*bool*/ visible;
|
||||
} spSlotData;
|
||||
|
||||
SP_API spSlotData *spSlotData_create(const int index, const char *name, spBoneData *boneData);
|
||||
|
||||
SP_API void spSlotData_dispose(spSlotData *self);
|
||||
|
||||
/* @param attachmentName May be 0 for no setup pose attachment. */
|
||||
SP_API void spSlotData_setAttachmentName(spSlotData *self, const char *attachmentName);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_SLOTDATA_H_ */
|
||||
@ -1,50 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_TEXTURE_REGION_H
|
||||
#define SPINE_TEXTURE_REGION_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spTextureRegion {
|
||||
void *rendererObject;
|
||||
float u, v, u2, v2;
|
||||
int degrees;
|
||||
float offsetX, offsetY;
|
||||
int width, height;
|
||||
int originalWidth, originalHeight;
|
||||
} spTextureRegion;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1,65 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_TRANSFORMCONSTRAINT_H_
|
||||
#define SPINE_TRANSFORMCONSTRAINT_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/TransformConstraintData.h>
|
||||
#include <spine/Bone.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct spSkeleton;
|
||||
|
||||
typedef struct spTransformConstraint {
|
||||
spTransformConstraintData *data;
|
||||
int bonesCount;
|
||||
spBone **bones;
|
||||
spBone *target;
|
||||
float mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY;
|
||||
int /*boolean*/ active;
|
||||
} spTransformConstraint;
|
||||
|
||||
SP_API spTransformConstraint *
|
||||
spTransformConstraint_create(spTransformConstraintData *data, const struct spSkeleton *skeleton);
|
||||
|
||||
SP_API void spTransformConstraint_dispose(spTransformConstraint *self);
|
||||
|
||||
SP_API void spTransformConstraint_update(spTransformConstraint *self);
|
||||
|
||||
SP_API void spTransformConstraint_setToSetupPose(spTransformConstraint *self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_TRANSFORMCONSTRAINT_H_ */
|
||||
@ -1,61 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_TRANSFORMCONSTRAINTDATA_H_
|
||||
#define SPINE_TRANSFORMCONSTRAINTDATA_H_
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/BoneData.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spTransformConstraintData {
|
||||
char *name;
|
||||
int order;
|
||||
int/*bool*/ skinRequired;
|
||||
int bonesCount;
|
||||
spBoneData **bones;
|
||||
spBoneData *target;
|
||||
float mixRotate, mixX, mixY, mixScaleX, mixScaleY, mixShearY;
|
||||
float offsetRotation, offsetX, offsetY, offsetScaleX, offsetScaleY, offsetShearY;
|
||||
int /*boolean*/ relative;
|
||||
int /*boolean*/ local;
|
||||
} spTransformConstraintData;
|
||||
|
||||
SP_API spTransformConstraintData *spTransformConstraintData_create(const char *name);
|
||||
|
||||
SP_API void spTransformConstraintData_dispose(spTransformConstraintData *self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_TRANSFORMCONSTRAINTDATA_H_ */
|
||||
@ -1,66 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_TRIANGULATOR_H
|
||||
#define SPINE_TRIANGULATOR_H
|
||||
|
||||
#include <spine/dll.h>
|
||||
#include <spine/Array.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct spTriangulator {
|
||||
spArrayFloatArray *convexPolygons;
|
||||
spArrayShortArray *convexPolygonsIndices;
|
||||
|
||||
spShortArray *indicesArray;
|
||||
spIntArray *isConcaveArray;
|
||||
spShortArray *triangles;
|
||||
|
||||
spArrayFloatArray *polygonPool;
|
||||
spArrayShortArray *polygonIndicesPool;
|
||||
} spTriangulator;
|
||||
|
||||
SP_API spTriangulator *spTriangulator_create(void);
|
||||
|
||||
SP_API spShortArray *spTriangulator_triangulate(spTriangulator *self, spFloatArray *verticesArray);
|
||||
|
||||
SP_API spArrayFloatArray *
|
||||
spTriangulator_decompose(spTriangulator *self, spFloatArray *verticesArray, spShortArray *triangles);
|
||||
|
||||
SP_API void spTriangulator_dispose(spTriangulator *self);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* SPINE_TRIANGULATOR_H_ */
|
||||
@ -1,37 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Spine Runtimes License Agreement
|
||||
* Last updated April 5, 2025. Replaces all prior versions.
|
||||
*
|
||||
* Copyright (c) 2013-2025, Esoteric Software LLC
|
||||
*
|
||||
* Integration of the Spine Runtimes into software or otherwise creating
|
||||
* derivative works of the Spine Runtimes is permitted under the terms and
|
||||
* conditions of Section 2 of the Spine Editor License Agreement:
|
||||
* http://esotericsoftware.com/spine-editor-license
|
||||
*
|
||||
* Otherwise, it is permitted to integrate the Spine Runtimes into software
|
||||
* or otherwise create derivative works of the Spine Runtimes (collectively,
|
||||
* "Products"), provided that each user of the Products must obtain their own
|
||||
* Spine Editor license and redistribution of the Products in any form must
|
||||
* include this license and copyright notice.
|
||||
*
|
||||
* THE SPINE RUNTIMES ARE PROVIDED BY ESOTERIC SOFTWARE LLC "AS IS" AND ANY
|
||||
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ESOTERIC SOFTWARE LLC BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES,
|
||||
* BUSINESS INTERRUPTION, OR LOSS OF USE, DATA, OR PROFITS) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THE SPINE RUNTIMES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef SPINE_VERTEXEFFECT_H_
|
||||
#define SPINE_VERTEXEFFECT_H_
|
||||
|
||||
#define SPINE_MAJOR_VERSION 4
|
||||
#define SPINE_MINOR_VERSION 2
|
||||
#define SPINE_VERSION_STRING "4.2"
|
||||
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user