mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of git://github.com/cocos2d/cocos2d-x into FileUtils_FILE_API
This commit is contained in:
commit
9d450d6513
|
@ -1,9 +1,15 @@
|
||||||
cocos2d-x-3.2 ???
|
cocos2d-x-3.2 ???
|
||||||
[NEW] Node: added getName(), setName(), getChildByName(), enumerateChildren()
|
|
||||||
[NEW] Label: support setting line height and additional kerning of label that not using system font
|
[NEW] Label: support setting line height and additional kerning of label that not using system font
|
||||||
|
[NEW] Lua-binding: Animation3D supported
|
||||||
|
[NEW] Node: added getName(), setName(), getChildByName(), enumerateChildren()
|
||||||
|
[NEW] Node: physical body supports rotation
|
||||||
|
|
||||||
|
|
||||||
[FIX] FileUtils: getStringFromFile may return a unterminated string
|
[FIX] FileUtils: getStringFromFile may return a unterminated string
|
||||||
|
[FIX] Lua-binding: Sequence:create will cause drop-dead issue
|
||||||
|
[FIX] Studio support: NodeReader may cause crash
|
||||||
[FIX] UIButton: doesn't support TTF font
|
[FIX] UIButton: doesn't support TTF font
|
||||||
|
[FIX] UIListView: addEventListener can not work
|
||||||
|
|
||||||
cocos2d-x-3.2-alpha0 Jun.17 2014
|
cocos2d-x-3.2-alpha0 Jun.17 2014
|
||||||
[NEW] Console: add a command to show engine version
|
[NEW] Console: add a command to show engine version
|
||||||
|
|
|
@ -999,6 +999,10 @@
|
||||||
29CB8F4D1929D1BB00C841D6 /* UILayoutManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29CB8F4A1929D1BB00C841D6 /* UILayoutManager.cpp */; };
|
29CB8F4D1929D1BB00C841D6 /* UILayoutManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29CB8F4A1929D1BB00C841D6 /* UILayoutManager.cpp */; };
|
||||||
29CB8F4E1929D1BB00C841D6 /* UILayoutManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CB8F4B1929D1BB00C841D6 /* UILayoutManager.h */; };
|
29CB8F4E1929D1BB00C841D6 /* UILayoutManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CB8F4B1929D1BB00C841D6 /* UILayoutManager.h */; };
|
||||||
29CB8F4F1929D1BB00C841D6 /* UILayoutManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CB8F4B1929D1BB00C841D6 /* UILayoutManager.h */; };
|
29CB8F4F1929D1BB00C841D6 /* UILayoutManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CB8F4B1929D1BB00C841D6 /* UILayoutManager.h */; };
|
||||||
|
29E99D1E1957BA7000046604 /* CocoLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29E99D1C1957BA7000046604 /* CocoLoader.cpp */; };
|
||||||
|
29E99D1F1957BA7000046604 /* CocoLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29E99D1C1957BA7000046604 /* CocoLoader.cpp */; };
|
||||||
|
29E99D201957BA7000046604 /* CocoLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 29E99D1D1957BA7000046604 /* CocoLoader.h */; };
|
||||||
|
29E99D211957BA7000046604 /* CocoLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 29E99D1D1957BA7000046604 /* CocoLoader.h */; };
|
||||||
2AC795DB1862870F005EC8E1 /* SkeletonBounds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2AC795D918628689005EC8E1 /* SkeletonBounds.cpp */; };
|
2AC795DB1862870F005EC8E1 /* SkeletonBounds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2AC795D918628689005EC8E1 /* SkeletonBounds.cpp */; };
|
||||||
2AC795DC1862870F005EC8E1 /* Event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2AC795D51862867D005EC8E1 /* Event.cpp */; };
|
2AC795DC1862870F005EC8E1 /* Event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2AC795D51862867D005EC8E1 /* Event.cpp */; };
|
||||||
2AC795DD1862870F005EC8E1 /* EventData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2AC795D71862867D005EC8E1 /* EventData.cpp */; };
|
2AC795DD1862870F005EC8E1 /* EventData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2AC795D71862867D005EC8E1 /* EventData.cpp */; };
|
||||||
|
@ -2309,6 +2313,8 @@
|
||||||
299754F3193EC95400A54AC3 /* ObjectFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjectFactory.h; path = ../base/ObjectFactory.h; sourceTree = "<group>"; };
|
299754F3193EC95400A54AC3 /* ObjectFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ObjectFactory.h; path = ../base/ObjectFactory.h; sourceTree = "<group>"; };
|
||||||
29CB8F4A1929D1BB00C841D6 /* UILayoutManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UILayoutManager.cpp; sourceTree = "<group>"; };
|
29CB8F4A1929D1BB00C841D6 /* UILayoutManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UILayoutManager.cpp; sourceTree = "<group>"; };
|
||||||
29CB8F4B1929D1BB00C841D6 /* UILayoutManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UILayoutManager.h; sourceTree = "<group>"; };
|
29CB8F4B1929D1BB00C841D6 /* UILayoutManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UILayoutManager.h; sourceTree = "<group>"; };
|
||||||
|
29E99D1C1957BA7000046604 /* CocoLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CocoLoader.cpp; sourceTree = "<group>"; };
|
||||||
|
29E99D1D1957BA7000046604 /* CocoLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocoLoader.h; sourceTree = "<group>"; };
|
||||||
2AC795D318628672005EC8E1 /* BoundingBoxAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BoundingBoxAttachment.cpp; sourceTree = "<group>"; };
|
2AC795D318628672005EC8E1 /* BoundingBoxAttachment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BoundingBoxAttachment.cpp; sourceTree = "<group>"; };
|
||||||
2AC795D418628672005EC8E1 /* BoundingBoxAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BoundingBoxAttachment.h; sourceTree = "<group>"; };
|
2AC795D418628672005EC8E1 /* BoundingBoxAttachment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BoundingBoxAttachment.h; sourceTree = "<group>"; };
|
||||||
2AC795D51862867D005EC8E1 /* Event.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Event.cpp; sourceTree = "<group>"; };
|
2AC795D51862867D005EC8E1 /* Event.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Event.cpp; sourceTree = "<group>"; };
|
||||||
|
@ -3641,6 +3647,8 @@
|
||||||
1A8C5946180E930E00EF57C3 /* cocostudio */ = {
|
1A8C5946180E930E00EF57C3 /* cocostudio */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
29E99D1C1957BA7000046604 /* CocoLoader.cpp */,
|
||||||
|
29E99D1D1957BA7000046604 /* CocoLoader.h */,
|
||||||
0634A4C4194B19E400E608AF /* ActionTimeline */,
|
0634A4C4194B19E400E608AF /* ActionTimeline */,
|
||||||
50FCEB6818C72017004AD434 /* WidgetReader */,
|
50FCEB6818C72017004AD434 /* WidgetReader */,
|
||||||
06CAAAC1186AD63B0012A414 /* TriggerObj.h */,
|
06CAAAC1186AD63B0012A414 /* TriggerObj.h */,
|
||||||
|
@ -5162,6 +5170,7 @@
|
||||||
1AD71E0D180E26E600808F54 /* CocosBuilder.h in Headers */,
|
1AD71E0D180E26E600808F54 /* CocosBuilder.h in Headers */,
|
||||||
1AD71E97180E26E600808F54 /* Animation.h in Headers */,
|
1AD71E97180E26E600808F54 /* Animation.h in Headers */,
|
||||||
1AD71E9B180E26E600808F54 /* AnimationState.h in Headers */,
|
1AD71E9B180E26E600808F54 /* AnimationState.h in Headers */,
|
||||||
|
29E99D201957BA7000046604 /* CocoLoader.h in Headers */,
|
||||||
1A01C69218F57BE800EFE3A6 /* CCDouble.h in Headers */,
|
1A01C69218F57BE800EFE3A6 /* CCDouble.h in Headers */,
|
||||||
50ABBE251925AB6F00A911A9 /* base64.h in Headers */,
|
50ABBE251925AB6F00A911A9 /* base64.h in Headers */,
|
||||||
50ABBEC91925AB6F00A911A9 /* firePngData.h in Headers */,
|
50ABBEC91925AB6F00A911A9 /* firePngData.h in Headers */,
|
||||||
|
@ -5469,6 +5478,7 @@
|
||||||
06CAAACE186AD7FA0012A414 /* TriggerBase.h in Headers */,
|
06CAAACE186AD7FA0012A414 /* TriggerBase.h in Headers */,
|
||||||
503DD8EC1926736A00CD74DD /* CCGLView.h in Headers */,
|
503DD8EC1926736A00CD74DD /* CCGLView.h in Headers */,
|
||||||
50FCEBC218C72017004AD434 /* TextFieldReader.h in Headers */,
|
50FCEBC218C72017004AD434 /* TextFieldReader.h in Headers */,
|
||||||
|
29E99D211957BA7000046604 /* CocoLoader.h in Headers */,
|
||||||
50ABBEBA1925AB6F00A911A9 /* ccUTF8.h in Headers */,
|
50ABBEBA1925AB6F00A911A9 /* ccUTF8.h in Headers */,
|
||||||
1A570068180BC5A10088DEC7 /* CCActionCamera.h in Headers */,
|
1A570068180BC5A10088DEC7 /* CCActionCamera.h in Headers */,
|
||||||
1A57006C180BC5A10088DEC7 /* CCActionCatmullRom.h in Headers */,
|
1A57006C180BC5A10088DEC7 /* CCActionCatmullRom.h in Headers */,
|
||||||
|
@ -6173,6 +6183,7 @@
|
||||||
ED9C6A9418599AD8000A5232 /* CCNodeGrid.cpp in Sources */,
|
ED9C6A9418599AD8000A5232 /* CCNodeGrid.cpp in Sources */,
|
||||||
06CAAACB186AD7F20012A414 /* TriggerMng.cpp in Sources */,
|
06CAAACB186AD7F20012A414 /* TriggerMng.cpp in Sources */,
|
||||||
46A170E61807CECA005B8026 /* CCPhysicsBody.cpp in Sources */,
|
46A170E61807CECA005B8026 /* CCPhysicsBody.cpp in Sources */,
|
||||||
|
29E99D1E1957BA7000046604 /* CocoLoader.cpp in Sources */,
|
||||||
50ABBDA71925AB4100A911A9 /* CCRenderCommand.cpp in Sources */,
|
50ABBDA71925AB4100A911A9 /* CCRenderCommand.cpp in Sources */,
|
||||||
50ABBD501925AB0000A911A9 /* Quaternion.cpp in Sources */,
|
50ABBD501925AB0000A911A9 /* Quaternion.cpp in Sources */,
|
||||||
50ABBEBB1925AB6F00A911A9 /* ccUtils.cpp in Sources */,
|
50ABBEBB1925AB6F00A911A9 /* ccUtils.cpp in Sources */,
|
||||||
|
@ -6633,6 +6644,7 @@
|
||||||
50ABBE621925AB6F00A911A9 /* CCEventListenerAcceleration.cpp in Sources */,
|
50ABBE621925AB6F00A911A9 /* CCEventListenerAcceleration.cpp in Sources */,
|
||||||
B37510811823ACA100B3BA6A /* CCPhysicsJointInfo_chipmunk.cpp in Sources */,
|
B37510811823ACA100B3BA6A /* CCPhysicsJointInfo_chipmunk.cpp in Sources */,
|
||||||
2905FA8D18CF08D100240AA3 /* UIWidget.cpp in Sources */,
|
2905FA8D18CF08D100240AA3 /* UIWidget.cpp in Sources */,
|
||||||
|
29E99D1F1957BA7000046604 /* CocoLoader.cpp in Sources */,
|
||||||
B29594B51926D5EC003EEF37 /* CCMeshCommand.cpp in Sources */,
|
B29594B51926D5EC003EEF37 /* CCMeshCommand.cpp in Sources */,
|
||||||
0634A4D5194B19E400E608AF /* CCActionTimelineCache.cpp in Sources */,
|
0634A4D5194B19E400E608AF /* CCActionTimelineCache.cpp in Sources */,
|
||||||
50ABBE7E1925AB6F00A911A9 /* CCEventTouch.cpp in Sources */,
|
50ABBE7E1925AB6F00A911A9 /* CCEventTouch.cpp in Sources */,
|
||||||
|
|
|
@ -5476,6 +5476,7 @@
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
CC_TARGET_OS_IPHONE,
|
CC_TARGET_OS_IPHONE,
|
||||||
|
@ -5492,6 +5493,7 @@
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CODE_SIGN_IDENTITY = "iPhone Developer";
|
CODE_SIGN_IDENTITY = "iPhone Developer";
|
||||||
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
CC_TARGET_OS_IPHONE,
|
CC_TARGET_OS_IPHONE,
|
||||||
|
|
|
@ -9,14 +9,15 @@
|
||||||
|
|
||||||
<!--LayoutRoot is the root grid where all page content is placed-->
|
<!--LayoutRoot is the root grid where all page content is placed-->
|
||||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||||
<StackPanel Orientation="Horizontal" Margin="40,100,0,0" Height="50" VerticalAlignment="Top">
|
<StackPanel Orientation="Vertical">
|
||||||
<TextBlock Text="Memory: " FontSize="36"/>
|
<StackPanel Orientation="Horizontal" Margin="40,100,0,0" Height="50" VerticalAlignment="Top">
|
||||||
<TextBlock x:Name="MemoryTextBlock" FontSize="36"/>
|
<TextBlock Text="Save file to cocos\platform\wp8\shaders\precompiledshaders.h" FontSize="36"/>
|
||||||
<TextBlock Text=" MB" FontSize="36"/>
|
</StackPanel>
|
||||||
<TextBlock Text=" Peak: " FontSize="36"/>
|
<StackPanel Orientation="Horizontal" Margin="40,100,0,0" Height="50" VerticalAlignment="Top">
|
||||||
<TextBlock x:Name="PeakMemoryTextBlock" FontSize="36"/>
|
<TextBlock Text="Result: " FontSize="36"/>
|
||||||
<TextBlock Text=" MB" FontSize="36"/>
|
<TextBlock Text="" FontSize="36" x:Name="ResultText" />
|
||||||
|
</StackPanel>
|
||||||
|
<Button Margin="40,100,0,0" x:Name="compileButton" Content="Compile" Width="150" Click="OnCompile" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Button Margin="40,10,0,0" x:Name="compileButton" Content="Compile" Width="150" Click="OnCompile" />
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Page>
|
</Page>
|
||||||
|
|
|
@ -60,7 +60,7 @@ DirectXPage::~DirectXPage()
|
||||||
|
|
||||||
void DirectXPage::OnCompile(Object^ sender, RoutedEventArgs^ args)
|
void DirectXPage::OnCompile(Object^ sender, RoutedEventArgs^ args)
|
||||||
{
|
{
|
||||||
compiler.Compile();
|
compiler.Compile(ResultText);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Saves the current state of the app for suspend and terminate events.
|
// Saves the current state of the app for suspend and terminate events.
|
||||||
|
|
|
@ -35,7 +35,11 @@ using namespace Windows::UI::Core;
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
|
|
||||||
ShaderCompiler::ShaderCompiler() : m_display(nullptr), m_context(nullptr), m_initialized(false)
|
ShaderCompiler::ShaderCompiler()
|
||||||
|
: m_display(nullptr),
|
||||||
|
m_context(nullptr),
|
||||||
|
m_initialized(false),
|
||||||
|
m_resultText(nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -64,14 +68,22 @@ void ShaderCompiler::applicationWillEnterForeground()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ShaderCompiler::Compile()
|
bool ShaderCompiler::Compile(Windows::UI::Xaml::Controls::TextBlock^ resultText)
|
||||||
{
|
{
|
||||||
|
m_resultText = resultText;
|
||||||
|
resultText->Text = "Compiling shaders...";
|
||||||
|
|
||||||
|
if (!InitializeAngle(ANGLE_D3D_FEATURE_LEVEL::ANGLE_D3D_FEATURE_LEVEL_9_3))
|
||||||
|
{
|
||||||
|
resultText->Text = "Unable to initialize Angle";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool result = InitializeAngle(ANGLE_D3D_FEATURE_LEVEL::ANGLE_D3D_FEATURE_LEVEL_9_3);
|
|
||||||
Director::getInstance()->setAnimationInterval(1.0 / 60.0);
|
Director::getInstance()->setAnimationInterval(1.0 / 60.0);
|
||||||
CCShaderCache::getInstance()->loadDefaultShaders();
|
CCShaderCache::getInstance()->loadDefaultShaders();
|
||||||
CCPrecompiledShaders::getInstance()->savePrecompiledShaders();
|
CCPrecompiledShaders::getInstance()->savePrecompiledShaders();
|
||||||
return result;
|
resultText->Text = "Complete";
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -34,10 +34,12 @@ class ShaderCompiler : private cocos2d::Application
|
||||||
public:
|
public:
|
||||||
ShaderCompiler();
|
ShaderCompiler();
|
||||||
~ShaderCompiler();
|
~ShaderCompiler();
|
||||||
bool Compile();
|
bool Compile(Windows::UI::Xaml::Controls::TextBlock^ resultText);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
Windows::UI::Xaml::Controls::TextBlock^ m_resultText;
|
||||||
|
|
||||||
virtual bool applicationDidFinishLaunching();
|
virtual bool applicationDidFinishLaunching();
|
||||||
virtual void applicationDidEnterBackground();
|
virtual void applicationDidEnterBackground();
|
||||||
virtual void applicationWillEnterForeground();
|
virtual void applicationWillEnterForeground();
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
How to compile precompiled shaders for Windows Phone 8.0 (WP8)
|
||||||
|
|
||||||
|
1. Open the VS project Cocos2dShaderCompiler\Cocos2dShaderCompiler.sln
|
||||||
|
2. Build and run the project
|
||||||
|
3. Click the Compile button
|
||||||
|
4. Select the file cocos\platform\wp8\shaders\precompiledshaders.h in the file dialog box
|
||||||
|
5. Program will precompile all of the cached cocos2d-x shaders.
|
|
@ -828,8 +828,26 @@ void RotateTo::update(float time)
|
||||||
{
|
{
|
||||||
if (_target)
|
if (_target)
|
||||||
{
|
{
|
||||||
|
#if CC_USE_PHYSICS
|
||||||
|
if (_target->getPhysicsBody() != nullptr && _startAngleX == _startAngleY && _diffAngleX == _diffAngleY)
|
||||||
|
{
|
||||||
|
_target->setRotation(_startAngleX + _diffAngleX * time);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// _startAngleX != _startAngleY || _diffAngleX != _diffAngleY
|
||||||
|
if (_target->getPhysicsBody() != nullptr)
|
||||||
|
{
|
||||||
|
CCLOG("RotateTo WARNING: PhysicsBody doesn't support skew rotation");
|
||||||
|
}
|
||||||
|
|
||||||
|
_target->setRotationSkewX(_startAngleX + _diffAngleX * time);
|
||||||
|
_target->setRotationSkewY(_startAngleY + _diffAngleY * time);
|
||||||
|
}
|
||||||
|
#else
|
||||||
_target->setRotationSkewX(_startAngleX + _diffAngleX * time);
|
_target->setRotationSkewX(_startAngleX + _diffAngleX * time);
|
||||||
_target->setRotationSkewY(_startAngleY + _diffAngleY * time);
|
_target->setRotationSkewY(_startAngleY + _diffAngleY * time);
|
||||||
|
#endif // CC_USE_PHYSICS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -952,8 +970,26 @@ void RotateBy::update(float time)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#if CC_USE_PHYSICS
|
||||||
|
if (_target->getPhysicsBody() != nullptr && _startAngleZ_X == _startAngleZ_Y && _angleZ_X == _angleZ_Y)
|
||||||
|
{
|
||||||
|
_target->setRotation(_startAngleZ_X + _angleZ_X * time);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// _startAngleZ_X != _startAngleZ_Y || _angleZ_X != _angleZ_Y
|
||||||
|
if (_target->getPhysicsBody() != nullptr)
|
||||||
|
{
|
||||||
|
CCLOG("RotateBy WARNING: PhysicsBody doesn't support skew rotation");
|
||||||
|
}
|
||||||
|
|
||||||
|
_target->setRotationSkewX(_startAngleZ_X + _angleZ_X * time);
|
||||||
|
_target->setRotationSkewY(_startAngleZ_Y + _angleZ_Y * time);
|
||||||
|
}
|
||||||
|
#else
|
||||||
_target->setRotationSkewX(_startAngleZ_X + _angleZ_X * time);
|
_target->setRotationSkewX(_startAngleZ_X + _angleZ_X * time);
|
||||||
_target->setRotationSkewY(_startAngleZ_Y + _angleZ_Y * time);
|
_target->setRotationSkewY(_startAngleZ_Y + _angleZ_Y * time);
|
||||||
|
#endif // CC_USE_PHYSICS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -370,6 +370,7 @@ class CC_DLL RotateBy : public ActionInterval
|
||||||
public:
|
public:
|
||||||
/** creates the action */
|
/** creates the action */
|
||||||
static RotateBy* create(float duration, float deltaAngle);
|
static RotateBy* create(float duration, float deltaAngle);
|
||||||
|
/** @warning The physics body contained in Node doesn't support rotate with different x and y angle. */
|
||||||
static RotateBy* create(float duration, float deltaAngleZ_X, float deltaAngleZ_Y);
|
static RotateBy* create(float duration, float deltaAngleZ_X, float deltaAngleZ_Y);
|
||||||
static RotateBy* create(float duration, const Vec3& deltaAngle3D);
|
static RotateBy* create(float duration, const Vec3& deltaAngle3D);
|
||||||
|
|
||||||
|
@ -387,6 +388,7 @@ CC_CONSTRUCTOR_ACCESS:
|
||||||
|
|
||||||
/** initializes the action */
|
/** initializes the action */
|
||||||
bool initWithDuration(float duration, float deltaAngle);
|
bool initWithDuration(float duration, float deltaAngle);
|
||||||
|
/** @warning The physics body contained in Node doesn't support rotate with different x and y angle. */
|
||||||
bool initWithDuration(float duration, float deltaAngleZ_X, float deltaAngleZ_Y);
|
bool initWithDuration(float duration, float deltaAngleZ_X, float deltaAngleZ_Y);
|
||||||
bool initWithDuration(float duration, const Vec3& deltaAngle3D);
|
bool initWithDuration(float duration, const Vec3& deltaAngle3D);
|
||||||
|
|
||||||
|
@ -675,6 +677,7 @@ private:
|
||||||
|
|
||||||
/** @brief Scales a Node object to a zoom factor by modifying it's scale attribute.
|
/** @brief Scales a Node object to a zoom factor by modifying it's scale attribute.
|
||||||
@warning This action doesn't support "reverse"
|
@warning This action doesn't support "reverse"
|
||||||
|
@warning The physics body contained in Node doesn't support this action.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ScaleTo : public ActionInterval
|
class CC_DLL ScaleTo : public ActionInterval
|
||||||
{
|
{
|
||||||
|
@ -726,6 +729,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Scales a Node object a zoom factor by modifying it's scale attribute.
|
/** @brief Scales a Node object a zoom factor by modifying it's scale attribute.
|
||||||
|
@warning The physics body contained in Node doesn't support this action.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ScaleBy : public ScaleTo
|
class CC_DLL ScaleBy : public ScaleTo
|
||||||
{
|
{
|
||||||
|
|
|
@ -203,6 +203,13 @@ void Node::setSkewX(float skewX)
|
||||||
if (_skewX == skewX)
|
if (_skewX == skewX)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if CC_USE_PHYSICS
|
||||||
|
if (_physicsBody != nullptr)
|
||||||
|
{
|
||||||
|
CCLOG("Node WARNING: PhysicsBody doesn't support setSkewX");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
_skewX = skewX;
|
_skewX = skewX;
|
||||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||||
}
|
}
|
||||||
|
@ -217,6 +224,13 @@ void Node::setSkewY(float skewY)
|
||||||
if (_skewY == skewY)
|
if (_skewY == skewY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if CC_USE_PHYSICS
|
||||||
|
if (_physicsBody != nullptr)
|
||||||
|
{
|
||||||
|
CCLOG("Node WARNING: PhysicsBody doesn't support setSkewY");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
_skewY = skewY;
|
_skewY = skewY;
|
||||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||||
}
|
}
|
||||||
|
@ -298,10 +312,9 @@ void Node::setRotation3D(const Vec3& rotation)
|
||||||
_rotationZ_Y = _rotationZ_X = rotation.z;
|
_rotationZ_Y = _rotationZ_X = rotation.z;
|
||||||
|
|
||||||
#if CC_USE_PHYSICS
|
#if CC_USE_PHYSICS
|
||||||
if (_physicsBody)
|
if (_physicsBody != nullptr)
|
||||||
{
|
{
|
||||||
Scene* scene = _physicsBody->getWorld() != nullptr ? &_physicsBody->getWorld()->getScene() : nullptr;
|
CCLOG("Node WARNING: PhysicsBody doesn't support setRotation3D");
|
||||||
updatePhysicsBodyRotation(scene);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -319,6 +332,13 @@ void Node::setRotationSkewX(float rotationX)
|
||||||
if (_rotationZ_X == rotationX)
|
if (_rotationZ_X == rotationX)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if CC_USE_PHYSICS
|
||||||
|
if (_physicsBody != nullptr)
|
||||||
|
{
|
||||||
|
CCLOG("Node WARNING: PhysicsBody doesn't support setRotationSkewX");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
_rotationZ_X = rotationX;
|
_rotationZ_X = rotationX;
|
||||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||||
}
|
}
|
||||||
|
@ -333,6 +353,13 @@ void Node::setRotationSkewY(float rotationY)
|
||||||
if (_rotationZ_Y == rotationY)
|
if (_rotationZ_Y == rotationY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if CC_USE_PHYSICS
|
||||||
|
if (_physicsBody != nullptr)
|
||||||
|
{
|
||||||
|
CCLOG("Node WARNING: PhysicsBody doesn't support setRotationSkewY");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
_rotationZ_Y = rotationY;
|
_rotationZ_Y = rotationY;
|
||||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||||
}
|
}
|
||||||
|
@ -349,7 +376,14 @@ void Node::setScale(float scale)
|
||||||
{
|
{
|
||||||
if (_scaleX == scale)
|
if (_scaleX == scale)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if CC_USE_PHYSICS
|
||||||
|
if (_physicsBody != nullptr)
|
||||||
|
{
|
||||||
|
CCLOG("Node WARNING: PhysicsBody doesn't support setScale");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
_scaleX = _scaleY = _scaleZ = scale;
|
_scaleX = _scaleY = _scaleZ = scale;
|
||||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||||
}
|
}
|
||||||
|
@ -366,6 +400,13 @@ void Node::setScale(float scaleX,float scaleY)
|
||||||
if (_scaleX == scaleX && _scaleY == scaleY)
|
if (_scaleX == scaleX && _scaleY == scaleY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if CC_USE_PHYSICS
|
||||||
|
if (_physicsBody != nullptr)
|
||||||
|
{
|
||||||
|
CCLOG("Node WARNING: PhysicsBody doesn't support setScale");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
_scaleX = scaleX;
|
_scaleX = scaleX;
|
||||||
_scaleY = scaleY;
|
_scaleY = scaleY;
|
||||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||||
|
@ -377,6 +418,13 @@ void Node::setScaleX(float scaleX)
|
||||||
if (_scaleX == scaleX)
|
if (_scaleX == scaleX)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if CC_USE_PHYSICS
|
||||||
|
if (_physicsBody != nullptr)
|
||||||
|
{
|
||||||
|
CCLOG("Node WARNING: PhysicsBody doesn't support setScaleX");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
_scaleX = scaleX;
|
_scaleX = scaleX;
|
||||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||||
}
|
}
|
||||||
|
@ -393,6 +441,13 @@ void Node::setScaleZ(float scaleZ)
|
||||||
if (_scaleZ == scaleZ)
|
if (_scaleZ == scaleZ)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if CC_USE_PHYSICS
|
||||||
|
if (_physicsBody != nullptr)
|
||||||
|
{
|
||||||
|
CCLOG("Node WARNING: PhysicsBody doesn't support setScaleZ");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
_scaleZ = scaleZ;
|
_scaleZ = scaleZ;
|
||||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||||
}
|
}
|
||||||
|
@ -409,6 +464,13 @@ void Node::setScaleY(float scaleY)
|
||||||
if (_scaleY == scaleY)
|
if (_scaleY == scaleY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if CC_USE_PHYSICS
|
||||||
|
if (_physicsBody != nullptr)
|
||||||
|
{
|
||||||
|
CCLOG("Node WARNING: PhysicsBody doesn't support setScaleY");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
_scaleY = scaleY;
|
_scaleY = scaleY;
|
||||||
_transformUpdated = _transformDirty = _inverseDirty = true;
|
_transformUpdated = _transformDirty = _inverseDirty = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,6 +201,8 @@ public:
|
||||||
* It is a scaling factor that multiplies the width of the node and its children.
|
* It is a scaling factor that multiplies the width of the node and its children.
|
||||||
*
|
*
|
||||||
* @param scaleX The scale factor on X axis.
|
* @param scaleX The scale factor on X axis.
|
||||||
|
*
|
||||||
|
* @warning The physics body doesn't support this.
|
||||||
*/
|
*/
|
||||||
virtual void setScaleX(float scaleX);
|
virtual void setScaleX(float scaleX);
|
||||||
/**
|
/**
|
||||||
|
@ -219,6 +221,8 @@ public:
|
||||||
* It is a scaling factor that multiplies the height of the node and its children.
|
* It is a scaling factor that multiplies the height of the node and its children.
|
||||||
*
|
*
|
||||||
* @param scaleY The scale factor on Y axis.
|
* @param scaleY The scale factor on Y axis.
|
||||||
|
*
|
||||||
|
* @warning The physics body doesn't support this.
|
||||||
*/
|
*/
|
||||||
virtual void setScaleY(float scaleY);
|
virtual void setScaleY(float scaleY);
|
||||||
/**
|
/**
|
||||||
|
@ -236,6 +240,8 @@ public:
|
||||||
* The Default value is 1.0 if you haven't changed it before.
|
* The Default value is 1.0 if you haven't changed it before.
|
||||||
*
|
*
|
||||||
* @param scaleY The scale factor on Y axis.
|
* @param scaleY The scale factor on Y axis.
|
||||||
|
*
|
||||||
|
* @warning The physics body doesn't support this.
|
||||||
*/
|
*/
|
||||||
virtual void setScaleZ(float scaleZ);
|
virtual void setScaleZ(float scaleZ);
|
||||||
/**
|
/**
|
||||||
|
@ -254,6 +260,8 @@ public:
|
||||||
* It is a scaling factor that multiplies the width, height and depth of the node and its children.
|
* It is a scaling factor that multiplies the width, height and depth of the node and its children.
|
||||||
*
|
*
|
||||||
* @param scale The scale factor for both X and Y axis.
|
* @param scale The scale factor for both X and Y axis.
|
||||||
|
*
|
||||||
|
* @warning The physics body doesn't support this.
|
||||||
*/
|
*/
|
||||||
virtual void setScale(float scale);
|
virtual void setScale(float scale);
|
||||||
/**
|
/**
|
||||||
|
@ -273,6 +281,8 @@ public:
|
||||||
*
|
*
|
||||||
* @param scaleX The scale factor on X axis.
|
* @param scaleX The scale factor on X axis.
|
||||||
* @param scaleY The scale factor on Y axis.
|
* @param scaleY The scale factor on Y axis.
|
||||||
|
*
|
||||||
|
* @warning The physics body doesn't support this.
|
||||||
*/
|
*/
|
||||||
virtual void setScale(float scaleX, float scaleY);
|
virtual void setScale(float scaleX, float scaleY);
|
||||||
|
|
||||||
|
@ -395,6 +405,8 @@ public:
|
||||||
* The default skewX angle is 0. Positive values distort the node in a CW direction.
|
* The default skewX angle is 0. Positive values distort the node in a CW direction.
|
||||||
*
|
*
|
||||||
* @param skewX The X skew angle of the node in degrees.
|
* @param skewX The X skew angle of the node in degrees.
|
||||||
|
*
|
||||||
|
* @warning The physics body doesn't support this.
|
||||||
*/
|
*/
|
||||||
virtual void setSkewX(float skewX);
|
virtual void setSkewX(float skewX);
|
||||||
/**
|
/**
|
||||||
|
@ -418,6 +430,8 @@ public:
|
||||||
* The default skewY angle is 0. Positive values distort the node in a CCW direction.
|
* The default skewY angle is 0. Positive values distort the node in a CCW direction.
|
||||||
*
|
*
|
||||||
* @param skewY The Y skew angle of the node in degrees.
|
* @param skewY The Y skew angle of the node in degrees.
|
||||||
|
*
|
||||||
|
* @warning The physics body doesn't support this.
|
||||||
*/
|
*/
|
||||||
virtual void setSkewY(float skewY);
|
virtual void setSkewY(float skewY);
|
||||||
/**
|
/**
|
||||||
|
@ -520,6 +534,8 @@ public:
|
||||||
/**
|
/**
|
||||||
* Sets the rotation (X,Y,Z) in degrees.
|
* Sets the rotation (X,Y,Z) in degrees.
|
||||||
* Useful for 3d rotations
|
* Useful for 3d rotations
|
||||||
|
*
|
||||||
|
* @warning The physics body doesn't support this.
|
||||||
*/
|
*/
|
||||||
virtual void setRotation3D(const Vec3& rotation);
|
virtual void setRotation3D(const Vec3& rotation);
|
||||||
/**
|
/**
|
||||||
|
@ -537,6 +553,8 @@ public:
|
||||||
* Positive values rotate node clockwise, and negative values for anti-clockwise.
|
* Positive values rotate node clockwise, and negative values for anti-clockwise.
|
||||||
*
|
*
|
||||||
* @param rotationX The X rotation in degrees which performs a horizontal rotational skew.
|
* @param rotationX The X rotation in degrees which performs a horizontal rotational skew.
|
||||||
|
*
|
||||||
|
* @warning The physics body doesn't support this.
|
||||||
*/
|
*/
|
||||||
virtual void setRotationSkewX(float rotationX);
|
virtual void setRotationSkewX(float rotationX);
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual void setRotationX(float rotationX) { return setRotationSkewX(rotationX); }
|
CC_DEPRECATED_ATTRIBUTE virtual void setRotationX(float rotationX) { return setRotationSkewX(rotationX); }
|
||||||
|
@ -561,6 +579,8 @@ public:
|
||||||
* Positive values rotate node clockwise, and negative values for anti-clockwise.
|
* Positive values rotate node clockwise, and negative values for anti-clockwise.
|
||||||
*
|
*
|
||||||
* @param rotationY The Y rotation in degrees.
|
* @param rotationY The Y rotation in degrees.
|
||||||
|
*
|
||||||
|
* @warning The physics body doesn't support this.
|
||||||
*/
|
*/
|
||||||
virtual void setRotationSkewY(float rotationY);
|
virtual void setRotationSkewY(float rotationY);
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual void setRotationY(float rotationY) { return setRotationSkewY(rotationY); }
|
CC_DEPRECATED_ATTRIBUTE virtual void setRotationY(float rotationY) { return setRotationSkewY(rotationY); }
|
||||||
|
|
|
@ -521,8 +521,8 @@ void Sprite::updateTransform(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CCASSERT( dynamic_cast<Sprite*>(_parent), "Logic error in Sprite. Parent must be a Sprite");
|
CCASSERT( dynamic_cast<Sprite*>(_parent), "Logic error in Sprite. Parent must be a Sprite");
|
||||||
Mat4 nodeToParent = getNodeToParentTransform();
|
const Mat4 &nodeToParent = getNodeToParentTransform();
|
||||||
Mat4 parentTransform = static_cast<Sprite*>(_parent)->_transformToBatch;
|
Mat4 &parentTransform = static_cast<Sprite*>(_parent)->_transformToBatch;
|
||||||
_transformToBatch = parentTransform * nodeToParent;
|
_transformToBatch = parentTransform * nodeToParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\jpeg\prebuilt\win32\*.*" "$(OutDir)"
|
||||||
xcopy /Y /Q "$(ProjectDir)..\..\external\png\prebuilt\win32\*.*" "$(OutDir)"
|
xcopy /Y /Q "$(ProjectDir)..\..\external\png\prebuilt\win32\*.*" "$(OutDir)"
|
||||||
xcopy /Y /Q "$(ProjectDir)..\..\external\tiff\prebuilt\win32\*.*" "$(OutDir)"
|
xcopy /Y /Q "$(ProjectDir)..\..\external\tiff\prebuilt\win32\*.*" "$(OutDir)"
|
||||||
xcopy /Y /Q "$(ProjectDir)..\..\external\webp\prebuilt\win32\*.*" "$(OutDir)"
|
xcopy /Y /Q "$(ProjectDir)..\..\external\webp\prebuilt\win32\*.*" "$(OutDir)"
|
||||||
|
xcopy /Y /Q "$(ProjectDir)..\..\external\websockets\prebuilt\win32\*.*" "$(OutDir)"
|
||||||
xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\zlib\prebuilt\*.*" "$(OutDir)"
|
xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\zlib\prebuilt\*.*" "$(OutDir)"
|
||||||
xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\icon\prebuilt\*.*" "$(OutDir)"
|
xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\icon\prebuilt\*.*" "$(OutDir)"
|
||||||
xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(OutDir)"
|
xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(OutDir)"
|
||||||
|
@ -125,16 +126,18 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
|
||||||
</Command>
|
</Command>
|
||||||
</PreBuildEvent>
|
</PreBuildEvent>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\win32;$(EngineRoot)external\jpeg\include\win32;$(EngineRoot)external\tiff\include\win32;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\win32;$(EngineRoot)external\win32-specific\icon\include;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\xxhash;$(EngineRoot)external\ConvertUTF;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\win32;$(EngineRoot)external\jpeg\include\win32;$(EngineRoot)external\tiff\include\win32;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\win32;$(EngineRoot)external\win32-specific\icon\include;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\xxhash;$(EngineRoot)external\ConvertUTF;$(EngineRoot)external;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>None</DebugInformationFormat>
|
||||||
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<CompileAs>CompileAsCpp</CompileAs>
|
<CompileAs>CompileAsCpp</CompileAs>
|
||||||
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
|
<Optimization>MinSpace</Optimization>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<PreLinkEvent>
|
<PreLinkEvent>
|
||||||
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
|
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
|
||||||
|
@ -145,6 +148,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\jpeg\prebuilt\win32\*.*" "$(OutDir)"
|
||||||
xcopy /Y /Q "$(ProjectDir)..\..\external\png\prebuilt\win32\*.*" "$(OutDir)"
|
xcopy /Y /Q "$(ProjectDir)..\..\external\png\prebuilt\win32\*.*" "$(OutDir)"
|
||||||
xcopy /Y /Q "$(ProjectDir)..\..\external\tiff\prebuilt\win32\*.*" "$(OutDir)"
|
xcopy /Y /Q "$(ProjectDir)..\..\external\tiff\prebuilt\win32\*.*" "$(OutDir)"
|
||||||
xcopy /Y /Q "$(ProjectDir)..\..\external\webp\prebuilt\win32\*.*" "$(OutDir)"
|
xcopy /Y /Q "$(ProjectDir)..\..\external\webp\prebuilt\win32\*.*" "$(OutDir)"
|
||||||
|
xcopy /Y /Q "$(ProjectDir)..\..\external\websockets\prebuilt\win32\*.*" "$(OutDir)"
|
||||||
xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\zlib\prebuilt\*.*" "$(OutDir)"
|
xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\zlib\prebuilt\*.*" "$(OutDir)"
|
||||||
xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\icon\prebuilt\*.*" "$(OutDir)"
|
xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\icon\prebuilt\*.*" "$(OutDir)"
|
||||||
xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(OutDir)"
|
xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(OutDir)"
|
||||||
|
|
|
@ -139,7 +139,7 @@
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<CompileAsWinRT>true</CompileAsWinRT>
|
<CompileAsWinRT>true</CompileAsWinRT>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(EngineRoot)external;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WINRT;_DEBUG;_LIB;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WINRT;_DEBUG;_LIB;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<DisableSpecificWarnings>4267;4251;4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4267;4251;4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
||||||
|
@ -160,7 +160,7 @@
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<CompileAsWinRT>true</CompileAsWinRT>
|
<CompileAsWinRT>true</CompileAsWinRT>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(EngineRoot)external;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WINRT;NDEBUG;_LIB;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WINRT;NDEBUG;_LIB;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<DisableSpecificWarnings>4267;4251;4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4267;4251;4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
||||||
|
@ -181,7 +181,7 @@
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<CompileAsWinRT>true</CompileAsWinRT>
|
<CompileAsWinRT>true</CompileAsWinRT>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(EngineRoot)external;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WINRT;_DEBUG;_LIB;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WINRT;_DEBUG;_LIB;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<DisableSpecificWarnings>4267;4251;4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4267;4251;4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
||||||
|
@ -202,7 +202,7 @@
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<CompileAsWinRT>true</CompileAsWinRT>
|
<CompileAsWinRT>true</CompileAsWinRT>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(EngineRoot)external;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WINRT;NDEBUG;_LIB;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WINRT;NDEBUG;_LIB;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<DisableSpecificWarnings>4267;4251;4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4267;4251;4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
||||||
|
@ -223,7 +223,7 @@
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<CompileAsWinRT>true</CompileAsWinRT>
|
<CompileAsWinRT>true</CompileAsWinRT>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(EngineRoot)external;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WINRT;_DEBUG;_LIB;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WINRT;_DEBUG;_LIB;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<DisableSpecificWarnings>4267;4251;4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4267;4251;4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
||||||
|
@ -244,7 +244,7 @@
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<CompileAsWinRT>true</CompileAsWinRT>
|
<CompileAsWinRT>true</CompileAsWinRT>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(EngineRoot)external;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\edtaa3func;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\winrt;$(EngineRoot)external\jpeg\include\winrt;$(EngineRoot)external\tiff\include\winrt;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\winrt;$(EngineRoot)external\winrt-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WINRT;NDEBUG;_LIB;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WINRT;NDEBUG;_LIB;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<DisableSpecificWarnings>4267;4251;4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4267;4251;4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
||||||
|
@ -312,7 +312,6 @@
|
||||||
<ClCompile Include="..\3d\CCMesh.cpp" />
|
<ClCompile Include="..\3d\CCMesh.cpp" />
|
||||||
<ClCompile Include="..\3d\CCObjLoader.cpp" />
|
<ClCompile Include="..\3d\CCObjLoader.cpp" />
|
||||||
<ClCompile Include="..\3d\CCSprite3D.cpp" />
|
<ClCompile Include="..\3d\CCSprite3D.cpp" />
|
||||||
<ClCompile Include="..\3d\CCSprite3DDataCache.cpp" />
|
|
||||||
<ClCompile Include="..\base\atitc.cpp" />
|
<ClCompile Include="..\base\atitc.cpp" />
|
||||||
<ClCompile Include="..\base\base64.cpp" />
|
<ClCompile Include="..\base\base64.cpp" />
|
||||||
<ClCompile Include="..\base\CCAutoreleasePool.cpp" />
|
<ClCompile Include="..\base\CCAutoreleasePool.cpp" />
|
||||||
|
@ -505,7 +504,6 @@
|
||||||
<ClInclude Include="..\3d\CCMesh.h" />
|
<ClInclude Include="..\3d\CCMesh.h" />
|
||||||
<ClInclude Include="..\3d\CCObjLoader.h" />
|
<ClInclude Include="..\3d\CCObjLoader.h" />
|
||||||
<ClInclude Include="..\3d\CCSprite3D.h" />
|
<ClInclude Include="..\3d\CCSprite3D.h" />
|
||||||
<ClInclude Include="..\3d\CCSprite3DDataCache.h" />
|
|
||||||
<ClInclude Include="..\base\atitc.h" />
|
<ClInclude Include="..\base\atitc.h" />
|
||||||
<ClInclude Include="..\base\base64.h" />
|
<ClInclude Include="..\base\base64.h" />
|
||||||
<ClInclude Include="..\base\CCAutoreleasePool.h" />
|
<ClInclude Include="..\base\CCAutoreleasePool.h" />
|
||||||
|
|
|
@ -308,9 +308,6 @@
|
||||||
<ClCompile Include="..\3d\CCSprite3D.cpp">
|
<ClCompile Include="..\3d\CCSprite3D.cpp">
|
||||||
<Filter>3d</Filter>
|
<Filter>3d</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\3d\CCSprite3DDataCache.cpp">
|
|
||||||
<Filter>3d</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\base\atitc.cpp">
|
<ClCompile Include="..\base\atitc.cpp">
|
||||||
<Filter>base</Filter>
|
<Filter>base</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -858,9 +855,6 @@
|
||||||
<ClInclude Include="..\3d\CCSprite3D.h">
|
<ClInclude Include="..\3d\CCSprite3D.h">
|
||||||
<Filter>3d</Filter>
|
<Filter>3d</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\3d\CCSprite3DDataCache.h">
|
|
||||||
<Filter>3d</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\base\atitc.h">
|
<ClInclude Include="..\base\atitc.h">
|
||||||
<Filter>base</Filter>
|
<Filter>base</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
||||||
<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>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
@ -32,8 +32,8 @@
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
||||||
<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>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
@ -103,9 +103,11 @@
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>None</DebugInformationFormat>
|
||||||
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
|
<Optimization>MinSpace</Optimization>
|
||||||
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>winmm.lib;libcocos2d.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>winmm.lib;libcocos2d.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
||||||
<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>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
@ -31,8 +31,8 @@
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
||||||
<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>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -76,13 +76,15 @@
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MinSpace</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>
|
<SDLCheck>
|
||||||
</SDLCheck>
|
</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)extensions;$(EngineRoot)cocos\audio\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)extensions;$(EngineRoot)cocos\audio\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<DebugInformationFormat>None</DebugInformationFormat>
|
||||||
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
|
|
@ -171,7 +171,7 @@ void ActionTimeline::step(float delta)
|
||||||
if(!_playing)
|
if(!_playing)
|
||||||
_time = _endFrame * _frameInternal;
|
_time = _endFrame * _frameInternal;
|
||||||
else
|
else
|
||||||
_time = _startFrame * _frameInternal;
|
gotoFrameAndPlay(_startFrame, _endFrame, _loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,7 +332,7 @@ Frame* ActionTimelineCache::loadTextureFrame(const rapidjson::Value& json)
|
||||||
|
|
||||||
const char* texture = DICTOOL->getStringValue_json(json, Value);
|
const char* texture = DICTOOL->getStringValue_json(json, Value);
|
||||||
|
|
||||||
if(texture != NULL)
|
if(texture != nullptr)
|
||||||
{
|
{
|
||||||
std::string path = texture;
|
std::string path = texture;
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ Frame* ActionTimelineCache::loadEventFrame(const rapidjson::Value& json)
|
||||||
|
|
||||||
const char* evnt = DICTOOL->getStringValue_json(json, Value);
|
const char* evnt = DICTOOL->getStringValue_json(json, Value);
|
||||||
|
|
||||||
if(evnt != NULL)
|
if(evnt != nullptr)
|
||||||
frame->setEvent(evnt);
|
frame->setEvent(evnt);
|
||||||
|
|
||||||
return frame;
|
return frame;
|
||||||
|
@ -371,4 +371,4 @@ Frame* ActionTimelineCache::loadZOrderFrame(const rapidjson::Value& json)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ void RotationFrame::onEnter(Frame *nextFrame)
|
||||||
|
|
||||||
void RotationFrame::apply(float percent)
|
void RotationFrame::apply(float percent)
|
||||||
{
|
{
|
||||||
if (_tween && percent != 0 || _betwennRotation != 0)
|
if (_tween && percent != 0 && _betwennRotation != 0)
|
||||||
{
|
{
|
||||||
float rotation = _rotation + percent * _betwennRotation;
|
float rotation = _rotation + percent * _betwennRotation;
|
||||||
_node->setRotation(rotation);
|
_node->setRotation(rotation);
|
||||||
|
@ -227,7 +227,7 @@ void SkewFrame::onEnter(Frame *nextFrame)
|
||||||
|
|
||||||
void SkewFrame::apply(float percent)
|
void SkewFrame::apply(float percent)
|
||||||
{
|
{
|
||||||
if (_tween && percent != 0 || (_betweenSkewX != 0 || _betweenSkewY != 0))
|
if (_tween && percent != 0 && (_betweenSkewX != 0 || _betweenSkewY != 0))
|
||||||
{
|
{
|
||||||
float skewx = _skewX + percent * _betweenSkewX;
|
float skewx = _skewX + percent * _betweenSkewX;
|
||||||
float skewy = _skewY + percent * _betweenSkewY;
|
float skewy = _skewY + percent * _betweenSkewY;
|
||||||
|
@ -282,7 +282,7 @@ void RotationSkewFrame::onEnter(Frame *nextFrame)
|
||||||
|
|
||||||
void RotationSkewFrame::apply(float percent)
|
void RotationSkewFrame::apply(float percent)
|
||||||
{
|
{
|
||||||
if (_tween && percent != 0 || (_betweenSkewX != 0 || _betweenSkewY != 0))
|
if (_tween && percent != 0 && (_betweenSkewX != 0 || _betweenSkewY != 0))
|
||||||
{
|
{
|
||||||
float skewx = _skewX + percent * _betweenSkewX;
|
float skewx = _skewX + percent * _betweenSkewX;
|
||||||
float skewy = _skewY + percent * _betweenSkewY;
|
float skewy = _skewY + percent * _betweenSkewY;
|
||||||
|
@ -335,7 +335,7 @@ void PositionFrame::onEnter(Frame *nextFrame)
|
||||||
|
|
||||||
void PositionFrame::apply(float percent)
|
void PositionFrame::apply(float percent)
|
||||||
{
|
{
|
||||||
if (_tween && percent != 0 || (_betweenX != 0 || _betweenY != 0))
|
if (_tween && percent != 0 && (_betweenX != 0 || _betweenY != 0))
|
||||||
{
|
{
|
||||||
Point p;
|
Point p;
|
||||||
p.x = _position.x + _betweenX * percent;
|
p.x = _position.x + _betweenX * percent;
|
||||||
|
@ -389,7 +389,7 @@ void ScaleFrame::onEnter(Frame *nextFrame)
|
||||||
|
|
||||||
void ScaleFrame::apply(float percent)
|
void ScaleFrame::apply(float percent)
|
||||||
{
|
{
|
||||||
if (_tween && percent != 0 || (_betweenScaleX != 0 || _betweenScaleY != 0))
|
if (_tween && percent != 0 && (_betweenScaleX != 0 || _betweenScaleY != 0))
|
||||||
{
|
{
|
||||||
float scaleX = _scaleX + _betweenScaleX * percent;
|
float scaleX = _scaleX + _betweenScaleX * percent;
|
||||||
float scaleY = _scaleY + _betweenScaleY * percent;
|
float scaleY = _scaleY + _betweenScaleY * percent;
|
||||||
|
@ -523,7 +523,7 @@ void ColorFrame::onEnter(Frame *nextFrame)
|
||||||
|
|
||||||
void ColorFrame::apply(float percent)
|
void ColorFrame::apply(float percent)
|
||||||
{
|
{
|
||||||
if (_tween && percent != 0 || (_betweenAlpha !=0 || _betweenRed != 0 || _betweenGreen != 0 || _betweenBlue != 0))
|
if (_tween && percent != 0 && (_betweenAlpha !=0 || _betweenRed != 0 || _betweenGreen != 0 || _betweenBlue != 0))
|
||||||
{
|
{
|
||||||
GLubyte alpha = _alpha + _betweenAlpha * percent;
|
GLubyte alpha = _alpha + _betweenAlpha * percent;
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ THE SOFTWARE.
|
||||||
#include "CCActionTimelineCache.h"
|
#include "CCActionTimelineCache.h"
|
||||||
#include "CCActionTimeline.h"
|
#include "CCActionTimeline.h"
|
||||||
|
|
||||||
#include "../CCSGUIReader.h"
|
#include "cocostudio/CCSGUIReader.h"
|
||||||
|
|
||||||
using namespace cocos2d;
|
using namespace cocos2d;
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
@ -150,7 +150,6 @@ void NodeReader::init()
|
||||||
_funcs.insert(Pair(ClassName_Widget, std::bind(&NodeReader::loadWidget, this, _1)));
|
_funcs.insert(Pair(ClassName_Widget, std::bind(&NodeReader::loadWidget, this, _1)));
|
||||||
_funcs.insert(Pair(ClassName_Label, std::bind(&NodeReader::loadWidget, this, _1)));
|
_funcs.insert(Pair(ClassName_Label, std::bind(&NodeReader::loadWidget, this, _1)));
|
||||||
|
|
||||||
_guiReader = new WidgetPropertiesReader0300();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Node* NodeReader::createNode(const std::string& filename)
|
Node* NodeReader::createNode(const std::string& filename)
|
||||||
|
@ -220,7 +219,7 @@ Node* NodeReader::loadNode(const rapidjson::Value& json)
|
||||||
Node* node = nullptr;
|
Node* node = nullptr;
|
||||||
std::string nodeType = DICTOOL->getStringValue_json(json, CLASSNAME);
|
std::string nodeType = DICTOOL->getStringValue_json(json, CLASSNAME);
|
||||||
|
|
||||||
NodeCreateFunc func = _funcs.at(nodeType);
|
NodeCreateFunc func = _funcs[nodeType];
|
||||||
if (func != nullptr)
|
if (func != nullptr)
|
||||||
{
|
{
|
||||||
const rapidjson::Value& options = DICTOOL->getSubDictionary_json(json, OPTIONS);
|
const rapidjson::Value& options = DICTOOL->getSubDictionary_json(json, OPTIONS);
|
||||||
|
@ -383,9 +382,9 @@ Node* NodeReader::loadSprite(const rapidjson::Value& json)
|
||||||
bool flipY = DICTOOL->getBooleanValue_json(json, FLIPY);
|
bool flipY = DICTOOL->getBooleanValue_json(json, FLIPY);
|
||||||
|
|
||||||
if(flipX != false)
|
if(flipX != false)
|
||||||
sprite->setFlipX(flipX);
|
sprite->setFlippedX(flipX);
|
||||||
if(flipY != false)
|
if(flipY != false)
|
||||||
sprite->setFlipY(flipY);
|
sprite->setFlippedY(flipY);
|
||||||
|
|
||||||
return sprite;
|
return sprite;
|
||||||
}
|
}
|
||||||
|
@ -445,7 +444,9 @@ Node* NodeReader::loadWidget(const rapidjson::Value& json)
|
||||||
|
|
||||||
WidgetReaderProtocol* reader = dynamic_cast<WidgetReaderProtocol*>(ObjectFactory::getInstance()->createObject(readerName));
|
WidgetReaderProtocol* reader = dynamic_cast<WidgetReaderProtocol*>(ObjectFactory::getInstance()->createObject(readerName));
|
||||||
|
|
||||||
_guiReader->setPropsForAllWidgetFromJsonDictionary(reader, widget, json);
|
WidgetPropertiesReader0300* guiReader = new WidgetPropertiesReader0300();
|
||||||
|
guiReader->setPropsForAllWidgetFromJsonDictionary(reader, widget, json);
|
||||||
|
CC_SAFE_DELETE(guiReader);
|
||||||
|
|
||||||
int actionTag = DICTOOL->getIntValue_json(json, ACTION_TAG);
|
int actionTag = DICTOOL->getIntValue_json(json, ACTION_TAG);
|
||||||
widget->setUserObject(ActionTimelineData::create(actionTag));
|
widget->setUserObject(ActionTimelineData::create(actionTag));
|
||||||
|
|
|
@ -30,7 +30,6 @@ THE SOFTWARE.
|
||||||
|
|
||||||
namespace cocostudio {
|
namespace cocostudio {
|
||||||
|
|
||||||
class WidgetPropertiesReader0300;
|
|
||||||
|
|
||||||
namespace timeline{
|
namespace timeline{
|
||||||
|
|
||||||
|
@ -78,7 +77,6 @@ protected:
|
||||||
|
|
||||||
std::unordered_map<std::string, NodeCreateFunc> _funcs;
|
std::unordered_map<std::string, NodeCreateFunc> _funcs;
|
||||||
|
|
||||||
WidgetPropertiesReader0300* _guiReader;
|
|
||||||
bool _recordJsonPath;
|
bool _recordJsonPath;
|
||||||
|
|
||||||
std::string _jsonPath;
|
std::string _jsonPath;
|
||||||
|
|
|
@ -35,4 +35,4 @@ Copyright (c) 2013-2014 Chukong Technologies
|
||||||
#define USING_NS_TIMELINE
|
#define USING_NS_TIMELINE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -39,6 +39,7 @@ CCSSceneReader.cpp \
|
||||||
TriggerBase.cpp \
|
TriggerBase.cpp \
|
||||||
TriggerMng.cpp \
|
TriggerMng.cpp \
|
||||||
TriggerObj.cpp \
|
TriggerObj.cpp \
|
||||||
|
CocoLoader.cpp \
|
||||||
WidgetReader/WidgetReader.cpp \
|
WidgetReader/WidgetReader.cpp \
|
||||||
WidgetReader/ButtonReader/ButtonReader.cpp \
|
WidgetReader/ButtonReader/ButtonReader.cpp \
|
||||||
WidgetReader/CheckBoxReader/CheckBoxReader.cpp \
|
WidgetReader/CheckBoxReader/CheckBoxReader.cpp \
|
||||||
|
|
|
@ -24,6 +24,7 @@ THE SOFTWARE.
|
||||||
|
|
||||||
#include "cocostudio/CCActionManagerEx.h"
|
#include "cocostudio/CCActionManagerEx.h"
|
||||||
#include "cocostudio/DictionaryHelper.h"
|
#include "cocostudio/DictionaryHelper.h"
|
||||||
|
#include "cocostudio/CocoLoader.h"
|
||||||
|
|
||||||
using namespace cocos2d;
|
using namespace cocos2d;
|
||||||
|
|
||||||
|
@ -70,6 +71,42 @@ void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::V
|
||||||
}
|
}
|
||||||
_actionDic.insert(std::pair<std::string, cocos2d::Vector<ActionObject*>>(fileName, actionList));
|
_actionDic.insert(std::pair<std::string, cocos2d::Vector<ActionObject*>>(fileName, actionList));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActionManagerEx::initWithBinary(const char* file,
|
||||||
|
cocos2d::Ref *root,
|
||||||
|
CocoLoader* cocoLoader,
|
||||||
|
stExpCocoNode* pCocoNode)
|
||||||
|
{
|
||||||
|
std::string path = file;
|
||||||
|
ssize_t pos = path.find_last_of("/");
|
||||||
|
std::string fileName = path.substr(pos+1,path.length());
|
||||||
|
CCLOG("filename == %s",fileName.c_str());
|
||||||
|
cocos2d::Vector<ActionObject*> actionList;
|
||||||
|
|
||||||
|
stExpCocoNode *stChildArray = pCocoNode->GetChildArray();
|
||||||
|
stExpCocoNode *actionNode = nullptr;
|
||||||
|
for (int i=0; i < pCocoNode->GetChildNum(); ++i) {
|
||||||
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
|
if (key == "actionlist") {
|
||||||
|
actionNode = &stChildArray[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (nullptr != actionNode)
|
||||||
|
{
|
||||||
|
int actionCount = actionNode->GetChildNum();
|
||||||
|
for (int i = 0; i < actionCount; ++i) {
|
||||||
|
ActionObject* action = new ActionObject();
|
||||||
|
action->autorelease();
|
||||||
|
|
||||||
|
action->initWithBinary(cocoLoader, actionNode->GetChildArray(), root);
|
||||||
|
|
||||||
|
actionList.pushBack(action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_actionDic.insert(std::pair<std::string, cocos2d::Vector<ActionObject*>>(fileName, actionList));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ActionObject* ActionManagerEx::getActionByName(const char* jsonName,const char* actionName)
|
ActionObject* ActionManagerEx::getActionByName(const char* jsonName,const char* actionName)
|
||||||
|
|
|
@ -29,6 +29,9 @@ THE SOFTWARE.
|
||||||
#include "cocostudio/DictionaryHelper.h"
|
#include "cocostudio/DictionaryHelper.h"
|
||||||
|
|
||||||
namespace cocostudio {
|
namespace cocostudio {
|
||||||
|
|
||||||
|
class CocoLoader;
|
||||||
|
struct stExpCocoNode;
|
||||||
|
|
||||||
class ActionManagerEx:public cocos2d::Ref
|
class ActionManagerEx:public cocos2d::Ref
|
||||||
{
|
{
|
||||||
|
@ -96,6 +99,8 @@ public:
|
||||||
|
|
||||||
/*init properties with json dictionay*/
|
/*init properties with json dictionay*/
|
||||||
void initWithDictionary(const char* jsonName,const rapidjson::Value &dic, Ref* root);
|
void initWithDictionary(const char* jsonName,const rapidjson::Value &dic, Ref* root);
|
||||||
|
void initWithBinary(const char* file, Ref* root, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release all actions.
|
* Release all actions.
|
||||||
*
|
*
|
||||||
|
|
|
@ -27,6 +27,7 @@ THE SOFTWARE.
|
||||||
#include "cocostudio/DictionaryHelper.h"
|
#include "cocostudio/DictionaryHelper.h"
|
||||||
#include "ui/UIWidget.h"
|
#include "ui/UIWidget.h"
|
||||||
#include "ui/UIHelper.h"
|
#include "ui/UIHelper.h"
|
||||||
|
#include "cocostudio/CocoLoader.h"
|
||||||
|
|
||||||
using namespace cocos2d;
|
using namespace cocos2d;
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
@ -167,6 +168,149 @@ void ActionNode::initWithDictionary(const rapidjson::Value& dic, Ref* root)
|
||||||
}
|
}
|
||||||
initActionNodeFromRoot(root);
|
initActionNodeFromRoot(root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ActionNode::valueToInt(const std::string& value)
|
||||||
|
{
|
||||||
|
return atoi(value.c_str());
|
||||||
|
}
|
||||||
|
bool ActionNode::valueToBool(const std::string& value)
|
||||||
|
{
|
||||||
|
int intValue = valueToInt(value);
|
||||||
|
if (1 == intValue) {
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
float ActionNode::valueToFloat(const std::string& value)
|
||||||
|
{
|
||||||
|
return atof(value.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ActionNode::initWithBinary(CocoLoader *cocoLoader,
|
||||||
|
stExpCocoNode *cocoNode,
|
||||||
|
cocos2d::Ref *root)
|
||||||
|
{
|
||||||
|
|
||||||
|
stExpCocoNode *stChildNode = cocoNode;
|
||||||
|
|
||||||
|
int actionNodeCount = stChildNode->GetChildNum();
|
||||||
|
stChildNode = stChildNode[0].GetChildArray();
|
||||||
|
stExpCocoNode *frameListNode = nullptr;
|
||||||
|
for (int i = 0; i < actionNodeCount; ++i) {
|
||||||
|
std::string key = stChildNode[i].GetName(cocoLoader);
|
||||||
|
std::string value = stChildNode[i].GetValue();
|
||||||
|
if (key == "ActionTag") {
|
||||||
|
setActionTag(valueToInt(value));
|
||||||
|
}else if (key == "actionframelist"){
|
||||||
|
frameListNode = &stChildNode[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int actionFrameCount = frameListNode->GetChildNum();
|
||||||
|
stExpCocoNode *stFrameChildNode = frameListNode->GetChildArray();
|
||||||
|
for (int i=0; i<actionFrameCount; i++) {
|
||||||
|
|
||||||
|
int frameIndex;
|
||||||
|
int frameTweenType;
|
||||||
|
float positionX;
|
||||||
|
float positionY;
|
||||||
|
float scaleX;
|
||||||
|
float scaleY;
|
||||||
|
float rotation;
|
||||||
|
int opacity;
|
||||||
|
int colorR = -1;
|
||||||
|
int colorG = -1;
|
||||||
|
int colorB = -1;
|
||||||
|
std::vector<float> frameTweenParameter;
|
||||||
|
|
||||||
|
int framesCount = stFrameChildNode[i].GetChildNum();
|
||||||
|
stExpCocoNode *innerFrameNode = stFrameChildNode[i].GetChildArray();
|
||||||
|
for (int j = 0; j < framesCount; j++) {
|
||||||
|
std::string key = innerFrameNode[j].GetName(cocoLoader);
|
||||||
|
std::string value = innerFrameNode[j].GetValue();
|
||||||
|
|
||||||
|
if (key == "frameid") {
|
||||||
|
frameIndex = valueToInt(value);
|
||||||
|
}else if(key == "tweenType"){
|
||||||
|
frameTweenType = valueToInt(value);
|
||||||
|
}else if (key == "tweenParameter"){
|
||||||
|
// There are no tweenParameter args in the json file
|
||||||
|
int tweenParameterCount = innerFrameNode[j].GetChildNum();
|
||||||
|
stExpCocoNode *tweenParameterArray = innerFrameNode[j].GetChildArray();
|
||||||
|
for (int k = 0; k < tweenParameterCount; ++k) {
|
||||||
|
std::string t_key = tweenParameterArray[j].GetName(cocoLoader);
|
||||||
|
std::string t_value = tweenParameterArray[j].GetValue();
|
||||||
|
frameTweenParameter.push_back(valueToFloat(t_value));
|
||||||
|
}
|
||||||
|
}else if (key == "positionx"){
|
||||||
|
positionX = valueToFloat(value);
|
||||||
|
}else if (key == "positiony"){
|
||||||
|
positionY = valueToFloat(value);
|
||||||
|
ActionMoveFrame* actionFrame = new ActionMoveFrame();
|
||||||
|
actionFrame->autorelease();
|
||||||
|
actionFrame->setEasingType(frameTweenType);
|
||||||
|
actionFrame->setEasingParameter(frameTweenParameter);
|
||||||
|
actionFrame->setFrameIndex(frameIndex);
|
||||||
|
actionFrame->setPosition(Vec2(positionX, positionY));
|
||||||
|
auto cActionArray = _frameArray.at((int)kKeyframeMove);
|
||||||
|
cActionArray->pushBack(actionFrame);
|
||||||
|
}else if(key == "scalex"){
|
||||||
|
scaleX = valueToFloat(value);
|
||||||
|
}else if(key == "scaley"){
|
||||||
|
scaleY = valueToFloat(value);
|
||||||
|
ActionScaleFrame* actionFrame = new ActionScaleFrame();
|
||||||
|
actionFrame->autorelease();
|
||||||
|
actionFrame->setEasingType(frameTweenType);
|
||||||
|
actionFrame->setEasingParameter(frameTweenParameter);
|
||||||
|
actionFrame->setFrameIndex(frameIndex);
|
||||||
|
actionFrame->setScaleX(scaleX);
|
||||||
|
actionFrame->setScaleY(scaleY);
|
||||||
|
auto cActionArray = _frameArray.at((int)kKeyframeScale);
|
||||||
|
cActionArray->pushBack(actionFrame);
|
||||||
|
}else if (key == "rotation"){
|
||||||
|
rotation = valueToFloat(value);
|
||||||
|
ActionRotationFrame* actionFrame = new ActionRotationFrame();
|
||||||
|
actionFrame->autorelease();
|
||||||
|
actionFrame->setEasingType(frameTweenType);
|
||||||
|
actionFrame->setEasingParameter(frameTweenParameter);
|
||||||
|
actionFrame->setFrameIndex(frameIndex);
|
||||||
|
actionFrame->setRotation(rotation);
|
||||||
|
auto cActionArray = _frameArray.at((int)kKeyframeRotate);
|
||||||
|
cActionArray->pushBack(actionFrame);
|
||||||
|
}else if (key == "opacity"){
|
||||||
|
opacity = valueToInt(value);
|
||||||
|
ActionFadeFrame* actionFrame = new ActionFadeFrame();
|
||||||
|
actionFrame->autorelease();
|
||||||
|
actionFrame->setEasingType(frameTweenType);
|
||||||
|
actionFrame->setEasingParameter(frameTweenParameter);
|
||||||
|
actionFrame->setFrameIndex(frameIndex);
|
||||||
|
actionFrame->setOpacity(opacity);
|
||||||
|
auto cActionArray = _frameArray.at((int)kKeyframeFade);
|
||||||
|
cActionArray->pushBack(actionFrame);
|
||||||
|
}else if (key == "colorb"){
|
||||||
|
colorB = valueToInt(value);
|
||||||
|
}else if(key == "colorg"){
|
||||||
|
colorG = valueToInt(value);
|
||||||
|
}else if(key == "colorr"){
|
||||||
|
colorR = valueToInt(value);
|
||||||
|
|
||||||
|
ActionTintFrame* actionFrame = new ActionTintFrame();
|
||||||
|
actionFrame->autorelease();
|
||||||
|
actionFrame->setEasingType(frameTweenType);
|
||||||
|
actionFrame->setEasingParameter(frameTweenParameter);
|
||||||
|
actionFrame->setFrameIndex(frameIndex);
|
||||||
|
actionFrame->setColor(Color3B(colorR,colorG,colorB));
|
||||||
|
auto cActionArray = _frameArray.at((int)kKeyframeTint);
|
||||||
|
cActionArray->pushBack(actionFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
initActionNodeFromRoot(root);
|
||||||
|
}
|
||||||
|
|
||||||
void ActionNode::initActionNodeFromRoot(Ref* root)
|
void ActionNode::initActionNodeFromRoot(Ref* root)
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,7 +29,9 @@ THE SOFTWARE.
|
||||||
#include "cocostudio/DictionaryHelper.h"
|
#include "cocostudio/DictionaryHelper.h"
|
||||||
|
|
||||||
namespace cocostudio {
|
namespace cocostudio {
|
||||||
|
|
||||||
|
class CocoLoader;
|
||||||
|
struct stExpCocoNode;
|
||||||
/**
|
/**
|
||||||
* @js NA
|
* @js NA
|
||||||
* @lua NA
|
* @lua NA
|
||||||
|
@ -149,6 +151,7 @@ public:
|
||||||
|
|
||||||
/*init properties with a json dictionary*/
|
/*init properties with a json dictionary*/
|
||||||
virtual void initWithDictionary(const rapidjson::Value& dic, cocos2d::Ref* root);
|
virtual void initWithDictionary(const rapidjson::Value& dic, cocos2d::Ref* root);
|
||||||
|
virtual void initWithBinary(CocoLoader* cocoLoader, stExpCocoNode* pCocoNode, Ref* root);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets if the action is done once time.
|
* Gets if the action is done once time.
|
||||||
|
@ -157,6 +160,10 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual bool isActionDoneOnce();
|
virtual bool isActionDoneOnce();
|
||||||
protected:
|
protected:
|
||||||
|
int valueToInt(const std::string& value);
|
||||||
|
bool valueToBool(const std::string& value);
|
||||||
|
float valueToFloat(const std::string& value);
|
||||||
|
|
||||||
int _currentFrameIndex;
|
int _currentFrameIndex;
|
||||||
int _destFrameIndex;
|
int _destFrameIndex;
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ THE SOFTWARE.
|
||||||
|
|
||||||
#include "cocostudio/CCActionObject.h"
|
#include "cocostudio/CCActionObject.h"
|
||||||
#include "cocostudio/DictionaryHelper.h"
|
#include "cocostudio/DictionaryHelper.h"
|
||||||
|
#include "cocostudio/CocoLoader.h"
|
||||||
|
|
||||||
#include "base/CCDirector.h"
|
#include "base/CCDirector.h"
|
||||||
#include "base/CCScheduler.h"
|
#include "base/CCScheduler.h"
|
||||||
|
@ -44,128 +45,192 @@ ActionObject::ActionObject()
|
||||||
, _CallBack(nullptr)
|
, _CallBack(nullptr)
|
||||||
, _fTotalTime(0.0f)
|
, _fTotalTime(0.0f)
|
||||||
{
|
{
|
||||||
_pScheduler = Director::getInstance()->getScheduler();
|
_pScheduler = Director::getInstance()->getScheduler();
|
||||||
CC_SAFE_RETAIN(_pScheduler);
|
CC_SAFE_RETAIN(_pScheduler);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionObject::~ActionObject()
|
ActionObject::~ActionObject()
|
||||||
{
|
{
|
||||||
_actionNodeList.clear();
|
_actionNodeList.clear();
|
||||||
CC_SAFE_RELEASE(_pScheduler);
|
CC_SAFE_RELEASE(_pScheduler);
|
||||||
CC_SAFE_RELEASE(_CallBack);
|
CC_SAFE_RELEASE(_CallBack);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionObject::setName(const char* name)
|
void ActionObject::setName(const char* name)
|
||||||
{
|
{
|
||||||
_name.assign(name);
|
_name.assign(name);
|
||||||
}
|
}
|
||||||
const char* ActionObject::getName()
|
const char* ActionObject::getName()
|
||||||
{
|
{
|
||||||
return _name.c_str();
|
return _name.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionObject::setLoop(bool bLoop)
|
void ActionObject::setLoop(bool bLoop)
|
||||||
{
|
{
|
||||||
_loop = bLoop;
|
_loop = bLoop;
|
||||||
}
|
}
|
||||||
bool ActionObject::getLoop()
|
bool ActionObject::getLoop()
|
||||||
{
|
{
|
||||||
return _loop;
|
return _loop;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionObject::setUnitTime(float fTime)
|
void ActionObject::setUnitTime(float fTime)
|
||||||
{
|
{
|
||||||
_fUnitTime = fTime;
|
_fUnitTime = fTime;
|
||||||
for(const auto &e : _actionNodeList)
|
for(const auto &e : _actionNodeList)
|
||||||
{
|
{
|
||||||
e->setUnitTime(_fUnitTime);
|
e->setUnitTime(_fUnitTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float ActionObject::getUnitTime()
|
float ActionObject::getUnitTime()
|
||||||
{
|
{
|
||||||
return _fUnitTime;
|
return _fUnitTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ActionObject::getCurrentTime()
|
float ActionObject::getCurrentTime()
|
||||||
{
|
{
|
||||||
return _currentTime;
|
return _currentTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionObject::setCurrentTime(float fTime)
|
void ActionObject::setCurrentTime(float fTime)
|
||||||
{
|
{
|
||||||
_currentTime = fTime;
|
_currentTime = fTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ActionObject::getTotalTime()
|
float ActionObject::getTotalTime()
|
||||||
{
|
{
|
||||||
return _fTotalTime;
|
return _fTotalTime;
|
||||||
}
|
}
|
||||||
bool ActionObject::isPlaying()
|
bool ActionObject::isPlaying()
|
||||||
{
|
{
|
||||||
return _bPlaying;
|
return _bPlaying;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionObject::initWithDictionary(const rapidjson::Value& dic, Ref* root)
|
void ActionObject::initWithDictionary(const rapidjson::Value& dic, Ref* root)
|
||||||
{
|
{
|
||||||
setName(DICTOOL->getStringValue_json(dic, "name"));
|
setName(DICTOOL->getStringValue_json(dic, "name"));
|
||||||
setLoop(DICTOOL->getBooleanValue_json(dic, "loop"));
|
setLoop(DICTOOL->getBooleanValue_json(dic, "loop"));
|
||||||
setUnitTime(DICTOOL->getFloatValue_json(dic, "unittime"));
|
setUnitTime(DICTOOL->getFloatValue_json(dic, "unittime"));
|
||||||
int actionNodeCount = DICTOOL->getArrayCount_json(dic, "actionnodelist");
|
int actionNodeCount = DICTOOL->getArrayCount_json(dic, "actionnodelist");
|
||||||
int maxLength = 0;
|
int maxLength = 0;
|
||||||
for (int i=0; i<actionNodeCount; i++) {
|
for (int i=0; i<actionNodeCount; i++) {
|
||||||
ActionNode* actionNode = new ActionNode();
|
ActionNode* actionNode = new ActionNode();
|
||||||
actionNode->autorelease();
|
actionNode->autorelease();
|
||||||
const rapidjson::Value& actionNodeDic = DICTOOL->getDictionaryFromArray_json(dic, "actionnodelist", i);
|
const rapidjson::Value& actionNodeDic = DICTOOL->getDictionaryFromArray_json(dic, "actionnodelist", i);
|
||||||
actionNode->initWithDictionary(actionNodeDic,root);
|
actionNode->initWithDictionary(actionNodeDic,root);
|
||||||
actionNode->setUnitTime(getUnitTime());
|
actionNode->setUnitTime(getUnitTime());
|
||||||
_actionNodeList.pushBack(actionNode);
|
_actionNodeList.pushBack(actionNode);
|
||||||
|
|
||||||
|
int length = actionNode->getLastFrameIndex() - actionNode->getFirstFrameIndex();
|
||||||
|
if(length > maxLength)
|
||||||
|
maxLength = length;
|
||||||
|
}
|
||||||
|
_fTotalTime = maxLength*_fUnitTime;
|
||||||
|
}
|
||||||
|
|
||||||
int length = actionNode->getLastFrameIndex() - actionNode->getFirstFrameIndex();
|
void ActionObject::initWithBinary(CocoLoader *cocoLoader,
|
||||||
if(length > maxLength)
|
stExpCocoNode *cocoNode,
|
||||||
maxLength = length;
|
cocos2d::Ref *root)
|
||||||
}
|
{
|
||||||
_fTotalTime = maxLength*_fUnitTime;
|
stExpCocoNode *stChildNode = cocoNode->GetChildArray();
|
||||||
|
stExpCocoNode *actionNodeList = nullptr;
|
||||||
|
int count = cocoNode->GetChildNum();
|
||||||
|
for (int i = 0; i < count; ++i) {
|
||||||
|
std::string key = stChildNode[i].GetName(cocoLoader);
|
||||||
|
std::string value = stChildNode[i].GetValue();
|
||||||
|
if (key == "name") {
|
||||||
|
setName(value.c_str());
|
||||||
|
}else if (key == "loop"){
|
||||||
|
setLoop(valueToBool(value));
|
||||||
|
}else if(key == "unittime"){
|
||||||
|
setUnitTime(valueToFloat(value));
|
||||||
|
}else if (key == "actionnodelist"){
|
||||||
|
actionNodeList = &stChildNode[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(nullptr != actionNodeList)
|
||||||
|
{
|
||||||
|
int actionNodeCount = actionNodeList->GetChildNum();
|
||||||
|
stExpCocoNode *actionNodeArray = actionNodeList->GetChildArray();
|
||||||
|
int maxLength = 0;
|
||||||
|
for (int i=0; i<actionNodeCount; i++) {
|
||||||
|
ActionNode* actionNode = new ActionNode();
|
||||||
|
actionNode->autorelease();
|
||||||
|
|
||||||
|
actionNode->initWithBinary(cocoLoader, &actionNodeArray[i] , root);
|
||||||
|
|
||||||
|
actionNode->setUnitTime(getUnitTime());
|
||||||
|
|
||||||
|
_actionNodeList.pushBack(actionNode);
|
||||||
|
|
||||||
|
int length = actionNode->getLastFrameIndex() - actionNode->getFirstFrameIndex();
|
||||||
|
if(length > maxLength)
|
||||||
|
maxLength = length;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_fTotalTime = maxLength* _fUnitTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int ActionObject::valueToInt(const std::string& value)
|
||||||
|
{
|
||||||
|
return atoi(value.c_str());
|
||||||
|
}
|
||||||
|
bool ActionObject::valueToBool(const std::string& value)
|
||||||
|
{
|
||||||
|
int intValue = valueToInt(value);
|
||||||
|
if (1 == intValue) {
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
float ActionObject::valueToFloat(const std::string& value)
|
||||||
|
{
|
||||||
|
return atof(value.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionObject::addActionNode(ActionNode* node)
|
void ActionObject::addActionNode(ActionNode* node)
|
||||||
{
|
{
|
||||||
if (node == nullptr)
|
if (node == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_actionNodeList.pushBack(node);
|
_actionNodeList.pushBack(node);
|
||||||
node->setUnitTime(_fUnitTime);
|
node->setUnitTime(_fUnitTime);
|
||||||
}
|
}
|
||||||
void ActionObject::removeActionNode(ActionNode* node)
|
void ActionObject::removeActionNode(ActionNode* node)
|
||||||
{
|
{
|
||||||
if (node == nullptr)
|
if (node == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_actionNodeList.eraseObject(node);
|
_actionNodeList.eraseObject(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionObject::play()
|
void ActionObject::play()
|
||||||
{
|
{
|
||||||
stop();
|
stop();
|
||||||
this->updateToFrameByTime(0.0f);
|
this->updateToFrameByTime(0.0f);
|
||||||
for(const auto &e : _actionNodeList)
|
for(const auto &e : _actionNodeList)
|
||||||
{
|
{
|
||||||
e->playAction();
|
e->playAction();
|
||||||
}
|
}
|
||||||
if (_loop)
|
if (_loop)
|
||||||
{
|
{
|
||||||
_pScheduler->schedule(schedule_selector(ActionObject::simulationActionUpdate), this, 0.0f , kRepeatForever, 0.0f, false);
|
_pScheduler->schedule(schedule_selector(ActionObject::simulationActionUpdate), this, 0.0f , kRepeatForever, 0.0f, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_pScheduler->schedule(schedule_selector(ActionObject::simulationActionUpdate), this, 0.0f, false);
|
_pScheduler->schedule(schedule_selector(ActionObject::simulationActionUpdate), this, 0.0f, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionObject::play(CallFunc* func)
|
void ActionObject::play(CallFunc* func)
|
||||||
{
|
{
|
||||||
this->play();
|
this->play();
|
||||||
this->_CallBack = func;
|
this->_CallBack = func;
|
||||||
CC_SAFE_RETAIN(_CallBack);
|
CC_SAFE_RETAIN(_CallBack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,9 @@ THE SOFTWARE.
|
||||||
|
|
||||||
namespace cocostudio {
|
namespace cocostudio {
|
||||||
|
|
||||||
|
class CocoLoader;
|
||||||
|
struct stExpCocoNode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @js NA
|
* @js NA
|
||||||
* @lua NA
|
* @lua NA
|
||||||
|
@ -160,10 +163,17 @@ public:
|
||||||
|
|
||||||
/*init properties with a json dictionary*/
|
/*init properties with a json dictionary*/
|
||||||
void initWithDictionary(const rapidjson::Value& dic, cocos2d::Ref* root);
|
void initWithDictionary(const rapidjson::Value& dic, cocos2d::Ref* root);
|
||||||
|
|
||||||
|
void initWithBinary(CocoLoader* cocoLoader, stExpCocoNode* pCocoNode, cocos2d::Ref* root);
|
||||||
|
|
||||||
|
|
||||||
/*scheduler update function*/
|
/*scheduler update function*/
|
||||||
void simulationActionUpdate(float dt);
|
void simulationActionUpdate(float dt);
|
||||||
protected:
|
protected:
|
||||||
|
int valueToInt(const std::string& value);
|
||||||
|
bool valueToBool(const std::string& value);
|
||||||
|
float valueToFloat(const std::string& value);
|
||||||
|
|
||||||
cocos2d::Vector<ActionNode*> _actionNodeList;
|
cocos2d::Vector<ActionNode*> _actionNodeList;
|
||||||
std::string _name;
|
std::string _name;
|
||||||
bool _loop;
|
bool _loop;
|
||||||
|
|
|
@ -35,6 +35,9 @@ THE SOFTWARE.
|
||||||
#include "cocostudio/CCArmatureDefine.h"
|
#include "cocostudio/CCArmatureDefine.h"
|
||||||
#include "cocostudio/CCDatas.h"
|
#include "cocostudio/CCDatas.h"
|
||||||
|
|
||||||
|
#include "cocostudio/CocoLoader.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace cocos2d;
|
using namespace cocos2d;
|
||||||
|
|
||||||
|
|
||||||
|
@ -192,6 +195,10 @@ void DataReaderHelper::loadData()
|
||||||
{
|
{
|
||||||
DataReaderHelper::addDataFromJsonCache(pAsyncStruct->fileContent.c_str(), pDataInfo);
|
DataReaderHelper::addDataFromJsonCache(pAsyncStruct->fileContent.c_str(), pDataInfo);
|
||||||
}
|
}
|
||||||
|
else if(pAsyncStruct->configType == CocoStudio_Binary)
|
||||||
|
{
|
||||||
|
DataReaderHelper::addDataFromBinaryCache(pAsyncStruct->fileContent.c_str(),pDataInfo);
|
||||||
|
}
|
||||||
|
|
||||||
// put the image info into the queue
|
// put the image info into the queue
|
||||||
_dataInfoMutex.lock();
|
_dataInfoMutex.lock();
|
||||||
|
@ -294,8 +301,17 @@ void DataReaderHelper::addDataFromFile(const std::string& filePath)
|
||||||
|
|
||||||
// Read content from file
|
// Read content from file
|
||||||
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
|
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
|
||||||
std::string contentStr = FileUtils::getInstance()->getStringFromFile(fullPath);
|
bool isbinarysrc = str==".csb";
|
||||||
|
std::string filemode("r");
|
||||||
|
if(isbinarysrc)
|
||||||
|
filemode += "b";
|
||||||
|
ssize_t filesize;
|
||||||
|
|
||||||
|
_dataReaderHelper->_getFileMutex.lock();
|
||||||
|
unsigned char *pBytes = FileUtils::getInstance()->getFileData(filePath, filemode.c_str(), &filesize);
|
||||||
|
std::string contentStr((const char*)pBytes,filesize);
|
||||||
|
_dataReaderHelper->_getFileMutex.unlock();
|
||||||
|
|
||||||
DataInfo dataInfo;
|
DataInfo dataInfo;
|
||||||
dataInfo.filename = filePathStr;
|
dataInfo.filename = filePathStr;
|
||||||
dataInfo.asyncStruct = nullptr;
|
dataInfo.asyncStruct = nullptr;
|
||||||
|
@ -308,6 +324,12 @@ void DataReaderHelper::addDataFromFile(const std::string& filePath)
|
||||||
{
|
{
|
||||||
DataReaderHelper::addDataFromJsonCache(contentStr, &dataInfo);
|
DataReaderHelper::addDataFromJsonCache(contentStr, &dataInfo);
|
||||||
}
|
}
|
||||||
|
else if(str == ".csb")
|
||||||
|
{
|
||||||
|
DataReaderHelper::addDataFromBinaryCache(contentStr.c_str(),&dataInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
CC_SAFE_DELETE_ARRAY(pBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataReaderHelper::addDataFromFileAsync(const std::string& imagePath, const std::string& plistPath, const std::string& filePath, Ref *target, SEL_SCHEDULE selector)
|
void DataReaderHelper::addDataFromFileAsync(const std::string& imagePath, const std::string& plistPath, const std::string& filePath, Ref *target, SEL_SCHEDULE selector)
|
||||||
|
@ -391,9 +413,23 @@ void DataReaderHelper::addDataFromFileAsync(const std::string& imagePath, const
|
||||||
|
|
||||||
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
|
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
|
||||||
|
|
||||||
|
bool isbinaryfilesrc = str==".csb";
|
||||||
|
std::string filereadmode("r");
|
||||||
|
if (isbinaryfilesrc) {
|
||||||
|
filereadmode += "b";
|
||||||
|
}
|
||||||
|
ssize_t size;
|
||||||
// XXX fileContent is being leaked
|
// XXX fileContent is being leaked
|
||||||
data->fileContent = FileUtils::getInstance()->getStringFromFile(fullPath);
|
|
||||||
|
_dataReaderHelper->_getFileMutex.lock();
|
||||||
|
unsigned char *pBytes = FileUtils::getInstance()->getFileData(fullPath.c_str() , filereadmode.c_str(), &size);
|
||||||
|
_dataReaderHelper->_getFileMutex.unlock();
|
||||||
|
|
||||||
|
Data bytecpy;
|
||||||
|
bytecpy.copy(pBytes, size);
|
||||||
|
data->fileContent = std::string((const char*)bytecpy.getBytes(), size);
|
||||||
|
CC_SAFE_DELETE_ARRAY(pBytes);
|
||||||
|
|
||||||
if (str == ".xml")
|
if (str == ".xml")
|
||||||
{
|
{
|
||||||
data->configType = DragonBone_XML;
|
data->configType = DragonBone_XML;
|
||||||
|
@ -402,6 +438,10 @@ void DataReaderHelper::addDataFromFileAsync(const std::string& imagePath, const
|
||||||
{
|
{
|
||||||
data->configType = CocoStudio_JSON;
|
data->configType = CocoStudio_JSON;
|
||||||
}
|
}
|
||||||
|
else if(str == ".csb")
|
||||||
|
{
|
||||||
|
data->configType = CocoStudio_Binary;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// add async struct into queue
|
// add async struct into queue
|
||||||
|
@ -1368,7 +1408,7 @@ DisplayData *DataReaderHelper::decodeBoneDisplay(const rapidjson::Value& json, D
|
||||||
displayData = new SpriteDisplayData();
|
displayData = new SpriteDisplayData();
|
||||||
|
|
||||||
const char *name = DICTOOL->getStringValue_json(json, A_NAME);
|
const char *name = DICTOOL->getStringValue_json(json, A_NAME);
|
||||||
if(name != NULL)
|
if(name != nullptr)
|
||||||
{
|
{
|
||||||
((SpriteDisplayData *)displayData)->displayName = name;
|
((SpriteDisplayData *)displayData)->displayName = name;
|
||||||
}
|
}
|
||||||
|
@ -1700,5 +1740,844 @@ void DataReaderHelper::decodeNode(BaseData *node, const rapidjson::Value& json,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataReaderHelper::addDataFromBinaryCache(const char *fileContent, DataInfo *dataInfo)
|
||||||
|
{
|
||||||
|
CocoLoader tCocoLoader;
|
||||||
|
if (tCocoLoader.ReadCocoBinBuff((char*)fileContent))
|
||||||
|
{
|
||||||
|
stExpCocoNode *tpRootCocoNode = tCocoLoader.GetRootCocoNode();
|
||||||
|
rapidjson::Type tType = tpRootCocoNode->GetType(&tCocoLoader);
|
||||||
|
if (rapidjson::kObjectType == tType)
|
||||||
|
{
|
||||||
|
stExpCocoNode *tpChildArray = tpRootCocoNode->GetChildArray();
|
||||||
|
int nCount = tpRootCocoNode->GetChildNum();
|
||||||
|
|
||||||
|
dataInfo->contentScale = 1.0f;
|
||||||
|
int length = 0;
|
||||||
|
std::string key;
|
||||||
|
stExpCocoNode* pDataArray;
|
||||||
|
for (int i = 0; i < nCount; ++i)
|
||||||
|
{
|
||||||
|
key = tpChildArray[i].GetName(&tCocoLoader);
|
||||||
|
if (key.compare(CONTENT_SCALE) == 0)
|
||||||
|
{
|
||||||
|
std::string value = tpChildArray[i].GetValue();
|
||||||
|
dataInfo->contentScale = atof(value.c_str());
|
||||||
|
}
|
||||||
|
else if ( 0 == key.compare(ARMATURE_DATA))
|
||||||
|
{
|
||||||
|
pDataArray = tpChildArray[i].GetChildArray();
|
||||||
|
length = tpChildArray[i].GetChildNum();
|
||||||
|
ArmatureData * armatureData;
|
||||||
|
for (int ii = 0; ii < length; ++ii)
|
||||||
|
{
|
||||||
|
armatureData = decodeArmature(&tCocoLoader, &pDataArray[ii], dataInfo);
|
||||||
|
if (dataInfo->asyncStruct)
|
||||||
|
{
|
||||||
|
_dataReaderHelper->_addDataMutex.lock();
|
||||||
|
}
|
||||||
|
ArmatureDataManager::getInstance()->addArmatureData(armatureData->name.c_str(), armatureData, dataInfo->filename.c_str());
|
||||||
|
armatureData->release();
|
||||||
|
if (dataInfo->asyncStruct)
|
||||||
|
{
|
||||||
|
_dataReaderHelper->_addDataMutex.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( 0 == key.compare(ANIMATION_DATA))
|
||||||
|
{
|
||||||
|
pDataArray = tpChildArray[i].GetChildArray();
|
||||||
|
length = tpChildArray[i].GetChildNum();
|
||||||
|
AnimationData *animationData;
|
||||||
|
for (int ii = 0; ii < length; ++ii)
|
||||||
|
{
|
||||||
|
animationData = decodeAnimation(&tCocoLoader, &pDataArray[ii], dataInfo);
|
||||||
|
if (dataInfo->asyncStruct)
|
||||||
|
{
|
||||||
|
_dataReaderHelper->_addDataMutex.lock();
|
||||||
|
}
|
||||||
|
ArmatureDataManager::getInstance()->addAnimationData(animationData->name.c_str(), animationData, dataInfo->filename.c_str());
|
||||||
|
animationData->release();
|
||||||
|
if (dataInfo->asyncStruct)
|
||||||
|
{
|
||||||
|
_dataReaderHelper->_addDataMutex.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(TEXTURE_DATA) == 0)
|
||||||
|
{
|
||||||
|
pDataArray = tpChildArray[i].GetChildArray();
|
||||||
|
length = tpChildArray[i].GetChildNum();
|
||||||
|
for (int ii = 0; ii < length; ++ii)
|
||||||
|
{
|
||||||
|
TextureData *textureData = decodeTexture(&tCocoLoader, &pDataArray[ii]);
|
||||||
|
if (dataInfo->asyncStruct)
|
||||||
|
{
|
||||||
|
_dataReaderHelper->_addDataMutex.lock();
|
||||||
|
}
|
||||||
|
ArmatureDataManager::getInstance()->addTextureData(textureData->name.c_str(), textureData, dataInfo->filename.c_str());
|
||||||
|
textureData->release();
|
||||||
|
if (dataInfo->asyncStruct)
|
||||||
|
{
|
||||||
|
_dataReaderHelper->_addDataMutex.unlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Auto losprite file
|
||||||
|
bool autoLoad = dataInfo->asyncStruct == nullptr ? ArmatureDataManager::getInstance()->isAutoLoadSpriteFile() : dataInfo->asyncStruct->autoLoadSpriteFile;
|
||||||
|
if (autoLoad)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < nCount; ++i)
|
||||||
|
{
|
||||||
|
key = tpChildArray[i].GetName(&tCocoLoader);
|
||||||
|
if( 0 != key.compare(CONFIG_FILE_PATH))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
length = tpChildArray[i].GetChildNum();
|
||||||
|
stExpCocoNode *pConfigFilePath = tpChildArray[i].GetChildArray();
|
||||||
|
for (int ii = 0; ii < length; ii++)
|
||||||
|
{
|
||||||
|
const char *path = pConfigFilePath[ii].GetValue();
|
||||||
|
if (path == nullptr)
|
||||||
|
{
|
||||||
|
CCLOG("load CONFIG_FILE_PATH error.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string filePath = path;
|
||||||
|
filePath = filePath.erase(filePath.find_last_of("."));
|
||||||
|
|
||||||
|
if (dataInfo->asyncStruct)
|
||||||
|
{
|
||||||
|
dataInfo->configFileQueue.push(filePath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string plistPath = filePath + ".plist";
|
||||||
|
std::string pngPath = filePath + ".png";
|
||||||
|
|
||||||
|
ArmatureDataManager::getInstance()->addSpriteFrameFromFile((dataInfo->baseFilePath + plistPath).c_str(), (dataInfo->baseFilePath + pngPath).c_str(), dataInfo->filename.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ArmatureData* DataReaderHelper::decodeArmature(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, DataInfo *dataInfo)
|
||||||
|
{
|
||||||
|
ArmatureData *armatureData = new ArmatureData();
|
||||||
|
armatureData->init();
|
||||||
|
stExpCocoNode *pAramtureDataArray = cocoNode->GetChildArray();
|
||||||
|
const char *name = pAramtureDataArray[2].GetValue(); //DICTOOL->getStringValue_json(json, A_NAME);
|
||||||
|
if(name != nullptr)
|
||||||
|
{
|
||||||
|
armatureData->name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
float version = atof(pAramtureDataArray[1].GetValue());
|
||||||
|
dataInfo->cocoStudioVersion = armatureData->dataVersion = version; //DICTOOL->getFloatValue_json(json, VERSION, 0.1f);
|
||||||
|
|
||||||
|
int length = pAramtureDataArray[3].GetChildNum(); //DICTOOL->getArrayCount_json(json, BONE_DATA, 0);
|
||||||
|
stExpCocoNode *pBoneChildren = pAramtureDataArray[3].GetChildArray();
|
||||||
|
stExpCocoNode* child;
|
||||||
|
for (int i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
//const rapidjson::Value &dic = DICTOOL->getSubDictionary_json(json, BONE_DATA, i); //json[BONE_DATA][i];
|
||||||
|
child = &pBoneChildren[i];
|
||||||
|
BoneData *boneData = decodeBone(cocoLoader, child, dataInfo);
|
||||||
|
armatureData->addBoneData(boneData);
|
||||||
|
boneData->release();
|
||||||
|
}
|
||||||
|
|
||||||
|
return armatureData;
|
||||||
|
}
|
||||||
|
|
||||||
|
BoneData* DataReaderHelper::decodeBone(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, DataInfo *dataInfo)
|
||||||
|
{
|
||||||
|
BoneData *boneData = new BoneData();
|
||||||
|
boneData->init();
|
||||||
|
|
||||||
|
decodeNode(boneData, cocoLoader, cocoNode, dataInfo);
|
||||||
|
|
||||||
|
int length = cocoNode->GetChildNum();
|
||||||
|
stExpCocoNode *pBoneChildren = cocoNode->GetChildArray();
|
||||||
|
stExpCocoNode* child;
|
||||||
|
const char *str = nullptr;
|
||||||
|
std::string key;
|
||||||
|
for (int i = 0; i < length; ++i)
|
||||||
|
{
|
||||||
|
child = &pBoneChildren[i];
|
||||||
|
key = child->GetName(cocoLoader);
|
||||||
|
str = child->GetValue();
|
||||||
|
if (key.compare(A_NAME) == 0)
|
||||||
|
{
|
||||||
|
//DICTOOL->getStringValue_json(json, A_NAME);
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
boneData->name = str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(A_PARENT) == 0)
|
||||||
|
{
|
||||||
|
//DICTOOL->getStringValue_json(json, A_PARENT);
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
boneData->parentName = str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(DISPLAY_DATA) == 0)
|
||||||
|
{
|
||||||
|
int count = child->GetChildNum();
|
||||||
|
stExpCocoNode *pDisplayData = child->GetChildArray();
|
||||||
|
for (int ii = 0; ii < count; ++ii)
|
||||||
|
{
|
||||||
|
DisplayData *displayData = decodeBoneDisplay(cocoLoader, &pDisplayData[ii], dataInfo);
|
||||||
|
if(displayData == nullptr)
|
||||||
|
continue;
|
||||||
|
boneData->addDisplayData(displayData);
|
||||||
|
displayData->release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return boneData;
|
||||||
|
}
|
||||||
|
|
||||||
|
DisplayData* DataReaderHelper::decodeBoneDisplay(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, DataInfo *dataInfo)
|
||||||
|
{
|
||||||
|
stExpCocoNode* children = cocoNode->GetChildArray();
|
||||||
|
stExpCocoNode* child = &children[1];
|
||||||
|
const char *str = nullptr;
|
||||||
|
|
||||||
|
std::string key = child->GetName(cocoLoader);
|
||||||
|
str = child->GetValue();
|
||||||
|
DisplayData *displayData = nullptr;
|
||||||
|
if (key.compare(A_DISPLAY_TYPE) == 0)
|
||||||
|
{
|
||||||
|
str = child->GetValue();
|
||||||
|
DisplayType displayType = (DisplayType)(atoi(str));
|
||||||
|
|
||||||
|
int length = 0;
|
||||||
|
switch (displayType)
|
||||||
|
{
|
||||||
|
case CS_DISPLAY_SPRITE:
|
||||||
|
{
|
||||||
|
displayData = new SpriteDisplayData();
|
||||||
|
|
||||||
|
const char *name = children[0].GetValue();
|
||||||
|
if(name != nullptr)
|
||||||
|
{
|
||||||
|
((SpriteDisplayData *)displayData)->displayName = name;
|
||||||
|
}
|
||||||
|
stExpCocoNode *pSkinDataArray = children[2].GetChildArray();
|
||||||
|
if (pSkinDataArray != nullptr)
|
||||||
|
{
|
||||||
|
stExpCocoNode *pSkinData = &pSkinDataArray[0];
|
||||||
|
if (pSkinData != nullptr)
|
||||||
|
{
|
||||||
|
SpriteDisplayData *sdd = (SpriteDisplayData *)displayData;
|
||||||
|
length = pSkinData->GetChildNum();
|
||||||
|
stExpCocoNode *SkinDataValue = pSkinData->GetChildArray();
|
||||||
|
for (int i = 0; i < length; ++i)
|
||||||
|
{
|
||||||
|
key = SkinDataValue[i].GetName(cocoLoader);
|
||||||
|
str = SkinDataValue[i].GetValue();
|
||||||
|
if (key.compare(A_X) == 0)
|
||||||
|
{
|
||||||
|
sdd->skinData.x = atof(str) * s_PositionReadScale;
|
||||||
|
}
|
||||||
|
else if (key.compare(A_Y) == 0)
|
||||||
|
{
|
||||||
|
sdd->skinData.y = atof(str) * s_PositionReadScale;
|
||||||
|
}
|
||||||
|
else if (key.compare(A_SCALE_X) == 0)
|
||||||
|
{
|
||||||
|
sdd->skinData.scaleX = atof(str);
|
||||||
|
}
|
||||||
|
else if (key.compare(A_SCALE_Y) == 0)
|
||||||
|
{
|
||||||
|
sdd->skinData.scaleY = atof(str);
|
||||||
|
}
|
||||||
|
else if (key.compare(A_SKEW_X) == 0)
|
||||||
|
{
|
||||||
|
sdd->skinData.skewX = atof(str);
|
||||||
|
}
|
||||||
|
else if (key.compare(A_SKEW_Y) == 0)
|
||||||
|
{
|
||||||
|
sdd->skinData.skewY = atof(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sdd->skinData.x *= dataInfo->contentScale;
|
||||||
|
sdd->skinData.y *= dataInfo->contentScale;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case CS_DISPLAY_ARMATURE:
|
||||||
|
{
|
||||||
|
displayData = new ArmatureDisplayData();
|
||||||
|
|
||||||
|
const char *name = cocoNode[0].GetValue();
|
||||||
|
if(name != nullptr)
|
||||||
|
{
|
||||||
|
((ArmatureDisplayData *)displayData)->displayName = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CS_DISPLAY_PARTICLE:
|
||||||
|
{
|
||||||
|
displayData = new ParticleDisplayData();
|
||||||
|
length = cocoNode->GetChildNum();
|
||||||
|
stExpCocoNode *pDisplayData = cocoNode->GetChildArray();
|
||||||
|
for (int i = 0; i < length; ++i)
|
||||||
|
{
|
||||||
|
key = pDisplayData[i].GetName(cocoLoader);
|
||||||
|
str = pDisplayData[i].GetValue();
|
||||||
|
if (key.compare(A_PLIST) == 0)
|
||||||
|
{
|
||||||
|
const char *plist = str;
|
||||||
|
if(plist != nullptr)
|
||||||
|
{
|
||||||
|
if (dataInfo->asyncStruct)
|
||||||
|
{
|
||||||
|
((ParticleDisplayData *)displayData)->displayName = dataInfo->asyncStruct->baseFilePath + plist;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
((ParticleDisplayData *)displayData)->displayName = dataInfo->baseFilePath + plist;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
displayData = new SpriteDisplayData();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
displayData->displayType = displayType;
|
||||||
|
}
|
||||||
|
return displayData;
|
||||||
|
}
|
||||||
|
|
||||||
|
AnimationData* DataReaderHelper::decodeAnimation(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, DataInfo *dataInfo)
|
||||||
|
{
|
||||||
|
AnimationData *aniData = new AnimationData();
|
||||||
|
|
||||||
|
int length = cocoNode->GetChildNum();
|
||||||
|
stExpCocoNode *pAnimationData = cocoNode->GetChildArray();
|
||||||
|
const char *str = nullptr;
|
||||||
|
std::string key;
|
||||||
|
stExpCocoNode* child;
|
||||||
|
MovementData *movementData;
|
||||||
|
for (int i = 0; i < length; ++i)
|
||||||
|
{
|
||||||
|
child = &pAnimationData[i];
|
||||||
|
key = child->GetName(cocoLoader);
|
||||||
|
str = child->GetValue();
|
||||||
|
if (key.compare(A_NAME) == 0)
|
||||||
|
{
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
aniData->name = str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(MOVEMENT_DATA) == 0)
|
||||||
|
{
|
||||||
|
int movcount = child->GetChildNum();
|
||||||
|
stExpCocoNode* movArray = child->GetChildArray();
|
||||||
|
for( int movnum =0; movnum <movcount; movnum++)
|
||||||
|
{
|
||||||
|
movementData = decodeMovement(cocoLoader, &movArray[movnum], dataInfo);
|
||||||
|
aniData->addMovement(movementData);
|
||||||
|
movementData->release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return aniData;
|
||||||
|
}
|
||||||
|
|
||||||
|
MovementData* DataReaderHelper::decodeMovement(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, DataInfo *dataInfo)
|
||||||
|
{
|
||||||
|
MovementData *movementData = new MovementData();
|
||||||
|
movementData->scale = 1.0f;
|
||||||
|
|
||||||
|
int length = cocoNode->GetChildNum();
|
||||||
|
stExpCocoNode *pMoveDataArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
|
const char *str = nullptr;
|
||||||
|
std::string key;
|
||||||
|
stExpCocoNode* child;
|
||||||
|
for (int i = 0; i < length; ++i)
|
||||||
|
{
|
||||||
|
child = &pMoveDataArray[i];
|
||||||
|
key = child->GetName(cocoLoader);
|
||||||
|
str = child->GetValue();
|
||||||
|
if (key.compare(A_NAME) == 0)
|
||||||
|
{
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
movementData->name = str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(A_LOOP) == 0)
|
||||||
|
{
|
||||||
|
movementData->loop = true;
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
if (strcmp("1", str) != 0)
|
||||||
|
{
|
||||||
|
movementData->loop = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(A_DURATION_TWEEN) == 0)
|
||||||
|
{
|
||||||
|
movementData->durationTween = 0;
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
movementData->durationTween = atoi(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(A_DURATION_TO) == 0)
|
||||||
|
{
|
||||||
|
movementData->durationTo = 0;
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
movementData->durationTo = atoi(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(A_DURATION) == 0)
|
||||||
|
{
|
||||||
|
movementData->duration = 0;
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
movementData->duration = atoi(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(A_MOVEMENT_SCALE) == 0)
|
||||||
|
{
|
||||||
|
movementData->scale = 1.0;
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
movementData->scale = atof(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(A_TWEEN_EASING) == 0)
|
||||||
|
{
|
||||||
|
movementData->tweenEasing = cocos2d::tweenfunc::Linear;
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
movementData->tweenEasing = (TweenType)(atoi(str));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(MOVEMENT_BONE_DATA) == 0)
|
||||||
|
{
|
||||||
|
int count = child->GetChildNum();
|
||||||
|
stExpCocoNode *pMoveBoneData = child->GetChildArray();
|
||||||
|
MovementBoneData *movementBoneData;
|
||||||
|
for (int ii = 0; ii < count; ++ii)
|
||||||
|
{
|
||||||
|
movementBoneData = decodeMovementBone(cocoLoader, &pMoveBoneData[ii],dataInfo);
|
||||||
|
movementData->addMovementBoneData(movementBoneData);
|
||||||
|
movementBoneData->release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return movementData;
|
||||||
|
}
|
||||||
|
|
||||||
|
MovementBoneData* DataReaderHelper::decodeMovementBone(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, DataInfo *dataInfo)
|
||||||
|
{
|
||||||
|
MovementBoneData *movementBoneData = new MovementBoneData();
|
||||||
|
movementBoneData->init();
|
||||||
|
|
||||||
|
int length = cocoNode->GetChildNum();
|
||||||
|
stExpCocoNode *pMovementBoneDataArray = cocoNode->GetChildArray();
|
||||||
|
stExpCocoNode* movebonechild;
|
||||||
|
const char *str = nullptr;
|
||||||
|
for (int i = 0; i < length; ++i)
|
||||||
|
{
|
||||||
|
movebonechild = &pMovementBoneDataArray[i];
|
||||||
|
std::string key = movebonechild->GetName(cocoLoader);
|
||||||
|
str = movebonechild->GetValue();
|
||||||
|
if (key.compare(A_NAME) == 0)
|
||||||
|
{
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
movementBoneData->name = str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(A_MOVEMENT_DELAY) == 0)
|
||||||
|
{
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
movementBoneData->delay = atof(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(FRAME_DATA) == 0)
|
||||||
|
{
|
||||||
|
int count =movebonechild->GetChildNum();
|
||||||
|
stExpCocoNode *pFrameDataArray = movebonechild->GetChildArray();
|
||||||
|
for (int ii = 0; ii < count; ++ii)
|
||||||
|
{
|
||||||
|
FrameData *frameData = decodeFrame(cocoLoader, &pFrameDataArray[ii], dataInfo);
|
||||||
|
movementBoneData->addFrameData(frameData);
|
||||||
|
frameData->release();
|
||||||
|
|
||||||
|
if (dataInfo->cocoStudioVersion < VERSION_COMBINED)
|
||||||
|
{
|
||||||
|
frameData->frameID = movementBoneData->duration;
|
||||||
|
movementBoneData->duration += frameData->duration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const ssize_t framesizemusone = movementBoneData->frameList.size()-1;
|
||||||
|
if (dataInfo->cocoStudioVersion < VERSION_CHANGE_ROTATION_RANGE)
|
||||||
|
{
|
||||||
|
//! Change rotation range from (-180 -- 180) to (-infinity -- infinity)
|
||||||
|
cocos2d::Vector<FrameData*> frames =movementBoneData->frameList;
|
||||||
|
|
||||||
|
ssize_t imusone =0;
|
||||||
|
ssize_t i =0;
|
||||||
|
for (i = framesizemusone; i >= 0; i--)
|
||||||
|
{
|
||||||
|
if (i > 0)
|
||||||
|
{
|
||||||
|
imusone = i-1;
|
||||||
|
float difSkewX = frames.at(i)->skewX - frames.at(imusone)->skewX;
|
||||||
|
float difSkewY = frames.at(i)->skewY - frames.at(imusone)->skewY;
|
||||||
|
|
||||||
|
if (difSkewX < -M_PI || difSkewX > M_PI)
|
||||||
|
{
|
||||||
|
frames.at(imusone)->skewX = difSkewX < 0 ? frames.at(imusone)->skewX - 2 * M_PI : frames.at(imusone)->skewX + 2 * M_PI;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (difSkewY < -M_PI || difSkewY > M_PI)
|
||||||
|
{
|
||||||
|
frames.at(imusone)->skewY = difSkewY < 0 ? frames.at(imusone)->skewY - 2 * M_PI : frames.at(imusone)->skewY + 2 * M_PI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (dataInfo->cocoStudioVersion < VERSION_COMBINED)
|
||||||
|
{
|
||||||
|
if (movementBoneData->frameList.size() > 0)
|
||||||
|
{
|
||||||
|
FrameData *frameData = new FrameData();
|
||||||
|
frameData = movementBoneData->frameList.at(framesizemusone);
|
||||||
|
movementBoneData->addFrameData(frameData);
|
||||||
|
frameData->release();
|
||||||
|
frameData->frameID = movementBoneData->duration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return movementBoneData;
|
||||||
|
}
|
||||||
|
|
||||||
|
FrameData* DataReaderHelper::decodeFrame(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, DataInfo *dataInfo)
|
||||||
|
{
|
||||||
|
FrameData *frameData = new FrameData();
|
||||||
|
|
||||||
|
decodeNode(frameData, cocoLoader, cocoNode, dataInfo);
|
||||||
|
|
||||||
|
int length = cocoNode->GetChildNum();
|
||||||
|
stExpCocoNode *pFrameDataArray = cocoNode->GetChildArray();
|
||||||
|
const char *str = nullptr;
|
||||||
|
for (int i = 0; i < length; ++i)
|
||||||
|
{
|
||||||
|
std::string key = pFrameDataArray[i].GetName(cocoLoader);
|
||||||
|
str = pFrameDataArray[i].GetValue();
|
||||||
|
if (key.compare(A_TWEEN_EASING) == 0)
|
||||||
|
{
|
||||||
|
frameData->tweenEasing = cocos2d::tweenfunc::Linear;
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
frameData->tweenEasing = (TweenType)(atoi(str));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(A_DISPLAY_INDEX) == 0)
|
||||||
|
{
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
frameData->displayIndex = atoi(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(A_BLEND_SRC) == 0)
|
||||||
|
{
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
frameData->blendFunc.src = (GLenum)(atoi(str));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(A_BLEND_DST) == 0)
|
||||||
|
{
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
frameData->blendFunc.dst = (GLenum)(atoi(str));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(A_TWEEN_FRAME) == 0)
|
||||||
|
{
|
||||||
|
frameData->isTween = true;
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
if (strcmp("1", str) != 0)
|
||||||
|
{
|
||||||
|
frameData->isTween = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(A_EVENT) == 0)
|
||||||
|
{
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
frameData->strEvent = str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(A_DURATION) == 0)
|
||||||
|
{
|
||||||
|
if (dataInfo->cocoStudioVersion < VERSION_COMBINED)
|
||||||
|
{
|
||||||
|
frameData->duration = 1;
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
frameData->duration = atoi(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(A_FRAME_INDEX) == 0)
|
||||||
|
{
|
||||||
|
if (dataInfo->cocoStudioVersion >= VERSION_COMBINED)
|
||||||
|
{
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
frameData->frameID = atoi(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(A_EASING_PARAM) == 0)
|
||||||
|
{
|
||||||
|
int count = pFrameDataArray[i].GetChildNum();
|
||||||
|
if (count != 0 )
|
||||||
|
{
|
||||||
|
frameData->easingParams = new float[count];
|
||||||
|
stExpCocoNode *pFrameData = pFrameDataArray[i].GetChildArray();
|
||||||
|
for (int ii = 0; ii < count; ++ii)
|
||||||
|
{
|
||||||
|
str = pFrameData[ii].GetValue();
|
||||||
|
if (str != nullptr)
|
||||||
|
{
|
||||||
|
frameData->easingParams[ii] = atof(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return frameData;
|
||||||
|
}
|
||||||
|
|
||||||
|
TextureData* DataReaderHelper::decodeTexture(CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
|
{
|
||||||
|
TextureData *textureData = new TextureData();
|
||||||
|
textureData->init();
|
||||||
|
|
||||||
|
if(cocoNode == nullptr)
|
||||||
|
{
|
||||||
|
return textureData;
|
||||||
|
}
|
||||||
|
|
||||||
|
int length = cocoNode->GetChildNum();
|
||||||
|
stExpCocoNode *pTextureDataArray = cocoNode->GetChildArray();
|
||||||
|
const char *str = nullptr;
|
||||||
|
for (int i = 0; i < length; ++i)
|
||||||
|
{
|
||||||
|
std::string key = pTextureDataArray[i].GetName(cocoLoader);
|
||||||
|
str = pTextureDataArray[i].GetValue();
|
||||||
|
if (key.compare(A_NAME) == 0)
|
||||||
|
{
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
textureData->name = str;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(A_WIDTH) == 0)
|
||||||
|
{
|
||||||
|
if(str != nullptr)
|
||||||
|
{
|
||||||
|
textureData->width = atof(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(A_HEIGHT) == 0)
|
||||||
|
{
|
||||||
|
if(str != NULL)
|
||||||
|
{
|
||||||
|
textureData->height = atof(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(A_PIVOT_X) == 0)
|
||||||
|
{
|
||||||
|
if(str != NULL)
|
||||||
|
{
|
||||||
|
textureData->pivotX = atof(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(A_PIVOT_Y) == 0)
|
||||||
|
{
|
||||||
|
if(str != NULL)
|
||||||
|
{
|
||||||
|
textureData->pivotY = atof(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (key.compare(CONTOUR_DATA) == 0)
|
||||||
|
{
|
||||||
|
int count = pTextureDataArray[i].GetChildNum();
|
||||||
|
stExpCocoNode *pContourArray = pTextureDataArray[i].GetChildArray();
|
||||||
|
for (int ii = 0; ii < count; ++ii)
|
||||||
|
{
|
||||||
|
ContourData *contourData = decodeContour(cocoLoader, &pContourArray[ii]);
|
||||||
|
textureData->contourDataList.pushBack(contourData);
|
||||||
|
contourData->release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return textureData;
|
||||||
|
}
|
||||||
|
|
||||||
|
ContourData* DataReaderHelper::decodeContour(CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
|
{
|
||||||
|
ContourData *contourData = new ContourData();
|
||||||
|
contourData->init();
|
||||||
|
|
||||||
|
int length = cocoNode->GetChildNum();
|
||||||
|
stExpCocoNode *verTexPointArray = cocoNode->GetChildArray();
|
||||||
|
const char *str = nullptr;
|
||||||
|
for (int i = 0; i < length; ++i)
|
||||||
|
{
|
||||||
|
std::string key = verTexPointArray[i].GetName(cocoLoader);
|
||||||
|
str = verTexPointArray[i].GetValue();
|
||||||
|
if (key.compare(VERTEX_POINT) == 0)
|
||||||
|
{
|
||||||
|
int count = verTexPointArray[i].GetChildNum();
|
||||||
|
stExpCocoNode *pVerTexPointArray = verTexPointArray[i].GetChildArray();
|
||||||
|
stExpCocoNode *pVerTexPoint;
|
||||||
|
for (int ii = count - 1; ii >= 0; --ii)
|
||||||
|
{
|
||||||
|
pVerTexPoint = pVerTexPointArray[ii].GetChildArray();
|
||||||
|
Vec2 vertex;
|
||||||
|
vertex.x = atof(pVerTexPoint[0].GetValue());
|
||||||
|
vertex.y = atof(pVerTexPoint[1].GetValue());
|
||||||
|
contourData->vertexList.push_back(vertex); }
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return contourData;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataReaderHelper::decodeNode(BaseData *node, CocoLoader *cocoLoader, stExpCocoNode* cocoNode, DataInfo *dataInfo)
|
||||||
|
{
|
||||||
|
int length = cocoNode->GetChildNum();
|
||||||
|
stExpCocoNode *NodeArray = cocoNode->GetChildArray();
|
||||||
|
const char *str = nullptr;
|
||||||
|
|
||||||
|
bool isVersionL = dataInfo->cocoStudioVersion < VERSION_COLOR_READING;
|
||||||
|
stExpCocoNode* child;
|
||||||
|
for (int i = 0; i < length; ++i)
|
||||||
|
{
|
||||||
|
child = &NodeArray[i];
|
||||||
|
std::string key = child->GetName(cocoLoader);
|
||||||
|
str = child->GetValue();
|
||||||
|
if (key.compare(A_X) == 0)
|
||||||
|
{
|
||||||
|
node->x = atof(str) * dataInfo->contentScale;
|
||||||
|
}
|
||||||
|
else if (key.compare(A_Y) == 0)
|
||||||
|
{
|
||||||
|
node->y = atof(str) * dataInfo->contentScale;
|
||||||
|
}
|
||||||
|
else if (key.compare(A_Z) == 0)
|
||||||
|
{
|
||||||
|
node->zOrder = atoi(str);
|
||||||
|
}
|
||||||
|
else if (key.compare(A_SKEW_X) == 0)
|
||||||
|
{
|
||||||
|
node->skewX = atof(str);
|
||||||
|
}
|
||||||
|
else if (key.compare(A_SKEW_Y) == 0)
|
||||||
|
{
|
||||||
|
node->skewY = atof(str);
|
||||||
|
}
|
||||||
|
else if (key.compare(A_SCALE_X) == 0)
|
||||||
|
{
|
||||||
|
node->scaleX = atof(str);
|
||||||
|
}
|
||||||
|
else if (key.compare(A_SCALE_Y) == 0)
|
||||||
|
{
|
||||||
|
node->scaleY = atof(str);
|
||||||
|
}
|
||||||
|
else if (key.compare(COLOR_INFO) == 0)
|
||||||
|
{
|
||||||
|
if (!isVersionL)
|
||||||
|
{
|
||||||
|
if (child->GetType(cocoLoader) == rapidjson::kObjectType)
|
||||||
|
{
|
||||||
|
if(child->GetChildNum() == 4)
|
||||||
|
{
|
||||||
|
stExpCocoNode *ChildArray = child->GetChildArray();
|
||||||
|
|
||||||
|
node->a = atoi(ChildArray[0].GetValue());
|
||||||
|
node->r = atoi(ChildArray[1].GetValue());
|
||||||
|
node->g = atoi(ChildArray[2].GetValue());
|
||||||
|
node->b = atoi(ChildArray[3].GetValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
node->isUseColorInfo = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isVersionL)
|
||||||
|
{
|
||||||
|
int colorcoount = NodeArray[0].GetChildNum();
|
||||||
|
if(colorcoount>0)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (NodeArray[0].GetType(cocoLoader) == rapidjson::kObjectType)
|
||||||
|
{
|
||||||
|
if(NodeArray[0].GetChildNum() == 4)
|
||||||
|
{
|
||||||
|
stExpCocoNode *ChildArray = NodeArray[0].GetChildArray();
|
||||||
|
|
||||||
|
node->a = atoi(ChildArray[0].GetValue());
|
||||||
|
node->r = atoi(ChildArray[1].GetValue());
|
||||||
|
node->g = atoi(ChildArray[2].GetValue());
|
||||||
|
node->b = atoi(ChildArray[3].GetValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
node->isUseColorInfo = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,9 @@ THE SOFTWARE.
|
||||||
#include "cocostudio/CCArmature.h"
|
#include "cocostudio/CCArmature.h"
|
||||||
#include "cocostudio/DictionaryHelper.h"
|
#include "cocostudio/DictionaryHelper.h"
|
||||||
|
|
||||||
|
#include "json/document.h"
|
||||||
|
#include "DictionaryHelper.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
@ -43,7 +46,8 @@ namespace tinyxml2
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace cocostudio {
|
namespace cocostudio {
|
||||||
|
class CocoLoader;
|
||||||
|
struct stExpCocoNode;
|
||||||
/**
|
/**
|
||||||
* @js NA
|
* @js NA
|
||||||
* @lua NA
|
* @lua NA
|
||||||
|
@ -55,7 +59,8 @@ protected:
|
||||||
enum ConfigType
|
enum ConfigType
|
||||||
{
|
{
|
||||||
DragonBone_XML,
|
DragonBone_XML,
|
||||||
CocoStudio_JSON
|
CocoStudio_JSON,
|
||||||
|
CocoStudio_Binary
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _AsyncStruct
|
typedef struct _AsyncStruct
|
||||||
|
@ -171,7 +176,24 @@ public:
|
||||||
static ContourData *decodeContour(const rapidjson::Value& json);
|
static ContourData *decodeContour(const rapidjson::Value& json);
|
||||||
|
|
||||||
static void decodeNode(BaseData *node, const rapidjson::Value& json, DataInfo *dataInfo);
|
static void decodeNode(BaseData *node, const rapidjson::Value& json, DataInfo *dataInfo);
|
||||||
|
|
||||||
|
// for binary decode
|
||||||
|
public:
|
||||||
|
static void addDataFromBinaryCache(const char *fileContent, DataInfo *dataInfo = nullptr);
|
||||||
|
static ArmatureData *decodeArmature(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
||||||
|
static BoneData *decodeBone(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
||||||
|
static DisplayData *decodeBoneDisplay(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
||||||
|
static AnimationData *decodeAnimation(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
||||||
|
static MovementData *decodeMovement(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
||||||
|
|
||||||
|
static MovementBoneData *decodeMovementBone(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
||||||
|
static FrameData *decodeFrame(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
||||||
|
|
||||||
|
static TextureData *decodeTexture(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode);
|
||||||
|
static ContourData *decodeContour(CocoLoader *cocoLoader, stExpCocoNode *pCocoNode);
|
||||||
|
|
||||||
|
static void decodeNode(BaseData *node, CocoLoader *cocoLoader, stExpCocoNode *pCocoNode, DataInfo *dataInfo);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void loadData();
|
void loadData();
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -30,8 +30,10 @@ THE SOFTWARE.
|
||||||
#include "WidgetReader/WidgetReaderProtocol.h"
|
#include "WidgetReader/WidgetReaderProtocol.h"
|
||||||
#include "base/ObjectFactory.h"
|
#include "base/ObjectFactory.h"
|
||||||
|
|
||||||
|
|
||||||
namespace cocostudio {
|
namespace cocostudio {
|
||||||
|
|
||||||
|
class CocoLoader;
|
||||||
|
struct stExpCocoNode;
|
||||||
|
|
||||||
|
|
||||||
#define kCCSVersion 1.0
|
#define kCCSVersion 1.0
|
||||||
|
@ -49,6 +51,9 @@ public:
|
||||||
static void destroyInstance();
|
static void destroyInstance();
|
||||||
|
|
||||||
cocos2d::ui::Widget* widgetFromJsonFile(const char* fileName);
|
cocos2d::ui::Widget* widgetFromJsonFile(const char* fileName);
|
||||||
|
|
||||||
|
cocos2d::ui::Widget* widgetFromBinaryFile(const char* fileName);
|
||||||
|
|
||||||
int getVersionInteger(const char* str);
|
int getVersionInteger(const char* str);
|
||||||
/**
|
/**
|
||||||
* @js NA
|
* @js NA
|
||||||
|
@ -66,7 +71,6 @@ public:
|
||||||
cocos2d::ObjectFactory::Instance ins,
|
cocos2d::ObjectFactory::Instance ins,
|
||||||
Ref* object,
|
Ref* object,
|
||||||
SEL_ParseEvent callBack);
|
SEL_ParseEvent callBack);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GUIReader();
|
GUIReader();
|
||||||
~GUIReader();
|
~GUIReader();
|
||||||
|
@ -89,13 +93,27 @@ class WidgetPropertiesReader : public cocos2d::Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual cocos2d::ui::Widget* createWidget(const rapidjson::Value& dic, const char* fullPath, const char* fileName)=0;
|
virtual cocos2d::ui::Widget* createWidget(const rapidjson::Value& dic, const char* fullPath, const char* fileName)=0;
|
||||||
|
|
||||||
virtual cocos2d::ui::Widget* widgetFromJsonDictionary(const rapidjson::Value& data) = 0;
|
virtual cocos2d::ui::Widget* widgetFromJsonDictionary(const rapidjson::Value& data) = 0;
|
||||||
virtual void setPropsForAllWidgetFromJsonDictionary(WidgetReaderProtocol* reader, cocos2d::ui::Widget* widget, const rapidjson::Value& options) = 0;
|
virtual void setPropsForAllWidgetFromJsonDictionary(WidgetReaderProtocol* reader, cocos2d::ui::Widget* widget, const rapidjson::Value& options) = 0;
|
||||||
|
|
||||||
|
|
||||||
virtual void setPropsForAllCustomWidgetFromJsonDictionary(const std::string& classType,
|
virtual void setPropsForAllCustomWidgetFromJsonDictionary(const std::string& classType,
|
||||||
cocos2d::ui::Widget* widget,
|
cocos2d::ui::Widget* widget,
|
||||||
const rapidjson::Value& customOptions) = 0;
|
const rapidjson::Value& customOptions) = 0;
|
||||||
|
|
||||||
|
//add binary parsing
|
||||||
|
virtual cocos2d::ui::Widget* createWidgetFromBinary(CocoLoader* cocoLoader,stExpCocoNode* pCocoNode, const char* fileName)=0;
|
||||||
|
virtual cocos2d::ui::Widget* widgetFromBinary(CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) = 0;
|
||||||
|
virtual void setPropsForAllWidgetFromBinary(WidgetReaderProtocol* reader,
|
||||||
|
cocos2d::ui::Widget* widget,
|
||||||
|
CocoLoader* cocoLoader,
|
||||||
|
stExpCocoNode* pCocoNode) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setAnchorPointForWidget(cocos2d::ui::Widget* widget, const rapidjson::Value&options);
|
void setAnchorPointForWidget(cocos2d::ui::Widget* widget, const rapidjson::Value&options);
|
||||||
|
std::string getWidgetReaderClassName(const std::string& classname);
|
||||||
|
std::string getWidgetReaderClassName(cocos2d::ui::Widget *widget);
|
||||||
|
|
||||||
std::string getGUIClassName(const std::string& name);
|
std::string getGUIClassName(const std::string& name);
|
||||||
cocos2d::ui::Widget *createGUI(const std::string& classname);
|
cocos2d::ui::Widget *createGUI(const std::string& classname);
|
||||||
|
@ -115,7 +133,22 @@ public:
|
||||||
virtual ~WidgetPropertiesReader0250(){};
|
virtual ~WidgetPropertiesReader0250(){};
|
||||||
|
|
||||||
virtual cocos2d::ui::Widget* createWidget(const rapidjson::Value& dic, const char* fullPath, const char* fileName);
|
virtual cocos2d::ui::Widget* createWidget(const rapidjson::Value& dic, const char* fullPath, const char* fileName);
|
||||||
|
|
||||||
virtual cocos2d::ui::Widget* widgetFromJsonDictionary(const rapidjson::Value& dic);
|
virtual cocos2d::ui::Widget* widgetFromJsonDictionary(const rapidjson::Value& dic);
|
||||||
|
|
||||||
|
//added for binary parsing
|
||||||
|
virtual cocos2d::ui::Widget* createWidgetFromBinary(CocoLoader* cocoLoader,
|
||||||
|
stExpCocoNode* pCocoNode,
|
||||||
|
const char* fileName)override{return nullptr;}
|
||||||
|
|
||||||
|
virtual cocos2d::ui::Widget* widgetFromBinary(CocoLoader* cocoLoader,
|
||||||
|
stExpCocoNode* pCocoNode){return nullptr;}
|
||||||
|
|
||||||
|
virtual void setPropsForAllWidgetFromBinary(WidgetReaderProtocol* reader,
|
||||||
|
cocos2d::ui::Widget* widget,
|
||||||
|
CocoLoader* cocoLoader,
|
||||||
|
stExpCocoNode* pCocoNode) {}
|
||||||
|
|
||||||
virtual void setPropsForWidgetFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options);
|
virtual void setPropsForWidgetFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options);
|
||||||
|
|
||||||
virtual void setColorPropsForWidgetFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options);
|
virtual void setColorPropsForWidgetFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options);
|
||||||
|
@ -137,7 +170,7 @@ public:
|
||||||
cocos2d::ui::Widget* widget,
|
cocos2d::ui::Widget* widget,
|
||||||
const rapidjson::Value& customOptions);
|
const rapidjson::Value& customOptions);
|
||||||
};
|
};
|
||||||
|
|
||||||
class WidgetPropertiesReader0300 : public WidgetPropertiesReader
|
class WidgetPropertiesReader0300 : public WidgetPropertiesReader
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -146,32 +179,40 @@ public:
|
||||||
WidgetPropertiesReader0300(){};
|
WidgetPropertiesReader0300(){};
|
||||||
virtual ~WidgetPropertiesReader0300(){};
|
virtual ~WidgetPropertiesReader0300(){};
|
||||||
|
|
||||||
virtual cocos2d::ui::Widget* createWidget(const rapidjson::Value& dic, const char* fullPath, const char* fileName);
|
virtual cocos2d::ui::Widget* createWidget(const rapidjson::Value& dic,
|
||||||
|
const char* fullPath,
|
||||||
|
const char* fileName);
|
||||||
|
|
||||||
|
|
||||||
|
//add bin parse support
|
||||||
|
virtual cocos2d::ui::Widget* createWidgetFromBinary(CocoLoader* cocoLoader,
|
||||||
|
stExpCocoNode* pCocoNode,
|
||||||
|
const char* fileName)override;
|
||||||
|
|
||||||
|
virtual cocos2d::ui::Widget* widgetFromBinary(CocoLoader* cocoLoader,
|
||||||
|
stExpCocoNode* pCocoNode);
|
||||||
|
|
||||||
|
virtual void setPropsForAllWidgetFromBinary(WidgetReaderProtocol* reader,
|
||||||
|
cocos2d::ui::Widget* widget,
|
||||||
|
CocoLoader* cocoLoader,
|
||||||
|
stExpCocoNode* pCocoNode);
|
||||||
|
|
||||||
|
virtual void setPropsForAllCustomWidgetFromBinary(const std::string& classType,
|
||||||
|
cocos2d::ui::Widget* widget,
|
||||||
|
CocoLoader* cocoLoader,
|
||||||
|
stExpCocoNode* pCocoNode) {
|
||||||
|
//TODO: custom property
|
||||||
|
}
|
||||||
|
|
||||||
virtual cocos2d::ui::Widget* widgetFromJsonDictionary(const rapidjson::Value& dic);
|
virtual cocos2d::ui::Widget* widgetFromJsonDictionary(const rapidjson::Value& dic);
|
||||||
virtual void setPropsForWidgetFromJsonDictionary(cocos2d::ui::Widget*,const rapidjson::Value& options);
|
|
||||||
|
|
||||||
virtual void setColorPropsForWidgetFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options);
|
virtual void setPropsForAllWidgetFromJsonDictionary(WidgetReaderProtocol* reader,
|
||||||
virtual void setPropsForButtonFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options);
|
cocos2d::ui::Widget* widget,
|
||||||
virtual void setPropsForCheckBoxFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options);
|
const rapidjson::Value& options);
|
||||||
virtual void setPropsForImageViewFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options);
|
|
||||||
virtual void setPropsForLabelFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options);
|
|
||||||
virtual void setPropsForLabelAtlasFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options);
|
|
||||||
virtual void setPropsForLabelBMFontFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options);
|
|
||||||
virtual void setPropsForLoadingBarFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options);
|
|
||||||
virtual void setPropsForSliderFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options);
|
|
||||||
virtual void setPropsForTextFieldFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options);
|
|
||||||
|
|
||||||
virtual void setPropsForLayoutFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options);
|
|
||||||
virtual void setPropsForPageViewFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options);
|
|
||||||
virtual void setPropsForScrollViewFromJsonDictionary(cocos2d::ui::Widget* widget,const rapidjson::Value& options);
|
|
||||||
virtual void setPropsForListViewFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
|
||||||
|
|
||||||
virtual void setPropsForAllWidgetFromJsonDictionary(WidgetReaderProtocol* reader, cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
|
||||||
virtual void setPropsForAllCustomWidgetFromJsonDictionary(const std::string& classType,
|
virtual void setPropsForAllCustomWidgetFromJsonDictionary(const std::string& classType,
|
||||||
cocos2d::ui::Widget* widget,
|
cocos2d::ui::Widget* widget,
|
||||||
const rapidjson::Value& customOptions);
|
const rapidjson::Value& customOptions);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ THE SOFTWARE.
|
||||||
#include "cocostudio/CocoStudio.h"
|
#include "cocostudio/CocoStudio.h"
|
||||||
#include "ui/CocosGUI.h"
|
#include "ui/CocosGUI.h"
|
||||||
#include "audio/include/SimpleAudioEngine.h"
|
#include "audio/include/SimpleAudioEngine.h"
|
||||||
#include "ObjectFactory.h"
|
#include "base/ObjectFactory.h"
|
||||||
|
|
||||||
using namespace cocos2d;
|
using namespace cocos2d;
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
|
@ -33,6 +33,7 @@ set(CS_SRC
|
||||||
TriggerBase.cpp
|
TriggerBase.cpp
|
||||||
TriggerMng.cpp
|
TriggerMng.cpp
|
||||||
TriggerObj.cpp
|
TriggerObj.cpp
|
||||||
|
CocoLoader.cpp
|
||||||
WidgetReader/WidgetReader.cpp
|
WidgetReader/WidgetReader.cpp
|
||||||
WidgetReader/ButtonReader/ButtonReader.cpp
|
WidgetReader/ButtonReader/ButtonReader.cpp
|
||||||
WidgetReader/CheckBoxReader/CheckBoxReader.cpp
|
WidgetReader/CheckBoxReader/CheckBoxReader.cpp
|
||||||
|
|
|
@ -0,0 +1,196 @@
|
||||||
|
#include "CocoLoader.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace rapidjson;
|
||||||
|
|
||||||
|
namespace cocostudio{
|
||||||
|
|
||||||
|
|
||||||
|
const char* kTypeNames[] = { "Null", "False", "True", "Object", "Array", "String", "Number" };
|
||||||
|
const char* kObjKeyName[] = { "__type" , "classname" };
|
||||||
|
char g_Buff[2048];
|
||||||
|
|
||||||
|
Type stExpCocoNode::GetType(CocoLoader* pCoco)
|
||||||
|
{
|
||||||
|
Type tType = kObjectType;
|
||||||
|
if(m_ObjIndex >= 0)
|
||||||
|
{
|
||||||
|
stExpCocoObjectDesc* tpCocoObjectDesc = pCoco->GetCocoObjectDescArray();
|
||||||
|
if( m_AttribIndex >= 0 )
|
||||||
|
{
|
||||||
|
stExpCocoAttribDesc* tpAttribDescArray = (stExpCocoAttribDesc*) tpCocoObjectDesc[m_ObjIndex].m_pAttribDescArray;
|
||||||
|
tType = tpAttribDescArray[m_AttribIndex].m_Type;
|
||||||
|
|
||||||
|
if(kFalseType == tType || kTrueType == tType)
|
||||||
|
{
|
||||||
|
char* szValue = (char*)m_szValue;
|
||||||
|
if(szValue[0] == '0')
|
||||||
|
{
|
||||||
|
return kFalseType;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return kTrueType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tType = kObjectType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(m_AttribIndex >= 0)
|
||||||
|
{
|
||||||
|
tType = (Type)m_ChildNum;
|
||||||
|
|
||||||
|
if(kFalseType == tType || kTrueType == tType)
|
||||||
|
{
|
||||||
|
char* szValue = (char*)m_szValue;
|
||||||
|
if(szValue[0] == '0')
|
||||||
|
{
|
||||||
|
return kFalseType;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return kTrueType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tType = kArrayType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tType;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* stExpCocoNode::GetName(CocoLoader* pCoco)
|
||||||
|
{
|
||||||
|
char* szName = NULL ;
|
||||||
|
if(m_ObjIndex >= 0)
|
||||||
|
{
|
||||||
|
stExpCocoObjectDesc* tpCocoObjectDesc = pCoco->GetCocoObjectDescArray();
|
||||||
|
if( m_AttribIndex >= 0 )
|
||||||
|
{
|
||||||
|
stExpCocoAttribDesc* tpAttribDescArray = (stExpCocoAttribDesc*) tpCocoObjectDesc[m_ObjIndex].m_pAttribDescArray;
|
||||||
|
szName = (char*)tpAttribDescArray[m_AttribIndex].m_szName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char* szValue = (char*)m_szValue;
|
||||||
|
if(szValue[0])
|
||||||
|
{
|
||||||
|
szName = (char*)m_szValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
szName = (char*)tpCocoObjectDesc[m_ObjIndex].m_szName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(m_AttribIndex >= 0)
|
||||||
|
{
|
||||||
|
char* pStringAddr = (char*)pCoco->GetCocoObjectDescArray() + pCoco->GetFileHeader()->m_lStringMemAddr ;
|
||||||
|
szName = m_ChildArray + pStringAddr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
szName = (char*)m_szValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return szName ;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* stExpCocoNode::GetValue()
|
||||||
|
{
|
||||||
|
return (char*)m_szValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
int stExpCocoNode::GetChildNum()
|
||||||
|
{
|
||||||
|
return m_ChildNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
stExpCocoNode* stExpCocoNode::GetChildArray()
|
||||||
|
{
|
||||||
|
return (stExpCocoNode*)m_ChildArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
void stExpCocoNode::ReBuild(char* cocoNodeAddr,char* pStringMemoryAddr)
|
||||||
|
{
|
||||||
|
m_szValue = m_szValue + (uint64_t)pStringMemoryAddr;
|
||||||
|
if( -1 == m_AttribIndex )
|
||||||
|
{
|
||||||
|
if(m_ChildNum > 0)
|
||||||
|
{
|
||||||
|
m_ChildArray = m_ChildArray + (uint64_t)cocoNodeAddr;
|
||||||
|
|
||||||
|
stExpCocoNode* tpChildArray = (stExpCocoNode*)m_ChildArray;
|
||||||
|
for(int i = 0 ; i < m_ChildNum ; i++)
|
||||||
|
{
|
||||||
|
tpChildArray[i].ReBuild(cocoNodeAddr,pStringMemoryAddr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CocoLoader::CocoLoader()
|
||||||
|
{
|
||||||
|
m_pRootNode = NULL;
|
||||||
|
m_pObjectDescArray = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
CocoLoader::~CocoLoader()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CocoLoader::ReadCocoBinBuff(char* pBinBuff)
|
||||||
|
{
|
||||||
|
char* pTempBuff = pBinBuff;
|
||||||
|
|
||||||
|
m_pFileHeader = (stCocoFileHeader*)pTempBuff;
|
||||||
|
pTempBuff += sizeof(stCocoFileHeader);
|
||||||
|
|
||||||
|
char* pStartAddr = pTempBuff;
|
||||||
|
m_pObjectDescArray = (stExpCocoObjectDesc*)pStartAddr;
|
||||||
|
|
||||||
|
char* pAttrAddr = pStartAddr + m_pFileHeader->m_lAttribMemAddr ;
|
||||||
|
char* pCocoMemAddr = pStartAddr + m_pFileHeader->m_CocoNodeMemAddr;
|
||||||
|
char* pStringAddr = pStartAddr + m_pFileHeader->m_lStringMemAddr ;
|
||||||
|
|
||||||
|
m_pRootNode = (stExpCocoNode*)pCocoMemAddr;
|
||||||
|
|
||||||
|
if(1 == m_pFileHeader->m_nFirstUsed)
|
||||||
|
{
|
||||||
|
for(int i = 0 ; i < m_pFileHeader->m_ObjectCount ; i++)
|
||||||
|
{
|
||||||
|
m_pObjectDescArray[i].ReBuild(pAttrAddr,pStringAddr) ;
|
||||||
|
}
|
||||||
|
m_pRootNode->ReBuild(pCocoMemAddr,pStringAddr);
|
||||||
|
|
||||||
|
m_pFileHeader->m_nFirstUsed = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
stExpCocoObjectDesc* CocoLoader::GetCocoObjectDesc(const char* szObjDesc)
|
||||||
|
{
|
||||||
|
for(int i = 0 ; i < m_pFileHeader->m_ObjectCount ; i++)
|
||||||
|
{
|
||||||
|
if(0 == strcmp((char*)m_pObjectDescArray[i].m_szName,szObjDesc))
|
||||||
|
{
|
||||||
|
return &m_pObjectDescArray[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,139 @@
|
||||||
|
/****************************************************************************
|
||||||
|
Copyright (c) 2013 cocos2d-x.org
|
||||||
|
|
||||||
|
http://www.cocos2d-x.org
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _COCOLOADER_H
|
||||||
|
#define _COCOLOADER_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <vector>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "json/rapidjson.h"
|
||||||
|
#include "json/document.h"
|
||||||
|
|
||||||
|
#pragma pack (4)
|
||||||
|
|
||||||
|
namespace cocostudio{
|
||||||
|
|
||||||
|
|
||||||
|
struct stExpCocoAttribDesc
|
||||||
|
{
|
||||||
|
rapidjson::Type m_Type;
|
||||||
|
uint64_t m_szName;
|
||||||
|
uint64_t m_szDefaultValue;
|
||||||
|
public:
|
||||||
|
|
||||||
|
void ReBuild(char* pStringMemoryAddr)
|
||||||
|
{
|
||||||
|
m_szName = m_szName + (uint64_t)pStringMemoryAddr;
|
||||||
|
m_szDefaultValue = m_szDefaultValue + (uint64_t)pStringMemoryAddr;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct stExpCocoObjectDesc
|
||||||
|
{
|
||||||
|
uint32_t m_nAttribNum;
|
||||||
|
uint64_t m_szName;
|
||||||
|
uint64_t m_pAttribDescArray;
|
||||||
|
|
||||||
|
public:
|
||||||
|
stExpCocoObjectDesc()
|
||||||
|
{
|
||||||
|
m_nAttribNum = 0;
|
||||||
|
m_szName = 0;
|
||||||
|
m_pAttribDescArray = 0;
|
||||||
|
}
|
||||||
|
void ReBuild(char* pAttribMemoryAddr,char* pStringMemoryAddr)
|
||||||
|
{
|
||||||
|
m_szName = m_szName + (uint64_t)pStringMemoryAddr;
|
||||||
|
m_pAttribDescArray = m_pAttribDescArray + (uint64_t)pAttribMemoryAddr;
|
||||||
|
stExpCocoAttribDesc* tpAttribDescArray = (stExpCocoAttribDesc*)m_pAttribDescArray;
|
||||||
|
for(uint32_t i = 0 ; i < m_nAttribNum ; i++)
|
||||||
|
{
|
||||||
|
tpAttribDescArray[i].ReBuild(pStringMemoryAddr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class CocoLoader;
|
||||||
|
|
||||||
|
struct stExpCocoNode
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
int32_t m_ObjIndex;
|
||||||
|
int32_t m_AttribIndex;
|
||||||
|
uint32_t m_ChildNum;
|
||||||
|
uint64_t m_szValue;
|
||||||
|
uint64_t m_ChildArray;
|
||||||
|
|
||||||
|
public:
|
||||||
|
rapidjson::Type GetType(CocoLoader* pCoco);
|
||||||
|
char* GetName(CocoLoader* pCoco);
|
||||||
|
char* GetValue();
|
||||||
|
int GetChildNum();
|
||||||
|
stExpCocoNode* GetChildArray();
|
||||||
|
|
||||||
|
public:
|
||||||
|
inline void ReBuild(char* cocoNodeAddr,char* pStringMemoryAddr);
|
||||||
|
void WriteJson(CocoLoader* pCoco, void* pFileName = NULL, int vLayer = 0, bool bEndNode = false, bool bParentNodeIsArray = false);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct stCocoFileHeader
|
||||||
|
{
|
||||||
|
char m_FileDesc[32];
|
||||||
|
char m_Version[32];
|
||||||
|
uint32_t m_nFirstUsed;
|
||||||
|
uint32_t m_ObjectCount;
|
||||||
|
uint64_t m_lAttribMemAddr;
|
||||||
|
uint64_t m_CocoNodeMemAddr;
|
||||||
|
uint64_t m_lStringMemAddr;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class CocoLoader
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
stCocoFileHeader* m_pFileHeader;
|
||||||
|
stExpCocoNode* m_pRootNode;
|
||||||
|
stExpCocoObjectDesc* m_pObjectDescArray;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CocoLoader();
|
||||||
|
~CocoLoader();
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool ReadCocoBinBuff(char* pBinBuff);
|
||||||
|
stCocoFileHeader* GetFileHeader(){return m_pFileHeader;}
|
||||||
|
stExpCocoNode* GetRootCocoNode(){return m_pRootNode;}
|
||||||
|
stExpCocoObjectDesc* GetCocoObjectDescArray(){return m_pObjectDescArray;}
|
||||||
|
stExpCocoObjectDesc* GetCocoObjectDesc(const char* szObjDesc);
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma pack ()
|
||||||
|
#endif
|
|
@ -1,202 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "ObjectFactory.h"
|
|
||||||
#include "ui/UIWidget.h"
|
|
||||||
#include "cocostudio/WidgetReader/WidgetReaderProtocol.h"
|
|
||||||
|
|
||||||
using namespace cocos2d;
|
|
||||||
|
|
||||||
namespace cocostudio {
|
|
||||||
|
|
||||||
ObjectFactory::TInfo::TInfo(void)
|
|
||||||
:_class("")
|
|
||||||
,_fun(nullptr)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ObjectFactory::TInfo::TInfo(const std::string& type, Instance ins)
|
|
||||||
:_class(type)
|
|
||||||
,_fun(ins)
|
|
||||||
{
|
|
||||||
ObjectFactory::getInstance()->registerType(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
ObjectFactory::TInfo::TInfo(const TInfo &t)
|
|
||||||
{
|
|
||||||
_class = t._class;
|
|
||||||
_fun = t._fun;
|
|
||||||
}
|
|
||||||
|
|
||||||
ObjectFactory::TInfo::~TInfo(void)
|
|
||||||
{
|
|
||||||
_class = "";
|
|
||||||
_fun = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
ObjectFactory::TInfo& ObjectFactory::TInfo::operator= (const TInfo &t)
|
|
||||||
{
|
|
||||||
_class = t._class;
|
|
||||||
_fun = t._fun;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ObjectFactory* ObjectFactory::_sharedFactory = nullptr;
|
|
||||||
|
|
||||||
ObjectFactory::ObjectFactory(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ObjectFactory::~ObjectFactory(void)
|
|
||||||
{
|
|
||||||
_typeMap.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
ObjectFactory* ObjectFactory::getInstance()
|
|
||||||
{
|
|
||||||
if ( nullptr == _sharedFactory)
|
|
||||||
{
|
|
||||||
_sharedFactory = new ObjectFactory();
|
|
||||||
}
|
|
||||||
return _sharedFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectFactory::destroyInstance()
|
|
||||||
{
|
|
||||||
CC_SAFE_DELETE(_sharedFactory);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ref* ObjectFactory::createObject(const std::string &name)
|
|
||||||
{
|
|
||||||
Ref *o = nullptr;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
const TInfo t = _typeMap[name];
|
|
||||||
CC_BREAK_IF(t._fun == nullptr);
|
|
||||||
o = t._fun();
|
|
||||||
} while (0);
|
|
||||||
|
|
||||||
return o;
|
|
||||||
}
|
|
||||||
|
|
||||||
Component* ObjectFactory::createComponent(const std::string &name)
|
|
||||||
{
|
|
||||||
std::string comName;
|
|
||||||
if (name == "CCSprite" || name == "CCTMXTiledMap" || name == "CCParticleSystemQuad" || name == "CCArmature" || name == "GUIComponent")
|
|
||||||
{
|
|
||||||
comName = "ComRender";
|
|
||||||
}
|
|
||||||
else if (name == "CCComAudio" || name == "CCBackgroundAudio")
|
|
||||||
{
|
|
||||||
comName = "ComAudio";
|
|
||||||
}
|
|
||||||
else if (name == "CCComController")
|
|
||||||
{
|
|
||||||
comName = "ComController";
|
|
||||||
}
|
|
||||||
else if (name == "CCComAttribute")
|
|
||||||
{
|
|
||||||
comName = "ComAttribute";
|
|
||||||
}
|
|
||||||
else if (name == "CCScene")
|
|
||||||
{
|
|
||||||
comName = "Scene";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CCASSERT(false, "Unregistered Component!");
|
|
||||||
}
|
|
||||||
Ref *o = NULL;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
const TInfo t = _typeMap[comName];
|
|
||||||
CC_BREAK_IF(t._fun == NULL);
|
|
||||||
o = t._fun();
|
|
||||||
} while (0);
|
|
||||||
|
|
||||||
return (Component*)o;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ui::Widget* ObjectFactory::createGUI(std::string name)
|
|
||||||
{
|
|
||||||
Ref* object = nullptr;
|
|
||||||
|
|
||||||
if (name == "Panel")
|
|
||||||
{
|
|
||||||
name = "Layout";
|
|
||||||
}
|
|
||||||
else if (name == "TextArea")
|
|
||||||
{
|
|
||||||
name = "Text";
|
|
||||||
}
|
|
||||||
else if (name == "TextButton")
|
|
||||||
{
|
|
||||||
name = "Button";
|
|
||||||
}
|
|
||||||
else if (name == "Label")
|
|
||||||
{
|
|
||||||
name = "Text";
|
|
||||||
}
|
|
||||||
else if (name == "LabelAtlas")
|
|
||||||
{
|
|
||||||
name = "TextAtlas";
|
|
||||||
}
|
|
||||||
else if (name == "LabelBMFont")
|
|
||||||
{
|
|
||||||
name = "TextBMFont";
|
|
||||||
}
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
const TInfo t = _typeMap[name];
|
|
||||||
CC_BREAK_IF(t._fun == NULL);
|
|
||||||
object = t._fun();
|
|
||||||
} while (0);
|
|
||||||
|
|
||||||
return static_cast<ui::Widget*>(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
WidgetReaderProtocol* ObjectFactory::createWidgetReaderProtocol(std::string name)
|
|
||||||
{
|
|
||||||
Ref* object = NULL;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
const TInfo t = _typeMap[name];
|
|
||||||
CC_BREAK_IF(t._fun == NULL);
|
|
||||||
object = t._fun();
|
|
||||||
} while (0);
|
|
||||||
|
|
||||||
return dynamic_cast<WidgetReaderProtocol*>(object);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ObjectFactory::registerType(const TInfo &t)
|
|
||||||
{
|
|
||||||
_typeMap.insert(std::make_pair(t._class, t));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,81 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __TRIGGERFACTORY_H__
|
|
||||||
#define __TRIGGERFACTORY_H__
|
|
||||||
|
|
||||||
#include "cocos2d.h"
|
|
||||||
#include <string>
|
|
||||||
#include <unordered_map>
|
|
||||||
|
|
||||||
namespace cocos2d
|
|
||||||
{
|
|
||||||
namespace ui
|
|
||||||
{
|
|
||||||
class Widget;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
namespace cocostudio
|
|
||||||
{
|
|
||||||
class WidgetReaderProtocol;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace cocostudio {
|
|
||||||
|
|
||||||
class ObjectFactory
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef cocos2d::Ref* (*Instance)(void);
|
|
||||||
struct TInfo
|
|
||||||
{
|
|
||||||
TInfo(void);
|
|
||||||
TInfo(const std::string& type, Instance ins = NULL);
|
|
||||||
TInfo(const TInfo &t);
|
|
||||||
~TInfo(void);
|
|
||||||
TInfo& operator= (const TInfo &t);
|
|
||||||
std::string _class;
|
|
||||||
Instance _fun;
|
|
||||||
};
|
|
||||||
typedef std::unordered_map<std::string, TInfo> FactoryMap;
|
|
||||||
|
|
||||||
static ObjectFactory* getInstance();
|
|
||||||
static void destroyInstance();
|
|
||||||
cocos2d::Ref* createObject(const std::string &name);
|
|
||||||
cocos2d::Component* createComponent(const std::string &name);
|
|
||||||
cocos2d::ui::Widget* createGUI(std::string name);
|
|
||||||
WidgetReaderProtocol* createWidgetReaderProtocol(std::string name);
|
|
||||||
void registerType(const TInfo &t);
|
|
||||||
void removeAll();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
ObjectFactory(void);
|
|
||||||
virtual ~ObjectFactory(void);
|
|
||||||
private:
|
|
||||||
static ObjectFactory *_sharedFactory;
|
|
||||||
FactoryMap _typeMap;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -2,13 +2,34 @@
|
||||||
|
|
||||||
#include "ButtonReader.h"
|
#include "ButtonReader.h"
|
||||||
#include "ui/UIButton.h"
|
#include "ui/UIButton.h"
|
||||||
|
#include "cocostudio/CocoLoader.h"
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
||||||
namespace cocostudio
|
namespace cocostudio
|
||||||
{
|
{
|
||||||
static ButtonReader* instanceButtonReader = NULL;
|
|
||||||
|
static const char* P_Scale9Enable = "scale9Enable";
|
||||||
|
static const char* P_NormalData = "normalData";
|
||||||
|
static const char* P_PressedData = "pressedData";
|
||||||
|
static const char* P_DisabledData = "disabledData";
|
||||||
|
static const char* P_Text = "text";
|
||||||
|
static const char* P_CapInsetsX = "capInsetsX";
|
||||||
|
static const char* P_CapInsetsY = "capInsetsY";
|
||||||
|
static const char* P_CapInsetsWidth = "capInsetsWidth";
|
||||||
|
static const char* P_CapInsetsHeight = "capInsetsHeight";
|
||||||
|
static const char* P_Scale9Width = "scale9Width";
|
||||||
|
static const char* P_Scale9Height = "scale9Height";
|
||||||
|
static const char* P_TextColorR = "textColorR";
|
||||||
|
static const char* P_TextColorG = "textColorG";
|
||||||
|
static const char* P_TextColorB = "textColorB";
|
||||||
|
static const char* P_FontSize = "fontSize";
|
||||||
|
static const char* P_FontName = "fontName";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static ButtonReader* instanceButtonReader = nullptr;
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(ButtonReader)
|
IMPLEMENT_CLASS_WIDGET_READER_INFO(ButtonReader)
|
||||||
|
|
||||||
|
@ -36,78 +57,181 @@ namespace cocostudio
|
||||||
CC_SAFE_DELETE(instanceButtonReader);
|
CC_SAFE_DELETE(instanceButtonReader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ButtonReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
|
{
|
||||||
|
WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode);
|
||||||
|
|
||||||
|
Button *button = static_cast<Button*>(widget);
|
||||||
|
|
||||||
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
|
this->beginSetBasicProperties(widget);
|
||||||
|
|
||||||
|
float capsx = 0.0f, capsy = 0.0, capsWidth = 0.0, capsHeight = 0.0f;
|
||||||
|
int cri = 255, cgi = 255, cbi = 255;
|
||||||
|
float scale9Width = 0.0f, scale9Height = 0.0f;
|
||||||
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
// CCLOG("Button: key = %s, value = %d", key.c_str(), i);
|
||||||
|
|
||||||
|
//read all basic properties of widget
|
||||||
|
CC_BASIC_PROPERTY_BINARY_READER
|
||||||
|
//read all color related properties of widget
|
||||||
|
CC_COLOR_PROPERTY_BINARY_READER
|
||||||
|
|
||||||
|
|
||||||
|
else if (key == P_Scale9Enable) {
|
||||||
|
button->setScale9Enabled(valueToBool(value));
|
||||||
|
}
|
||||||
|
else if (key == P_NormalData){
|
||||||
|
|
||||||
|
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
|
||||||
|
std::string resType = backGroundChildren[2].GetValue();;
|
||||||
|
|
||||||
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
|
button->loadTextureNormal(backgroundValue, imageFileNameType);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (key == P_PressedData){
|
||||||
|
|
||||||
|
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
|
||||||
|
std::string resType = backGroundChildren[2].GetValue();;
|
||||||
|
|
||||||
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
|
button->loadTexturePressed(backgroundValue, imageFileNameType);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (key == P_DisabledData){
|
||||||
|
|
||||||
|
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
|
||||||
|
std::string resType = backGroundChildren[2].GetValue();;
|
||||||
|
|
||||||
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
|
button->loadTextureDisabled(backgroundValue, imageFileNameType);
|
||||||
|
|
||||||
|
}else if (key == P_Text){
|
||||||
|
button->setTitleText(value);
|
||||||
|
}
|
||||||
|
else if(key == P_CapInsetsX){
|
||||||
|
capsx = valueToFloat(value);
|
||||||
|
}else if(key == P_CapInsetsY){
|
||||||
|
capsy = valueToFloat(value);
|
||||||
|
}else if(key == P_CapInsetsWidth){
|
||||||
|
capsWidth = valueToFloat(value);
|
||||||
|
}else if(key == P_CapInsetsHeight){
|
||||||
|
capsHeight = valueToFloat(value);
|
||||||
|
}else if(key == P_Scale9Width){
|
||||||
|
scale9Width = valueToFloat(value);
|
||||||
|
}else if(key == P_Scale9Height){
|
||||||
|
scale9Height = valueToFloat(value);
|
||||||
|
}else if(key == P_TextColorR){
|
||||||
|
cri = valueToInt(value);
|
||||||
|
}else if(key == P_TextColorG){
|
||||||
|
cgi = valueToInt(value);
|
||||||
|
}else if(key == P_TextColorB){
|
||||||
|
cbi = valueToInt(value);
|
||||||
|
}else if(key == P_FontSize){
|
||||||
|
button->setTitleFontSize(valueToFloat(value));
|
||||||
|
}else if(key == P_FontName){
|
||||||
|
button->setTitleFontName(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
} //end of for loop
|
||||||
|
|
||||||
|
this->endSetBasicProperties(widget);
|
||||||
|
|
||||||
|
if (button->isScale9Enabled()) {
|
||||||
|
button->setCapInsets(Rect(capsx, capsy, capsWidth, capsHeight));
|
||||||
|
button->setSize(Size(scale9Width, scale9Height));
|
||||||
|
}
|
||||||
|
|
||||||
|
button->setTitleColor(Color3B(cri, cgi, cbi));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void ButtonReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
void ButtonReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
||||||
{
|
{
|
||||||
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
||||||
|
|
||||||
|
|
||||||
Button* button = static_cast<Button*>(widget);
|
Button* button = static_cast<Button*>(widget);
|
||||||
bool scale9Enable = DICTOOL->getBooleanValue_json(options, "scale9Enable");
|
bool scale9Enable = DICTOOL->getBooleanValue_json(options, P_Scale9Enable);
|
||||||
button->setScale9Enabled(scale9Enable);
|
button->setScale9Enabled(scale9Enable);
|
||||||
|
|
||||||
|
|
||||||
const rapidjson::Value& normalDic = DICTOOL->getSubDictionary_json(options, "normalData");
|
const rapidjson::Value& normalDic = DICTOOL->getSubDictionary_json(options, P_NormalData);
|
||||||
int normalType = DICTOOL->getIntValue_json(normalDic, "resourceType");
|
int normalType = DICTOOL->getIntValue_json(normalDic, P_ResourceType);
|
||||||
std::string normalTexturePath = this->getResourcePath(normalDic, "path", (Widget::TextureResType)normalType);
|
std::string normalTexturePath = this->getResourcePath(normalDic, P_Path, (Widget::TextureResType)normalType);
|
||||||
button->loadTextureNormal(normalTexturePath, (Widget::TextureResType)normalType);
|
button->loadTextureNormal(normalTexturePath, (Widget::TextureResType)normalType);
|
||||||
|
|
||||||
|
|
||||||
const rapidjson::Value& pressedDic = DICTOOL->getSubDictionary_json(options, "pressedData");
|
const rapidjson::Value& pressedDic = DICTOOL->getSubDictionary_json(options, P_PressedData);
|
||||||
int pressedType = DICTOOL->getIntValue_json(pressedDic, "resourceType");
|
int pressedType = DICTOOL->getIntValue_json(pressedDic, P_ResourceType);
|
||||||
|
|
||||||
std::string pressedTexturePath = this->getResourcePath(pressedDic, "path", (Widget::TextureResType)pressedType);
|
std::string pressedTexturePath = this->getResourcePath(pressedDic, P_Path, (Widget::TextureResType)pressedType);
|
||||||
button->loadTexturePressed(pressedTexturePath, (Widget::TextureResType)pressedType);
|
button->loadTexturePressed(pressedTexturePath, (Widget::TextureResType)pressedType);
|
||||||
|
|
||||||
|
|
||||||
const rapidjson::Value& disabledDic = DICTOOL->getSubDictionary_json(options, "disabledData");
|
const rapidjson::Value& disabledDic = DICTOOL->getSubDictionary_json(options, P_DisabledData);
|
||||||
int disabledType = DICTOOL->getIntValue_json(disabledDic, "resourceType");
|
int disabledType = DICTOOL->getIntValue_json(disabledDic, P_ResourceType);
|
||||||
|
|
||||||
std::string disabledTexturePath = this->getResourcePath(disabledDic, "path", (Widget::TextureResType)disabledType);
|
std::string disabledTexturePath = this->getResourcePath(disabledDic, P_Path, (Widget::TextureResType)disabledType);
|
||||||
button->loadTextureDisabled(disabledTexturePath, (Widget::TextureResType)disabledType);
|
button->loadTextureDisabled(disabledTexturePath, (Widget::TextureResType)disabledType);
|
||||||
|
|
||||||
if (scale9Enable)
|
if (scale9Enable)
|
||||||
{
|
{
|
||||||
float cx = DICTOOL->getFloatValue_json(options, "capInsetsX");
|
float cx = DICTOOL->getFloatValue_json(options, P_CapInsetsX);
|
||||||
float cy = DICTOOL->getFloatValue_json(options, "capInsetsY");
|
float cy = DICTOOL->getFloatValue_json(options, P_CapInsetsY);
|
||||||
float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");
|
float cw = DICTOOL->getFloatValue_json(options, P_CapInsetsWidth);
|
||||||
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
|
float ch = DICTOOL->getFloatValue_json(options, P_CapInsetsHeight);
|
||||||
|
|
||||||
button->setCapInsets(Rect(cx, cy, cw, ch));
|
button->setCapInsets(Rect(cx, cy, cw, ch));
|
||||||
bool sw = DICTOOL->checkObjectExist_json(options, "scale9Width");
|
bool sw = DICTOOL->checkObjectExist_json(options, P_Scale9Width);
|
||||||
bool sh = DICTOOL->checkObjectExist_json(options, "scale9Height");
|
bool sh = DICTOOL->checkObjectExist_json(options, P_Scale9Height);
|
||||||
if (sw && sh)
|
if (sw && sh)
|
||||||
{
|
{
|
||||||
float swf = DICTOOL->getFloatValue_json(options, "scale9Width");
|
float swf = DICTOOL->getFloatValue_json(options, P_Scale9Width);
|
||||||
float shf = DICTOOL->getFloatValue_json(options, "scale9Height");
|
float shf = DICTOOL->getFloatValue_json(options, P_Scale9Height);
|
||||||
button->setSize(Size(swf, shf));
|
button->setSize(Size(swf, shf));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool tt = DICTOOL->checkObjectExist_json(options, "text");
|
bool tt = DICTOOL->checkObjectExist_json(options, P_Text);
|
||||||
if (tt)
|
if (tt)
|
||||||
{
|
{
|
||||||
const char* text = DICTOOL->getStringValue_json(options, "text");
|
const char* text = DICTOOL->getStringValue_json(options, P_Text);
|
||||||
if (text)
|
if (text)
|
||||||
{
|
{
|
||||||
button->setTitleText(text);
|
button->setTitleText(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cr = DICTOOL->checkObjectExist_json(options, "textColorR");
|
bool cr = DICTOOL->checkObjectExist_json(options, P_TextColorR);
|
||||||
bool cg = DICTOOL->checkObjectExist_json(options, "textColorG");
|
bool cg = DICTOOL->checkObjectExist_json(options, P_TextColorG);
|
||||||
bool cb = DICTOOL->checkObjectExist_json(options, "textColorB");
|
bool cb = DICTOOL->checkObjectExist_json(options, P_TextColorB);
|
||||||
int cri = cr?DICTOOL->getIntValue_json(options, "textColorR"):255;
|
int cri = cr?DICTOOL->getIntValue_json(options, P_TextColorR):255;
|
||||||
int cgi = cg?DICTOOL->getIntValue_json(options, "textColorG"):255;
|
int cgi = cg?DICTOOL->getIntValue_json(options, P_TextColorG):255;
|
||||||
int cbi = cb?DICTOOL->getIntValue_json(options, "textColorB"):255;
|
int cbi = cb?DICTOOL->getIntValue_json(options, P_TextColorB):255;
|
||||||
button->setTitleColor(Color3B(cri,cgi,cbi));
|
button->setTitleColor(Color3B(cri,cgi,cbi));
|
||||||
bool fs = DICTOOL->checkObjectExist_json(options, "fontSize");
|
bool fs = DICTOOL->checkObjectExist_json(options, P_FontSize);
|
||||||
if (fs)
|
if (fs)
|
||||||
{
|
{
|
||||||
button->setTitleFontSize(DICTOOL->getIntValue_json(options, "fontSize"));
|
button->setTitleFontSize(DICTOOL->getIntValue_json(options, P_FontSize));
|
||||||
}
|
}
|
||||||
bool fn = DICTOOL->checkObjectExist_json(options, "fontName");
|
bool fn = DICTOOL->checkObjectExist_json(options, P_FontName);
|
||||||
if (fn)
|
if (fn)
|
||||||
{
|
{
|
||||||
button->setTitleFontName(DICTOOL->getStringValue_json(options, "fontName"));
|
button->setTitleFontName(DICTOOL->getStringValue_json(options, P_FontName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ namespace cocostudio
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget,
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget,
|
||||||
const rapidjson::Value& options);
|
const rapidjson::Value& options);
|
||||||
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode);
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,19 @@
|
||||||
|
|
||||||
#include "CheckBoxReader.h"
|
#include "CheckBoxReader.h"
|
||||||
#include "ui/UICheckBox.h"
|
#include "ui/UICheckBox.h"
|
||||||
|
#include "cocostudio/CocoLoader.h"
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
||||||
namespace cocostudio
|
namespace cocostudio
|
||||||
{
|
{
|
||||||
|
static const char* P_BackGroundBoxData = "backGroundBoxData";
|
||||||
|
static const char* P_BackGroundBoxSelectedData = "backGroundBoxSelectedData";
|
||||||
|
static const char* P_FrontCrossData = "frontCrossData";
|
||||||
|
static const char* P_BackGroundBoxDisabledData = "backGroundBoxDisabledData";
|
||||||
|
static const char* P_FrontCrossDisabledData = "frontCrossDisabledData";
|
||||||
|
|
||||||
static CheckBoxReader* instanceCheckBoxReader = NULL;
|
static CheckBoxReader* instanceCheckBoxReader = NULL;
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(CheckBoxReader)
|
IMPLEMENT_CLASS_WIDGET_READER_INFO(CheckBoxReader)
|
||||||
|
@ -31,41 +38,113 @@ namespace cocostudio
|
||||||
return instanceCheckBoxReader;
|
return instanceCheckBoxReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CheckBoxReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
|
{
|
||||||
|
|
||||||
|
CheckBox *checkBox = static_cast<CheckBox*>(widget);
|
||||||
|
this->beginSetBasicProperties(widget);
|
||||||
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
// CCLOG("key = %s, index : %d", key.c_str(), i);
|
||||||
|
//read all basic properties of widget
|
||||||
|
CC_BASIC_PROPERTY_BINARY_READER
|
||||||
|
//read all color related properties of widget
|
||||||
|
CC_COLOR_PROPERTY_BINARY_READER
|
||||||
|
|
||||||
|
else if (key == P_BackGroundBoxData){
|
||||||
|
|
||||||
|
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
|
||||||
|
std::string resType = backGroundChildren[2].GetValue();;
|
||||||
|
|
||||||
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
|
checkBox->loadTextureBackGround(backgroundValue, imageFileNameType);
|
||||||
|
}else if(key == P_BackGroundBoxSelectedData){
|
||||||
|
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
|
||||||
|
std::string resType = backGroundChildren[2].GetValue();;
|
||||||
|
|
||||||
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
|
checkBox->loadTextureBackGroundSelected(backgroundValue, imageFileNameType);
|
||||||
|
}else if(key == P_FrontCrossData){
|
||||||
|
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
|
||||||
|
std::string resType = backGroundChildren[2].GetValue();;
|
||||||
|
|
||||||
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
|
checkBox->loadTextureFrontCross(backgroundValue, imageFileNameType);
|
||||||
|
}else if(key == P_BackGroundBoxDisabledData){
|
||||||
|
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
|
||||||
|
std::string resType = backGroundChildren[2].GetValue();;
|
||||||
|
|
||||||
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
|
checkBox->loadTextureBackGroundDisabled(backgroundValue, imageFileNameType);
|
||||||
|
}else if (key == P_FrontCrossDisabledData){
|
||||||
|
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
|
||||||
|
std::string resType = backGroundChildren[2].GetValue();;
|
||||||
|
|
||||||
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
|
checkBox->loadTextureFrontCrossDisabled(backgroundValue, imageFileNameType);
|
||||||
|
}
|
||||||
|
// else if (key == "selectedState"){
|
||||||
|
// checkBox->setSelectedState(valueToBool(value));
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
this->endSetBasicProperties(widget);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void CheckBoxReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
void CheckBoxReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
||||||
{
|
{
|
||||||
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
||||||
|
|
||||||
CheckBox* checkBox = static_cast<CheckBox*>(widget);
|
CheckBox* checkBox = static_cast<CheckBox*>(widget);
|
||||||
|
|
||||||
|
|
||||||
//load background image
|
//load background image
|
||||||
const rapidjson::Value& backGroundDic = DICTOOL->getSubDictionary_json(options, "backGroundBoxData");
|
const rapidjson::Value& backGroundDic = DICTOOL->getSubDictionary_json(options, P_BackGroundBoxData);
|
||||||
int backGroundType = DICTOOL->getIntValue_json(backGroundDic, "resourceType");
|
int backGroundType = DICTOOL->getIntValue_json(backGroundDic,P_ResourceType);
|
||||||
std::string backGroundTexturePath = this->getResourcePath(backGroundDic, "path", (Widget::TextureResType)backGroundType);
|
std::string backGroundTexturePath = this->getResourcePath(backGroundDic, P_Path, (Widget::TextureResType)backGroundType);
|
||||||
checkBox->loadTextureBackGround(backGroundTexturePath, (Widget::TextureResType)backGroundType);
|
checkBox->loadTextureBackGround(backGroundTexturePath, (Widget::TextureResType)backGroundType);
|
||||||
|
|
||||||
//load background selected image
|
//load background selected image
|
||||||
const rapidjson::Value& backGroundSelectedDic = DICTOOL->getSubDictionary_json(options, "backGroundBoxSelectedData");
|
const rapidjson::Value& backGroundSelectedDic = DICTOOL->getSubDictionary_json(options, P_BackGroundBoxSelectedData);
|
||||||
int backGroundSelectedType = DICTOOL->getIntValue_json(backGroundSelectedDic, "resourceType");
|
int backGroundSelectedType = DICTOOL->getIntValue_json(backGroundSelectedDic, P_ResourceType);
|
||||||
std::string backGroundSelectedTexturePath = this->getResourcePath(backGroundSelectedDic, "path", (Widget::TextureResType)backGroundSelectedType);
|
std::string backGroundSelectedTexturePath = this->getResourcePath(backGroundSelectedDic, P_Path, (Widget::TextureResType)backGroundSelectedType);
|
||||||
checkBox->loadTextureBackGroundSelected(backGroundSelectedTexturePath, (Widget::TextureResType)backGroundSelectedType);
|
checkBox->loadTextureBackGroundSelected(backGroundSelectedTexturePath, (Widget::TextureResType)backGroundSelectedType);
|
||||||
|
|
||||||
//load frontCross image
|
//load frontCross image
|
||||||
const rapidjson::Value& frontCrossDic = DICTOOL->getSubDictionary_json(options, "frontCrossData");
|
const rapidjson::Value& frontCrossDic = DICTOOL->getSubDictionary_json(options, P_FrontCrossData);
|
||||||
int frontCrossType = DICTOOL->getIntValue_json(frontCrossDic, "resourceType");
|
int frontCrossType = DICTOOL->getIntValue_json(frontCrossDic, P_ResourceType);
|
||||||
std::string frontCrossFileName = this->getResourcePath(frontCrossDic, "path", (Widget::TextureResType)frontCrossType);
|
std::string frontCrossFileName = this->getResourcePath(frontCrossDic, P_Path, (Widget::TextureResType)frontCrossType);
|
||||||
checkBox->loadTextureFrontCross(frontCrossFileName, (Widget::TextureResType)frontCrossType);
|
checkBox->loadTextureFrontCross(frontCrossFileName, (Widget::TextureResType)frontCrossType);
|
||||||
|
|
||||||
//load backGroundBoxDisabledData
|
//load backGroundBoxDisabledData
|
||||||
const rapidjson::Value& backGroundDisabledDic = DICTOOL->getSubDictionary_json(options, "backGroundBoxDisabledData");
|
const rapidjson::Value& backGroundDisabledDic = DICTOOL->getSubDictionary_json(options, P_BackGroundBoxDisabledData);
|
||||||
int backGroundDisabledType = DICTOOL->getIntValue_json(backGroundDisabledDic, "resourceType");
|
int backGroundDisabledType = DICTOOL->getIntValue_json(backGroundDisabledDic, P_ResourceType);
|
||||||
std::string backGroundDisabledFileName = this->getResourcePath(backGroundDisabledDic, "path", (Widget::TextureResType)backGroundDisabledType);
|
std::string backGroundDisabledFileName = this->getResourcePath(backGroundDisabledDic, P_Path, (Widget::TextureResType)backGroundDisabledType);
|
||||||
checkBox->loadTextureBackGroundDisabled(backGroundDisabledFileName, (Widget::TextureResType)backGroundDisabledType);
|
checkBox->loadTextureBackGroundDisabled(backGroundDisabledFileName, (Widget::TextureResType)backGroundDisabledType);
|
||||||
|
|
||||||
///load frontCrossDisabledData
|
///load frontCrossDisabledData
|
||||||
const rapidjson::Value& frontCrossDisabledDic = DICTOOL->getSubDictionary_json(options, "frontCrossDisabledData");
|
const rapidjson::Value& frontCrossDisabledDic = DICTOOL->getSubDictionary_json(options, P_FrontCrossDisabledData);
|
||||||
int frontCrossDisabledType = DICTOOL->getIntValue_json(frontCrossDisabledDic, "resourceType");
|
int frontCrossDisabledType = DICTOOL->getIntValue_json(frontCrossDisabledDic, P_ResourceType);
|
||||||
std::string frontCrossDisabledFileName = this->getResourcePath(frontCrossDisabledDic, "path", (Widget::TextureResType)frontCrossDisabledType);
|
std::string frontCrossDisabledFileName = this->getResourcePath(frontCrossDisabledDic, P_Path, (Widget::TextureResType)frontCrossDisabledType);
|
||||||
checkBox->loadTextureFrontCrossDisabled(frontCrossDisabledFileName, (Widget::TextureResType)frontCrossDisabledType);
|
checkBox->loadTextureFrontCrossDisabled(frontCrossDisabledFileName, (Widget::TextureResType)frontCrossDisabledType);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,23 @@
|
||||||
|
|
||||||
#include "ImageViewReader.h"
|
#include "ImageViewReader.h"
|
||||||
#include "ui/UIImageView.h"
|
#include "ui/UIImageView.h"
|
||||||
|
#include "cocostudio/CocoLoader.h"
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
||||||
namespace cocostudio
|
namespace cocostudio
|
||||||
{
|
{
|
||||||
|
static const char* P_Scale9Enable = "scale9Enable";
|
||||||
|
static const char* P_FileNameData = "fileNameData";
|
||||||
|
static const char* P_CapInsetsX = "capInsetsX";
|
||||||
|
static const char* P_CapInsetsY = "capInsetsY";
|
||||||
|
static const char* P_CapInsetsWidth = "capInsetsWidth";
|
||||||
|
static const char* P_CapInsetsHeight = "capInsetsHeight";
|
||||||
|
static const char* P_Scale9Width = "scale9Width";
|
||||||
|
static const char* P_Scale9Height = "scale9Height";
|
||||||
|
|
||||||
|
|
||||||
static ImageViewReader* instanceImageViewReader = NULL;
|
static ImageViewReader* instanceImageViewReader = NULL;
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(ImageViewReader)
|
IMPLEMENT_CLASS_WIDGET_READER_INFO(ImageViewReader)
|
||||||
|
@ -31,6 +42,64 @@ namespace cocostudio
|
||||||
return instanceImageViewReader;
|
return instanceImageViewReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImageViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
|
{
|
||||||
|
WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode);
|
||||||
|
|
||||||
|
ImageView* imageView = static_cast<ImageView*>(widget);
|
||||||
|
this->beginSetBasicProperties(widget);
|
||||||
|
float capsx = 0.0f, capsy = 0.0, capsWidth = 0.0, capsHeight = 0.0f;
|
||||||
|
|
||||||
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
|
||||||
|
//read all basic properties of widget
|
||||||
|
CC_BASIC_PROPERTY_BINARY_READER
|
||||||
|
//read all color related properties of widget
|
||||||
|
CC_COLOR_PROPERTY_BINARY_READER
|
||||||
|
|
||||||
|
else if (key == P_Scale9Enable) {
|
||||||
|
imageView->setScale9Enabled(valueToBool(value));
|
||||||
|
}
|
||||||
|
else if (key == P_FileNameData){
|
||||||
|
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
|
||||||
|
std::string resType = backGroundChildren[2].GetValue();;
|
||||||
|
|
||||||
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
|
imageView->loadTexture(backgroundValue, imageFileNameType);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(key == P_Scale9Width){
|
||||||
|
imageView->setSize(Size(valueToFloat(value), imageView->getSize().height));
|
||||||
|
}else if(key == P_Scale9Height){
|
||||||
|
imageView->setSize(Size(imageView->getSize().width, valueToFloat(value)));
|
||||||
|
}
|
||||||
|
else if(key == P_CapInsetsX){
|
||||||
|
capsx = valueToFloat(value);
|
||||||
|
}else if(key == P_CapInsetsY){
|
||||||
|
capsy = valueToFloat(value);
|
||||||
|
}else if(key == P_CapInsetsWidth){
|
||||||
|
capsWidth = valueToFloat(value);
|
||||||
|
}else if(key == P_CapInsetsHeight){
|
||||||
|
capsHeight = valueToFloat(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
} //end of for loop
|
||||||
|
|
||||||
|
if (imageView->isScale9Enabled()) {
|
||||||
|
imageView->setCapInsets(Rect(capsx, capsy, capsWidth, capsHeight));
|
||||||
|
}
|
||||||
|
|
||||||
|
this->endSetBasicProperties(widget);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void ImageViewReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
void ImageViewReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
||||||
{
|
{
|
||||||
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
||||||
|
@ -39,36 +108,36 @@ namespace cocostudio
|
||||||
|
|
||||||
ImageView* imageView = static_cast<ImageView*>(widget);
|
ImageView* imageView = static_cast<ImageView*>(widget);
|
||||||
|
|
||||||
const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, "fileNameData");
|
const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, P_FileNameData);
|
||||||
int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType");
|
int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, P_ResourceType);
|
||||||
std::string imageFileName = this->getResourcePath(imageFileNameDic, "path", (Widget::TextureResType)imageFileNameType);
|
std::string imageFileName = this->getResourcePath(imageFileNameDic, P_Path, (Widget::TextureResType)imageFileNameType);
|
||||||
imageView->loadTexture(imageFileName, (Widget::TextureResType)imageFileNameType);
|
imageView->loadTexture(imageFileName, (Widget::TextureResType)imageFileNameType);
|
||||||
|
|
||||||
|
|
||||||
bool scale9EnableExist = DICTOOL->checkObjectExist_json(options, "scale9Enable");
|
bool scale9EnableExist = DICTOOL->checkObjectExist_json(options, P_Scale9Enable);
|
||||||
bool scale9Enable = false;
|
bool scale9Enable = false;
|
||||||
if (scale9EnableExist)
|
if (scale9EnableExist)
|
||||||
{
|
{
|
||||||
scale9Enable = DICTOOL->getBooleanValue_json(options, "scale9Enable");
|
scale9Enable = DICTOOL->getBooleanValue_json(options, P_Scale9Enable);
|
||||||
}
|
}
|
||||||
imageView->setScale9Enabled(scale9Enable);
|
imageView->setScale9Enabled(scale9Enable);
|
||||||
|
|
||||||
|
|
||||||
if (scale9Enable)
|
if (scale9Enable)
|
||||||
{
|
{
|
||||||
bool sw = DICTOOL->checkObjectExist_json(options, "scale9Width");
|
bool sw = DICTOOL->checkObjectExist_json(options, P_Scale9Width);
|
||||||
bool sh = DICTOOL->checkObjectExist_json(options, "scale9Height");
|
bool sh = DICTOOL->checkObjectExist_json(options, P_Scale9Height);
|
||||||
if (sw && sh)
|
if (sw && sh)
|
||||||
{
|
{
|
||||||
float swf = DICTOOL->getFloatValue_json(options, "scale9Width");
|
float swf = DICTOOL->getFloatValue_json(options, P_Scale9Width);
|
||||||
float shf = DICTOOL->getFloatValue_json(options, "scale9Height");
|
float shf = DICTOOL->getFloatValue_json(options, P_Scale9Height);
|
||||||
imageView->setSize(Size(swf, shf));
|
imageView->setSize(Size(swf, shf));
|
||||||
}
|
}
|
||||||
|
|
||||||
float cx = DICTOOL->getFloatValue_json(options, "capInsetsX");
|
float cx = DICTOOL->getFloatValue_json(options, P_CapInsetsX);
|
||||||
float cy = DICTOOL->getFloatValue_json(options, "capInsetsY");
|
float cy = DICTOOL->getFloatValue_json(options, P_CapInsetsY);
|
||||||
float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");
|
float cw = DICTOOL->getFloatValue_json(options, P_CapInsetsWidth);
|
||||||
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
|
float ch = DICTOOL->getFloatValue_json(options, P_CapInsetsHeight);
|
||||||
|
|
||||||
imageView->setCapInsets(Rect(cx, cy, cw, ch));
|
imageView->setCapInsets(Rect(cx, cy, cw, ch));
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,35 @@
|
||||||
|
|
||||||
#include "LayoutReader.h"
|
#include "LayoutReader.h"
|
||||||
#include "ui/UILayout.h"
|
#include "ui/UILayout.h"
|
||||||
|
#include "cocostudio/CocoLoader.h"
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
||||||
namespace cocostudio
|
namespace cocostudio
|
||||||
{
|
{
|
||||||
|
static const char* P_CapInsetsX = "capInsetsX";
|
||||||
|
static const char* P_CapInsetsY = "capInsetsY";
|
||||||
|
static const char* P_CapInsetsWidth = "capInsetsWidth";
|
||||||
|
static const char* P_CapInsetsHeight = "capInsetsHeight";
|
||||||
|
static const char* P_ClipAble = "clipAble";
|
||||||
|
static const char* P_BackGroundScale9Enable = "backGroundScale9Enable";
|
||||||
|
static const char* P_BgColorR = "bgColorR";
|
||||||
|
static const char* P_BgColorG = "bgColorG";
|
||||||
|
static const char* P_BgColorB = "bgColorB";
|
||||||
|
static const char* P_BgStartColorR = "bgStartColorR";
|
||||||
|
static const char* P_BgStartColorG = "bgStartColorG";
|
||||||
|
static const char* P_BgStartColorB = "bgStartColorB";
|
||||||
|
static const char* P_BgEndColorR = "bgEndColorR";
|
||||||
|
static const char* P_BgEndColorG = "bgEndColorG";
|
||||||
|
static const char* P_BgEndColorB = "bgEndColorB";
|
||||||
|
static const char* P_VectorX = "vectorX";
|
||||||
|
static const char* P_VectorY = "vectorY";
|
||||||
|
static const char* P_BgColorOpacity = "bgColorOpacity";
|
||||||
|
static const char* P_ColorType = "colorType";
|
||||||
|
static const char* P_BackGroundImageData = "backGroundImageData";
|
||||||
|
static const char* P_LayoutType = "layoutType";
|
||||||
|
|
||||||
static LayoutReader* instanceLayoutReader = NULL;
|
static LayoutReader* instanceLayoutReader = NULL;
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(LayoutReader)
|
IMPLEMENT_CLASS_WIDGET_READER_INFO(LayoutReader)
|
||||||
|
@ -31,6 +54,119 @@ namespace cocostudio
|
||||||
return instanceLayoutReader;
|
return instanceLayoutReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LayoutReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
|
{
|
||||||
|
WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode);
|
||||||
|
|
||||||
|
Layout* panel = static_cast<Layout*>(widget);
|
||||||
|
|
||||||
|
|
||||||
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
this->beginSetBasicProperties(widget);
|
||||||
|
|
||||||
|
int cr=0, cg = 0, cb = 0;
|
||||||
|
int scr=0, scg=0, scb=0;
|
||||||
|
int ecr=0, ecg=0, ecb= 0;
|
||||||
|
float bgcv1 = 0.0f, bgcv2= 0.0f;
|
||||||
|
float capsx = 0.0f, capsy = 0.0, capsWidth = 0.0, capsHeight = 0.0f;
|
||||||
|
Layout::Type layoutType;
|
||||||
|
int bgColorOpacity = panel->getBackGroundColorOpacity();
|
||||||
|
|
||||||
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
|
||||||
|
//read all basic properties of widget
|
||||||
|
CC_BASIC_PROPERTY_BINARY_READER
|
||||||
|
//read all color related properties of widget
|
||||||
|
CC_COLOR_PROPERTY_BINARY_READER
|
||||||
|
|
||||||
|
else if(key == P_AdaptScreen){
|
||||||
|
_isAdaptScreen = valueToBool(value);
|
||||||
|
}
|
||||||
|
else if( key == P_ClipAble){
|
||||||
|
panel->setClippingEnabled(valueToBool(value));
|
||||||
|
}else if(key == P_BackGroundScale9Enable){
|
||||||
|
panel->setBackGroundImageScale9Enabled(valueToBool(value));
|
||||||
|
}else if(key == P_BgColorR){
|
||||||
|
cr = valueToInt(value);
|
||||||
|
}else if(key == P_BgColorG){
|
||||||
|
cg = valueToInt(value);
|
||||||
|
}else if(key == P_BgColorB)
|
||||||
|
{
|
||||||
|
cb = valueToInt(value);
|
||||||
|
}else if(key == P_BgStartColorR){
|
||||||
|
scr = valueToInt(value);
|
||||||
|
}else if(key == P_BgStartColorG){
|
||||||
|
scg = valueToInt(value);
|
||||||
|
}else if(key == P_BgStartColorB)
|
||||||
|
{
|
||||||
|
scb = valueToInt(value);
|
||||||
|
}
|
||||||
|
else if(key == P_BgEndColorR){
|
||||||
|
ecr = valueToInt(value);
|
||||||
|
}else if(key == P_BgEndColorG){
|
||||||
|
ecg = valueToInt(value);
|
||||||
|
}else if(key == P_BgEndColorB)
|
||||||
|
{
|
||||||
|
ecb = valueToInt(value);
|
||||||
|
}else if (key == P_VectorX){
|
||||||
|
bgcv1 = valueToFloat(value);
|
||||||
|
}else if(key == P_VectorY){
|
||||||
|
bgcv2 = valueToFloat(value);
|
||||||
|
}else if(key == P_BgColorOpacity){
|
||||||
|
bgColorOpacity = valueToInt(value);
|
||||||
|
}else if( key == P_ColorType){
|
||||||
|
panel->setBackGroundColorType(Layout::BackGroundColorType(valueToInt(value)));
|
||||||
|
}else if (key == P_BackGroundImageData){
|
||||||
|
|
||||||
|
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
|
||||||
|
if (backGroundChildren) {
|
||||||
|
std::string resType = backGroundChildren[2].GetValue();;
|
||||||
|
|
||||||
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
|
panel->setBackGroundImage(backgroundValue, imageFileNameType);
|
||||||
|
}
|
||||||
|
|
||||||
|
}else if(key == P_CapInsetsX){
|
||||||
|
capsx = valueToFloat(value);
|
||||||
|
}else if(key == P_CapInsetsY){
|
||||||
|
capsy = valueToFloat(value);
|
||||||
|
}else if(key == P_CapInsetsWidth){
|
||||||
|
capsWidth = valueToFloat(value);
|
||||||
|
}else if(key == P_CapInsetsHeight){
|
||||||
|
capsHeight = valueToFloat(value);
|
||||||
|
}else if (key == P_LayoutType){
|
||||||
|
layoutType = (Layout::Type)valueToInt(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
panel->setBackGroundColor(Color3B(scr, scg, scb),Color3B(ecr, ecg, ecb));
|
||||||
|
panel->setBackGroundColor(Color3B(cr, cg, cb));
|
||||||
|
panel->setBackGroundColorVector(Vec2(bgcv1, bgcv2));
|
||||||
|
|
||||||
|
|
||||||
|
panel->setBackGroundColorOpacity(bgColorOpacity);
|
||||||
|
|
||||||
|
|
||||||
|
panel->setBackGroundImageColor(Color3B(_color.r, _color.g, _color.b));
|
||||||
|
|
||||||
|
panel->setBackGroundImageOpacity(_opacity);
|
||||||
|
|
||||||
|
if (panel->isBackGroundImageScale9Enabled()) {
|
||||||
|
panel->setBackGroundImageCapInsets(Rect(capsx, capsy, capsWidth, capsHeight));
|
||||||
|
}
|
||||||
|
|
||||||
|
panel->setLayoutType(layoutType);
|
||||||
|
this->endSetBasicProperties(widget);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void LayoutReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
void LayoutReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
||||||
{
|
{
|
||||||
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
||||||
|
@ -39,7 +175,7 @@ namespace cocostudio
|
||||||
|
|
||||||
/* adapt screen gui */
|
/* adapt screen gui */
|
||||||
float w = 0, h = 0;
|
float w = 0, h = 0;
|
||||||
bool adaptScrenn = DICTOOL->getBooleanValue_json(options, "adaptScreen");
|
bool adaptScrenn = DICTOOL->getBooleanValue_json(options, P_AdaptScreen);
|
||||||
if (adaptScrenn)
|
if (adaptScrenn)
|
||||||
{
|
{
|
||||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||||
|
@ -48,60 +184,61 @@ namespace cocostudio
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
w = DICTOOL->getFloatValue_json(options, "width");
|
w = DICTOOL->getFloatValue_json(options, P_Width);
|
||||||
h = DICTOOL->getFloatValue_json(options, "height");
|
h = DICTOOL->getFloatValue_json(options, P_Height);
|
||||||
}
|
}
|
||||||
panel->setSize(Size(w, h));
|
panel->setSize(Size(w, h));
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
panel->setClippingEnabled(DICTOOL->getBooleanValue_json(options, "clipAble"));
|
panel->setClippingEnabled(DICTOOL->getBooleanValue_json(options, P_ClipAble));
|
||||||
|
|
||||||
bool backGroundScale9Enable = DICTOOL->getBooleanValue_json(options, "backGroundScale9Enable");
|
bool backGroundScale9Enable = DICTOOL->getBooleanValue_json(options, P_BackGroundScale9Enable);
|
||||||
panel->setBackGroundImageScale9Enabled(backGroundScale9Enable);
|
panel->setBackGroundImageScale9Enabled(backGroundScale9Enable);
|
||||||
int cr = DICTOOL->getIntValue_json(options, "bgColorR");
|
int cr = DICTOOL->getIntValue_json(options, P_BgColorR);
|
||||||
int cg = DICTOOL->getIntValue_json(options, "bgColorG");
|
int cg = DICTOOL->getIntValue_json(options, P_BgColorG);
|
||||||
int cb = DICTOOL->getIntValue_json(options, "bgColorB");
|
int cb = DICTOOL->getIntValue_json(options, P_BgColorB);
|
||||||
|
|
||||||
int scr = DICTOOL->getIntValue_json(options, "bgStartColorR");
|
int scr = DICTOOL->getIntValue_json(options, P_BgStartColorR);
|
||||||
int scg = DICTOOL->getIntValue_json(options, "bgStartColorG");
|
int scg = DICTOOL->getIntValue_json(options, P_BgStartColorG);
|
||||||
int scb = DICTOOL->getIntValue_json(options, "bgStartColorB");
|
int scb = DICTOOL->getIntValue_json(options, P_BgStartColorB);
|
||||||
|
|
||||||
int ecr = DICTOOL->getIntValue_json(options, "bgEndColorR");
|
int ecr = DICTOOL->getIntValue_json(options, P_BgEndColorR);
|
||||||
int ecg = DICTOOL->getIntValue_json(options, "bgEndColorG");
|
int ecg = DICTOOL->getIntValue_json(options, P_BgEndColorG);
|
||||||
int ecb = DICTOOL->getIntValue_json(options, "bgEndColorB");
|
int ecb = DICTOOL->getIntValue_json(options, P_BgEndColorB);
|
||||||
|
|
||||||
float bgcv1 = DICTOOL->getFloatValue_json(options, "vectorX");
|
float bgcv1 = DICTOOL->getFloatValue_json(options, P_VectorX);
|
||||||
float bgcv2 = DICTOOL->getFloatValue_json(options, "vectorY");
|
float bgcv2 = DICTOOL->getFloatValue_json(options, P_VectorY);
|
||||||
panel->setBackGroundColorVector(Vec2(bgcv1, bgcv2));
|
panel->setBackGroundColorVector(Vec2(bgcv1, bgcv2));
|
||||||
|
|
||||||
int co = DICTOOL->getIntValue_json(options, "bgColorOpacity");
|
int co = DICTOOL->getIntValue_json(options, P_BgColorOpacity);
|
||||||
|
|
||||||
int colorType = DICTOOL->getIntValue_json(options, "colorType");
|
int colorType = DICTOOL->getIntValue_json(options, P_ColorType);
|
||||||
panel->setBackGroundColorType(Layout::BackGroundColorType(colorType));
|
panel->setBackGroundColorType(Layout::BackGroundColorType(colorType));
|
||||||
panel->setBackGroundColor(Color3B(scr, scg, scb),Color3B(ecr, ecg, ecb));
|
panel->setBackGroundColor(Color3B(scr, scg, scb),Color3B(ecr, ecg, ecb));
|
||||||
panel->setBackGroundColor(Color3B(cr, cg, cb));
|
panel->setBackGroundColor(Color3B(cr, cg, cb));
|
||||||
panel->setBackGroundColorOpacity(co);
|
panel->setBackGroundColorOpacity(co);
|
||||||
|
|
||||||
|
|
||||||
const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, "backGroundImageData");
|
const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, P_BackGroundImageData);
|
||||||
int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType");
|
int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, P_ResourceType);
|
||||||
std::string imageFileName = this->getResourcePath(imageFileNameDic, "path", (Widget::TextureResType)imageFileNameType);
|
std::string imageFileName = this->getResourcePath(imageFileNameDic, P_Path, (Widget::TextureResType)imageFileNameType);
|
||||||
panel->setBackGroundImage(imageFileName, (Widget::TextureResType)imageFileNameType);
|
panel->setBackGroundImage(imageFileName, (Widget::TextureResType)imageFileNameType);
|
||||||
|
|
||||||
|
|
||||||
if (backGroundScale9Enable)
|
if (backGroundScale9Enable)
|
||||||
{
|
{
|
||||||
float cx = DICTOOL->getFloatValue_json(options, "capInsetsX");
|
float cx = DICTOOL->getFloatValue_json(options, P_CapInsetsX);
|
||||||
float cy = DICTOOL->getFloatValue_json(options, "capInsetsY");
|
float cy = DICTOOL->getFloatValue_json(options, P_CapInsetsY);
|
||||||
float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");
|
float cw = DICTOOL->getFloatValue_json(options, P_CapInsetsWidth);
|
||||||
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
|
float ch = DICTOOL->getFloatValue_json(options, P_CapInsetsHeight);
|
||||||
panel->setBackGroundImageCapInsets(Rect(cx, cy, cw, ch));
|
panel->setBackGroundImageCapInsets(Rect(cx, cy, cw, ch));
|
||||||
}
|
}
|
||||||
panel->setLayoutType((Layout::Type)DICTOOL->getIntValue_json(options, "layoutType"));
|
|
||||||
|
|
||||||
int bgimgcr = DICTOOL->getIntValue_json(options, "colorR");
|
panel->setLayoutType((Layout::Type)DICTOOL->getIntValue_json(options, P_LayoutType));
|
||||||
int bgimgcg = DICTOOL->getIntValue_json(options, "colorG");
|
|
||||||
int bgimgcb = DICTOOL->getIntValue_json(options, "colorB");
|
int bgimgcr = DICTOOL->getIntValue_json(options, P_ColorR);
|
||||||
|
int bgimgcg = DICTOOL->getIntValue_json(options, P_ColorG);
|
||||||
|
int bgimgcb = DICTOOL->getIntValue_json(options, P_ColorB);
|
||||||
panel->setBackGroundImageColor(Color3B(bgimgcr, bgimgcg, bgimgcb));
|
panel->setBackGroundImageColor(Color3B(bgimgcr, bgimgcg, bgimgcb));
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,16 @@
|
||||||
|
|
||||||
#include "ListViewReader.h"
|
#include "ListViewReader.h"
|
||||||
#include "ui/UIListView.h"
|
#include "ui/UIListView.h"
|
||||||
|
#include "cocostudio/CocoLoader.h"
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
||||||
namespace cocostudio
|
namespace cocostudio
|
||||||
{
|
{
|
||||||
|
static const char* P_Direction = "direction";
|
||||||
|
static const char* P_ItemMargin = "itemMargin";
|
||||||
|
|
||||||
static ListViewReader* instanceListViewReader = NULL;
|
static ListViewReader* instanceListViewReader = NULL;
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(ListViewReader)
|
IMPLEMENT_CLASS_WIDGET_READER_INFO(ListViewReader)
|
||||||
|
@ -31,6 +35,30 @@ namespace cocostudio
|
||||||
return instanceListViewReader;
|
return instanceListViewReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ListViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode)
|
||||||
|
{
|
||||||
|
ScrollViewReader::setPropsFromBinary(widget, cocoLoader, cocoNode);
|
||||||
|
|
||||||
|
ListView* listView = static_cast<ListView*>(widget);
|
||||||
|
|
||||||
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
|
||||||
|
if (key == P_Direction) {
|
||||||
|
listView->setDirection((ScrollView::Direction)valueToInt(value));
|
||||||
|
}
|
||||||
|
else if(key == P_Gravity){
|
||||||
|
listView->setGravity((ListView::Gravity)valueToInt(value));
|
||||||
|
}else if(key == P_ItemMargin){
|
||||||
|
listView->setItemsMargin(valueToFloat(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
} //end of for loop
|
||||||
|
}
|
||||||
|
|
||||||
void ListViewReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
void ListViewReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
||||||
{
|
{
|
||||||
ScrollViewReader::setPropsFromJsonDictionary(widget, options);
|
ScrollViewReader::setPropsFromJsonDictionary(widget, options);
|
||||||
|
@ -38,13 +66,13 @@ namespace cocostudio
|
||||||
|
|
||||||
ListView* listView = static_cast<ListView*>(widget);
|
ListView* listView = static_cast<ListView*>(widget);
|
||||||
|
|
||||||
int direction = DICTOOL->getFloatValue_json(options, "direction");
|
int direction = DICTOOL->getFloatValue_json(options, P_Direction);
|
||||||
listView->setDirection((ScrollView::Direction)direction);
|
listView->setDirection((ScrollView::Direction)direction);
|
||||||
|
|
||||||
ListView::Gravity gravity = (ListView::Gravity)DICTOOL->getIntValue_json(options, "gravity");
|
ListView::Gravity gravity = (ListView::Gravity)DICTOOL->getIntValue_json(options, P_Gravity);
|
||||||
listView->setGravity(gravity);
|
listView->setGravity(gravity);
|
||||||
|
|
||||||
float itemMargin = DICTOOL->getFloatValue_json(options, "itemMargin");
|
float itemMargin = DICTOOL->getFloatValue_json(options, P_ItemMargin);
|
||||||
listView->setItemsMargin(itemMargin);
|
listView->setItemsMargin(itemMargin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,23 @@
|
||||||
|
|
||||||
#include "LoadingBarReader.h"
|
#include "LoadingBarReader.h"
|
||||||
#include "ui/UILoadingBar.h"
|
#include "ui/UILoadingBar.h"
|
||||||
|
#include "cocostudio/CocoLoader.h"
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
using namespace cocostudio;
|
||||||
|
|
||||||
namespace cocostudio
|
namespace cocostudio
|
||||||
{
|
{
|
||||||
|
static const char* P_Scale9Enable = "scale9Enable";
|
||||||
|
static const char* P_CapInsetsX = "capInsetsX";
|
||||||
|
static const char* P_CapInsetsY = "capInsetsY";
|
||||||
|
static const char* P_CapInsetsWidth = "capInsetsWidth";
|
||||||
|
static const char* P_CapInsetsHeight = "capInsetsHeight";
|
||||||
|
static const char* P_TextureData = "textureData";
|
||||||
|
static const char* P_Direction = "direction";
|
||||||
|
static const char* P_Percent = "percent";
|
||||||
|
|
||||||
static LoadingBarReader* instanceLoadingBar = NULL;
|
static LoadingBarReader* instanceLoadingBar = NULL;
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(LoadingBarReader)
|
IMPLEMENT_CLASS_WIDGET_READER_INFO(LoadingBarReader)
|
||||||
|
@ -31,6 +42,64 @@ namespace cocostudio
|
||||||
return instanceLoadingBar;
|
return instanceLoadingBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LoadingBarReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
|
{
|
||||||
|
WidgetReader::setPropsFromBinary(widget, cocoLoader, cocoNode);
|
||||||
|
|
||||||
|
LoadingBar* loadingBar = static_cast<LoadingBar*>(widget);
|
||||||
|
this->beginSetBasicProperties(widget);
|
||||||
|
float capsx = 0.0f, capsy = 0.0, capsWidth = 0.0, capsHeight = 0.0f;
|
||||||
|
int percent = loadingBar->getPercent();
|
||||||
|
|
||||||
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
|
||||||
|
//read all basic properties of widget
|
||||||
|
CC_BASIC_PROPERTY_BINARY_READER
|
||||||
|
//read all color related properties of widget
|
||||||
|
CC_COLOR_PROPERTY_BINARY_READER
|
||||||
|
|
||||||
|
else if (key == P_Scale9Enable) {
|
||||||
|
loadingBar->setScale9Enabled(valueToBool(value));
|
||||||
|
}
|
||||||
|
else if (key == P_TextureData){
|
||||||
|
|
||||||
|
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
|
||||||
|
std::string resType = backGroundChildren[2].GetValue();;
|
||||||
|
|
||||||
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
|
loadingBar->loadTexture(backgroundValue, imageFileNameType);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(key == P_CapInsetsX){
|
||||||
|
capsx = valueToFloat(value);
|
||||||
|
}else if(key == P_CapInsetsY){
|
||||||
|
capsy = valueToFloat(value);
|
||||||
|
}else if(key == P_CapInsetsWidth){
|
||||||
|
capsWidth = valueToFloat(value);
|
||||||
|
}else if(key == P_CapInsetsHeight){
|
||||||
|
capsHeight = valueToFloat(value);
|
||||||
|
}else if(key == P_Direction){
|
||||||
|
loadingBar->setDirection((LoadingBar::Direction)valueToInt(value));
|
||||||
|
}else if(key == P_Percent){
|
||||||
|
percent = valueToInt(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
} //end of for loop
|
||||||
|
|
||||||
|
if (loadingBar->isScale9Enabled()) {
|
||||||
|
loadingBar->setCapInsets(Rect(capsx, capsy, capsWidth, capsHeight));
|
||||||
|
}
|
||||||
|
loadingBar->setPercent(percent);
|
||||||
|
this->endSetBasicProperties(widget);
|
||||||
|
}
|
||||||
|
|
||||||
void LoadingBarReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
void LoadingBarReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
||||||
{
|
{
|
||||||
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
||||||
|
@ -38,33 +107,33 @@ namespace cocostudio
|
||||||
|
|
||||||
LoadingBar* loadingBar = static_cast<LoadingBar*>(widget);
|
LoadingBar* loadingBar = static_cast<LoadingBar*>(widget);
|
||||||
|
|
||||||
const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, "textureData");
|
const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, P_TextureData);
|
||||||
int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType");
|
int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, P_ResourceType);
|
||||||
std::string imageFileName = this->getResourcePath(imageFileNameDic, "path", (Widget::TextureResType)imageFileNameType);
|
std::string imageFileName = this->getResourcePath(imageFileNameDic, P_Path, (Widget::TextureResType)imageFileNameType);
|
||||||
loadingBar->loadTexture(imageFileName, (Widget::TextureResType)imageFileNameType);
|
loadingBar->loadTexture(imageFileName, (Widget::TextureResType)imageFileNameType);
|
||||||
|
|
||||||
|
|
||||||
/* gui mark add load bar scale9 parse */
|
/* gui mark add load bar scale9 parse */
|
||||||
bool scale9Enable = DICTOOL->getBooleanValue_json(options, "scale9Enable");
|
bool scale9Enable = DICTOOL->getBooleanValue_json(options, P_Scale9Enable);
|
||||||
loadingBar->setScale9Enabled(scale9Enable);
|
loadingBar->setScale9Enabled(scale9Enable);
|
||||||
|
|
||||||
if (scale9Enable)
|
if (scale9Enable)
|
||||||
{
|
{
|
||||||
float cx = DICTOOL->getFloatValue_json(options, "capInsetsX");
|
float cx = DICTOOL->getFloatValue_json(options, P_CapInsetsX);
|
||||||
float cy = DICTOOL->getFloatValue_json(options, "capInsetsY");
|
float cy = DICTOOL->getFloatValue_json(options, P_CapInsetsY);
|
||||||
float cw = DICTOOL->getFloatValue_json(options, "capInsetsWidth");
|
float cw = DICTOOL->getFloatValue_json(options, P_CapInsetsWidth);
|
||||||
float ch = DICTOOL->getFloatValue_json(options, "capInsetsHeight");
|
float ch = DICTOOL->getFloatValue_json(options, P_CapInsetsHeight);
|
||||||
|
|
||||||
loadingBar->setCapInsets(Rect(cx, cy, cw, ch));
|
loadingBar->setCapInsets(Rect(cx, cy, cw, ch));
|
||||||
|
|
||||||
float width = DICTOOL->getFloatValue_json(options, "width");
|
float width = DICTOOL->getFloatValue_json(options, P_Width);
|
||||||
float height = DICTOOL->getFloatValue_json(options, "height");
|
float height = DICTOOL->getFloatValue_json(options, P_Height);
|
||||||
loadingBar->setSize(Size(width, height));
|
loadingBar->setSize(Size(width, height));
|
||||||
}
|
}
|
||||||
/**/
|
/**/
|
||||||
|
|
||||||
loadingBar->setDirection(LoadingBar::Direction(DICTOOL->getIntValue_json(options, "direction")));
|
loadingBar->setDirection(LoadingBar::Direction(DICTOOL->getIntValue_json(options, P_Direction)));
|
||||||
loadingBar->setPercent(DICTOOL->getIntValue_json(options, "percent"));
|
loadingBar->setPercent(DICTOOL->getIntValue_json(options, P_Percent));
|
||||||
|
|
||||||
|
|
||||||
WidgetReader::setColorPropsFromJsonDictionary(widget, options);
|
WidgetReader::setColorPropsFromJsonDictionary(widget, options);
|
||||||
|
|
|
@ -41,6 +41,7 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,15 @@
|
||||||
|
|
||||||
#include "PageViewReader.h"
|
#include "PageViewReader.h"
|
||||||
#include "ui/UIPageView.h"
|
#include "ui/UIPageView.h"
|
||||||
|
#include "ui/UILayout.h"
|
||||||
|
#include "cocostudio/CocoLoader.h"
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
||||||
namespace cocostudio
|
namespace cocostudio
|
||||||
{
|
{
|
||||||
static PageViewReader* instancePageViewReader = NULL;
|
static PageViewReader* instancePageViewReader = nullptr;
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(PageViewReader)
|
IMPLEMENT_CLASS_WIDGET_READER_INFO(PageViewReader)
|
||||||
|
|
||||||
|
@ -31,6 +33,11 @@ namespace cocostudio
|
||||||
return instancePageViewReader;
|
return instancePageViewReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PageViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
|
{
|
||||||
|
LayoutReader::setPropsFromBinary(widget, cocoLoader, cocoNode);
|
||||||
|
}
|
||||||
|
|
||||||
void PageViewReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
void PageViewReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
||||||
{
|
{
|
||||||
LayoutReader::setPropsFromJsonDictionary(widget, options);
|
LayoutReader::setPropsFromJsonDictionary(widget, options);
|
||||||
|
|
|
@ -41,6 +41,8 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* cocoNode) ;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,19 @@
|
||||||
|
|
||||||
#include "ScrollViewReader.h"
|
#include "ScrollViewReader.h"
|
||||||
#include "ui/UIScrollView.h"
|
#include "ui/UIScrollView.h"
|
||||||
|
#include "cocostudio/CocoLoader.h"
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
||||||
namespace cocostudio
|
namespace cocostudio
|
||||||
{
|
{
|
||||||
static ScrollViewReader* instanceScrollViewReader = NULL;
|
static const char* P_InnerWidth = "innerWidth";
|
||||||
|
static const char* P_InnerHeight = "innerHeight";
|
||||||
|
static const char* P_Direction = "direction";
|
||||||
|
static const char* P_BounceEnable = "bounceEnable";
|
||||||
|
|
||||||
|
static ScrollViewReader* instanceScrollViewReader = nullptr;
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(ScrollViewReader)
|
IMPLEMENT_CLASS_WIDGET_READER_INFO(ScrollViewReader)
|
||||||
|
|
||||||
|
@ -31,18 +37,47 @@ namespace cocostudio
|
||||||
return instanceScrollViewReader;
|
return instanceScrollViewReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ScrollViewReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode)
|
||||||
|
{
|
||||||
|
//TODO::need to refactor...
|
||||||
|
LayoutReader::setPropsFromBinary(widget, cocoLoader, cocoNode);
|
||||||
|
|
||||||
|
ScrollView* scrollView = static_cast<ScrollView*>(widget);
|
||||||
|
|
||||||
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
float innerWidth;
|
||||||
|
float innerHeight;
|
||||||
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
if (key == P_InnerWidth) {
|
||||||
|
innerWidth = valueToFloat(value);
|
||||||
|
}
|
||||||
|
else if(key == P_InnerHeight){
|
||||||
|
innerHeight = valueToFloat(value);
|
||||||
|
}else if(key == P_Direction){
|
||||||
|
scrollView->setDirection((ScrollView::Direction)valueToInt(value));
|
||||||
|
}else if(key == P_BounceEnable){
|
||||||
|
scrollView->setBounceEnabled(valueToBool(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
} //end of for loop
|
||||||
|
scrollView->setInnerContainerSize(Size(innerWidth, innerHeight));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void ScrollViewReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
void ScrollViewReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
||||||
{
|
{
|
||||||
LayoutReader::setPropsFromJsonDictionary(widget, options);
|
LayoutReader::setPropsFromJsonDictionary(widget, options);
|
||||||
|
|
||||||
|
|
||||||
ScrollView* scrollView = static_cast<ScrollView*>(widget);
|
ScrollView* scrollView = static_cast<ScrollView*>(widget);
|
||||||
float innerWidth = DICTOOL->getFloatValue_json(options, "innerWidth");
|
float innerWidth = DICTOOL->getFloatValue_json(options, P_InnerWidth);
|
||||||
float innerHeight = DICTOOL->getFloatValue_json(options, "innerHeight");
|
float innerHeight = DICTOOL->getFloatValue_json(options, P_InnerHeight);
|
||||||
scrollView->setInnerContainerSize(Size(innerWidth, innerHeight));
|
scrollView->setInnerContainerSize(Size(innerWidth, innerHeight));
|
||||||
int direction = DICTOOL->getFloatValue_json(options, "direction");
|
int direction = DICTOOL->getFloatValue_json(options, P_Direction);
|
||||||
scrollView->setDirection((ScrollView::Direction)direction);
|
scrollView->setDirection((ScrollView::Direction)direction);
|
||||||
scrollView->setBounceEnabled(DICTOOL->getBooleanValue_json(options, "bounceEnable"));
|
scrollView->setBounceEnabled(DICTOOL->getBooleanValue_json(options, P_BounceEnable));
|
||||||
|
|
||||||
|
|
||||||
LayoutReader::setColorPropsFromJsonDictionary(widget, options);
|
LayoutReader::setColorPropsFromJsonDictionary(widget, options);
|
||||||
|
|
|
@ -41,6 +41,8 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,24 @@
|
||||||
|
|
||||||
#include "SliderReader.h"
|
#include "SliderReader.h"
|
||||||
#include "ui/UISlider.h"
|
#include "ui/UISlider.h"
|
||||||
|
#include "cocostudio/CocoLoader.h"
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
||||||
namespace cocostudio
|
namespace cocostudio
|
||||||
{
|
{
|
||||||
|
static const char* P_Scale9Enable = "scale9Enable";
|
||||||
|
static const char* P_Percent = "percent";
|
||||||
|
static const char* P_BarFileNameData = "barFileNameData";
|
||||||
|
static const char* P_Length = "length";
|
||||||
|
static const char* P_BallNormalData = "ballNormalData";
|
||||||
|
static const char* P_BallPressedData = "ballPressedData";
|
||||||
|
static const char* P_BallDisabledData = "ballDisabledData";
|
||||||
|
static const char* P_ProgressBarData = "progressBarData";
|
||||||
|
|
||||||
|
static const char* P_BarFileName = "barFileName";
|
||||||
|
|
||||||
static SliderReader* instanceSliderReader = NULL;
|
static SliderReader* instanceSliderReader = NULL;
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(SliderReader)
|
IMPLEMENT_CLASS_WIDGET_READER_INFO(SliderReader)
|
||||||
|
@ -31,6 +43,95 @@ namespace cocostudio
|
||||||
return instanceSliderReader;
|
return instanceSliderReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SliderReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode)
|
||||||
|
{
|
||||||
|
this->beginSetBasicProperties(widget);
|
||||||
|
|
||||||
|
Slider* slider = static_cast<Slider*>(widget);
|
||||||
|
|
||||||
|
float barLength = 0.0f;
|
||||||
|
int percent = slider->getPercent();
|
||||||
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
|
||||||
|
//read all basic properties of widget
|
||||||
|
CC_BASIC_PROPERTY_BINARY_READER
|
||||||
|
//read all color related properties of widget
|
||||||
|
CC_COLOR_PROPERTY_BINARY_READER
|
||||||
|
|
||||||
|
//control custom properties
|
||||||
|
else if (key == P_Scale9Enable) {
|
||||||
|
slider->setScale9Enabled(valueToBool(value));
|
||||||
|
}
|
||||||
|
else if(key == P_Percent){
|
||||||
|
percent = valueToInt(value);
|
||||||
|
}else if(key == P_BarFileNameData){
|
||||||
|
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
|
||||||
|
std::string resType = backGroundChildren[2].GetValue();;
|
||||||
|
|
||||||
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
|
slider->loadBarTexture(backgroundValue, imageFileNameType);
|
||||||
|
|
||||||
|
}else if(key == P_Length){
|
||||||
|
barLength = valueToFloat(value);
|
||||||
|
}else if(key == P_BallNormalData){
|
||||||
|
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
|
||||||
|
std::string resType = backGroundChildren[2].GetValue();;
|
||||||
|
|
||||||
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
|
slider->loadSlidBallTextureNormal(backgroundValue, imageFileNameType);
|
||||||
|
|
||||||
|
}else if(key == P_BallPressedData){
|
||||||
|
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
|
||||||
|
std::string resType = backGroundChildren[2].GetValue();;
|
||||||
|
|
||||||
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
|
slider->loadSlidBallTexturePressed(backgroundValue, imageFileNameType);
|
||||||
|
|
||||||
|
}else if(key == P_BallDisabledData){
|
||||||
|
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
|
||||||
|
std::string resType = backGroundChildren[2].GetValue();;
|
||||||
|
|
||||||
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
|
slider->loadSlidBallTextureDisabled(backgroundValue, imageFileNameType);
|
||||||
|
|
||||||
|
}else if(key == P_ProgressBarData){
|
||||||
|
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
|
||||||
|
std::string resType = backGroundChildren[2].GetValue();;
|
||||||
|
|
||||||
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
|
slider->loadProgressBarTexture(backgroundValue, imageFileNameType);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} //end of for loop
|
||||||
|
|
||||||
|
if (slider->isScale9Enabled()) {
|
||||||
|
slider->setSize(Size(barLength, slider->getContentSize().height));
|
||||||
|
}
|
||||||
|
slider->setPercent(percent);
|
||||||
|
|
||||||
|
this->endSetBasicProperties(widget);
|
||||||
|
}
|
||||||
|
|
||||||
void SliderReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
void SliderReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
||||||
{
|
{
|
||||||
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
||||||
|
@ -38,19 +139,19 @@ namespace cocostudio
|
||||||
|
|
||||||
Slider* slider = static_cast<Slider*>(widget);
|
Slider* slider = static_cast<Slider*>(widget);
|
||||||
|
|
||||||
bool barTextureScale9Enable = DICTOOL->getBooleanValue_json(options, "scale9Enable");
|
bool barTextureScale9Enable = DICTOOL->getBooleanValue_json(options, P_Scale9Enable);
|
||||||
slider->setScale9Enabled(barTextureScale9Enable);
|
slider->setScale9Enabled(barTextureScale9Enable);
|
||||||
|
|
||||||
slider->setPercent(DICTOOL->getIntValue_json(options, "percent"));
|
slider->setPercent(DICTOOL->getIntValue_json(options, P_Percent));
|
||||||
|
|
||||||
|
|
||||||
bool bt = DICTOOL->checkObjectExist_json(options, "barFileName");
|
bool bt = DICTOOL->checkObjectExist_json(options, P_BarFileName);
|
||||||
float barLength = DICTOOL->getFloatValue_json(options, "length");
|
float barLength = DICTOOL->getFloatValue_json(options, P_Length);
|
||||||
if (bt)
|
if (bt)
|
||||||
{
|
{
|
||||||
const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, "barFileNameData");
|
const rapidjson::Value& imageFileNameDic = DICTOOL->getSubDictionary_json(options, P_BarFileNameData);
|
||||||
int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, "resourceType");
|
int imageFileNameType = DICTOOL->getIntValue_json(imageFileNameDic, P_ResourceType);
|
||||||
std::string imageFileName = this->getResourcePath(imageFileNameDic, "path", (Widget::TextureResType)imageFileNameType);
|
std::string imageFileName = this->getResourcePath(imageFileNameDic, P_Path, (Widget::TextureResType)imageFileNameType);
|
||||||
slider->loadBarTexture(imageFileName, (Widget::TextureResType)imageFileNameType);
|
slider->loadBarTexture(imageFileName, (Widget::TextureResType)imageFileNameType);
|
||||||
|
|
||||||
if (barTextureScale9Enable)
|
if (barTextureScale9Enable)
|
||||||
|
@ -60,28 +161,28 @@ namespace cocostudio
|
||||||
}
|
}
|
||||||
|
|
||||||
//loading normal slider ball texture
|
//loading normal slider ball texture
|
||||||
const rapidjson::Value& normalDic = DICTOOL->getSubDictionary_json(options, "ballNormalData");
|
const rapidjson::Value& normalDic = DICTOOL->getSubDictionary_json(options, P_BallNormalData);
|
||||||
int normalType = DICTOOL->getIntValue_json(normalDic, "resourceType");
|
int normalType = DICTOOL->getIntValue_json(normalDic, P_ResourceType);
|
||||||
std::string imageFileName = this->getResourcePath(normalDic, "path", (Widget::TextureResType)normalType);
|
std::string imageFileName = this->getResourcePath(normalDic, P_Path, (Widget::TextureResType)normalType);
|
||||||
slider->loadSlidBallTextureNormal(imageFileName, (Widget::TextureResType)normalType);
|
slider->loadSlidBallTextureNormal(imageFileName, (Widget::TextureResType)normalType);
|
||||||
|
|
||||||
|
|
||||||
//loading slider ball press texture
|
//loading slider ball press texture
|
||||||
const rapidjson::Value& pressedDic = DICTOOL->getSubDictionary_json(options, "ballPressedData");
|
const rapidjson::Value& pressedDic = DICTOOL->getSubDictionary_json(options, P_BallPressedData);
|
||||||
int pressedType = DICTOOL->getIntValue_json(pressedDic, "resourceType");
|
int pressedType = DICTOOL->getIntValue_json(pressedDic, P_ResourceType);
|
||||||
std::string pressedFileName = this->getResourcePath(pressedDic, "path", (Widget::TextureResType)pressedType);
|
std::string pressedFileName = this->getResourcePath(pressedDic, P_Path, (Widget::TextureResType)pressedType);
|
||||||
slider->loadSlidBallTexturePressed(pressedFileName, (Widget::TextureResType)pressedType);
|
slider->loadSlidBallTexturePressed(pressedFileName, (Widget::TextureResType)pressedType);
|
||||||
|
|
||||||
//loading silder ball disable texture
|
//loading silder ball disable texture
|
||||||
const rapidjson::Value& disabledDic = DICTOOL->getSubDictionary_json(options, "ballDisabledData");
|
const rapidjson::Value& disabledDic = DICTOOL->getSubDictionary_json(options, P_BallDisabledData);
|
||||||
int disabledType = DICTOOL->getIntValue_json(disabledDic, "resourceType");
|
int disabledType = DICTOOL->getIntValue_json(disabledDic, P_ResourceType);
|
||||||
std::string disabledFileName = this->getResourcePath(disabledDic, "path", (Widget::TextureResType)disabledType);
|
std::string disabledFileName = this->getResourcePath(disabledDic, P_Path, (Widget::TextureResType)disabledType);
|
||||||
slider->loadSlidBallTextureDisabled(disabledFileName, (Widget::TextureResType)disabledType);
|
slider->loadSlidBallTextureDisabled(disabledFileName, (Widget::TextureResType)disabledType);
|
||||||
|
|
||||||
//load slider progress texture
|
//load slider progress texture
|
||||||
const rapidjson::Value& progressBarDic = DICTOOL->getSubDictionary_json(options, "progressBarData");
|
const rapidjson::Value& progressBarDic = DICTOOL->getSubDictionary_json(options, P_ProgressBarData);
|
||||||
int progressBarType = DICTOOL->getIntValue_json(progressBarDic, "resourceType");
|
int progressBarType = DICTOOL->getIntValue_json(progressBarDic, P_ResourceType);
|
||||||
std::string progressBarFileName = this->getResourcePath(progressBarDic, "path", (Widget::TextureResType)progressBarType);
|
std::string progressBarFileName = this->getResourcePath(progressBarDic, P_Path, (Widget::TextureResType)progressBarType);
|
||||||
slider->loadProgressBarTexture(progressBarFileName, (Widget::TextureResType)progressBarType);
|
slider->loadProgressBarTexture(progressBarFileName, (Widget::TextureResType)progressBarType);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,8 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,22 @@
|
||||||
|
|
||||||
#include "TextAtlasReader.h"
|
#include "TextAtlasReader.h"
|
||||||
#include "ui/UITextAtlas.h"
|
#include "ui/UITextAtlas.h"
|
||||||
|
#include "cocostudio/CocoLoader.h"
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
||||||
namespace cocostudio
|
namespace cocostudio
|
||||||
{
|
{
|
||||||
|
static const char* P_StringValue = "stringValue";
|
||||||
|
static const char* P_CharMapFileData = "charMapFileData";
|
||||||
|
static const char* P_ItemWidth = "itemWidth";
|
||||||
|
static const char* P_ItemHeight = "itemHeight";
|
||||||
|
static const char* P_StartCharMap = "startCharMap";
|
||||||
|
|
||||||
|
|
||||||
|
static const char* P_CharMapFile = "charMapFile";
|
||||||
|
|
||||||
static TextAtlasReader* instanceTextAtalsReader = NULL;
|
static TextAtlasReader* instanceTextAtalsReader = NULL;
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(TextAtlasReader)
|
IMPLEMENT_CLASS_WIDGET_READER_INFO(TextAtlasReader)
|
||||||
|
@ -31,6 +41,58 @@ namespace cocostudio
|
||||||
return instanceTextAtalsReader;
|
return instanceTextAtalsReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextAtlasReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
|
{
|
||||||
|
this->beginSetBasicProperties(widget);
|
||||||
|
|
||||||
|
TextAtlas* labelAtlas = static_cast<TextAtlas*>(widget);
|
||||||
|
|
||||||
|
|
||||||
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
Widget::TextureResType type;
|
||||||
|
std::string charMapFileName;
|
||||||
|
std::string stringValue;
|
||||||
|
std::string startCharMap;
|
||||||
|
float itemWidth;
|
||||||
|
float itemHeight;
|
||||||
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
|
||||||
|
//read all basic properties of widget
|
||||||
|
CC_BASIC_PROPERTY_BINARY_READER
|
||||||
|
//read all color related properties of widget
|
||||||
|
CC_COLOR_PROPERTY_BINARY_READER
|
||||||
|
|
||||||
|
else if (key == P_StringValue) {
|
||||||
|
stringValue = value;
|
||||||
|
}
|
||||||
|
else if(key == P_CharMapFileData){
|
||||||
|
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
|
||||||
|
std::string resType = backGroundChildren[2].GetValue();;
|
||||||
|
|
||||||
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
|
||||||
|
charMapFileName = backgroundValue;
|
||||||
|
type = imageFileNameType;
|
||||||
|
|
||||||
|
}else if(key == P_ItemWidth){
|
||||||
|
itemWidth = valueToFloat(value);
|
||||||
|
}else if(key == P_ItemHeight){
|
||||||
|
itemHeight = valueToFloat(value);
|
||||||
|
}else if(key == P_StartCharMap){
|
||||||
|
startCharMap = value;
|
||||||
|
}
|
||||||
|
} //end of for loop
|
||||||
|
|
||||||
|
if (type == (Widget::TextureResType)0) {
|
||||||
|
labelAtlas->setProperty(stringValue, charMapFileName, itemWidth, itemHeight, startCharMap);
|
||||||
|
}
|
||||||
|
this->endSetBasicProperties(widget);
|
||||||
|
}
|
||||||
|
|
||||||
void TextAtlasReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
void TextAtlasReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
||||||
{
|
{
|
||||||
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
||||||
|
@ -39,23 +101,23 @@ namespace cocostudio
|
||||||
std::string jsonPath = GUIReader::getInstance()->getFilePath();
|
std::string jsonPath = GUIReader::getInstance()->getFilePath();
|
||||||
|
|
||||||
TextAtlas* labelAtlas = static_cast<TextAtlas*>(widget);
|
TextAtlas* labelAtlas = static_cast<TextAtlas*>(widget);
|
||||||
bool sv = DICTOOL->checkObjectExist_json(options, "stringValue");
|
bool sv = DICTOOL->checkObjectExist_json(options, P_StringValue);
|
||||||
bool cmf = DICTOOL->checkObjectExist_json(options, "charMapFile");
|
bool cmf = DICTOOL->checkObjectExist_json(options, P_CharMapFile);
|
||||||
bool iw = DICTOOL->checkObjectExist_json(options, "itemWidth");
|
bool iw = DICTOOL->checkObjectExist_json(options, P_ItemWidth);
|
||||||
bool ih = DICTOOL->checkObjectExist_json(options, "itemHeight");
|
bool ih = DICTOOL->checkObjectExist_json(options, P_ItemHeight);
|
||||||
bool scm = DICTOOL->checkObjectExist_json(options, "startCharMap");
|
bool scm = DICTOOL->checkObjectExist_json(options, P_StartCharMap);
|
||||||
if (sv && cmf && iw && ih && scm)
|
if (sv && cmf && iw && ih && scm)
|
||||||
{
|
{
|
||||||
const rapidjson::Value& cmftDic = DICTOOL->getSubDictionary_json(options, "charMapFileData");
|
const rapidjson::Value& cmftDic = DICTOOL->getSubDictionary_json(options, P_CharMapFileData);
|
||||||
int cmfType = DICTOOL->getIntValue_json(cmftDic, "resourceType");
|
int cmfType = DICTOOL->getIntValue_json(cmftDic, P_ResourceType);
|
||||||
switch (cmfType)
|
switch (cmfType)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
std::string tp_c = jsonPath;
|
std::string tp_c = jsonPath;
|
||||||
const char* cmfPath = DICTOOL->getStringValue_json(cmftDic, "path");
|
const char* cmfPath = DICTOOL->getStringValue_json(cmftDic, P_Path);
|
||||||
const char* cmf_tp = tp_c.append(cmfPath).c_str();
|
const char* cmf_tp = tp_c.append(cmfPath).c_str();
|
||||||
labelAtlas->setProperty(DICTOOL->getStringValue_json(options, "stringValue"),cmf_tp,DICTOOL->getIntValue_json(options, "itemWidth"),DICTOOL->getIntValue_json(options,"itemHeight"), DICTOOL->getStringValue_json(options, "startCharMap"));
|
labelAtlas->setProperty(DICTOOL->getStringValue_json(options, P_StringValue),cmf_tp,DICTOOL->getIntValue_json(options, P_ItemWidth),DICTOOL->getIntValue_json(options,P_ItemHeight), DICTOOL->getStringValue_json(options, P_StartCharMap));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
|
|
|
@ -40,6 +40,8 @@ namespace cocostudio
|
||||||
static TextAtlasReader* getInstance();
|
static TextAtlasReader* getInstance();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,16 @@
|
||||||
|
|
||||||
#include "TextBMFontReader.h"
|
#include "TextBMFontReader.h"
|
||||||
#include "ui/UITextBMFont.h"
|
#include "ui/UITextBMFont.h"
|
||||||
|
#include "cocostudio/CocoLoader.h"
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
||||||
namespace cocostudio
|
namespace cocostudio
|
||||||
{
|
{
|
||||||
|
static const char* P_FileNameData = "fileNameData";
|
||||||
|
static const char* P_Text = "text";
|
||||||
|
|
||||||
static TextBMFontReader* instanceTextBMFontReader = NULL;
|
static TextBMFontReader* instanceTextBMFontReader = NULL;
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(TextBMFontReader)
|
IMPLEMENT_CLASS_WIDGET_READER_INFO(TextBMFontReader)
|
||||||
|
@ -31,6 +35,41 @@ namespace cocostudio
|
||||||
return instanceTextBMFontReader;
|
return instanceTextBMFontReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextBMFontReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
|
{
|
||||||
|
this->beginSetBasicProperties(widget);
|
||||||
|
|
||||||
|
TextBMFont* labelBMFont = static_cast<TextBMFont*>(widget);
|
||||||
|
|
||||||
|
|
||||||
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
//read all basic properties of widget
|
||||||
|
CC_BASIC_PROPERTY_BINARY_READER
|
||||||
|
//read all color related properties of widget
|
||||||
|
CC_COLOR_PROPERTY_BINARY_READER
|
||||||
|
|
||||||
|
else if(key == P_FileNameData){
|
||||||
|
stExpCocoNode *backGroundChildren = stChildArray[i].GetChildArray();
|
||||||
|
std::string resType = backGroundChildren[2].GetValue();;
|
||||||
|
|
||||||
|
Widget::TextureResType imageFileNameType = (Widget::TextureResType)valueToInt(resType);
|
||||||
|
|
||||||
|
std::string backgroundValue = this->getResourcePath(cocoLoader, &stChildArray[i], imageFileNameType);
|
||||||
|
if (imageFileNameType == (Widget::TextureResType)0) {
|
||||||
|
labelBMFont->setFntFile(backgroundValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
}else if(key == P_Text){
|
||||||
|
labelBMFont->setString(value);
|
||||||
|
}
|
||||||
|
} //end of for loop
|
||||||
|
this->endSetBasicProperties(widget);
|
||||||
|
}
|
||||||
|
|
||||||
void TextBMFontReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
void TextBMFontReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
||||||
{
|
{
|
||||||
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
||||||
|
@ -40,14 +79,14 @@ namespace cocostudio
|
||||||
|
|
||||||
TextBMFont* labelBMFont = static_cast<TextBMFont*>(widget);
|
TextBMFont* labelBMFont = static_cast<TextBMFont*>(widget);
|
||||||
|
|
||||||
const rapidjson::Value& cmftDic = DICTOOL->getSubDictionary_json(options, "fileNameData");
|
const rapidjson::Value& cmftDic = DICTOOL->getSubDictionary_json(options, P_FileNameData);
|
||||||
int cmfType = DICTOOL->getIntValue_json(cmftDic, "resourceType");
|
int cmfType = DICTOOL->getIntValue_json(cmftDic, P_ResourceType);
|
||||||
switch (cmfType)
|
switch (cmfType)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
std::string tp_c = jsonPath;
|
std::string tp_c = jsonPath;
|
||||||
const char* cmfPath = DICTOOL->getStringValue_json(cmftDic, "path");
|
const char* cmfPath = DICTOOL->getStringValue_json(cmftDic, P_Path);
|
||||||
const char* cmf_tp = tp_c.append(cmfPath).c_str();
|
const char* cmf_tp = tp_c.append(cmfPath).c_str();
|
||||||
labelBMFont->setFntFile(cmf_tp);
|
labelBMFont->setFntFile(cmf_tp);
|
||||||
break;
|
break;
|
||||||
|
@ -59,7 +98,7 @@ namespace cocostudio
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* text = DICTOOL->getStringValue_json(options, "text");
|
const char* text = DICTOOL->getStringValue_json(options, P_Text);
|
||||||
labelBMFont->setString(text);
|
labelBMFont->setString(text);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,8 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "TextFieldReader.h"
|
#include "TextFieldReader.h"
|
||||||
#include "ui/UITextField.h"
|
#include "ui/UITextField.h"
|
||||||
|
#include "cocostudio/CocoLoader.h"
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
@ -10,6 +11,17 @@ namespace cocostudio
|
||||||
{
|
{
|
||||||
static TextFieldReader* instanceTextFieldReader = NULL;
|
static TextFieldReader* instanceTextFieldReader = NULL;
|
||||||
|
|
||||||
|
static const char* P_PlaceHolder = "placeHolder";
|
||||||
|
static const char* P_Text = "text";
|
||||||
|
static const char* P_FontSize = "fontSize";
|
||||||
|
static const char* P_FontName = "fontName";
|
||||||
|
static const char* P_TouchSizeWidth = "touchSizeWidth";
|
||||||
|
static const char* P_TouchSizeHeight = "touchSizeHeight";
|
||||||
|
static const char* P_MaxLengthEnable = "maxLengthEnable";
|
||||||
|
static const char* P_MaxLength = "maxLength";
|
||||||
|
static const char* P_PasswordEnable = "passwordEnable";
|
||||||
|
static const char* P_PasswordStyleText = "passwordStyleText";
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(TextFieldReader)
|
IMPLEMENT_CLASS_WIDGET_READER_INFO(TextFieldReader)
|
||||||
|
|
||||||
TextFieldReader::TextFieldReader()
|
TextFieldReader::TextFieldReader()
|
||||||
|
@ -31,54 +43,96 @@ namespace cocostudio
|
||||||
return instanceTextFieldReader;
|
return instanceTextFieldReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextFieldReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode* cocoNode)
|
||||||
|
{
|
||||||
|
this->beginSetBasicProperties(widget);
|
||||||
|
|
||||||
|
TextField* textField = static_cast<TextField*>(widget);
|
||||||
|
|
||||||
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
|
||||||
|
//read all basic properties of widget
|
||||||
|
CC_BASIC_PROPERTY_BINARY_READER
|
||||||
|
//read all color related properties of widget
|
||||||
|
CC_COLOR_PROPERTY_BINARY_READER
|
||||||
|
|
||||||
|
else if(key == P_PlaceHolder){
|
||||||
|
textField->setPlaceHolder(value);
|
||||||
|
}else if(key == P_Text){
|
||||||
|
textField->setText(value);
|
||||||
|
}else if(key == P_FontSize){
|
||||||
|
textField->setFontSize(valueToInt(value));
|
||||||
|
}else if(key == P_FontName){
|
||||||
|
textField->setFontName(value);
|
||||||
|
}else if(key == P_TouchSizeWidth){
|
||||||
|
textField->setTouchSize(Size(valueToFloat(value), textField->getTouchSize().height));
|
||||||
|
}else if(key == P_TouchSizeHeight){
|
||||||
|
textField->setTouchSize(Size(textField->getTouchSize().width, valueToFloat(value)));
|
||||||
|
}else if (key == P_MaxLengthEnable){
|
||||||
|
textField->setMaxLengthEnabled(valueToBool(value));
|
||||||
|
}else if(key == P_MaxLength){
|
||||||
|
textField->setMaxLength(valueToInt(value));
|
||||||
|
}else if(key == P_PasswordEnable){
|
||||||
|
textField->setPasswordEnabled(valueToBool(value));
|
||||||
|
}else if(key == P_PasswordStyleText){
|
||||||
|
textField->setPasswordStyleText(value.c_str());
|
||||||
|
}
|
||||||
|
} //end of for loop
|
||||||
|
this->endSetBasicProperties(widget);
|
||||||
|
}
|
||||||
|
|
||||||
void TextFieldReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
void TextFieldReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
||||||
{
|
{
|
||||||
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
||||||
|
|
||||||
|
|
||||||
TextField* textField = static_cast<TextField*>(widget);
|
TextField* textField = static_cast<TextField*>(widget);
|
||||||
bool ph = DICTOOL->checkObjectExist_json(options, "placeHolder");
|
bool ph = DICTOOL->checkObjectExist_json(options, P_PlaceHolder);
|
||||||
if (ph)
|
if (ph)
|
||||||
{
|
{
|
||||||
textField->setPlaceHolder(DICTOOL->getStringValue_json(options, "placeHolder"));
|
textField->setPlaceHolder(DICTOOL->getStringValue_json(options, P_PlaceHolder));
|
||||||
}
|
}
|
||||||
textField->setText(DICTOOL->getStringValue_json(options, "text"));
|
textField->setText(DICTOOL->getStringValue_json(options, P_Text));
|
||||||
bool fs = DICTOOL->checkObjectExist_json(options, "fontSize");
|
bool fs = DICTOOL->checkObjectExist_json(options, P_FontSize);
|
||||||
if (fs)
|
if (fs)
|
||||||
{
|
{
|
||||||
textField->setFontSize(DICTOOL->getIntValue_json(options, "fontSize"));
|
textField->setFontSize(DICTOOL->getIntValue_json(options, P_FontSize));
|
||||||
}
|
}
|
||||||
bool fn = DICTOOL->checkObjectExist_json(options, "fontName");
|
bool fn = DICTOOL->checkObjectExist_json(options, P_FontName);
|
||||||
if (fn)
|
if (fn)
|
||||||
{
|
{
|
||||||
textField->setFontName(DICTOOL->getStringValue_json(options, "fontName"));
|
textField->setFontName(DICTOOL->getStringValue_json(options, P_FontName));
|
||||||
}
|
}
|
||||||
bool tsw = DICTOOL->checkObjectExist_json(options, "touchSizeWidth");
|
bool tsw = DICTOOL->checkObjectExist_json(options, P_TouchSizeWidth);
|
||||||
bool tsh = DICTOOL->checkObjectExist_json(options, "touchSizeHeight");
|
bool tsh = DICTOOL->checkObjectExist_json(options, P_TouchSizeHeight);
|
||||||
if (tsw && tsh)
|
if (tsw && tsh)
|
||||||
{
|
{
|
||||||
textField->setTouchSize(Size(DICTOOL->getFloatValue_json(options, "touchSizeWidth"), DICTOOL->getFloatValue_json(options,"touchSizeHeight")));
|
textField->setTouchSize(Size(DICTOOL->getFloatValue_json(options, P_TouchSizeWidth), DICTOOL->getFloatValue_json(options,P_TouchSizeHeight)));
|
||||||
}
|
}
|
||||||
|
|
||||||
float dw = DICTOOL->getFloatValue_json(options, "width");
|
// float dw = DICTOOL->getFloatValue_json(options, "width");
|
||||||
float dh = DICTOOL->getFloatValue_json(options, "height");
|
// float dh = DICTOOL->getFloatValue_json(options, "height");
|
||||||
if (dw > 0.0f || dh > 0.0f)
|
// if (dw > 0.0f || dh > 0.0f)
|
||||||
{
|
// {
|
||||||
//textField->setSize(Size(dw, dh));
|
// //textField->setSize(Size(dw, dh));
|
||||||
}
|
// }
|
||||||
bool maxLengthEnable = DICTOOL->getBooleanValue_json(options, "maxLengthEnable");
|
bool maxLengthEnable = DICTOOL->getBooleanValue_json(options, P_MaxLengthEnable);
|
||||||
textField->setMaxLengthEnabled(maxLengthEnable);
|
textField->setMaxLengthEnabled(maxLengthEnable);
|
||||||
|
|
||||||
if (maxLengthEnable)
|
if (maxLengthEnable)
|
||||||
{
|
{
|
||||||
int maxLength = DICTOOL->getIntValue_json(options, "maxLength");
|
int maxLength = DICTOOL->getIntValue_json(options, P_MaxLength);
|
||||||
textField->setMaxLength(maxLength);
|
textField->setMaxLength(maxLength);
|
||||||
}
|
}
|
||||||
bool passwordEnable = DICTOOL->getBooleanValue_json(options, "passwordEnable");
|
bool passwordEnable = DICTOOL->getBooleanValue_json(options, P_PasswordEnable);
|
||||||
textField->setPasswordEnabled(passwordEnable);
|
textField->setPasswordEnabled(passwordEnable);
|
||||||
if (passwordEnable)
|
if (passwordEnable)
|
||||||
{
|
{
|
||||||
textField->setPasswordStyleText(DICTOOL->getStringValue_json(options, "passwordStyleText"));
|
textField->setPasswordStyleText(DICTOOL->getStringValue_json(options, P_PasswordStyleText));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,8 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) ;
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,22 @@
|
||||||
|
|
||||||
#include "TextReader.h"
|
#include "TextReader.h"
|
||||||
#include "ui/UIText.h"
|
#include "ui/UIText.h"
|
||||||
|
#include "cocostudio/CocoLoader.h"
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
||||||
namespace cocostudio
|
namespace cocostudio
|
||||||
{
|
{
|
||||||
|
static const char* P_TouchScaleEnable = "touchScaleEnable";
|
||||||
|
static const char* P_Text = "text";
|
||||||
|
static const char* P_FontSize = "fontSize";
|
||||||
|
static const char* P_FontName = "fontName";
|
||||||
|
static const char* P_AreaWidth = "areaWidth";
|
||||||
|
static const char* P_AreaHeight = "areaHeight";
|
||||||
|
static const char* P_HAlignment = "hAlignment";
|
||||||
|
static const char* P_VAlignment = "vAlignment";
|
||||||
|
|
||||||
static TextReader* instanceTextReader = NULL;
|
static TextReader* instanceTextReader = NULL;
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(TextReader)
|
IMPLEMENT_CLASS_WIDGET_READER_INFO(TextReader)
|
||||||
|
@ -31,6 +41,47 @@ namespace cocostudio
|
||||||
return instanceTextReader;
|
return instanceTextReader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextReader::setPropsFromBinary(cocos2d::ui::Widget *widget, CocoLoader *cocoLoader, stExpCocoNode *cocoNode)
|
||||||
|
{
|
||||||
|
this->beginSetBasicProperties(widget);
|
||||||
|
|
||||||
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
|
Text* label = static_cast<Text*>(widget);
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
//read all basic properties of widget
|
||||||
|
CC_BASIC_PROPERTY_BINARY_READER
|
||||||
|
//read all color related properties of widget
|
||||||
|
CC_COLOR_PROPERTY_BINARY_READER
|
||||||
|
|
||||||
|
else if (key == P_TouchScaleEnable) {
|
||||||
|
label->setTouchScaleChangeEnabled(valueToBool(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(key == P_Text){
|
||||||
|
label->setString(value);
|
||||||
|
}else if(key == P_FontSize){
|
||||||
|
label->setFontSize(valueToInt(value));
|
||||||
|
}else if(key == P_FontName){
|
||||||
|
label->setFontName(value);
|
||||||
|
}else if(key == P_AreaWidth){
|
||||||
|
label->setTextAreaSize(Size(valueToFloat(value), label->getTextAreaSize().height));
|
||||||
|
}else if(key == P_AreaHeight){
|
||||||
|
label->setTextAreaSize(Size(label->getTextAreaSize().width, valueToFloat(value)));
|
||||||
|
}else if(key == P_HAlignment){
|
||||||
|
label->setTextHorizontalAlignment((TextHAlignment)valueToInt(value));
|
||||||
|
}else if(key == P_VAlignment){
|
||||||
|
label->setTextVerticalAlignment((TextVAlignment)valueToInt(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
} //end of for loop
|
||||||
|
this->endSetBasicProperties(widget);
|
||||||
|
}
|
||||||
|
|
||||||
void TextReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
void TextReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
||||||
{
|
{
|
||||||
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
WidgetReader::setPropsFromJsonDictionary(widget, options);
|
||||||
|
@ -39,38 +90,38 @@ namespace cocostudio
|
||||||
std::string jsonPath = GUIReader::getInstance()->getFilePath();
|
std::string jsonPath = GUIReader::getInstance()->getFilePath();
|
||||||
|
|
||||||
Text* label = static_cast<Text*>(widget);
|
Text* label = static_cast<Text*>(widget);
|
||||||
bool touchScaleChangeAble = DICTOOL->getBooleanValue_json(options, "touchScaleEnable");
|
bool touchScaleChangeAble = DICTOOL->getBooleanValue_json(options, P_TouchScaleEnable);
|
||||||
label->setTouchScaleChangeEnabled(touchScaleChangeAble);
|
label->setTouchScaleChangeEnabled(touchScaleChangeAble);
|
||||||
const char* text = DICTOOL->getStringValue_json(options, "text");
|
const char* text = DICTOOL->getStringValue_json(options, P_Text);
|
||||||
label->setString(text);
|
label->setString(text);
|
||||||
bool fs = DICTOOL->checkObjectExist_json(options, "fontSize");
|
bool fs = DICTOOL->checkObjectExist_json(options, P_FontSize);
|
||||||
if (fs)
|
if (fs)
|
||||||
{
|
{
|
||||||
label->setFontSize(DICTOOL->getIntValue_json(options, "fontSize"));
|
label->setFontSize(DICTOOL->getIntValue_json(options, P_FontSize));
|
||||||
}
|
}
|
||||||
bool fn = DICTOOL->checkObjectExist_json(options, "fontName");
|
bool fn = DICTOOL->checkObjectExist_json(options, P_FontName);
|
||||||
if (fn)
|
if (fn)
|
||||||
{
|
{
|
||||||
std::string fontName = DICTOOL->getStringValue_json(options, "fontName");
|
std::string fontName = DICTOOL->getStringValue_json(options, P_FontName);
|
||||||
std::string fontFilePath = jsonPath.append(fontName);
|
std::string fontFilePath = jsonPath.append(fontName);
|
||||||
label->setFontName(fontFilePath);
|
label->setFontName(fontFilePath);
|
||||||
}
|
}
|
||||||
bool aw = DICTOOL->checkObjectExist_json(options, "areaWidth");
|
bool aw = DICTOOL->checkObjectExist_json(options, P_AreaWidth);
|
||||||
bool ah = DICTOOL->checkObjectExist_json(options, "areaHeight");
|
bool ah = DICTOOL->checkObjectExist_json(options, P_AreaHeight);
|
||||||
if (aw && ah)
|
if (aw && ah)
|
||||||
{
|
{
|
||||||
Size size = Size(DICTOOL->getFloatValue_json(options, "areaWidth"),DICTOOL->getFloatValue_json(options,"areaHeight"));
|
Size size = Size(DICTOOL->getFloatValue_json(options, P_AreaWidth),DICTOOL->getFloatValue_json(options,P_AreaHeight));
|
||||||
label->setTextAreaSize(size);
|
label->setTextAreaSize(size);
|
||||||
}
|
}
|
||||||
bool ha = DICTOOL->checkObjectExist_json(options, "hAlignment");
|
bool ha = DICTOOL->checkObjectExist_json(options, P_HAlignment);
|
||||||
if (ha)
|
if (ha)
|
||||||
{
|
{
|
||||||
label->setTextHorizontalAlignment((TextHAlignment)DICTOOL->getIntValue_json(options, "hAlignment"));
|
label->setTextHorizontalAlignment((TextHAlignment)DICTOOL->getIntValue_json(options, P_HAlignment));
|
||||||
}
|
}
|
||||||
bool va = DICTOOL->checkObjectExist_json(options, "vAlignment");
|
bool va = DICTOOL->checkObjectExist_json(options, P_VAlignment);
|
||||||
if (va)
|
if (va)
|
||||||
{
|
{
|
||||||
label->setTextVerticalAlignment((TextVAlignment)DICTOOL->getIntValue_json(options, "vAlignment"));
|
label->setTextVerticalAlignment((TextVAlignment)DICTOOL->getIntValue_json(options, P_VAlignment));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,8 @@ namespace cocostudio
|
||||||
static void purge();
|
static void purge();
|
||||||
|
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options);
|
||||||
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode);
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,98 @@
|
||||||
|
|
||||||
|
|
||||||
#include "WidgetReader.h"
|
#include "WidgetReader.h"
|
||||||
|
#include "cocostudio/CocoLoader.h"
|
||||||
|
#include "ui/UIButton.h"
|
||||||
|
|
||||||
USING_NS_CC;
|
USING_NS_CC;
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace cocostudio
|
namespace cocostudio
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
const char* P_IgnoreSize = "ignoreSize";
|
||||||
|
const char* P_SizeType = "sizeType";
|
||||||
|
const char* P_PositionType = "positionType";
|
||||||
|
const char* P_SizePercentX = "sizePercentX";
|
||||||
|
const char* P_SizePercentY = "sizePercentY";
|
||||||
|
const char* P_PositionPercentX = "positionPercentX";
|
||||||
|
const char* P_PositionPercentY = "positionPercentY";
|
||||||
|
const char* P_AdaptScreen = "adaptScreen";
|
||||||
|
const char* P_Width = "width";
|
||||||
|
const char* P_Height = "height";
|
||||||
|
const char* P_Tag = "tag";
|
||||||
|
const char* P_ActionTag = "actiontag";
|
||||||
|
const char* P_TouchAble = "touchAble";
|
||||||
|
const char* P_Name = "name";
|
||||||
|
const char* P_X = "x";
|
||||||
|
const char* P_Y = "y";
|
||||||
|
const char* P_ScaleX = "scaleX";
|
||||||
|
const char* P_ScaleY = "scaleY";
|
||||||
|
const char* P_Rotation = "rotation";
|
||||||
|
const char* P_Visbile = "visible";
|
||||||
|
const char* P_ZOrder = "ZOrder";
|
||||||
|
const char* P_LayoutParameter = "layoutParameter";
|
||||||
|
const char* P_Type = "type";
|
||||||
|
const char* P_Gravity = "gravity";
|
||||||
|
const char* P_RelativeName = "relativeName";
|
||||||
|
const char* P_RelativeToName = "relativeToName";
|
||||||
|
const char* P_Align = "align";
|
||||||
|
const char* P_MarginLeft = "marginLeft";
|
||||||
|
const char* P_MarginRight = "marginRight";
|
||||||
|
const char* P_MarginTop = "marginTop";
|
||||||
|
const char* P_MarginDown = "marginDown";
|
||||||
|
|
||||||
|
const char* P_Opacity = "opacity";
|
||||||
|
const char* P_ColorR = "colorR";
|
||||||
|
const char* P_ColorG = "colorG";
|
||||||
|
const char* P_ColorB = "colorB";
|
||||||
|
const char* P_FlipX = "flipX";
|
||||||
|
const char* P_FlipY = "flipY";
|
||||||
|
const char* P_AnchorPointX = "anchorPointX";
|
||||||
|
const char* P_AnchorPointY = "anchorPointY";
|
||||||
|
|
||||||
|
|
||||||
|
const char* P_ResourceType = "resourceType";
|
||||||
|
const char* P_Path = "path";
|
||||||
|
|
||||||
|
|
||||||
static WidgetReader* instanceWidgetReader = NULL;
|
static WidgetReader* instanceWidgetReader = NULL;
|
||||||
|
|
||||||
IMPLEMENT_CLASS_WIDGET_READER_INFO(WidgetReader)
|
IMPLEMENT_CLASS_WIDGET_READER_INFO(WidgetReader)
|
||||||
|
|
||||||
WidgetReader::WidgetReader()
|
WidgetReader::WidgetReader()
|
||||||
|
:_sizePercentX(0.0f),
|
||||||
|
_sizePercentY(0.0f),
|
||||||
|
_isAdaptScreen(false),
|
||||||
|
_width(0.0f),
|
||||||
|
_height(0.0f),
|
||||||
|
_positionPercentX(0.0f),
|
||||||
|
_positionPercentY(0.0f),
|
||||||
|
_opacity(255)
|
||||||
{
|
{
|
||||||
|
valueToInt = [=](const std::string& str) -> int{
|
||||||
|
return atoi(str.c_str());
|
||||||
|
};
|
||||||
|
|
||||||
|
valueToBool = [=](const std::string& str) -> bool{
|
||||||
|
int intValue = valueToInt(str);
|
||||||
|
if (1 == intValue) {
|
||||||
|
return true;
|
||||||
|
}else{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
valueToFloat = [=](const std::string& str) -> float{
|
||||||
|
return atof(str.c_str());
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
WidgetReader::~WidgetReader()
|
WidgetReader::~WidgetReader()
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -37,21 +113,21 @@ namespace cocostudio
|
||||||
|
|
||||||
void WidgetReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
void WidgetReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
||||||
{
|
{
|
||||||
bool ignoreSizeExsit = DICTOOL->checkObjectExist_json(options, "ignoreSize");
|
bool ignoreSizeExsit = DICTOOL->checkObjectExist_json(options, P_IgnoreSize);
|
||||||
if (ignoreSizeExsit)
|
if (ignoreSizeExsit)
|
||||||
{
|
{
|
||||||
widget->ignoreContentAdaptWithSize(DICTOOL->getBooleanValue_json(options, "ignoreSize"));
|
widget->ignoreContentAdaptWithSize(DICTOOL->getBooleanValue_json(options, P_IgnoreSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
widget->setSizeType((Widget::SizeType)DICTOOL->getIntValue_json(options, "sizeType"));
|
widget->setSizeType((Widget::SizeType)DICTOOL->getIntValue_json(options, P_SizeType));
|
||||||
widget->setPositionType((Widget::PositionType)DICTOOL->getIntValue_json(options, "positionType"));
|
widget->setPositionType((Widget::PositionType)DICTOOL->getIntValue_json(options, P_PositionType));
|
||||||
|
|
||||||
widget->setSizePercent(Vec2(DICTOOL->getFloatValue_json(options, "sizePercentX"), DICTOOL->getFloatValue_json(options, "sizePercentY")));
|
widget->setSizePercent(Vec2(DICTOOL->getFloatValue_json(options, P_SizePercentX), DICTOOL->getFloatValue_json(options, P_SizePercentY)));
|
||||||
widget->setPositionPercent(Vec2(DICTOOL->getFloatValue_json(options, "positionPercentX"), DICTOOL->getFloatValue_json(options, "positionPercentY")));
|
widget->setPositionPercent(Vec2(DICTOOL->getFloatValue_json(options, P_PositionPercentX), DICTOOL->getFloatValue_json(options, P_PositionPercentY)));
|
||||||
|
|
||||||
/* adapt screen */
|
/* adapt screen */
|
||||||
float w = 0, h = 0;
|
float w = 0, h = 0;
|
||||||
bool adaptScrenn = DICTOOL->getBooleanValue_json(options, "adaptScreen");
|
bool adaptScrenn = DICTOOL->getBooleanValue_json(options, P_AdaptScreen);
|
||||||
if (adaptScrenn)
|
if (adaptScrenn)
|
||||||
{
|
{
|
||||||
Size screenSize = CCDirector::getInstance()->getWinSize();
|
Size screenSize = CCDirector::getInstance()->getWinSize();
|
||||||
|
@ -60,55 +136,49 @@ namespace cocostudio
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
w = DICTOOL->getFloatValue_json(options, "width");
|
w = DICTOOL->getFloatValue_json(options, P_Width);
|
||||||
h = DICTOOL->getFloatValue_json(options, "height");
|
h = DICTOOL->getFloatValue_json(options, P_Height);
|
||||||
}
|
}
|
||||||
widget->setSize(Size(w, h));
|
widget->setSize(Size(w, h));
|
||||||
// before
|
|
||||||
/*
|
|
||||||
float w = DICTOOL->getFloatValue_json(options, "width");
|
|
||||||
float h = DICTOOL->getFloatValue_json(options, "height");
|
|
||||||
widget->setSize(CCSizeMake(w, h));
|
|
||||||
*/
|
|
||||||
/**/
|
|
||||||
|
|
||||||
widget->setTag(DICTOOL->getIntValue_json(options, "tag"));
|
widget->setTag(DICTOOL->getIntValue_json(options, P_Tag));
|
||||||
widget->setActionTag(DICTOOL->getIntValue_json(options, "actiontag"));
|
widget->setActionTag(DICTOOL->getIntValue_json(options, P_ActionTag));
|
||||||
widget->setTouchEnabled(DICTOOL->getBooleanValue_json(options, "touchAble"));
|
widget->setTouchEnabled(DICTOOL->getBooleanValue_json(options, P_TouchAble));
|
||||||
const char* name = DICTOOL->getStringValue_json(options, "name");
|
const char* name = DICTOOL->getStringValue_json(options, P_Name);
|
||||||
const char* widgetName = name?name:"default";
|
const char* widgetName = name?name:"default";
|
||||||
widget->setName(widgetName);
|
widget->setName(widgetName);
|
||||||
float x = DICTOOL->getFloatValue_json(options, "x");
|
|
||||||
float y = DICTOOL->getFloatValue_json(options, "y");
|
float x = DICTOOL->getFloatValue_json(options, P_X);
|
||||||
|
float y = DICTOOL->getFloatValue_json(options, P_Y);
|
||||||
widget->setPosition(Vec2(x,y));
|
widget->setPosition(Vec2(x,y));
|
||||||
bool sx = DICTOOL->checkObjectExist_json(options, "scaleX");
|
bool sx = DICTOOL->checkObjectExist_json(options, P_ScaleX);
|
||||||
if (sx)
|
if (sx)
|
||||||
{
|
{
|
||||||
widget->setScaleX(DICTOOL->getFloatValue_json(options, "scaleX"));
|
widget->setScaleX(DICTOOL->getFloatValue_json(options, P_ScaleX));
|
||||||
}
|
}
|
||||||
bool sy = DICTOOL->checkObjectExist_json(options, "scaleY");
|
bool sy = DICTOOL->checkObjectExist_json(options, P_ScaleY);
|
||||||
if (sy)
|
if (sy)
|
||||||
{
|
{
|
||||||
widget->setScaleY(DICTOOL->getFloatValue_json(options, "scaleY"));
|
widget->setScaleY(DICTOOL->getFloatValue_json(options, P_ScaleY));
|
||||||
}
|
}
|
||||||
bool rt = DICTOOL->checkObjectExist_json(options, "rotation");
|
bool rt = DICTOOL->checkObjectExist_json(options, P_Rotation);
|
||||||
if (rt)
|
if (rt)
|
||||||
{
|
{
|
||||||
widget->setRotation(DICTOOL->getFloatValue_json(options, "rotation"));
|
widget->setRotation(DICTOOL->getFloatValue_json(options, P_Rotation));
|
||||||
}
|
}
|
||||||
bool vb = DICTOOL->checkObjectExist_json(options, "visible");
|
bool vb = DICTOOL->checkObjectExist_json(options, P_Visbile);
|
||||||
if (vb)
|
if (vb)
|
||||||
{
|
{
|
||||||
widget->setVisible(DICTOOL->getBooleanValue_json(options, "visible"));
|
widget->setVisible(DICTOOL->getBooleanValue_json(options, P_Visbile));
|
||||||
}
|
}
|
||||||
int z = DICTOOL->getIntValue_json(options, "ZOrder");
|
int z = DICTOOL->getIntValue_json(options, P_ZOrder);
|
||||||
widget->setLocalZOrder(z);
|
widget->setLocalZOrder(z);
|
||||||
|
|
||||||
bool layout = DICTOOL->checkObjectExist_json(options, "layoutParameter");
|
bool layout = DICTOOL->checkObjectExist_json(options, P_LayoutParameter);
|
||||||
if (layout)
|
if (layout)
|
||||||
{
|
{
|
||||||
const rapidjson::Value& layoutParameterDic = DICTOOL->getSubDictionary_json(options, "layoutParameter");
|
const rapidjson::Value& layoutParameterDic = DICTOOL->getSubDictionary_json(options, P_LayoutParameter);
|
||||||
int paramType = DICTOOL->getIntValue_json(layoutParameterDic, "type");
|
int paramType = DICTOOL->getIntValue_json(layoutParameterDic, P_Type);
|
||||||
LayoutParameter* parameter = nullptr;
|
LayoutParameter* parameter = nullptr;
|
||||||
switch (paramType)
|
switch (paramType)
|
||||||
{
|
{
|
||||||
|
@ -117,7 +187,7 @@ namespace cocostudio
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
parameter = LinearLayoutParameter::create();
|
parameter = LinearLayoutParameter::create();
|
||||||
int gravity = DICTOOL->getIntValue_json(layoutParameterDic, "gravity");
|
int gravity = DICTOOL->getIntValue_json(layoutParameterDic, P_Gravity);
|
||||||
((LinearLayoutParameter*)parameter)->setGravity((cocos2d::ui::LinearLayoutParameter::LinearGravity)gravity);
|
((LinearLayoutParameter*)parameter)->setGravity((cocos2d::ui::LinearLayoutParameter::LinearGravity)gravity);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -125,11 +195,11 @@ namespace cocostudio
|
||||||
{
|
{
|
||||||
parameter = RelativeLayoutParameter::create();
|
parameter = RelativeLayoutParameter::create();
|
||||||
RelativeLayoutParameter* rParameter = (RelativeLayoutParameter*)parameter;
|
RelativeLayoutParameter* rParameter = (RelativeLayoutParameter*)parameter;
|
||||||
const char* relativeName = DICTOOL->getStringValue_json(layoutParameterDic, "relativeName");
|
const char* relativeName = DICTOOL->getStringValue_json(layoutParameterDic, P_RelativeName);
|
||||||
rParameter->setRelativeName(relativeName);
|
rParameter->setRelativeName(relativeName);
|
||||||
const char* relativeToName = DICTOOL->getStringValue_json(layoutParameterDic, "relativeToName");
|
const char* relativeToName = DICTOOL->getStringValue_json(layoutParameterDic, P_RelativeToName);
|
||||||
rParameter->setRelativeToWidgetName(relativeToName);
|
rParameter->setRelativeToWidgetName(relativeToName);
|
||||||
int align = DICTOOL->getIntValue_json(layoutParameterDic, "align");
|
int align = DICTOOL->getIntValue_json(layoutParameterDic, P_Align);
|
||||||
rParameter->setAlign((cocos2d::ui::RelativeLayoutParameter::RelativeAlign)align);
|
rParameter->setAlign((cocos2d::ui::RelativeLayoutParameter::RelativeAlign)align);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -138,10 +208,10 @@ namespace cocostudio
|
||||||
}
|
}
|
||||||
if (parameter)
|
if (parameter)
|
||||||
{
|
{
|
||||||
float mgl = DICTOOL->getFloatValue_json(layoutParameterDic, "marginLeft");
|
float mgl = DICTOOL->getFloatValue_json(layoutParameterDic, P_MarginLeft);
|
||||||
float mgt = DICTOOL->getFloatValue_json(layoutParameterDic, "marginTop");
|
float mgt = DICTOOL->getFloatValue_json(layoutParameterDic, P_MarginTop);
|
||||||
float mgr = DICTOOL->getFloatValue_json(layoutParameterDic, "marginRight");
|
float mgr = DICTOOL->getFloatValue_json(layoutParameterDic, P_MarginRight);
|
||||||
float mgb = DICTOOL->getFloatValue_json(layoutParameterDic, "marginDown");
|
float mgb = DICTOOL->getFloatValue_json(layoutParameterDic, P_MarginDown);
|
||||||
parameter->setMargin(Margin(mgl, mgt, mgr, mgb));
|
parameter->setMargin(Margin(mgl, mgt, mgr, mgb));
|
||||||
widget->setLayoutParameter(parameter);
|
widget->setLayoutParameter(parameter);
|
||||||
}
|
}
|
||||||
|
@ -150,27 +220,55 @@ namespace cocostudio
|
||||||
|
|
||||||
void WidgetReader::setColorPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
void WidgetReader::setColorPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
||||||
{
|
{
|
||||||
bool op = DICTOOL->checkObjectExist_json(options, "opacity");
|
bool op = DICTOOL->checkObjectExist_json(options, P_Opacity);
|
||||||
if (op)
|
if (op)
|
||||||
{
|
{
|
||||||
widget->setOpacity(DICTOOL->getIntValue_json(options, "opacity"));
|
widget->setOpacity(DICTOOL->getIntValue_json(options, P_Opacity));
|
||||||
}
|
}
|
||||||
bool cr = DICTOOL->checkObjectExist_json(options, "colorR");
|
bool cr = DICTOOL->checkObjectExist_json(options, P_ColorR);
|
||||||
bool cg = DICTOOL->checkObjectExist_json(options, "colorG");
|
bool cg = DICTOOL->checkObjectExist_json(options, P_ColorG);
|
||||||
bool cb = DICTOOL->checkObjectExist_json(options, "colorB");
|
bool cb = DICTOOL->checkObjectExist_json(options, P_ColorB);
|
||||||
int colorR = cr ? DICTOOL->getIntValue_json(options, "colorR") : 255;
|
int colorR = cr ? DICTOOL->getIntValue_json(options, P_ColorR) : 255;
|
||||||
int colorG = cg ? DICTOOL->getIntValue_json(options, "colorG") : 255;
|
int colorG = cg ? DICTOOL->getIntValue_json(options, P_ColorG) : 255;
|
||||||
int colorB = cb ? DICTOOL->getIntValue_json(options, "colorB") : 255;
|
int colorB = cb ? DICTOOL->getIntValue_json(options, P_ColorB) : 255;
|
||||||
widget->setColor(Color3B(colorR, colorG, colorB));
|
widget->setColor(Color3B(colorR, colorG, colorB));
|
||||||
|
|
||||||
this->setAnchorPointForWidget(widget, options);
|
this->setAnchorPointForWidget(widget, options);
|
||||||
|
|
||||||
bool flipX = DICTOOL->getBooleanValue_json(options, "flipX");
|
bool flipX = DICTOOL->getBooleanValue_json(options, P_FlipX);
|
||||||
bool flipY = DICTOOL->getBooleanValue_json(options, "flipY");
|
bool flipY = DICTOOL->getBooleanValue_json(options, P_FlipY);
|
||||||
widget->setFlippedX(flipX);
|
widget->setFlippedX(flipX);
|
||||||
widget->setFlippedY(flipY);
|
widget->setFlippedY(flipY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WidgetReader::beginSetBasicProperties(cocos2d::ui::Widget *widget)
|
||||||
|
{
|
||||||
|
_position = widget->getPosition();
|
||||||
|
//set default color
|
||||||
|
_color = Color3B(255,255,255);
|
||||||
|
widget->setColor(_color);
|
||||||
|
_opacity = widget->getOpacity();
|
||||||
|
_originalAnchorPoint = widget->getAnchorPoint();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WidgetReader::endSetBasicProperties(Widget *widget)
|
||||||
|
{
|
||||||
|
Size screenSize = Director::getInstance()->getWinSize();
|
||||||
|
|
||||||
|
widget->setPositionPercent(Vec2(_positionPercentX, _positionPercentY));
|
||||||
|
widget->setSizePercent(Vec2(_sizePercentX, _sizePercentY));
|
||||||
|
if (_isAdaptScreen) {
|
||||||
|
_width = screenSize.width;
|
||||||
|
_height = screenSize.height;
|
||||||
|
}
|
||||||
|
widget->setColor(_color);
|
||||||
|
widget->setOpacity(_opacity);
|
||||||
|
//the setSize method will be conflict with scale9Width & scale9Height
|
||||||
|
widget->setSize(Size(_width, _height));
|
||||||
|
widget->setPosition(_position);
|
||||||
|
widget->setAnchorPoint(_originalAnchorPoint);
|
||||||
|
}
|
||||||
|
|
||||||
std::string WidgetReader::getResourcePath(const rapidjson::Value &dict,
|
std::string WidgetReader::getResourcePath(const rapidjson::Value &dict,
|
||||||
const std::string &key,
|
const std::string &key,
|
||||||
cocos2d::ui::Widget::TextureResType texType)
|
cocos2d::ui::Widget::TextureResType texType)
|
||||||
|
@ -193,20 +291,47 @@ namespace cocostudio
|
||||||
return imageFileName_tp;
|
return imageFileName_tp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string WidgetReader::getResourcePath(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, cocos2d::ui::Widget::TextureResType texType)
|
||||||
|
{
|
||||||
|
stExpCocoNode *backGroundChildren = cocoNode->GetChildArray();
|
||||||
|
std::string backgroundValue = backGroundChildren[0].GetValue();
|
||||||
|
|
||||||
|
if (backgroundValue.size() < 3) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string binaryPath = GUIReader::getInstance()->getFilePath();
|
||||||
|
|
||||||
|
std::string imageFileName_tp;
|
||||||
|
if (!backgroundValue.empty())
|
||||||
|
{
|
||||||
|
if (texType == ui::Widget::TextureResType::LOCAL) {
|
||||||
|
imageFileName_tp = binaryPath + backgroundValue;
|
||||||
|
}
|
||||||
|
else if(texType == ui::Widget::TextureResType::PLIST){
|
||||||
|
imageFileName_tp = backgroundValue;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
CCASSERT(0, "invalid TextureResType!!!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return imageFileName_tp;
|
||||||
|
}
|
||||||
|
|
||||||
void WidgetReader::setAnchorPointForWidget(cocos2d::ui::Widget *widget, const rapidjson::Value &options)
|
void WidgetReader::setAnchorPointForWidget(cocos2d::ui::Widget *widget, const rapidjson::Value &options)
|
||||||
{
|
{
|
||||||
bool isAnchorPointXExists = DICTOOL->checkObjectExist_json(options, "anchorPointX");
|
bool isAnchorPointXExists = DICTOOL->checkObjectExist_json(options, P_AnchorPointX);
|
||||||
float anchorPointXInFile;
|
float anchorPointXInFile;
|
||||||
if (isAnchorPointXExists) {
|
if (isAnchorPointXExists) {
|
||||||
anchorPointXInFile = DICTOOL->getFloatValue_json(options, "anchorPointX");
|
anchorPointXInFile = DICTOOL->getFloatValue_json(options, P_AnchorPointX);
|
||||||
}else{
|
}else{
|
||||||
anchorPointXInFile = widget->getAnchorPoint().x;
|
anchorPointXInFile = widget->getAnchorPoint().x;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isAnchorPointYExists = DICTOOL->checkObjectExist_json(options, "anchorPointY");
|
bool isAnchorPointYExists = DICTOOL->checkObjectExist_json(options, P_AnchorPointY);
|
||||||
float anchorPointYInFile;
|
float anchorPointYInFile;
|
||||||
if (isAnchorPointYExists) {
|
if (isAnchorPointYExists) {
|
||||||
anchorPointYInFile = DICTOOL->getFloatValue_json(options, "anchorPointY");
|
anchorPointYInFile = DICTOOL->getFloatValue_json(options, P_AnchorPointY);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
anchorPointYInFile = widget->getAnchorPoint().y;
|
anchorPointYInFile = widget->getAnchorPoint().y;
|
||||||
|
@ -216,6 +341,23 @@ namespace cocostudio
|
||||||
widget->setAnchorPoint(Vec2(anchorPointXInFile, anchorPointYInFile));
|
widget->setAnchorPoint(Vec2(anchorPointXInFile, anchorPointYInFile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WidgetReader::setPropsFromBinary(cocos2d::ui::Widget *widget, cocostudio::CocoLoader *cocoLoader, cocostudio::stExpCocoNode *cocoNode)
|
||||||
|
{
|
||||||
|
stExpCocoNode *stChildArray = cocoNode->GetChildArray();
|
||||||
|
|
||||||
|
this->beginSetBasicProperties(widget);
|
||||||
|
|
||||||
|
for (int i = 0; i < cocoNode->GetChildNum(); ++i) {
|
||||||
|
std::string key = stChildArray[i].GetName(cocoLoader);
|
||||||
|
std::string value = stChildArray[i].GetValue();
|
||||||
|
|
||||||
|
CC_BASIC_PROPERTY_BINARY_READER
|
||||||
|
}
|
||||||
|
|
||||||
|
this->endSetBasicProperties(widget);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,12 +26,16 @@
|
||||||
#define __TestCpp__WidgetReader__
|
#define __TestCpp__WidgetReader__
|
||||||
|
|
||||||
#include "WidgetReaderProtocol.h"
|
#include "WidgetReaderProtocol.h"
|
||||||
#include "../CCSGUIReader.h"
|
#include "cocostudio/CCSGUIReader.h"
|
||||||
#include "ui/GUIDefine.h"
|
#include "ui/GUIDefine.h"
|
||||||
#include "ui/UIWidget.h"
|
#include "ui/UIWidget.h"
|
||||||
|
|
||||||
|
|
||||||
namespace cocostudio
|
namespace cocostudio
|
||||||
{
|
{
|
||||||
|
class CocoLoader;
|
||||||
|
struct stExpCocoNode;
|
||||||
|
|
||||||
class WidgetReader : public cocos2d::Ref, public WidgetReaderProtocol
|
class WidgetReader : public cocos2d::Ref, public WidgetReaderProtocol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -49,13 +53,193 @@ namespace cocostudio
|
||||||
virtual void setColorPropsFromJsonDictionary(cocos2d::ui::Widget* widget,
|
virtual void setColorPropsFromJsonDictionary(cocos2d::ui::Widget* widget,
|
||||||
const rapidjson::Value& options);
|
const rapidjson::Value& options);
|
||||||
|
|
||||||
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode);
|
||||||
protected:
|
protected:
|
||||||
std::string getResourcePath(const rapidjson::Value& dict,
|
std::string getResourcePath(const rapidjson::Value& dict,
|
||||||
const std::string& key,
|
const std::string& key,
|
||||||
cocos2d::ui::Widget::TextureResType texType);
|
cocos2d::ui::Widget::TextureResType texType);
|
||||||
void setAnchorPointForWidget(cocos2d::ui::Widget* widget, const rapidjson::Value&options);
|
void setAnchorPointForWidget(cocos2d::ui::Widget* widget, const rapidjson::Value&options);
|
||||||
|
|
||||||
|
|
||||||
|
std::string getResourcePath(CocoLoader* cocoLoader,
|
||||||
|
stExpCocoNode* pCocoNode,
|
||||||
|
cocos2d::ui::Widget::TextureResType texType);
|
||||||
|
|
||||||
|
void beginSetBasicProperties(cocos2d::ui::Widget *widget);
|
||||||
|
void endSetBasicProperties(cocos2d::ui::Widget *widget);
|
||||||
|
|
||||||
|
|
||||||
|
std::function<int(const std::string&)> valueToInt;
|
||||||
|
std::function<bool(const std::string&)> valueToBool;
|
||||||
|
std::function<float(const std::string&)> valueToFloat;
|
||||||
|
|
||||||
|
float _sizePercentX;
|
||||||
|
float _sizePercentY;
|
||||||
|
float _positionPercentX;
|
||||||
|
float _positionPercentY;
|
||||||
|
float _width ;
|
||||||
|
float _height;
|
||||||
|
cocos2d::Color3B _color;
|
||||||
|
int _opacity;
|
||||||
|
cocos2d::Vec2 _position;
|
||||||
|
bool _isAdaptScreen;
|
||||||
|
cocos2d::Vec2 _originalAnchorPoint;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//property const define
|
||||||
|
extern const char* P_IgnoreSize;
|
||||||
|
extern const char* P_SizeType;
|
||||||
|
extern const char* P_PositionType;
|
||||||
|
extern const char* P_SizePercentX;
|
||||||
|
extern const char* P_SizePercentY;
|
||||||
|
extern const char* P_PositionPercentX;
|
||||||
|
extern const char* P_PositionPercentY;
|
||||||
|
extern const char* P_AdaptScreen;
|
||||||
|
extern const char* P_Width;
|
||||||
|
extern const char* P_Height;
|
||||||
|
extern const char* P_Tag;
|
||||||
|
extern const char* P_ActionTag;
|
||||||
|
extern const char* P_TouchAble;
|
||||||
|
extern const char* P_Name;
|
||||||
|
extern const char* P_X;
|
||||||
|
extern const char* P_Y;
|
||||||
|
extern const char* P_ScaleX;
|
||||||
|
extern const char* P_ScaleY;
|
||||||
|
extern const char* P_Rotation;
|
||||||
|
extern const char* P_Visbile;
|
||||||
|
extern const char* P_ZOrder;
|
||||||
|
extern const char* P_LayoutParameter;
|
||||||
|
extern const char* P_Type;
|
||||||
|
extern const char* P_Gravity;
|
||||||
|
extern const char* P_RelativeName;
|
||||||
|
extern const char* P_RelativeToName;
|
||||||
|
extern const char* P_Align;
|
||||||
|
extern const char* P_MarginLeft;
|
||||||
|
extern const char* P_MarginRight;
|
||||||
|
extern const char* P_MarginTop;
|
||||||
|
extern const char* P_MarginDown;
|
||||||
|
|
||||||
|
extern const char* P_Opacity;
|
||||||
|
extern const char* P_ColorR;
|
||||||
|
extern const char* P_ColorG;
|
||||||
|
extern const char* P_ColorB;
|
||||||
|
extern const char* P_FlipX;
|
||||||
|
extern const char* P_FlipY;
|
||||||
|
extern const char* P_AnchorPointX;
|
||||||
|
extern const char* P_AnchorPointY;
|
||||||
|
|
||||||
|
extern const char* P_ResourceType;
|
||||||
|
extern const char* P_Path;
|
||||||
|
|
||||||
|
#define CC_BASIC_PROPERTY_BINARY_READER \
|
||||||
|
if (key == P_IgnoreSize) { \
|
||||||
|
widget->ignoreContentAdaptWithSize(valueToBool(value)); \
|
||||||
|
}else if(key == P_SizeType){ \
|
||||||
|
widget->setSizeType((Widget::SizeType)valueToInt(value)); \
|
||||||
|
}else if(key == P_PositionType){ \
|
||||||
|
widget->setPositionType((Widget::PositionType)valueToInt(value)); \
|
||||||
|
}else if(key == P_SizePercentX){ \
|
||||||
|
_sizePercentX = valueToFloat(value); \
|
||||||
|
}else if(key == P_SizePercentY){ \
|
||||||
|
_sizePercentY = valueToFloat(value); \
|
||||||
|
}else if(key == P_PositionPercentX){ \
|
||||||
|
_positionPercentX = valueToFloat(value); \
|
||||||
|
}else if(key == P_PositionPercentY){ \
|
||||||
|
_positionPercentY = valueToFloat(value); \
|
||||||
|
} \
|
||||||
|
else if (key == P_Width){ \
|
||||||
|
_width = valueToFloat(value); \
|
||||||
|
}else if(key == P_Height){ \
|
||||||
|
_height = valueToFloat(value); \
|
||||||
|
}else if(key == P_Tag){ \
|
||||||
|
widget->setTag(valueToInt(value)); \
|
||||||
|
}else if(key == P_ActionTag){ \
|
||||||
|
widget->setActionTag(valueToInt(value)); \
|
||||||
|
}else if(key == P_TouchAble){ \
|
||||||
|
widget->setTouchEnabled(valueToBool(value)); \
|
||||||
|
}else if(key == P_Name){ \
|
||||||
|
std::string widgetName = value.empty() ? "default" : value; \
|
||||||
|
widget->setName(widgetName); \
|
||||||
|
}else if(key == P_X){ \
|
||||||
|
_position.x = valueToFloat(value); \
|
||||||
|
}else if(key == P_Y){ \
|
||||||
|
_position.y = valueToFloat(value); \
|
||||||
|
}else if(key == P_ScaleX){ \
|
||||||
|
widget->setScaleX(valueToFloat(value)); \
|
||||||
|
}else if(key == P_ScaleY){ \
|
||||||
|
widget->setScaleY(valueToFloat(value)); \
|
||||||
|
}else if(key == P_Rotation){ \
|
||||||
|
widget->setRotation(valueToFloat(value)); \
|
||||||
|
}else if(key == P_Visbile){ \
|
||||||
|
widget->setVisible(valueToBool(value)); \
|
||||||
|
}else if(key == P_ZOrder){ \
|
||||||
|
widget->setZOrder(valueToInt(value)); \
|
||||||
|
}else if(key == P_LayoutParameter){ \
|
||||||
|
stExpCocoNode *layoutCocosNode = stChildArray[i].GetChildArray(); \
|
||||||
|
ui::LinearLayoutParameter *linearParameter = ui::LinearLayoutParameter::create(); \
|
||||||
|
ui::RelativeLayoutParameter *relativeParameter = ui::RelativeLayoutParameter::create(); \
|
||||||
|
ui::Margin mg; \
|
||||||
|
int paramType = -1; \
|
||||||
|
for (int j = 0; j < stChildArray[i].GetChildNum(); ++j) { \
|
||||||
|
std::string innerKey = layoutCocosNode[j].GetName(cocoLoader); \
|
||||||
|
std::string innerValue = layoutCocosNode[j].GetValue(); \
|
||||||
|
if (innerKey == P_Type) { \
|
||||||
|
paramType = valueToInt(innerValue); \
|
||||||
|
}else if(innerKey == P_Gravity){ \
|
||||||
|
linearParameter->setGravity((cocos2d::ui::LinearLayoutParameter::LinearGravity)valueToInt(innerValue)); \
|
||||||
|
}else if(innerKey == P_RelativeName){ \
|
||||||
|
relativeParameter->setRelativeName(innerValue); \
|
||||||
|
}else if(innerKey == P_RelativeToName){ \
|
||||||
|
relativeParameter->setRelativeToWidgetName(innerValue); \
|
||||||
|
}else if(innerKey == P_Align){ \
|
||||||
|
relativeParameter->setAlign((cocos2d::ui::RelativeLayoutParameter::RelativeAlign)valueToInt(innerValue)); \
|
||||||
|
}else if(innerKey == P_MarginLeft){ \
|
||||||
|
mg.left = valueToFloat(innerValue); \
|
||||||
|
}else if(innerKey == P_MarginTop){ \
|
||||||
|
mg.top = valueToFloat(innerValue); \
|
||||||
|
}else if(innerKey == P_MarginRight){ \
|
||||||
|
mg.right = valueToFloat(innerValue); \
|
||||||
|
}else if(innerKey == P_MarginDown){ \
|
||||||
|
mg.bottom = valueToFloat(innerValue); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
linearParameter->setMargin(mg); \
|
||||||
|
relativeParameter->setMargin(mg); \
|
||||||
|
switch (paramType) { \
|
||||||
|
case 1: \
|
||||||
|
widget->setLayoutParameter(linearParameter); \
|
||||||
|
break; \
|
||||||
|
case 2: \
|
||||||
|
widget->setLayoutParameter(relativeParameter); \
|
||||||
|
default: \
|
||||||
|
break;\
|
||||||
|
}\
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#define CC_COLOR_PROPERTY_BINARY_READER \
|
||||||
|
else if (key == P_Opacity) { \
|
||||||
|
_opacity = valueToInt(value); \
|
||||||
|
}else if(key == P_ColorR){ \
|
||||||
|
_color.r = valueToInt(value); \
|
||||||
|
}else if(key == P_ColorG){ \
|
||||||
|
_color.g = valueToInt(value); \
|
||||||
|
}else if(key == P_ColorB) \
|
||||||
|
{\
|
||||||
|
_color.b = valueToInt(value);\
|
||||||
|
}else if(key == P_FlipX){\
|
||||||
|
widget->setFlippedX(valueToBool(value));\
|
||||||
|
}else if(key == P_FlipY){\
|
||||||
|
widget->setFlippedY(valueToBool(value));\
|
||||||
|
} \
|
||||||
|
else if(key == P_AnchorPointX){ \
|
||||||
|
_originalAnchorPoint.x = valueToFloat(value); \
|
||||||
|
}else if(key == P_AnchorPointY){ \
|
||||||
|
_originalAnchorPoint.y = valueToFloat(value); \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* defined(__TestCpp__WidgetReader__) */
|
#endif /* defined(__TestCpp__WidgetReader__) */
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#include "cocos2d.h"
|
#include "cocos2d.h"
|
||||||
#include "cocostudio/DictionaryHelper.h"
|
#include "cocostudio/DictionaryHelper.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace cocos2d
|
namespace cocos2d
|
||||||
{
|
{
|
||||||
namespace ui
|
namespace ui
|
||||||
|
@ -38,11 +40,15 @@ namespace cocos2d
|
||||||
|
|
||||||
namespace cocostudio
|
namespace cocostudio
|
||||||
{
|
{
|
||||||
|
class CocoLoader;
|
||||||
|
struct stExpCocoNode;
|
||||||
|
|
||||||
class WidgetReaderProtocol
|
class WidgetReaderProtocol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~WidgetReaderProtocol() {};
|
virtual ~WidgetReaderProtocol() {};
|
||||||
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options) = 0;
|
virtual void setPropsFromJsonDictionary(cocos2d::ui::Widget* widget, const rapidjson::Value& options) = 0;
|
||||||
|
virtual void setPropsFromBinary(cocos2d::ui::Widget* widget, CocoLoader* cocoLoader, stExpCocoNode* pCocoNode) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
<ClCompile Include="..\CCTransformHelp.cpp" />
|
<ClCompile Include="..\CCTransformHelp.cpp" />
|
||||||
<ClCompile Include="..\CCTween.cpp" />
|
<ClCompile Include="..\CCTween.cpp" />
|
||||||
<ClCompile Include="..\CCUtilMath.cpp" />
|
<ClCompile Include="..\CCUtilMath.cpp" />
|
||||||
|
<ClCompile Include="..\CocoLoader.cpp" />
|
||||||
<ClCompile Include="..\DictionaryHelper.cpp" />
|
<ClCompile Include="..\DictionaryHelper.cpp" />
|
||||||
<ClCompile Include="..\TriggerBase.cpp" />
|
<ClCompile Include="..\TriggerBase.cpp" />
|
||||||
<ClCompile Include="..\TriggerMng.cpp" />
|
<ClCompile Include="..\TriggerMng.cpp" />
|
||||||
|
@ -113,6 +114,8 @@
|
||||||
<ClInclude Include="..\CCTransformHelp.h" />
|
<ClInclude Include="..\CCTransformHelp.h" />
|
||||||
<ClInclude Include="..\CCTween.h" />
|
<ClInclude Include="..\CCTween.h" />
|
||||||
<ClInclude Include="..\CCUtilMath.h" />
|
<ClInclude Include="..\CCUtilMath.h" />
|
||||||
|
<ClInclude Include="..\CocoLoader.h" />
|
||||||
|
<ClInclude Include="..\CocoStudio.h" />
|
||||||
<ClInclude Include="..\DictionaryHelper.h" />
|
<ClInclude Include="..\DictionaryHelper.h" />
|
||||||
<ClInclude Include="..\TriggerBase.h" />
|
<ClInclude Include="..\TriggerBase.h" />
|
||||||
<ClInclude Include="..\TriggerMng.h" />
|
<ClInclude Include="..\TriggerMng.h" />
|
||||||
|
@ -199,13 +202,15 @@
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MinSpace</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>
|
<SDLCheck>
|
||||||
</SDLCheck>
|
</SDLCheck>
|
||||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support;$(EngineRoot)external;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support;$(EngineRoot)external;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DebugInformationFormat>None</DebugInformationFormat>
|
||||||
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
|
|
@ -231,6 +231,9 @@
|
||||||
<ClCompile Include="..\WidgetReader\PageViewReader\PageViewReader.cpp">
|
<ClCompile Include="..\WidgetReader\PageViewReader\PageViewReader.cpp">
|
||||||
<Filter>reader\WidgetReader\PageViewReader</Filter>
|
<Filter>reader\WidgetReader\PageViewReader</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\CocoLoader.cpp">
|
||||||
|
<Filter>json</Filter>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\ActionTimeline\CCNodeReader.cpp">
|
<ClCompile Include="..\ActionTimeline\CCNodeReader.cpp">
|
||||||
<Filter>TimelineAction</Filter>
|
<Filter>TimelineAction</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -428,6 +431,12 @@
|
||||||
<ClInclude Include="..\WidgetReader\PageViewReader\PageViewReader.h">
|
<ClInclude Include="..\WidgetReader\PageViewReader\PageViewReader.h">
|
||||||
<Filter>reader\WidgetReader\PageViewReader</Filter>
|
<Filter>reader\WidgetReader\PageViewReader</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\CocoLoader.h">
|
||||||
|
<Filter>json</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\CocoStudio.h">
|
||||||
|
<Filter>json</Filter>
|
||||||
|
</ClInclude>
|
||||||
<ClInclude Include="..\ActionTimeline\CCNodeReader.h">
|
<ClInclude Include="..\ActionTimeline\CCNodeReader.h">
|
||||||
<Filter>TimelineAction</Filter>
|
<Filter>TimelineAction</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
|
|
@ -163,6 +163,11 @@
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\ActionTimeline\CCActionTimeline.cpp" />
|
||||||
|
<ClCompile Include="..\ActionTimeline\CCActionTimelineCache.cpp" />
|
||||||
|
<ClCompile Include="..\ActionTimeline\CCFrame.cpp" />
|
||||||
|
<ClCompile Include="..\ActionTimeline\CCNodeReader.cpp" />
|
||||||
|
<ClCompile Include="..\ActionTimeline\CCTimeLine.cpp" />
|
||||||
<ClCompile Include="..\CCActionFrame.cpp" />
|
<ClCompile Include="..\CCActionFrame.cpp" />
|
||||||
<ClCompile Include="..\CCActionFrameEasing.cpp" />
|
<ClCompile Include="..\CCActionFrameEasing.cpp" />
|
||||||
<ClCompile Include="..\CCActionManagerEx.cpp" />
|
<ClCompile Include="..\CCActionManagerEx.cpp" />
|
||||||
|
@ -193,6 +198,7 @@
|
||||||
<ClCompile Include="..\CCTransformHelp.cpp" />
|
<ClCompile Include="..\CCTransformHelp.cpp" />
|
||||||
<ClCompile Include="..\CCTween.cpp" />
|
<ClCompile Include="..\CCTween.cpp" />
|
||||||
<ClCompile Include="..\CCUtilMath.cpp" />
|
<ClCompile Include="..\CCUtilMath.cpp" />
|
||||||
|
<ClCompile Include="..\CocoLoader.cpp" />
|
||||||
<ClCompile Include="..\DictionaryHelper.cpp" />
|
<ClCompile Include="..\DictionaryHelper.cpp" />
|
||||||
<ClCompile Include="..\TriggerBase.cpp" />
|
<ClCompile Include="..\TriggerBase.cpp" />
|
||||||
<ClCompile Include="..\TriggerMng.cpp" />
|
<ClCompile Include="..\TriggerMng.cpp" />
|
||||||
|
@ -229,6 +235,12 @@
|
||||||
<ClInclude Include="..\..\..\..\external\json\reader.h" />
|
<ClInclude Include="..\..\..\..\external\json\reader.h" />
|
||||||
<ClInclude Include="..\..\..\..\external\json\stringbuffer.h" />
|
<ClInclude Include="..\..\..\..\external\json\stringbuffer.h" />
|
||||||
<ClInclude Include="..\..\..\..\external\json\writer.h" />
|
<ClInclude Include="..\..\..\..\external\json\writer.h" />
|
||||||
|
<ClInclude Include="..\ActionTimeline\CCActionTimeline.h" />
|
||||||
|
<ClInclude Include="..\ActionTimeline\CCActionTimelineCache.h" />
|
||||||
|
<ClInclude Include="..\ActionTimeline\CCFrame.h" />
|
||||||
|
<ClInclude Include="..\ActionTimeline\CCNodeReader.h" />
|
||||||
|
<ClInclude Include="..\ActionTimeline\CCTimeLine.h" />
|
||||||
|
<ClInclude Include="..\ActionTimeline\CCTimelineMacro.h" />
|
||||||
<ClInclude Include="..\CCActionFrame.h" />
|
<ClInclude Include="..\CCActionFrame.h" />
|
||||||
<ClInclude Include="..\CCActionFrameEasing.h" />
|
<ClInclude Include="..\CCActionFrameEasing.h" />
|
||||||
<ClInclude Include="..\CCActionManagerEx.h" />
|
<ClInclude Include="..\CCActionManagerEx.h" />
|
||||||
|
@ -260,6 +272,7 @@
|
||||||
<ClInclude Include="..\CCTransformHelp.h" />
|
<ClInclude Include="..\CCTransformHelp.h" />
|
||||||
<ClInclude Include="..\CCTween.h" />
|
<ClInclude Include="..\CCTween.h" />
|
||||||
<ClInclude Include="..\CCUtilMath.h" />
|
<ClInclude Include="..\CCUtilMath.h" />
|
||||||
|
<ClInclude Include="..\CocoLoader.h" />
|
||||||
<ClInclude Include="..\DictionaryHelper.h" />
|
<ClInclude Include="..\DictionaryHelper.h" />
|
||||||
<ClInclude Include="..\ObjectFactory.h" />
|
<ClInclude Include="..\ObjectFactory.h" />
|
||||||
<ClInclude Include="..\TriggerBase.h" />
|
<ClInclude Include="..\TriggerBase.h" />
|
||||||
|
@ -282,4 +295,4 @@
|
||||||
<ClInclude Include="..\WidgetReader\WidgetReaderProtocol.h" />
|
<ClInclude Include="..\WidgetReader\WidgetReaderProtocol.h" />
|
||||||
<ClInclude Include="pch.h" />
|
<ClInclude Include="pch.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -82,6 +82,9 @@
|
||||||
<Filter Include="reader\WidgetReader\TextReader">
|
<Filter Include="reader\WidgetReader\TextReader">
|
||||||
<UniqueIdentifier>{695e45cf-2af5-4bdb-84a2-f0e9f3d77f11}</UniqueIdentifier>
|
<UniqueIdentifier>{695e45cf-2af5-4bdb-84a2-f0e9f3d77f11}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="TimelineAction">
|
||||||
|
<UniqueIdentifier>{5f5a98dd-657c-4a9b-8862-c11555ad1293}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\CCComAttribute.cpp">
|
<ClCompile Include="..\CCComAttribute.cpp">
|
||||||
|
@ -229,6 +232,24 @@
|
||||||
<Filter>reader\WidgetReader\PageViewReader</Filter>
|
<Filter>reader\WidgetReader\PageViewReader</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="pch.cpp" />
|
<ClCompile Include="pch.cpp" />
|
||||||
|
<ClCompile Include="..\ActionTimeline\CCActionTimeline.cpp">
|
||||||
|
<Filter>TimelineAction</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\ActionTimeline\CCActionTimelineCache.cpp">
|
||||||
|
<Filter>TimelineAction</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\ActionTimeline\CCFrame.cpp">
|
||||||
|
<Filter>TimelineAction</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\ActionTimeline\CCNodeReader.cpp">
|
||||||
|
<Filter>TimelineAction</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\ActionTimeline\CCTimeLine.cpp">
|
||||||
|
<Filter>TimelineAction</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\CocoLoader.cpp">
|
||||||
|
<Filter>json</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\CCComAttribute.h">
|
<ClInclude Include="..\CCComAttribute.h">
|
||||||
|
@ -415,5 +436,26 @@
|
||||||
<Filter>reader\WidgetReader\PageViewReader</Filter>
|
<Filter>reader\WidgetReader\PageViewReader</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="pch.h" />
|
<ClInclude Include="pch.h" />
|
||||||
|
<ClInclude Include="..\ActionTimeline\CCActionTimeline.h">
|
||||||
|
<Filter>TimelineAction</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\ActionTimeline\CCActionTimelineCache.h">
|
||||||
|
<Filter>TimelineAction</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\ActionTimeline\CCFrame.h">
|
||||||
|
<Filter>TimelineAction</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\ActionTimeline\CCNodeReader.h">
|
||||||
|
<Filter>TimelineAction</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\ActionTimeline\CCTimeLine.h">
|
||||||
|
<Filter>TimelineAction</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\ActionTimeline\CCTimelineMacro.h">
|
||||||
|
<Filter>TimelineAction</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\CocoLoader.h">
|
||||||
|
<Filter>json</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -76,8 +76,8 @@
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
||||||
<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>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
@ -86,8 +86,8 @@
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
||||||
<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>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -130,13 +130,15 @@
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MinSpace</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>
|
<SDLCheck>
|
||||||
</SDLCheck>
|
</SDLCheck>
|
||||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DebugInformationFormat>None</DebugInformationFormat>
|
||||||
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
|
|
@ -35,8 +35,8 @@
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
||||||
<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>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
@ -44,8 +44,8 @@
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
||||||
<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>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
@ -113,9 +113,11 @@
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>None</DebugInformationFormat>
|
||||||
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4251</DisableSpecificWarnings>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
|
<Optimization>MinSpace</Optimization>
|
||||||
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>winmm.lib;libcocos2d.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>winmm.lib;libcocos2d.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -66,6 +66,8 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../external/lua/tolua \
|
||||||
$(LOCAL_PATH)/../../editor-support/cocosbuilder \
|
$(LOCAL_PATH)/../../editor-support/cocosbuilder \
|
||||||
$(LOCAL_PATH)/../../editor-support/cocostudio \
|
$(LOCAL_PATH)/../../editor-support/cocostudio \
|
||||||
$(LOCAL_PATH)/../../ui \
|
$(LOCAL_PATH)/../../ui \
|
||||||
|
$(LOCAL_PATH)/../../2d \
|
||||||
|
$(LOCAL_PATH)/../../3d \
|
||||||
$(LOCAL_PATH)/auto \
|
$(LOCAL_PATH)/auto \
|
||||||
$(LOCAL_PATH)/manual \
|
$(LOCAL_PATH)/manual \
|
||||||
$(LOCAL_PATH)/manual/platform/android \
|
$(LOCAL_PATH)/manual/platform/android \
|
||||||
|
|
|
@ -33,6 +33,8 @@ include_directories(
|
||||||
../../editor-support/cocostudio
|
../../editor-support/cocostudio
|
||||||
../../editor-support/spine
|
../../editor-support/spine
|
||||||
../../ui
|
../../ui
|
||||||
|
../../2d
|
||||||
|
../../3d
|
||||||
../../../external/lua/lua
|
../../../external/lua/lua
|
||||||
../../../external/lua/tolua
|
../../../external/lua/tolua
|
||||||
../../../external/xxtea
|
../../../external/xxtea
|
||||||
|
|
|
@ -22,6 +22,14 @@
|
||||||
-- @param #char char
|
-- @param #char char
|
||||||
-- @return ActionObject#ActionObject ret (return value: ccs.ActionObject)
|
-- @return ActionObject#ActionObject ret (return value: ccs.ActionObject)
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- @function [parent=#ActionManagerEx] initWithBinary
|
||||||
|
-- @param self
|
||||||
|
-- @param #char char
|
||||||
|
-- @param #cc.Ref ref
|
||||||
|
-- @param #ccs.CocoLoader cocoloader
|
||||||
|
-- @param #ccs.stExpCocoNode stexpcoconode
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- @function [parent=#ActionManagerEx] releaseActions
|
-- @function [parent=#ActionManagerEx] releaseActions
|
||||||
-- @param self
|
-- @param self
|
||||||
|
|
|
@ -60,6 +60,13 @@
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @return bool#bool ret (return value: bool)
|
-- @return bool#bool ret (return value: bool)
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- @function [parent=#ActionObject] initWithBinary
|
||||||
|
-- @param self
|
||||||
|
-- @param #ccs.CocoLoader cocoloader
|
||||||
|
-- @param #ccs.stExpCocoNode stexpcoconode
|
||||||
|
-- @param #cc.Ref ref
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- @function [parent=#ActionObject] addActionNode
|
-- @function [parent=#ActionObject] addActionNode
|
||||||
-- @param self
|
-- @param self
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- @module Animate3D
|
||||||
|
-- @extend ActionInterval
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- @function [parent=#Animate3D] setPlayBack
|
||||||
|
-- @param self
|
||||||
|
-- @param #bool bool
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- @function [parent=#Animate3D] setSpeed
|
||||||
|
-- @param self
|
||||||
|
-- @param #float float
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- @function [parent=#Animate3D] getPlayBack
|
||||||
|
-- @param self
|
||||||
|
-- @return bool#bool ret (return value: bool)
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- @function [parent=#Animate3D] getSpeed
|
||||||
|
-- @param self
|
||||||
|
-- @return float#float ret (return value: float)
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- @function [parent=#Animate3D] create
|
||||||
|
-- @param self
|
||||||
|
-- @param #cc.Animation3D animation3d
|
||||||
|
-- @return Animate3D#Animate3D ret (return value: cc.Animate3D)
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- @function [parent=#Animate3D] startWithTarget
|
||||||
|
-- @param self
|
||||||
|
-- @param #cc.Node node
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- @function [parent=#Animate3D] step
|
||||||
|
-- @param self
|
||||||
|
-- @param #float float
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- @function [parent=#Animate3D] clone
|
||||||
|
-- @param self
|
||||||
|
-- @return Animate3D#Animate3D ret (return value: cc.Animate3D)
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- @function [parent=#Animate3D] reverse
|
||||||
|
-- @param self
|
||||||
|
-- @return Animate3D#Animate3D ret (return value: cc.Animate3D)
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- @function [parent=#Animate3D] update
|
||||||
|
-- @param self
|
||||||
|
-- @param #float float
|
||||||
|
|
||||||
|
return nil
|
|
@ -0,0 +1,18 @@
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- @module Animation3D
|
||||||
|
-- @extend Ref
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- @function [parent=#Animation3D] getDuration
|
||||||
|
-- @param self
|
||||||
|
-- @return float#float ret (return value: float)
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- @function [parent=#Animation3D] getOrCreate
|
||||||
|
-- @param self
|
||||||
|
-- @param #string str
|
||||||
|
-- @param #string str
|
||||||
|
-- @return Animation3D#Animation3D ret (return value: cc.Animation3D)
|
||||||
|
|
||||||
|
return nil
|
|
@ -19,6 +19,12 @@
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @return string#string ret (return value: string)
|
-- @return string#string ret (return value: string)
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- @function [parent=#GUIReader] widgetFromBinaryFile
|
||||||
|
-- @param self
|
||||||
|
-- @param #char char
|
||||||
|
-- @return Widget#Widget ret (return value: ccui.Widget)
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- @function [parent=#GUIReader] getVersionInteger
|
-- @function [parent=#GUIReader] getVersionInteger
|
||||||
-- @param self
|
-- @param self
|
||||||
|
|
|
@ -1221,4 +1221,14 @@
|
||||||
-- @field [parent=#cc] ProtectedNode#ProtectedNode ProtectedNode preloaded module
|
-- @field [parent=#cc] ProtectedNode#ProtectedNode ProtectedNode preloaded module
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
-- the cc Animation3D
|
||||||
|
-- @field [parent=#cc] Animation3D#Animation3D Animation3D preloaded module
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------
|
||||||
|
-- the cc Animate3D
|
||||||
|
-- @field [parent=#cc] Animate3D#Animate3D Animate3D preloaded module
|
||||||
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#include "cocos2d.h"
|
#include "cocos2d.h"
|
||||||
#include "SimpleAudioEngine.h"
|
#include "SimpleAudioEngine.h"
|
||||||
#include "CCProtectedNode.h"
|
#include "CCProtectedNode.h"
|
||||||
|
#include "CCAnimation3D.h"
|
||||||
|
#include "CCAnimate3D.h"
|
||||||
#include "tolua_fix.h"
|
#include "tolua_fix.h"
|
||||||
#include "LuaBasicConversions.h"
|
#include "LuaBasicConversions.h"
|
||||||
|
|
||||||
|
@ -63993,6 +63995,353 @@ int lua_register_cocos2dx_ProtectedNode(lua_State* tolua_S)
|
||||||
g_typeCast["ProtectedNode"] = "cc.ProtectedNode";
|
g_typeCast["ProtectedNode"] = "cc.ProtectedNode";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lua_cocos2dx_Animation3D_getDuration(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocos2d::Animation3D* cobj = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.Animation3D",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cobj = (cocos2d::Animation3D*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!cobj)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animation3D_getDuration'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 0)
|
||||||
|
{
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
double ret = cobj->getDuration();
|
||||||
|
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getDuration",argc, 0);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animation3D_getDuration'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int lua_cocos2dx_Animation3D_getOrCreate(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertable(tolua_S,1,"cc.Animation3D",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S) - 1;
|
||||||
|
|
||||||
|
if (argc == 1)
|
||||||
|
{
|
||||||
|
std::string arg0;
|
||||||
|
ok &= luaval_to_std_string(tolua_S, 2,&arg0);
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
cocos2d::Animation3D* ret = cocos2d::Animation3D::getOrCreate(arg0);
|
||||||
|
object_to_luaval<cocos2d::Animation3D>(tolua_S, "cc.Animation3D",(cocos2d::Animation3D*)ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (argc == 2)
|
||||||
|
{
|
||||||
|
std::string arg0;
|
||||||
|
std::string arg1;
|
||||||
|
ok &= luaval_to_std_string(tolua_S, 2,&arg0);
|
||||||
|
ok &= luaval_to_std_string(tolua_S, 3,&arg1);
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
cocos2d::Animation3D* ret = cocos2d::Animation3D::getOrCreate(arg0, arg1);
|
||||||
|
object_to_luaval<cocos2d::Animation3D>(tolua_S, "cc.Animation3D",(cocos2d::Animation3D*)ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "getOrCreate",argc, 1);
|
||||||
|
return 0;
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animation3D_getOrCreate'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
static int lua_cocos2dx_Animation3D_finalize(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
printf("luabindings: finalizing LUA object (Animation3D)");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int lua_register_cocos2dx_Animation3D(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
tolua_usertype(tolua_S,"cc.Animation3D");
|
||||||
|
tolua_cclass(tolua_S,"Animation3D","cc.Animation3D","cc.Ref",nullptr);
|
||||||
|
|
||||||
|
tolua_beginmodule(tolua_S,"Animation3D");
|
||||||
|
tolua_function(tolua_S,"getDuration",lua_cocos2dx_Animation3D_getDuration);
|
||||||
|
tolua_function(tolua_S,"getOrCreate", lua_cocos2dx_Animation3D_getOrCreate);
|
||||||
|
tolua_endmodule(tolua_S);
|
||||||
|
std::string typeName = typeid(cocos2d::Animation3D).name();
|
||||||
|
g_luaType[typeName] = "cc.Animation3D";
|
||||||
|
g_typeCast["Animation3D"] = "cc.Animation3D";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int lua_cocos2dx_Animate3D_setPlayBack(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocos2d::Animate3D* cobj = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!cobj)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_setPlayBack'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 1)
|
||||||
|
{
|
||||||
|
bool arg0;
|
||||||
|
|
||||||
|
ok &= luaval_to_boolean(tolua_S, 2,&arg0);
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
cobj->setPlayBack(arg0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setPlayBack",argc, 1);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_setPlayBack'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int lua_cocos2dx_Animate3D_setSpeed(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocos2d::Animate3D* cobj = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!cobj)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_setSpeed'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 1)
|
||||||
|
{
|
||||||
|
double arg0;
|
||||||
|
|
||||||
|
ok &= luaval_to_number(tolua_S, 2,&arg0);
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
cobj->setSpeed(arg0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "setSpeed",argc, 1);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_setSpeed'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int lua_cocos2dx_Animate3D_getPlayBack(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocos2d::Animate3D* cobj = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!cobj)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_getPlayBack'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 0)
|
||||||
|
{
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
bool ret = cobj->getPlayBack();
|
||||||
|
tolua_pushboolean(tolua_S,(bool)ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getPlayBack",argc, 0);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_getPlayBack'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int lua_cocos2dx_Animate3D_getSpeed(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocos2d::Animate3D* cobj = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cobj = (cocos2d::Animate3D*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!cobj)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_Animate3D_getSpeed'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 0)
|
||||||
|
{
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
double ret = cobj->getSpeed();
|
||||||
|
tolua_pushnumber(tolua_S,(lua_Number)ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "getSpeed",argc, 0);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_getSpeed'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int lua_cocos2dx_Animate3D_create(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertable(tolua_S,1,"cc.Animate3D",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S) - 1;
|
||||||
|
|
||||||
|
if (argc == 1)
|
||||||
|
{
|
||||||
|
cocos2d::Animation3D* arg0;
|
||||||
|
ok &= luaval_to_object<cocos2d::Animation3D>(tolua_S, 2, "cc.Animation3D",&arg0);
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
cocos2d::Animate3D* ret = cocos2d::Animate3D::create(arg0);
|
||||||
|
object_to_luaval<cocos2d::Animate3D>(tolua_S, "cc.Animate3D",(cocos2d::Animate3D*)ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "create",argc, 1);
|
||||||
|
return 0;
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_Animate3D_create'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
static int lua_cocos2dx_Animate3D_finalize(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
printf("luabindings: finalizing LUA object (Animate3D)");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int lua_register_cocos2dx_Animate3D(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
tolua_usertype(tolua_S,"cc.Animate3D");
|
||||||
|
tolua_cclass(tolua_S,"Animate3D","cc.Animate3D","cc.ActionInterval",nullptr);
|
||||||
|
|
||||||
|
tolua_beginmodule(tolua_S,"Animate3D");
|
||||||
|
tolua_function(tolua_S,"setPlayBack",lua_cocos2dx_Animate3D_setPlayBack);
|
||||||
|
tolua_function(tolua_S,"setSpeed",lua_cocos2dx_Animate3D_setSpeed);
|
||||||
|
tolua_function(tolua_S,"getPlayBack",lua_cocos2dx_Animate3D_getPlayBack);
|
||||||
|
tolua_function(tolua_S,"getSpeed",lua_cocos2dx_Animate3D_getSpeed);
|
||||||
|
tolua_function(tolua_S,"create", lua_cocos2dx_Animate3D_create);
|
||||||
|
tolua_endmodule(tolua_S);
|
||||||
|
std::string typeName = typeid(cocos2d::Animate3D).name();
|
||||||
|
g_luaType[typeName] = "cc.Animate3D";
|
||||||
|
g_typeCast["Animate3D"] = "cc.Animate3D";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
TOLUA_API int register_all_cocos2dx(lua_State* tolua_S)
|
TOLUA_API int register_all_cocos2dx(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
tolua_open(tolua_S);
|
tolua_open(tolua_S);
|
||||||
|
@ -64180,6 +64529,7 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S)
|
||||||
lua_register_cocos2dx_Spawn(tolua_S);
|
lua_register_cocos2dx_Spawn(tolua_S);
|
||||||
lua_register_cocos2dx_EaseQuarticActionInOut(tolua_S);
|
lua_register_cocos2dx_EaseQuarticActionInOut(tolua_S);
|
||||||
lua_register_cocos2dx_GLProgramState(tolua_S);
|
lua_register_cocos2dx_GLProgramState(tolua_S);
|
||||||
|
lua_register_cocos2dx_Animation3D(tolua_S);
|
||||||
lua_register_cocos2dx_PageTurn3D(tolua_S);
|
lua_register_cocos2dx_PageTurn3D(tolua_S);
|
||||||
lua_register_cocos2dx_TransitionSlideInL(tolua_S);
|
lua_register_cocos2dx_TransitionSlideInL(tolua_S);
|
||||||
lua_register_cocos2dx_TransitionSlideInT(tolua_S);
|
lua_register_cocos2dx_TransitionSlideInT(tolua_S);
|
||||||
|
@ -64218,6 +64568,7 @@ TOLUA_API int register_all_cocos2dx(lua_State* tolua_S)
|
||||||
lua_register_cocos2dx_ParticleRain(tolua_S);
|
lua_register_cocos2dx_ParticleRain(tolua_S);
|
||||||
lua_register_cocos2dx_Waves(tolua_S);
|
lua_register_cocos2dx_Waves(tolua_S);
|
||||||
lua_register_cocos2dx_EaseOut(tolua_S);
|
lua_register_cocos2dx_EaseOut(tolua_S);
|
||||||
|
lua_register_cocos2dx_Animate3D(tolua_S);
|
||||||
lua_register_cocos2dx_MenuItemFont(tolua_S);
|
lua_register_cocos2dx_MenuItemFont(tolua_S);
|
||||||
lua_register_cocos2dx_TransitionFadeUp(tolua_S);
|
lua_register_cocos2dx_TransitionFadeUp(tolua_S);
|
||||||
lua_register_cocos2dx_EaseSineOut(tolua_S);
|
lua_register_cocos2dx_EaseSineOut(tolua_S);
|
||||||
|
|
|
@ -1542,6 +1542,15 @@ int register_all_cocos2dx(lua_State* tolua_S);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -500,6 +500,58 @@ int lua_cocos2dx_studio_ActionObject_getLoop(lua_State* tolua_S)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
int lua_cocos2dx_studio_ActionObject_initWithBinary(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocostudio::ActionObject* cobj = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"ccs.ActionObject",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cobj = (cocostudio::ActionObject*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!cobj)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionObject_initWithBinary'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 3)
|
||||||
|
{
|
||||||
|
cocostudio::CocoLoader* arg0;
|
||||||
|
cocostudio::stExpCocoNode* arg1;
|
||||||
|
cocos2d::Ref* arg2;
|
||||||
|
|
||||||
|
ok &= luaval_to_object<cocostudio::CocoLoader>(tolua_S, 2, "ccs.CocoLoader",&arg0);
|
||||||
|
|
||||||
|
#pragma warning NO CONVERSION TO NATIVE FOR stExpCocoNode*;
|
||||||
|
|
||||||
|
ok &= luaval_to_object<cocos2d::Ref>(tolua_S, 4, "cc.Ref",&arg2);
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
cobj->initWithBinary(arg0, arg1, arg2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "initWithBinary",argc, 3);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionObject_initWithBinary'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
int lua_cocos2dx_studio_ActionObject_addActionNode(lua_State* tolua_S)
|
int lua_cocos2dx_studio_ActionObject_addActionNode(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
|
@ -830,6 +882,7 @@ int lua_register_cocos2dx_studio_ActionObject(lua_State* tolua_S)
|
||||||
tolua_function(tolua_S,"getCurrentTime",lua_cocos2dx_studio_ActionObject_getCurrentTime);
|
tolua_function(tolua_S,"getCurrentTime",lua_cocos2dx_studio_ActionObject_getCurrentTime);
|
||||||
tolua_function(tolua_S,"removeActionNode",lua_cocos2dx_studio_ActionObject_removeActionNode);
|
tolua_function(tolua_S,"removeActionNode",lua_cocos2dx_studio_ActionObject_removeActionNode);
|
||||||
tolua_function(tolua_S,"getLoop",lua_cocos2dx_studio_ActionObject_getLoop);
|
tolua_function(tolua_S,"getLoop",lua_cocos2dx_studio_ActionObject_getLoop);
|
||||||
|
tolua_function(tolua_S,"initWithBinary",lua_cocos2dx_studio_ActionObject_initWithBinary);
|
||||||
tolua_function(tolua_S,"addActionNode",lua_cocos2dx_studio_ActionObject_addActionNode);
|
tolua_function(tolua_S,"addActionNode",lua_cocos2dx_studio_ActionObject_addActionNode);
|
||||||
tolua_function(tolua_S,"getUnitTime",lua_cocos2dx_studio_ActionObject_getUnitTime);
|
tolua_function(tolua_S,"getUnitTime",lua_cocos2dx_studio_ActionObject_getUnitTime);
|
||||||
tolua_function(tolua_S,"isPlaying",lua_cocos2dx_studio_ActionObject_isPlaying);
|
tolua_function(tolua_S,"isPlaying",lua_cocos2dx_studio_ActionObject_isPlaying);
|
||||||
|
@ -960,6 +1013,61 @@ int lua_cocos2dx_studio_ActionManagerEx_getActionByName(lua_State* tolua_S)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
int lua_cocos2dx_studio_ActionManagerEx_initWithBinary(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocostudio::ActionManagerEx* cobj = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"ccs.ActionManagerEx",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cobj = (cocostudio::ActionManagerEx*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!cobj)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_ActionManagerEx_initWithBinary'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 4)
|
||||||
|
{
|
||||||
|
const char* arg0;
|
||||||
|
cocos2d::Ref* arg1;
|
||||||
|
cocostudio::CocoLoader* arg2;
|
||||||
|
cocostudio::stExpCocoNode* arg3;
|
||||||
|
|
||||||
|
std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp); arg0 = arg0_tmp.c_str();
|
||||||
|
|
||||||
|
ok &= luaval_to_object<cocos2d::Ref>(tolua_S, 3, "cc.Ref",&arg1);
|
||||||
|
|
||||||
|
ok &= luaval_to_object<cocostudio::CocoLoader>(tolua_S, 4, "ccs.CocoLoader",&arg2);
|
||||||
|
|
||||||
|
#pragma warning NO CONVERSION TO NATIVE FOR stExpCocoNode*;
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
cobj->initWithBinary(arg0, arg1, arg2, arg3);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "initWithBinary",argc, 4);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_ActionManagerEx_initWithBinary'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
int lua_cocos2dx_studio_ActionManagerEx_releaseActions(lua_State* tolua_S)
|
int lua_cocos2dx_studio_ActionManagerEx_releaseActions(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
|
@ -1078,6 +1186,7 @@ int lua_register_cocos2dx_studio_ActionManagerEx(lua_State* tolua_S)
|
||||||
tolua_beginmodule(tolua_S,"ActionManagerEx");
|
tolua_beginmodule(tolua_S,"ActionManagerEx");
|
||||||
tolua_function(tolua_S,"playActionByName",lua_cocos2dx_studio_ActionManagerEx_playActionByName);
|
tolua_function(tolua_S,"playActionByName",lua_cocos2dx_studio_ActionManagerEx_playActionByName);
|
||||||
tolua_function(tolua_S,"getActionByName",lua_cocos2dx_studio_ActionManagerEx_getActionByName);
|
tolua_function(tolua_S,"getActionByName",lua_cocos2dx_studio_ActionManagerEx_getActionByName);
|
||||||
|
tolua_function(tolua_S,"initWithBinary",lua_cocos2dx_studio_ActionManagerEx_initWithBinary);
|
||||||
tolua_function(tolua_S,"releaseActions",lua_cocos2dx_studio_ActionManagerEx_releaseActions);
|
tolua_function(tolua_S,"releaseActions",lua_cocos2dx_studio_ActionManagerEx_releaseActions);
|
||||||
tolua_function(tolua_S,"destroyInstance", lua_cocos2dx_studio_ActionManagerEx_destroyInstance);
|
tolua_function(tolua_S,"destroyInstance", lua_cocos2dx_studio_ActionManagerEx_destroyInstance);
|
||||||
tolua_function(tolua_S,"getInstance", lua_cocos2dx_studio_ActionManagerEx_getInstance);
|
tolua_function(tolua_S,"getInstance", lua_cocos2dx_studio_ActionManagerEx_getInstance);
|
||||||
|
@ -12155,6 +12264,53 @@ int lua_cocos2dx_studio_GUIReader_getFilePath(lua_State* tolua_S)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
int lua_cocos2dx_studio_GUIReader_widgetFromBinaryFile(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocostudio::GUIReader* cobj = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"ccs.GUIReader",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cobj = (cocostudio::GUIReader*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!cobj)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_studio_GUIReader_widgetFromBinaryFile'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 1)
|
||||||
|
{
|
||||||
|
const char* arg0;
|
||||||
|
|
||||||
|
std::string arg0_tmp; ok &= luaval_to_std_string(tolua_S, 2, &arg0_tmp); arg0 = arg0_tmp.c_str();
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
cocos2d::ui::Widget* ret = cobj->widgetFromBinaryFile(arg0);
|
||||||
|
object_to_luaval<cocos2d::ui::Widget>(tolua_S, "ccui.Widget",(cocos2d::ui::Widget*)ret);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "widgetFromBinaryFile",argc, 1);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_studio_GUIReader_widgetFromBinaryFile'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
int lua_cocos2dx_studio_GUIReader_getVersionInteger(lua_State* tolua_S)
|
int lua_cocos2dx_studio_GUIReader_getVersionInteger(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
|
@ -12278,6 +12434,7 @@ int lua_register_cocos2dx_studio_GUIReader(lua_State* tolua_S)
|
||||||
tolua_function(tolua_S,"setFilePath",lua_cocos2dx_studio_GUIReader_setFilePath);
|
tolua_function(tolua_S,"setFilePath",lua_cocos2dx_studio_GUIReader_setFilePath);
|
||||||
tolua_function(tolua_S,"widgetFromJsonFile",lua_cocos2dx_studio_GUIReader_widgetFromJsonFile);
|
tolua_function(tolua_S,"widgetFromJsonFile",lua_cocos2dx_studio_GUIReader_widgetFromJsonFile);
|
||||||
tolua_function(tolua_S,"getFilePath",lua_cocos2dx_studio_GUIReader_getFilePath);
|
tolua_function(tolua_S,"getFilePath",lua_cocos2dx_studio_GUIReader_getFilePath);
|
||||||
|
tolua_function(tolua_S,"widgetFromBinaryFile",lua_cocos2dx_studio_GUIReader_widgetFromBinaryFile);
|
||||||
tolua_function(tolua_S,"getVersionInteger",lua_cocos2dx_studio_GUIReader_getVersionInteger);
|
tolua_function(tolua_S,"getVersionInteger",lua_cocos2dx_studio_GUIReader_getVersionInteger);
|
||||||
tolua_function(tolua_S,"destroyInstance", lua_cocos2dx_studio_GUIReader_destroyInstance);
|
tolua_function(tolua_S,"destroyInstance", lua_cocos2dx_studio_GUIReader_destroyInstance);
|
||||||
tolua_function(tolua_S,"getInstance", lua_cocos2dx_studio_GUIReader_getInstance);
|
tolua_function(tolua_S,"getInstance", lua_cocos2dx_studio_GUIReader_getInstance);
|
||||||
|
|
|
@ -305,6 +305,9 @@ int register_all_cocos2dx_studio(lua_State* tolua_S);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1756,19 +1756,19 @@ int tolua_cocos2d_Sequence_create(lua_State* tolua_S)
|
||||||
goto tolua_lerror;
|
goto tolua_lerror;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cocos2d::FiniteTimeAction* item = static_cast<cocos2d::FiniteTimeAction*>(tolua_tousertype(tolua_S, 1 + i, NULL));
|
cocos2d::FiniteTimeAction* item = static_cast<cocos2d::FiniteTimeAction*>(tolua_tousertype(tolua_S, 1 + i, nullptr));
|
||||||
if (NULL != item)
|
if (nullptr != item)
|
||||||
{
|
{
|
||||||
array.pushBack(item);
|
array.pushBack(item);
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cocos2d::Sequence* tolua_ret = cocos2d::Sequence::create(array);
|
cocos2d::Sequence* tolua_ret = cocos2d::Sequence::create(array);
|
||||||
//issue 2433 uncheck
|
//issue 2433 uncheck
|
||||||
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
|
int nID = (tolua_ret) ? (int)tolua_ret->_ID : -1;
|
||||||
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : NULL;
|
int* pLuaID = (tolua_ret) ? &tolua_ret->_luaID : nullptr;
|
||||||
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"cc.Sequence");
|
toluafix_pushusertype_ccobject(tolua_S, nID, pLuaID, (void*)tolua_ret,"cc.Sequence");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -445,9 +445,10 @@ static int lua_cocos2dx_ListView_addEventListener(lua_State* L)
|
||||||
#endif
|
#endif
|
||||||
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
|
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
|
||||||
|
|
||||||
self->addEventListener([=](cocos2d::Ref* ref,ListView::EventType eventType){
|
auto listViewCallback = [=](cocos2d::Ref* ref,ListView::EventType eventType){
|
||||||
handleUIEvent(handler, ref, (int)eventType);
|
handleUIEvent(handler, ref, (int)eventType);
|
||||||
});
|
};
|
||||||
|
self->addEventListener((ui::ListView::ccListViewCallback)listViewCallback);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -463,6 +464,57 @@ tolua_lerror:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int lua_cocos2dx_ListView_addScrollViewEventListener(lua_State* L)
|
||||||
|
{
|
||||||
|
if (nullptr == L)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int argc = 0;
|
||||||
|
ListView* self = nullptr;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
if (!tolua_isusertype(L,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
self = static_cast<ListView*>(tolua_tousertype(L,1,0));
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (nullptr == self) {
|
||||||
|
tolua_error(L,"invalid 'self' in function 'lua_cocos2dx_ListView_addScrollViewEventListener'\n", NULL);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
argc = lua_gettop(L) - 1;
|
||||||
|
if (1 == argc)
|
||||||
|
{
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!toluafix_isfunction(L,2,"LUA_FUNCTION",0,&tolua_err))
|
||||||
|
{
|
||||||
|
goto tolua_lerror;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
LUA_FUNCTION handler = ( toluafix_ref_function(L,2,0));
|
||||||
|
|
||||||
|
auto scrollViewCallback = [=](cocos2d::Ref* ref, ui::ScrollView::EventType eventType){
|
||||||
|
handleUIEvent(handler, ref, (int)eventType);
|
||||||
|
};
|
||||||
|
self->addEventListener((ui::ScrollView::ccScrollViewCallback)scrollViewCallback);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CCLOG("'addScrollViewEventListener' function of ListView has wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(L,"#ferror in function 'addScrollViewEventListener'.",&tolua_err);
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static void extendListView(lua_State* L)
|
static void extendListView(lua_State* L)
|
||||||
{
|
{
|
||||||
lua_pushstring(L, "ccui.ListView");
|
lua_pushstring(L, "ccui.ListView");
|
||||||
|
@ -470,6 +522,7 @@ static void extendListView(lua_State* L)
|
||||||
if (lua_istable(L,-1))
|
if (lua_istable(L,-1))
|
||||||
{
|
{
|
||||||
tolua_function(L, "addEventListener", lua_cocos2dx_ListView_addEventListener);
|
tolua_function(L, "addEventListener", lua_cocos2dx_ListView_addEventListener);
|
||||||
|
tolua_function(L, "addScrollViewEventListener", lua_cocos2dx_ListView_addScrollViewEventListener);
|
||||||
}
|
}
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -889,7 +889,7 @@
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../.. $(SRCROOT)/../../../base $(SRCROOT)/../../../2d $(SRCROOT)/../../../deprecated $(SRCROOT)/../../../physics $(SRCROOT)/../../../math/kazmath $(SRCROOT)/../../../2d/platform $(SRCROOT)/../../../audio/include $(SRCROOT)/../../../editor-support $(SRCROOT)/../../../editor-support/spine $(SRCROOT)/../../../editor-support/cocostudio $(SRCROOT)/../../../editor-support/cocosbuilder $(SRCROOT)/../../../ui $(SRCROOT)/../../../storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external/lua $(SRCROOT)/../../../../external/lua/luajit/include $(SRCROOT)/../../../../external/lua/tolua";
|
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../.. $(SRCROOT)/../../../base $(SRCROOT)/../../../3d $(SRCROOT)/../../../2d $(SRCROOT)/../../../deprecated $(SRCROOT)/../../../physics $(SRCROOT)/../../../math/kazmath $(SRCROOT)/../../../2d/platform $(SRCROOT)/../../../audio/include $(SRCROOT)/../../../editor-support $(SRCROOT)/../../../editor-support/spine $(SRCROOT)/../../../editor-support/cocostudio $(SRCROOT)/../../../editor-support/cocosbuilder $(SRCROOT)/../../../ui $(SRCROOT)/../../../storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external/lua $(SRCROOT)/../../../../external/lua/luajit/include $(SRCROOT)/../../../../external/lua/tolua";
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
|
@ -922,7 +922,7 @@
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../.. $(SRCROOT)/../../../base $(SRCROOT)/../../../2d $(SRCROOT)/../../../deprecated $(SRCROOT)/../../../physics $(SRCROOT)/../../../math/kazmath $(SRCROOT)/../../../2d/platform $(SRCROOT)/../../../audio/include $(SRCROOT)/../../../editor-support $(SRCROOT)/../../../editor-support/spine $(SRCROOT)/../../../editor-support/cocostudio $(SRCROOT)/../../../editor-support/cocosbuilder $(SRCROOT)/../../../ui $(SRCROOT)/../../../storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external/lua $(SRCROOT)/../../../../external/lua/luajit/include $(SRCROOT)/../../../../external/lua/tolua";
|
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../.. $(SRCROOT)/../../../base $(SRCROOT)/../../../3d $(SRCROOT)/../../../2d $(SRCROOT)/../../../deprecated $(SRCROOT)/../../../physics $(SRCROOT)/../../../math/kazmath $(SRCROOT)/../../../2d/platform $(SRCROOT)/../../../audio/include $(SRCROOT)/../../../editor-support $(SRCROOT)/../../../editor-support/spine $(SRCROOT)/../../../editor-support/cocostudio $(SRCROOT)/../../../editor-support/cocosbuilder $(SRCROOT)/../../../ui $(SRCROOT)/../../../storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external/lua $(SRCROOT)/../../../../external/lua/luajit/include $(SRCROOT)/../../../../external/lua/tolua";
|
||||||
VALIDATE_PRODUCT = YES;
|
VALIDATE_PRODUCT = YES;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
|
|
|
@ -188,7 +188,7 @@
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot)extensions\network;$(EngineRoot)external;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)external\lua;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot)extensions\network;$(EngineRoot)external;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)external\lua;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\3d;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<MinimalRebuild>false</MinimalRebuild>
|
<MinimalRebuild>false</MinimalRebuild>
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
|
@ -218,9 +218,9 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\lua\luajit\prebuilt\win32\*.*" "$
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MinSpace</Optimization>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot)extensions\network;$(EngineRoot)external;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)external\lua;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\ui;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\editor-support\spine;$(EngineRoot)cocos\audio\include;$(EngineRoot)extensions;$(EngineRoot)extensions\network;$(EngineRoot)external;$(EngineRoot)external\libwebsockets\win32\include;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\lua\luajit\include;$(EngineRoot)external\lua;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\2d;$(EngineRoot)cocos\3d;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;LIBLUA_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;LIBLUA_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
@ -231,9 +231,10 @@ xcopy /Y /Q "$(ProjectDir)..\..\..\..\external\lua\luajit\prebuilt\win32\*.*" "$
|
||||||
<PrecompiledHeaderOutputFile>
|
<PrecompiledHeaderOutputFile>
|
||||||
</PrecompiledHeaderOutputFile>
|
</PrecompiledHeaderOutputFile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>None</DebugInformationFormat>
|
||||||
<DisableSpecificWarnings>4800;4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4800;4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Lib>
|
<Lib>
|
||||||
<AdditionalLibraryDirectories>libcocos2d.lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>libcocos2d.lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
||||||
<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>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
@ -37,8 +37,8 @@
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
|
||||||
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
|
||||||
<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>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -81,13 +81,15 @@
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MinSpace</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>
|
<SDLCheck>
|
||||||
</SDLCheck>
|
</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>$(EngineRoot)external\sqlite3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(EngineRoot)external\sqlite3\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<DebugInformationFormat>None</DebugInformationFormat>
|
||||||
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
|
|
@ -71,7 +71,6 @@ public:
|
||||||
const std::string& disableImage = "",
|
const std::string& disableImage = "",
|
||||||
TextureResType texType = TextureResType::LOCAL);
|
TextureResType texType = TextureResType::LOCAL);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load textures for button.
|
* Load textures for button.
|
||||||
*
|
*
|
||||||
|
|
|
@ -453,6 +453,7 @@ void ListView::addEventListenerListView(Ref *target, SEL_ListViewEvent selector)
|
||||||
_listViewEventListener = target;
|
_listViewEventListener = target;
|
||||||
_listViewEventSelector = selector;
|
_listViewEventSelector = selector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ListView::addEventListener(const ccListViewCallback& callback)
|
void ListView::addEventListener(const ccListViewCallback& callback)
|
||||||
{
|
{
|
||||||
|
|
|
@ -174,7 +174,8 @@ public:
|
||||||
|
|
||||||
CC_DEPRECATED_ATTRIBUTE void addEventListenerListView(Ref* target, SEL_ListViewEvent selector);
|
CC_DEPRECATED_ATTRIBUTE void addEventListenerListView(Ref* target, SEL_ListViewEvent selector);
|
||||||
void addEventListener(const ccListViewCallback& callback);
|
void addEventListener(const ccListViewCallback& callback);
|
||||||
|
using ScrollView::addEventListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes scroll direction of scrollview.
|
* Changes scroll direction of scrollview.
|
||||||
*
|
*
|
||||||
|
|
|
@ -251,7 +251,7 @@ public:
|
||||||
* Add call back function called scrollview event triggered
|
* Add call back function called scrollview event triggered
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE void addEventListenerScrollView(Ref* target, SEL_ScrollViewEvent selector);
|
CC_DEPRECATED_ATTRIBUTE void addEventListenerScrollView(Ref* target, SEL_ScrollViewEvent selector);
|
||||||
void addEventListener(const ccScrollViewCallback& callback);
|
virtual void addEventListener(const ccScrollViewCallback& callback);
|
||||||
|
|
||||||
//all of these functions are related to innerContainer.
|
//all of these functions are related to innerContainer.
|
||||||
virtual void addChild(Node * child) override;
|
virtual void addChild(Node * child) override;
|
||||||
|
|
|
@ -603,7 +603,6 @@ CC_CONSTRUCTOR_ACCESS:
|
||||||
*@return void
|
*@return void
|
||||||
*/
|
*/
|
||||||
void dispatchFocusEvent(Widget* widgetLoseFocus, Widget* widgetGetFocus);
|
void dispatchFocusEvent(Widget* widgetLoseFocus, Widget* widgetGetFocus);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//call back function called when size changed.
|
//call back function called when size changed.
|
||||||
|
|
|
@ -126,13 +126,15 @@
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MinSpace</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<SDLCheck>
|
<SDLCheck>
|
||||||
</SDLCheck>
|
</SDLCheck>
|
||||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support;$(EngineRoot)external;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\editor-support;$(EngineRoot)external;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<DebugInformationFormat>None</DebugInformationFormat>
|
||||||
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
@ -143,4 +145,4 @@
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue