mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Merge branch 'socialpoint' into 3.8-beta
This commit is contained in:
commit
1dadeb48a4
@ -2,14 +2,14 @@ cmake_minimum_required(VERSION 2.8)
|
|||||||
set(EXAMPLE_DIR "${CMAKE_CURRENT_LIST_DIR}/example")
|
set(EXAMPLE_DIR "${CMAKE_CURRENT_LIST_DIR}/example")
|
||||||
if (NOT EXISTS ${EXAMPLE_DIR}/cocos2d)
|
if (NOT EXISTS ${EXAMPLE_DIR}/cocos2d)
|
||||||
message("Downloading cocos2dx, this may take some time!")
|
message("Downloading cocos2dx, this may take some time!")
|
||||||
file(DOWNLOAD "https://digitalocean.cocos2d-x.org/Cocos2D-X/cocos2d-x-3.17.1.zip" "${EXAMPLE_DIR}/cocos2dx.zip")
|
file(DOWNLOAD "https://digitalocean.cocos2d-x.org/Cocos2D-X/cocos2d-x-3.17.2.zip" "${EXAMPLE_DIR}/cocos2dx.zip")
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${CMAKE_COMMAND} -E tar x ${EXAMPLE_DIR}/cocos2dx.zip
|
COMMAND ${CMAKE_COMMAND} -E tar x ${EXAMPLE_DIR}/cocos2dx.zip
|
||||||
WORKING_DIRECTORY ${EXAMPLE_DIR}
|
WORKING_DIRECTORY ${EXAMPLE_DIR}
|
||||||
)
|
)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${CMAKE_COMMAND} -E rename
|
COMMAND ${CMAKE_COMMAND} -E rename
|
||||||
"${EXAMPLE_DIR}/cocos2d-x-3.17.1" "${EXAMPLE_DIR}/cocos2d"
|
"${EXAMPLE_DIR}/cocos2d-x-3.17.2" "${EXAMPLE_DIR}/cocos2d"
|
||||||
)
|
)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${CMAKE_COMMAND} -E remove_directory "${EXAMPLE_DIR}/cocos2d/cocos/editor-support/spine"
|
COMMAND ${CMAKE_COMMAND} -E remove_directory "${EXAMPLE_DIR}/cocos2d/cocos/editor-support/spine"
|
||||||
|
|||||||
@ -48,7 +48,7 @@ bool BatchingExample::init () {
|
|||||||
|
|
||||||
// Load the texture atlas. Note that the texture loader has to live
|
// Load the texture atlas. Note that the texture loader has to live
|
||||||
// as long as the Atlas, as the Atlas destructor will call TextureLoader::unload.
|
// as long as the Atlas, as the Atlas destructor will call TextureLoader::unload.
|
||||||
_atlas = new (__FILE__, __LINE__) Atlas("spineboy.atlas", &textureLoader);
|
_atlas = new (__FILE__, __LINE__) Atlas("spineboy.atlas", &textureLoader, true);
|
||||||
CCASSERT(_atlas, "Error reading atlas file.");
|
CCASSERT(_atlas, "Error reading atlas file.");
|
||||||
|
|
||||||
// This attachment loader configures attachments with data needed for cocos2d-x rendering.
|
// This attachment loader configures attachments with data needed for cocos2d-x rendering.
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 14
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 14.0.25420.1
|
VisualStudioVersion = 16.0.29009.5
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "spine-cocos2d-x", "spine-cocos2d-x.vcxproj", "{76A39BB2-9B84-4C65-98A5-654D86B86F2A}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "spine-cocos2d-x", "spine-cocos2d-x.vcxproj", "{76A39BB2-9B84-4C65-98A5-654D86B86F2A}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
@ -10,8 +10,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "spine-cocos2d-x", "spine-co
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\cocos2d\cocos\2d\libcocos2d.vcxproj", "{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\cocos2d\cocos\2d\libcocos2d.vcxproj", "{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d", "..\cocos2d\external\Box2D\proj.win32\libbox2d.vcxproj", "{929480E7-23C0-4DF6-8456-096D71547116}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "librecast", "..\cocos2d\external\recast\proj.win32\librecast.vcxproj", "{41E34993-647E-4282-8384-4AB1AE31A452}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "librecast", "..\cocos2d\external\recast\proj.win32\librecast.vcxproj", "{41E34993-647E-4282-8384-4AB1AE31A452}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
@ -28,10 +26,6 @@ Global
|
|||||||
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.Build.0 = Debug|Win32
|
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.ActiveCfg = Release|Win32
|
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.Build.0 = Release|Win32
|
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.Build.0 = Release|Win32
|
||||||
{929480E7-23C0-4DF6-8456-096D71547116}.Debug|Win32.ActiveCfg = Debug|Win32
|
|
||||||
{929480E7-23C0-4DF6-8456-096D71547116}.Debug|Win32.Build.0 = Debug|Win32
|
|
||||||
{929480E7-23C0-4DF6-8456-096D71547116}.Release|Win32.ActiveCfg = Release|Win32
|
|
||||||
{929480E7-23C0-4DF6-8456-096D71547116}.Release|Win32.Build.0 = Release|Win32
|
|
||||||
{41E34993-647E-4282-8384-4AB1AE31A452}.Debug|Win32.ActiveCfg = Debug|Win32
|
{41E34993-647E-4282-8384-4AB1AE31A452}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{41E34993-647E-4282-8384-4AB1AE31A452}.Debug|Win32.Build.0 = Debug|Win32
|
{41E34993-647E-4282-8384-4AB1AE31A452}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{41E34993-647E-4282-8384-4AB1AE31A452}.Release|Win32.ActiveCfg = Release|Win32
|
{41E34993-647E-4282-8384-4AB1AE31A452}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
@ -40,4 +34,7 @@ Global
|
|||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {E20D34B0-B32B-44B5-B42D-0028D1ED286F}
|
||||||
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
@ -19,11 +19,12 @@
|
|||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v140_xp</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v140_xp</PlatformToolset>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
@ -32,6 +33,7 @@
|
|||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0'">v140</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v140_xp</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '14.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v140_xp</PlatformToolset>
|
||||||
|
<PlatformToolset>v142</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
@ -62,13 +64,6 @@
|
|||||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<LibraryPath>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\lib;$(LibraryPath)</LibraryPath>
|
|
||||||
<IncludePath>$(VC_IncludePath);$(WindowsSdk_71A_IncludePath);</IncludePath>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<LibraryPath>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\lib;$(LibraryPath)</LibraryPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
@ -114,7 +109,7 @@ xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y
|
|||||||
<ClCompile>
|
<ClCompile>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<AdditionalIncludeDirectories>$(EngineRoot)external;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;..\Classes;..;%(AdditionalIncludeDirectories);$(_COCOS_HEADER_WIN32_BEGIN);$(_COCOS_HEADER_WIN32_END)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(EngineRoot)external;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;..\Classes;..;%(AdditionalIncludeDirectories);$(_COCOS_HEADER_WIN32_BEGIN);$(_COCOS_HEADER_WIN32_END);$(SolutionDir)..\..\..\spine-cpp\spine-cpp\include;$(SolutionDir)..\..\src;$(IncludePath)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USE_MATH_DEFINES;GL_GLEXT_PROTOTYPES;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USE_MATH_DEFINES;GL_GLEXT_PROTOTYPES;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
@ -126,7 +121,7 @@ xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y
|
|||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>libcurl_imp.lib;websockets.lib;%(AdditionalDependencies);$(_COCOS_LIB_WIN32_BEGIN);$(_COCOS_LIB_WIN32_END)</AdditionalDependencies>
|
<AdditionalDependencies>%(AdditionalDependencies);$(_COCOS_LIB_WIN32_BEGIN);$(_COCOS_LIB_WIN32_END)</AdditionalDependencies>
|
||||||
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
|
<OutputFile>$(OutDir)$(ProjectName).exe</OutputFile>
|
||||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories);$(_COCOS_LIB_PATH_WIN32_BEGIN);$(_COCOS_LIB_PATH_WIN32_END)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories);$(_COCOS_LIB_PATH_WIN32_BEGIN);$(_COCOS_LIB_PATH_WIN32_END)</AdditionalLibraryDirectories>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
@ -325,9 +320,6 @@ xcopy "$(ProjectDir)..\Resources" "$(OutDir)" /D /E /I /F /Y
|
|||||||
<Project>{98a51ba8-fc3a-415b-ac8f-8c7bd464e93e}</Project>
|
<Project>{98a51ba8-fc3a-415b-ac8f-8c7bd464e93e}</Project>
|
||||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\cocos2d\external\Box2D\proj.win32\libbox2d.vcxproj">
|
|
||||||
<Project>{929480e7-23c0-4df6-8456-096d71547116}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="game.rc" />
|
<ResourceCompile Include="game.rc" />
|
||||||
|
|||||||
@ -111,6 +111,7 @@ void SkeletonAnimation::initialize () {
|
|||||||
super::initialize();
|
super::initialize();
|
||||||
|
|
||||||
_ownsAnimationStateData = true;
|
_ownsAnimationStateData = true;
|
||||||
|
_updateOnlyIfVisible = false;
|
||||||
_state = new (__FILE__, __LINE__) AnimationState(new (__FILE__, __LINE__) AnimationStateData(_skeleton->getData()));
|
_state = new (__FILE__, __LINE__) AnimationState(new (__FILE__, __LINE__) AnimationStateData(_skeleton->getData()));
|
||||||
_state->setRendererObject(this);
|
_state->setRendererObject(this);
|
||||||
_state->setListener(animationCallback);
|
_state->setListener(animationCallback);
|
||||||
@ -128,6 +129,8 @@ SkeletonAnimation::~SkeletonAnimation () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SkeletonAnimation::update (float deltaTime) {
|
void SkeletonAnimation::update (float deltaTime) {
|
||||||
|
if (_updateOnlyIfVisible && !isVisible()) return;
|
||||||
|
|
||||||
super::update(deltaTime);
|
super::update(deltaTime);
|
||||||
|
|
||||||
deltaTime *= _timeScale;
|
deltaTime *= _timeScale;
|
||||||
@ -306,4 +309,8 @@ AnimationState* SkeletonAnimation::getState() const {
|
|||||||
return _state;
|
return _state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SkeletonAnimation::setUpdateOnlyIfVisible(bool status) {
|
||||||
|
_updateOnlyIfVisible = status;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,6 +99,7 @@ public:
|
|||||||
virtual void onTrackEntryEvent (TrackEntry* entry, EventType type, Event* event);
|
virtual void onTrackEntryEvent (TrackEntry* entry, EventType type, Event* event);
|
||||||
|
|
||||||
AnimationState* getState() const;
|
AnimationState* getState() const;
|
||||||
|
void setUpdateOnlyIfVisible(bool status);
|
||||||
|
|
||||||
CC_CONSTRUCTOR_ACCESS:
|
CC_CONSTRUCTOR_ACCESS:
|
||||||
SkeletonAnimation ();
|
SkeletonAnimation ();
|
||||||
@ -109,6 +110,7 @@ protected:
|
|||||||
AnimationState* _state;
|
AnimationState* _state;
|
||||||
|
|
||||||
bool _ownsAnimationStateData;
|
bool _ownsAnimationStateData;
|
||||||
|
bool _updateOnlyIfVisible;
|
||||||
bool _firstDraw;
|
bool _firstDraw;
|
||||||
|
|
||||||
StartListener _startListener;
|
StartListener _startListener;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -46,14 +46,13 @@ namespace spine {
|
|||||||
static SkeletonRenderer* createWithFile (const std::string& skeletonDataFile, Atlas* atlas, float scale = 1);
|
static SkeletonRenderer* createWithFile (const std::string& skeletonDataFile, Atlas* atlas, float scale = 1);
|
||||||
static SkeletonRenderer* createWithFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
|
static SkeletonRenderer* createWithFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale = 1);
|
||||||
|
|
||||||
virtual void update (float deltaTime) override;
|
void update (float deltaTime) override;
|
||||||
virtual void draw (cocos2d::Renderer* renderer, const cocos2d::Mat4& transform, uint32_t transformFlags) override;
|
void draw (cocos2d::Renderer* renderer, const cocos2d::Mat4& transform, uint32_t transformFlags) override;
|
||||||
virtual void drawDebug (cocos2d::Renderer* renderer, const cocos2d::Mat4& transform, uint32_t transformFlags);
|
cocos2d::Rect getBoundingBox () const override;
|
||||||
virtual cocos2d::Rect getBoundingBox () const override;
|
void onEnter () override;
|
||||||
virtual void onEnter () override;
|
void onExit () override;
|
||||||
virtual void onExit () override;
|
|
||||||
|
|
||||||
Skeleton* getSkeleton();
|
Skeleton* getSkeleton() const;
|
||||||
|
|
||||||
void setTimeScale(float scale);
|
void setTimeScale(float scale);
|
||||||
float getTimeScale() const;
|
float getTimeScale() const;
|
||||||
@ -68,6 +67,9 @@ namespace spine {
|
|||||||
void setDebugMeshesEnabled(bool enabled);
|
void setDebugMeshesEnabled(bool enabled);
|
||||||
bool getDebugMeshesEnabled() const;
|
bool getDebugMeshesEnabled() const;
|
||||||
|
|
||||||
|
void setDebugBoundingRectEnabled(bool enabled);
|
||||||
|
bool getDebugBoundingRectEnabled() const;
|
||||||
|
|
||||||
// --- Convenience methods for common Skeleton_* functions.
|
// --- Convenience methods for common Skeleton_* functions.
|
||||||
void updateWorldTransform ();
|
void updateWorldTransform ();
|
||||||
|
|
||||||
@ -107,13 +109,10 @@ namespace spine {
|
|||||||
void setSlotsRange(int startSlotIndex, int endSlotIndex);
|
void setSlotsRange(int startSlotIndex, int endSlotIndex);
|
||||||
|
|
||||||
// --- BlendProtocol
|
// --- BlendProtocol
|
||||||
virtual void setBlendFunc (const cocos2d::BlendFunc& blendFunc)override;
|
void setBlendFunc (const cocos2d::BlendFunc& blendFunc)override;
|
||||||
virtual const cocos2d::BlendFunc& getBlendFunc () const override;
|
const cocos2d::BlendFunc& getBlendFunc () const override;
|
||||||
virtual void setOpacityModifyRGB (bool value) override;
|
void setOpacityModifyRGB (bool value) override;
|
||||||
virtual bool isOpacityModifyRGB () const override;
|
bool isOpacityModifyRGB () const override;
|
||||||
|
|
||||||
// Frees global memory used for temporay vertex transformations.
|
|
||||||
static void destroyScratchBuffers();
|
|
||||||
|
|
||||||
CC_CONSTRUCTOR_ACCESS:
|
CC_CONSTRUCTOR_ACCESS:
|
||||||
SkeletonRenderer ();
|
SkeletonRenderer ();
|
||||||
@ -136,10 +135,11 @@ namespace spine {
|
|||||||
protected:
|
protected:
|
||||||
void setSkeletonData (SkeletonData* skeletonData, bool ownsSkeletonData);
|
void setSkeletonData (SkeletonData* skeletonData, bool ownsSkeletonData);
|
||||||
void setupGLProgramState(bool twoColorTintEnabled);
|
void setupGLProgramState(bool twoColorTintEnabled);
|
||||||
|
virtual void drawDebug (cocos2d::Renderer* renderer, const cocos2d::Mat4& transform, uint32_t transformFlags);
|
||||||
|
|
||||||
bool _ownsSkeletonData;
|
bool _ownsSkeletonData;
|
||||||
bool _ownsSkeleton;
|
bool _ownsSkeleton;
|
||||||
bool _ownsAtlas;
|
bool _ownsAtlas = false;
|
||||||
Atlas* _atlas;
|
Atlas* _atlas;
|
||||||
AttachmentLoader* _attachmentLoader;
|
AttachmentLoader* _attachmentLoader;
|
||||||
cocos2d::CustomCommand _debugCommand;
|
cocos2d::CustomCommand _debugCommand;
|
||||||
@ -150,8 +150,10 @@ namespace spine {
|
|||||||
bool _debugSlots;
|
bool _debugSlots;
|
||||||
bool _debugBones;
|
bool _debugBones;
|
||||||
bool _debugMeshes;
|
bool _debugMeshes;
|
||||||
|
bool _debugBoundingRect;
|
||||||
SkeletonClipping* _clipper;
|
SkeletonClipping* _clipper;
|
||||||
VertexEffect* _effect;
|
VertexEffect* _effect;
|
||||||
|
cocos2d::Rect _boundingRect;
|
||||||
|
|
||||||
int _startSlotIndex;
|
int _startSlotIndex;
|
||||||
int _endSlotIndex;
|
int _endSlotIndex;
|
||||||
|
|||||||
@ -66,8 +66,6 @@ static void setAttachmentVertices(MeshAttachment* attachment) {
|
|||||||
Cocos2dAtlasAttachmentLoader::Cocos2dAtlasAttachmentLoader(Atlas* atlas): AtlasAttachmentLoader(atlas) {
|
Cocos2dAtlasAttachmentLoader::Cocos2dAtlasAttachmentLoader(Atlas* atlas): AtlasAttachmentLoader(atlas) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Cocos2dAtlasAttachmentLoader::~Cocos2dAtlasAttachmentLoader() { }
|
|
||||||
|
|
||||||
void Cocos2dAtlasAttachmentLoader::configureAttachment(Attachment* attachment) {
|
void Cocos2dAtlasAttachmentLoader::configureAttachment(Attachment* attachment) {
|
||||||
if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) {
|
if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) {
|
||||||
setAttachmentVertices((RegionAttachment*)attachment);
|
setAttachmentVertices((RegionAttachment*)attachment);
|
||||||
@ -102,34 +100,31 @@ GLuint filter (TextureFilter filter) {
|
|||||||
return GL_LINEAR;
|
return GL_LINEAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cocos2dTextureLoader::Cocos2dTextureLoader() : TextureLoader() { }
|
|
||||||
Cocos2dTextureLoader::~Cocos2dTextureLoader() { }
|
|
||||||
|
|
||||||
void Cocos2dTextureLoader::load(AtlasPage& page, const spine::String& path) {
|
void Cocos2dTextureLoader::load(AtlasPage& page, const spine::String& path) {
|
||||||
Texture2D* texture = Director::getInstance()->getTextureCache()->addImage(path.buffer());
|
Texture2D* texture = Director::getInstance()->getTextureCache()->addImage(path.buffer());
|
||||||
CCASSERT(texture != nullptr, "Invalid image");
|
CCASSERT(texture != nullptr, "Invalid image");
|
||||||
|
if (texture)
|
||||||
|
{
|
||||||
texture->retain();
|
texture->retain();
|
||||||
|
Texture2D::TexParams textureParams = { filter(page.minFilter), filter(page.magFilter), wrap(page.uWrap), wrap(page.vWrap) };
|
||||||
Texture2D::TexParams textureParams = {filter(page.minFilter), filter(page.magFilter), wrap(page.uWrap), wrap(page.vWrap)};
|
|
||||||
texture->setTexParameters(textureParams);
|
texture->setTexParameters(textureParams);
|
||||||
|
|
||||||
page.setRendererObject(texture);
|
page.setRendererObject(texture);
|
||||||
page.width = texture->getPixelsWide();
|
page.width = texture->getPixelsWide();
|
||||||
page.height = texture->getPixelsHigh();
|
page.height = texture->getPixelsHigh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cocos2dTextureLoader::unload(void* texture) {
|
void Cocos2dTextureLoader::unload(void* texture) {
|
||||||
|
if (texture)
|
||||||
|
{
|
||||||
((Texture2D*)texture)->release();
|
((Texture2D*)texture)->release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Cocos2dExtension::Cocos2dExtension() : DefaultSpineExtension() { }
|
|
||||||
|
|
||||||
Cocos2dExtension::~Cocos2dExtension() { }
|
|
||||||
|
|
||||||
char *Cocos2dExtension::_readFile(const spine::String &path, int *length) {
|
char *Cocos2dExtension::_readFile(const spine::String &path, int *length) {
|
||||||
Data data = FileUtils::getInstance()->getDataFromFile(FileUtils::getInstance()->fullPathForFilename(path.buffer()));
|
Data data = FileUtils::getInstance()->getDataFromFile(FileUtils::getInstance()->fullPathForFilename(path.buffer()));
|
||||||
if (data.isNull()) return 0;
|
if (data.isNull()) return nullptr;
|
||||||
|
|
||||||
// avoid buffer overflow (int is shorter than ssize_t in certain platforms)
|
// avoid buffer overflow (int is shorter than ssize_t in certain platforms)
|
||||||
#if COCOS2D_VERSION >= 0x00031200
|
#if COCOS2D_VERSION >= 0x00031200
|
||||||
|
|||||||
@ -41,15 +41,11 @@ namespace spine {
|
|||||||
class Cocos2dAtlasAttachmentLoader: public AtlasAttachmentLoader {
|
class Cocos2dAtlasAttachmentLoader: public AtlasAttachmentLoader {
|
||||||
public:
|
public:
|
||||||
Cocos2dAtlasAttachmentLoader(Atlas* atlas);
|
Cocos2dAtlasAttachmentLoader(Atlas* atlas);
|
||||||
virtual ~Cocos2dAtlasAttachmentLoader();
|
|
||||||
virtual void configureAttachment(Attachment* attachment);
|
virtual void configureAttachment(Attachment* attachment);
|
||||||
};
|
};
|
||||||
|
|
||||||
class Cocos2dTextureLoader: public TextureLoader {
|
class Cocos2dTextureLoader: public TextureLoader {
|
||||||
public:
|
public:
|
||||||
Cocos2dTextureLoader();
|
|
||||||
|
|
||||||
virtual ~Cocos2dTextureLoader();
|
|
||||||
|
|
||||||
virtual void load(AtlasPage& page, const String& path);
|
virtual void load(AtlasPage& page, const String& path);
|
||||||
|
|
||||||
@ -58,9 +54,6 @@ namespace spine {
|
|||||||
|
|
||||||
class Cocos2dExtension: public DefaultSpineExtension {
|
class Cocos2dExtension: public DefaultSpineExtension {
|
||||||
public:
|
public:
|
||||||
Cocos2dExtension();
|
|
||||||
|
|
||||||
virtual ~Cocos2dExtension();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual char *_readFile(const String &path, int *length);
|
virtual char *_readFile(const String &path, int *length);
|
||||||
|
|||||||
@ -67,6 +67,7 @@ enum TextureWrap {
|
|||||||
class SP_API AtlasPage : public SpineObject, public HasRendererObject {
|
class SP_API AtlasPage : public SpineObject, public HasRendererObject {
|
||||||
public:
|
public:
|
||||||
String name;
|
String name;
|
||||||
|
String texturePath;
|
||||||
Format format;
|
Format format;
|
||||||
TextureFilter minFilter;
|
TextureFilter minFilter;
|
||||||
TextureFilter magFilter;
|
TextureFilter magFilter;
|
||||||
@ -76,10 +77,8 @@ public:
|
|||||||
|
|
||||||
explicit AtlasPage(const String &inName) : name(inName), format(Format_RGBA8888), minFilter(TextureFilter_Nearest),
|
explicit AtlasPage(const String &inName) : name(inName), format(Format_RGBA8888), minFilter(TextureFilter_Nearest),
|
||||||
magFilter(TextureFilter_Nearest), uWrap(TextureWrap_ClampToEdge),
|
magFilter(TextureFilter_Nearest), uWrap(TextureWrap_ClampToEdge),
|
||||||
vWrap(TextureWrap_ClampToEdge) {
|
vWrap(TextureWrap_ClampToEdge), width(0), height(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~AtlasPage() { }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SP_API AtlasRegion : public SpineObject {
|
class SP_API AtlasRegion : public SpineObject {
|
||||||
@ -101,9 +100,9 @@ class TextureLoader;
|
|||||||
|
|
||||||
class SP_API Atlas : public SpineObject {
|
class SP_API Atlas : public SpineObject {
|
||||||
public:
|
public:
|
||||||
Atlas(const String &path, TextureLoader *textureLoader);
|
Atlas(const String &path, TextureLoader *textureLoader, bool createTexture = true);
|
||||||
|
|
||||||
Atlas(const char *data, int length, const char *dir, TextureLoader *textureLoader);
|
Atlas(const char *data, int length, const char *dir, TextureLoader *textureLoader, bool createTexture = true);
|
||||||
|
|
||||||
~Atlas();
|
~Atlas();
|
||||||
|
|
||||||
@ -121,7 +120,7 @@ private:
|
|||||||
Vector<AtlasRegion *> _regions;
|
Vector<AtlasRegion *> _regions;
|
||||||
TextureLoader *_textureLoader;
|
TextureLoader *_textureLoader;
|
||||||
|
|
||||||
void load(const char *begin, int length, const char *dir);
|
void load(const char *begin, int length, const char *dir, bool createTexture);
|
||||||
|
|
||||||
class Str {
|
class Str {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
using namespace spine;
|
using namespace spine;
|
||||||
|
|
||||||
Atlas::Atlas(const String &path, TextureLoader *textureLoader) : _textureLoader(textureLoader) {
|
Atlas::Atlas(const String &path, TextureLoader *textureLoader, bool createTexture) : _textureLoader(textureLoader) {
|
||||||
int dirLength;
|
int dirLength;
|
||||||
char *dir;
|
char *dir;
|
||||||
int length;
|
int length;
|
||||||
@ -57,16 +57,16 @@ Atlas::Atlas(const String &path, TextureLoader *textureLoader) : _textureLoader(
|
|||||||
|
|
||||||
data = SpineExtension::readFile(path, &length);
|
data = SpineExtension::readFile(path, &length);
|
||||||
if (data) {
|
if (data) {
|
||||||
load(data, length, dir);
|
load(data, length, dir, createTexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
SpineExtension::free(data, __FILE__, __LINE__);
|
SpineExtension::free(data, __FILE__, __LINE__);
|
||||||
SpineExtension::free(dir, __FILE__, __LINE__);
|
SpineExtension::free(dir, __FILE__, __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
Atlas::Atlas(const char *data, int length, const char *dir, TextureLoader *textureLoader) : _textureLoader(
|
Atlas::Atlas(const char *data, int length, const char *dir, TextureLoader *textureLoader, bool createTexture) : _textureLoader(
|
||||||
textureLoader) {
|
textureLoader) {
|
||||||
load(data, length, dir);
|
load(data, length, dir, createTexture);
|
||||||
}
|
}
|
||||||
|
|
||||||
Atlas::~Atlas() {
|
Atlas::~Atlas() {
|
||||||
@ -102,7 +102,7 @@ Vector<AtlasPage*> &Atlas::getPages() {
|
|||||||
return _pages;
|
return _pages;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Atlas::load(const char *begin, int length, const char *dir) {
|
void Atlas::load(const char *begin, int length, const char *dir, bool createTexture) {
|
||||||
static const char *formatNames[] = {"", "Alpha", "Intensity", "LuminanceAlpha", "RGB565", "RGBA4444", "RGB888",
|
static const char *formatNames[] = {"", "Alpha", "Intensity", "LuminanceAlpha", "RGB565", "RGBA4444", "RGB888",
|
||||||
"RGBA8888"};
|
"RGBA8888"};
|
||||||
static const char *textureFilterNames[] = {"", "Nearest", "Linear", "MipMap", "MipMapNearestNearest",
|
static const char *textureFilterNames[] = {"", "Nearest", "Linear", "MipMap", "MipMapNearestNearest",
|
||||||
@ -163,9 +163,15 @@ void Atlas::load(const char *begin, int length, const char *dir) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (createTexture)
|
||||||
|
{
|
||||||
if (_textureLoader) _textureLoader->load(*page, String(path));
|
if (_textureLoader) _textureLoader->load(*page, String(path));
|
||||||
|
|
||||||
SpineExtension::free(path, __FILE__, __LINE__);
|
SpineExtension::free(path, __FILE__, __LINE__);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
page->texturePath = String(path, true);
|
||||||
|
}
|
||||||
|
|
||||||
_pages.add(page);
|
_pages.add(page);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user