Merge branch 'v3-newaudio' of D:\github_repository\cocosNew into v3

This commit is contained in:
Dhilan007 2014-07-24 22:00:57 +08:00
commit a558e78ff0
621 changed files with 27632 additions and 13943 deletions

3
.gitignore vendored
View File

@ -136,4 +136,5 @@ project.properties
/external/version.json /external/version.json
/templates/lua-template-runtime/runtime /templates/lua-template-runtime/runtime
/v*-deps-*.zip /v*-deps-*.zip
/v*-lua-runtime-*.zip /v*-lua-runtime-*.zip
/tools/fbx-conv/

20
AUTHORS
View File

@ -25,7 +25,7 @@ Developers:
longlene longlene
Improve android project creation script Improve android project creation script
simpliplant reneklacan
Hardware keyboard support Hardware keyboard support
liuyq liuyq
@ -530,6 +530,7 @@ Developers:
Casting variables to their own type, and print warning info if no corresponding lua callback function instead of crash. Casting variables to their own type, and print warning info if no corresponding lua callback function instead of crash.
fix of WebSocket url parse error for 'ws://domain.com/websocket' pattern. fix of WebSocket url parse error for 'ws://domain.com/websocket' pattern.
Fixed a bug that Websocket doesn't support send/receive data which larger than 4096 bytes. Fixed a bug that Websocket doesn't support send/receive data which larger than 4096 bytes.
Show detail class & function name in error message of lua-binding
musikov musikov
Fixing a bug that missing precision when getting strokeColor and fontFillColor Fixing a bug that missing precision when getting strokeColor and fontFillColor
@ -797,6 +798,7 @@ Developers:
Adds support for get response when Activity's onActivityResult is triggered Adds support for get response when Activity's onActivityResult is triggered
Improve Android projects Improve Android projects
Android jni error clear & more readable log Android jni error clear & more readable log
Add support of software PVRTC v1 decompression
youknowone youknowone
Adds iOS-like elastic bounceback support for cocos2d::extension::ScrollView Adds iOS-like elastic bounceback support for cocos2d::extension::ScrollView
@ -828,6 +830,8 @@ Developers:
Added missing Text Font and Placeholder feature of EditBox for Mac platform Added missing Text Font and Placeholder feature of EditBox for Mac platform
HttpRequest uses std::function as callback HttpRequest uses std::function as callback
EditBox: mac secure input EditBox: mac secure input
Fix a bug that can not get/set text in password mode on Mac OS X
Make sure TableView parents are visible before handling touch
iSevenDays iSevenDays
Fixed a bug that the result of 'malloc' is incompatible with type 'unsigned char *' in Image::saveImageToPNG Fixed a bug that the result of 'malloc' is incompatible with type 'unsigned char *' in Image::saveImageToPNG
@ -887,6 +891,7 @@ Developers:
Added TextField::getStringLength() Added TextField::getStringLength()
Add shadow, outline, glow filter support for UIText Add shadow, outline, glow filter support for UIText
Fix UITextField IME can't auto detach Fix UITextField IME can't auto detach
Add getChildByName method for get a node that can be cast to Type T
QiuleiWang QiuleiWang
Fix the bug that calculated height of multi-line string was incorrect on iOS Fix the bug that calculated height of multi-line string was incorrect on iOS
@ -896,7 +901,8 @@ Developers:
kyokomi kyokomi
Fix the bug that UIButton doesn't support TTF font Fix the bug that UIButton doesn't support TTF font
Fix a but of TextReader Fix a bug of TextReader
Fix a bug that UITextField doesn't support TTF font
gin0606 gin0606
Add a new line at the end of a file Add a new line at the end of a file
@ -910,6 +916,16 @@ Developers:
chareice chareice
Make `setup.py` work on zsh Make `setup.py` work on zsh
taug
Could add seach path and resolution order path in front.
CaiCQ
Fix a but that LabelTTF may lost chinese characters on linux
chenguangqi
Fixed a compiling error on Android
Fixed an error when importing project using Eclipse on Android
Retired Core Developers: Retired Core Developers:
WenSheng Yang WenSheng Yang

View File

@ -1,18 +1,43 @@
cocos2d-x-3.2 ?? cocos2d-x-3.3 ??
[NEW] CCImage: support of software PVRTC v1 decompression
[FIX] Label: can not set charmap after it is created
[FIX] Scale9Sprite: new added sprite will be hidden
[FIX] UIListView: can not insert an item in specific position, it is added at bottom
[FIX] TabelView: can handle touch event though its parents are invisible
[FIX] TextField: can not use backspace to delete a character
[FIX] Others: can not import java library shift by engine correctly when using Eclispe on Android
cocos2d-x-3.2 Jul.17 2014
[NEW] Node: added getChildByName method for get a node that can be cast to Type T
[NEW] FileUtils: could add seach path and resolution order path in front
[FIX] Animation3D: getOrCreate is deprecated and replaced with Animation3D::create [FIX] Animation3D: getOrCreate is deprecated and replaced with Animation3D::create
[FIX] Animate3D: setSpeed() accept negtive value, which means play reverse, getPlayback and setPlayBack are deprecated [FIX] Animate3D: setSpeed() accept negtive value, which means play reverse, getPlayback and setPlayBack are deprecated
[FIX] EditBox: can not set/get text in password mode on Mac OS X
[FIX] Game Controller: joystick y value inversed on iOS
[FIX] GLView: cursor position is not correct if design resolution is different from device resolution [FIX] GLView: cursor position is not correct if design resolution is different from device resolution
[FIX] Label: color can not be set correctly if using system font [FIX] Label: color can not be set correctly if using system font on iOS
[FIX] LabelTTF: may lost chinese characters on linux
[FIX] Lua-binding: support UIVideoPlayer
[FIX] Node: setRotation3D not work based on anchor point [FIX] Node: setRotation3D not work based on anchor point
[FIX] Node: modify regular of enumerateChildren, now it just searchs its children [FIX] Node: modify regular of enumerateChildren, now it just searchs its children
[FIX] Setup.py: not work if using zsh [FIX] Physics integration: body shape will be wrong when using negative value to scale
[FIX] ScrollViewDelegate: make the scrollView delegate methods optional
[FIX] Setup.py: will crash on windows because of checking `zsh`
[FIX] SpriteBatchNode: opacity can not work [FIX] SpriteBatchNode: opacity can not work
[FIX] Sprite3D: may crash on Android if playing animation and replace Scene after come from background [FIX] Sprite3D: may crash on Android if playing animation and replace Scene after come from background
[FIX] UIdget: opacity is wrong when replace texture [FIX] UIwidget: opacity is wrong when replace texture
[FIX] UIRichText: will crash when using utf8 string and the length exceed specified length
[FIX] UIText: can not wrap words automatically
[FIX] UITextField: keyboard can not hide if touching space outside of keyboard [FIX] UITextField: keyboard can not hide if touching space outside of keyboard
[FIX] UITextField: can not wrap words automatically
[FIX] UIVideoPlayer: can not exit full screen mode on Android
[FIX] Others: don't release singleton objects correctly that are needed in the whole game, which will be treated [FIX] Others: don't release singleton objects correctly that are needed in the whole game, which will be treated
as memory leak when using VLD. as memory leak when using VLD.
[FIX] Others: compiling error when building for iOS 64-bit devices with Xcode6 beta3
cocos2d-x-3.2rc0 Jul.7 2014 cocos2d-x-3.2rc0 Jul.7 2014

View File

@ -8,7 +8,7 @@ import shutil
from optparse import OptionParser from optparse import OptionParser
CPP_SAMPLES = ['cpp-empty-test', 'cpp-tests', 'game-controller-test'] CPP_SAMPLES = ['cpp-empty-test', 'cpp-tests', 'game-controller-test']
LUA_SAMPLES = ['lua-empty-test', 'lua-tests'] LUA_SAMPLES = ['lua-empty-test', 'lua-tests', 'lua-game-controller-test']
ALL_SAMPLES = CPP_SAMPLES + LUA_SAMPLES ALL_SAMPLES = CPP_SAMPLES + LUA_SAMPLES
def get_num_of_cpu(): def get_num_of_cpu():
@ -172,6 +172,10 @@ def copy_resources(target, app_android_root):
resources_dir = os.path.join(app_android_root, "../../../cpp-tests/Resources") resources_dir = os.path.join(app_android_root, "../../../cpp-tests/Resources")
copy_files(resources_dir, assets_res_dir) copy_files(resources_dir, assets_res_dir)
if target == "lua-game-controller-test":
print("coming generator game controller")
resources_dir = os.path.join(app_android_root, "../../../game-controller-test/Resources")
copy_files(resources_dir, assets_res_dir)
def build_samples(target,ndk_build_param,android_platform,build_mode): def build_samples(target,ndk_build_param,android_platform,build_mode):
@ -203,7 +207,8 @@ def build_samples(target,ndk_build_param,android_platform,build_mode):
"game-controller-test": "tests/game-controller-test/proj.android", "game-controller-test": "tests/game-controller-test/proj.android",
"cpp-tests": "tests/cpp-tests/proj.android", "cpp-tests": "tests/cpp-tests/proj.android",
"lua-empty-test": "tests/lua-empty-test/project/proj.android", "lua-empty-test": "tests/lua-empty-test/project/proj.android",
"lua-tests": "tests/lua-tests/project/proj.android" "lua-tests": "tests/lua-tests/project/proj.android",
"lua-game-controller-test": "tests/lua-game-controller-test/project/proj.android"
} }
for target in build_targets: for target in build_targets:

View File

@ -1,9 +1,12 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2012 for Windows Desktop # Visual Studio 2012
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libAudio", "..\cocos\audio\proj.win32\CocosDenshion.vcxproj", "{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libAudio", "..\cocos\audio\proj.win32\CocosDenshion.vcxproj", "{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\cocos\2d\cocos2d.vcxproj", "{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\cocos\2d\cocos2d.vcxproj", "{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}"
ProjectSection(ProjectDependencies) = postProject
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25} = {207BC7A9-CCF1-4F2F-A04D-45F72242AE25}
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libBox2D", "..\external\Box2D\proj.win32\Box2D.vcxproj", "{929480E7-23C0-4DF6-8456-096D71547116}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libBox2D", "..\external\Box2D\proj.win32\Box2D.vcxproj", "{929480E7-23C0-4DF6-8456-096D71547116}"
EndProject EndProject
@ -21,13 +24,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libNetwork", "..\cocos\netw
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine", "..\cocos\editor-support\spine\proj.win32\libSpine.vcxproj", "{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine", "..\cocos\editor-support\spine\proj.win32\libSpine.vcxproj", "{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libLocalStorage", "..\cocos\storage\local-storage\proj.win32\libLocalStorage.vcxproj", "{632A8F38-D0F0-4D22-86B3-D69F5E6BF63A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblua", "..\cocos\scripting\lua-bindings\proj.win32\liblua.vcxproj", "{DDC3E27F-004D-4DD4-9DD3-931A013D2159}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblua", "..\cocos\scripting\lua-bindings\proj.win32\liblua.vcxproj", "{DDC3E27F-004D-4DD4-9DD3-931A013D2159}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua-tests", "..\tests\lua-tests\project\proj.win32\lua-tests.win32.vcxproj", "{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua-tests", "..\tests\lua-tests\project\proj.win32\lua-tests.win32.vcxproj", "{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libGUI", "..\cocos\ui\proj.win32\libGUI.vcxproj", "{7E06E92C-537A-442B-9E4A-4761C84F8A1A}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libGUI", "..\cocos\ui\proj.win32\libGUI.vcxproj", "{7E06E92C-537A-442B-9E4A-4761C84F8A1A}"
ProjectSection(ProjectDependencies) = postProject
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-empty-test", "..\tests\cpp-empty-test\proj.win32\cpp-empty-test.vcxproj", "{B8BF9E81-35FD-4582-BA1C-B85FA365BABB}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpp-empty-test", "..\tests\cpp-empty-test\proj.win32\cpp-empty-test.vcxproj", "{B8BF9E81-35FD-4582-BA1C-B85FA365BABB}"
EndProject EndProject
@ -79,10 +83,6 @@ Global
{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Debug|Win32.Build.0 = Debug|Win32 {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Debug|Win32.Build.0 = Debug|Win32
{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|Win32.ActiveCfg = Release|Win32 {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|Win32.ActiveCfg = Release|Win32
{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|Win32.Build.0 = Release|Win32 {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|Win32.Build.0 = Release|Win32
{632A8F38-D0F0-4D22-86B3-D69F5E6BF63A}.Debug|Win32.ActiveCfg = Debug|Win32
{632A8F38-D0F0-4D22-86B3-D69F5E6BF63A}.Debug|Win32.Build.0 = Debug|Win32
{632A8F38-D0F0-4D22-86B3-D69F5E6BF63A}.Release|Win32.ActiveCfg = Release|Win32
{632A8F38-D0F0-4D22-86B3-D69F5E6BF63A}.Release|Win32.Build.0 = Release|Win32
{DDC3E27F-004D-4DD4-9DD3-931A013D2159}.Debug|Win32.ActiveCfg = Debug|Win32 {DDC3E27F-004D-4DD4-9DD3-931A013D2159}.Debug|Win32.ActiveCfg = Debug|Win32
{DDC3E27F-004D-4DD4-9DD3-931A013D2159}.Debug|Win32.Build.0 = Debug|Win32 {DDC3E27F-004D-4DD4-9DD3-931A013D2159}.Debug|Win32.Build.0 = Debug|Win32
{DDC3E27F-004D-4DD4-9DD3-931A013D2159}.Release|Win32.ActiveCfg = Release|Win32 {DDC3E27F-004D-4DD4-9DD3-931A013D2159}.Release|Win32.ActiveCfg = Release|Win32

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "15CBA015196EE56C005877BB"
BuildableName = "lua-game-controller-test iOS.app"
BlueprintName = "lua-game-controller-test iOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "15CBA015196EE56C005877BB"
BuildableName = "lua-game-controller-test iOS.app"
BlueprintName = "lua-game-controller-test iOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "15CBA015196EE56C005877BB"
BuildableName = "lua-game-controller-test iOS.app"
BlueprintName = "lua-game-controller-test iOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "15CBA015196EE56C005877BB"
BuildableName = "lua-game-controller-test iOS.app"
BlueprintName = "lua-game-controller-test iOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -53,11 +53,19 @@ public:
*/ */
virtual std::string description() const; virtual std::string description() const;
/** returns a clone of action */ /** returns a clone of action */
virtual Action* clone() const = 0; virtual Action* clone() const
{
CC_ASSERT(0);
return nullptr;
}
/** returns a new action that performs the exactly the reverse action */ /** returns a new action that performs the exactly the reverse action */
virtual Action* reverse() const = 0; virtual Action* reverse() const
{
CC_ASSERT(0);
return nullptr;
}
//! return true if the action has finished //! return true if the action has finished
virtual bool isDone() const; virtual bool isDone() const;
@ -137,12 +145,20 @@ public:
// //
// Overrides // Overrides
// //
virtual FiniteTimeAction* reverse() const override = 0; virtual FiniteTimeAction* reverse() const override
virtual FiniteTimeAction* clone() const override = 0; {
CC_ASSERT(0);
return nullptr;
}
virtual FiniteTimeAction* clone() const override
{
CC_ASSERT(0);
return nullptr;
}
protected: protected:
FiniteTimeAction() FiniteTimeAction()
: _duration(0) : _duration(0)
{} {}
virtual ~FiniteTimeAction(){} virtual ~FiniteTimeAction(){}
@ -180,7 +196,7 @@ public:
// //
// Override // Override
// //
virtual Speed* clone() const override; virtual Speed* clone() const override;
virtual Speed* reverse() const override; virtual Speed* reverse() const override;
virtual void startWithTarget(Node* target) override; virtual void startWithTarget(Node* target) override;
virtual void stop() override; virtual void stop() override;
@ -231,8 +247,8 @@ public:
// //
// Override // Override
// //
virtual Follow* clone() const override; virtual Follow* clone() const override;
virtual Follow* reverse() const override; virtual Follow* reverse() const override;
virtual void step(float dt) override; virtual void step(float dt) override;
virtual bool isDone() const override; virtual bool isDone() const override;
virtual void stop() override; virtual void stop() override;
@ -285,7 +301,7 @@ protected:
float _rightBoundary; float _rightBoundary;
float _topBoundary; float _topBoundary;
float _bottomBoundary; float _bottomBoundary;
Rect _worldRect; Rect _worldRect;
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(Follow); CC_DISALLOW_COPY_AND_ASSIGN(Follow);

View File

@ -49,8 +49,18 @@ public:
// //
// Overrides // Overrides
// //
virtual ActionEase* clone() const override = 0; virtual ActionEase* clone() const override
virtual ActionEase* reverse() const override = 0; {
CC_ASSERT(0);
return nullptr;
}
virtual ActionEase* reverse() const override
{
CC_ASSERT(0);
return nullptr;
}
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual void stop() override; virtual void stop() override;
virtual void update(float time) override; virtual void update(float time) override;
@ -83,8 +93,16 @@ public:
// //
// Overrides // Overrides
// //
virtual EaseRateAction* clone() const override = 0; virtual EaseRateAction* clone() const override
virtual EaseRateAction* reverse() const override = 0; {
CC_ASSERT(0);
return nullptr;
}
virtual EaseRateAction* reverse() const override
{
CC_ASSERT(0);
return nullptr;
}
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseRateAction() {} EaseRateAction() {}
@ -111,8 +129,8 @@ public:
// Overrides // Overrides
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseIn* clone() const override; virtual EaseIn* clone() const override;
virtual EaseIn* reverse() const override; virtual EaseIn* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseIn() {} EaseIn() {}
@ -134,8 +152,8 @@ public:
// Overrides // Overrides
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseOut* clone() const override; virtual EaseOut* clone() const override;
virtual EaseOut* reverse() const override; virtual EaseOut* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseOut() {} EaseOut() {}
@ -157,8 +175,8 @@ public:
// Overrides // Overrides
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseInOut* clone() const override; virtual EaseInOut* clone() const override;
virtual EaseInOut* reverse() const override; virtual EaseInOut* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseInOut() {} EaseInOut() {}
@ -180,8 +198,8 @@ public:
// Overrides // Overrides
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseExponentialIn* clone() const override; virtual EaseExponentialIn* clone() const override;
virtual ActionEase* reverse() const override; virtual ActionEase* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseExponentialIn() {} EaseExponentialIn() {}
@ -203,8 +221,8 @@ public:
// Overrides // Overrides
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseExponentialOut* clone() const override; virtual EaseExponentialOut* clone() const override;
virtual ActionEase* reverse() const override; virtual ActionEase* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseExponentialOut() {} EaseExponentialOut() {}
@ -226,8 +244,8 @@ public:
// Overrides // Overrides
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseExponentialInOut* clone() const override; virtual EaseExponentialInOut* clone() const override;
virtual EaseExponentialInOut* reverse() const override; virtual EaseExponentialInOut* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseExponentialInOut() {} EaseExponentialInOut() {}
@ -249,8 +267,8 @@ public:
// Overrides // Overrides
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseSineIn* clone() const override; virtual EaseSineIn* clone() const override;
virtual ActionEase* reverse() const override; virtual ActionEase* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseSineIn() {} EaseSineIn() {}
@ -272,8 +290,8 @@ public:
// Overrides // Overrides
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseSineOut* clone() const override; virtual EaseSineOut* clone() const override;
virtual ActionEase* reverse() const override; virtual ActionEase* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseSineOut() {} EaseSineOut() {}
@ -295,8 +313,8 @@ public:
// Overrides // Overrides
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseSineInOut* clone() const override; virtual EaseSineInOut* clone() const override;
virtual EaseSineInOut* reverse() const override; virtual EaseSineInOut* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseSineInOut() {} EaseSineInOut() {}
@ -323,8 +341,17 @@ public:
// //
// Overrides // Overrides
// //
virtual EaseElastic* clone() const override = 0; virtual EaseElastic* clone() const override
virtual EaseElastic* reverse() const override = 0; {
CC_ASSERT(0);
return nullptr;
}
virtual EaseElastic* reverse() const override
{
CC_ASSERT(0);
return nullptr;
}
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseElastic() {} EaseElastic() {}
@ -355,8 +382,8 @@ public:
// Overrides // Overrides
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseElasticIn* clone() const override; virtual EaseElasticIn* clone() const override;
virtual EaseElastic* reverse() const override; virtual EaseElastic* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseElasticIn() {} EaseElasticIn() {}
@ -381,8 +408,8 @@ public:
// Overrides // Overrides
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseElasticOut* clone() const override; virtual EaseElasticOut* clone() const override;
virtual EaseElastic* reverse() const override; virtual EaseElastic* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseElasticOut() {} EaseElasticOut() {}
@ -407,8 +434,8 @@ public:
// Overrides // Overrides
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseElasticInOut* clone() const override; virtual EaseElasticInOut* clone() const override;
virtual EaseElasticInOut* reverse() const override; virtual EaseElasticInOut* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseElasticInOut() {} EaseElasticInOut() {}
@ -428,8 +455,17 @@ class CC_DLL EaseBounce : public ActionEase
public: public:
// Overrides // Overrides
virtual EaseBounce* clone() const override = 0; virtual EaseBounce* clone() const override
virtual EaseBounce* reverse() const override = 0; {
CC_ASSERT(0);
return nullptr;
}
virtual EaseBounce* reverse() const override
{
CC_ASSERT(0);
return nullptr;
}
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseBounce() {} EaseBounce() {}
@ -453,8 +489,8 @@ public:
// Overrides // Overrides
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseBounceIn* clone() const override; virtual EaseBounceIn* clone() const override;
virtual EaseBounce* reverse() const override; virtual EaseBounce* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseBounceIn() {} EaseBounceIn() {}
@ -478,8 +514,8 @@ public:
// Overrides // Overrides
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseBounceOut* clone() const override; virtual EaseBounceOut* clone() const override;
virtual EaseBounce* reverse() const override; virtual EaseBounce* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseBounceOut() {} EaseBounceOut() {}
@ -503,8 +539,8 @@ public:
// Overrides // Overrides
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseBounceInOut* clone() const override; virtual EaseBounceInOut* clone() const override;
virtual EaseBounceInOut* reverse() const override; virtual EaseBounceInOut* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseBounceInOut() {} EaseBounceInOut() {}
@ -528,8 +564,8 @@ public:
// Overrides // Overrides
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseBackIn* clone() const override; virtual EaseBackIn* clone() const override;
virtual ActionEase* reverse() const override; virtual ActionEase* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseBackIn() {} EaseBackIn() {}
@ -553,8 +589,8 @@ public:
// Overrides // Overrides
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseBackOut* clone() const override; virtual EaseBackOut* clone() const override;
virtual ActionEase* reverse() const override; virtual ActionEase* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseBackOut() {} EaseBackOut() {}
@ -578,8 +614,8 @@ public:
// Overrides // Overrides
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseBackInOut* clone() const override; virtual EaseBackInOut* clone() const override;
virtual EaseBackInOut* reverse() const override; virtual EaseBackInOut* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseBackInOut() {} EaseBackInOut() {}
@ -594,52 +630,52 @@ private:
@brief Ease Bezier @brief Ease Bezier
@ingroup Actions @ingroup Actions
*/ */
class EaseBezierAction : public cocos2d::ActionEase class CC_DLL EaseBezierAction : public ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseBezierAction* create(cocos2d::ActionInterval* action); static EaseBezierAction* create(ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseBezierAction* clone() const override; virtual EaseBezierAction* clone() const override;
virtual EaseBezierAction* reverse() const override; virtual EaseBezierAction* reverse() const override;
virtual void setBezierParamer( float p0, float p1, float p2, float p3); virtual void setBezierParamer( float p0, float p1, float p2, float p3);
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseBezierAction() {} EaseBezierAction() {}
virtual ~EaseBezierAction() {} virtual ~EaseBezierAction() {}
protected: protected:
float _p0; float _p0;
float _p1; float _p1;
float _p2; float _p2;
float _p3; float _p3;
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(EaseBezierAction); CC_DISALLOW_COPY_AND_ASSIGN(EaseBezierAction);
}; };
/** /**
@brief Ease Quadratic In @brief Ease Quadratic In
@ingroup Actions @ingroup Actions
*/ */
class EaseQuadraticActionIn:public cocos2d::ActionEase class CC_DLL EaseQuadraticActionIn : public ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseQuadraticActionIn* create(cocos2d::ActionInterval* action); static EaseQuadraticActionIn* create(ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseQuadraticActionIn* clone() const override; virtual EaseQuadraticActionIn* clone() const override;
virtual EaseQuadraticActionIn* reverse() const override; virtual EaseQuadraticActionIn* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseQuadraticActionIn() {} EaseQuadraticActionIn() {}
virtual ~EaseQuadraticActionIn() {} virtual ~EaseQuadraticActionIn() {}
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(EaseQuadraticActionIn); CC_DISALLOW_COPY_AND_ASSIGN(EaseQuadraticActionIn);
}; };
@ -647,22 +683,22 @@ private:
@brief Ease Quadratic Out @brief Ease Quadratic Out
@ingroup Actions @ingroup Actions
*/ */
class EaseQuadraticActionOut:public cocos2d::ActionEase class CC_DLL EaseQuadraticActionOut : public ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseQuadraticActionOut* create(cocos2d::ActionInterval* action); static EaseQuadraticActionOut* create(ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseQuadraticActionOut* clone() const override; virtual EaseQuadraticActionOut* clone() const override;
virtual EaseQuadraticActionOut* reverse() const override; virtual EaseQuadraticActionOut* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseQuadraticActionOut() {} EaseQuadraticActionOut() {}
virtual ~EaseQuadraticActionOut() {} virtual ~EaseQuadraticActionOut() {}
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(EaseQuadraticActionOut); CC_DISALLOW_COPY_AND_ASSIGN(EaseQuadraticActionOut);
}; };
@ -670,88 +706,88 @@ private:
@brief Ease Quadratic InOut @brief Ease Quadratic InOut
@ingroup Actions @ingroup Actions
*/ */
class EaseQuadraticActionInOut:public cocos2d::ActionEase class CC_DLL EaseQuadraticActionInOut : public ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseQuadraticActionInOut* create(cocos2d::ActionInterval* action); static EaseQuadraticActionInOut* create(ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseQuadraticActionInOut* clone() const override; virtual EaseQuadraticActionInOut* clone() const override;
virtual EaseQuadraticActionInOut* reverse() const override; virtual EaseQuadraticActionInOut* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseQuadraticActionInOut() {} EaseQuadraticActionInOut() {}
virtual ~EaseQuadraticActionInOut() {} virtual ~EaseQuadraticActionInOut() {}
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(EaseQuadraticActionInOut); CC_DISALLOW_COPY_AND_ASSIGN(EaseQuadraticActionInOut);
}; };
/** /**
@brief Ease Quartic In @brief Ease Quartic In
@ingroup Actions @ingroup Actions
*/ */
class EaseQuarticActionIn:public cocos2d::ActionEase class CC_DLL EaseQuarticActionIn : public ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseQuarticActionIn* create(cocos2d::ActionInterval* action); static EaseQuarticActionIn* create(ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseQuarticActionIn* clone() const override; virtual EaseQuarticActionIn* clone() const override;
virtual EaseQuarticActionIn* reverse() const override; virtual EaseQuarticActionIn* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseQuarticActionIn() {} EaseQuarticActionIn() {}
virtual ~EaseQuarticActionIn() {} virtual ~EaseQuarticActionIn() {}
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(EaseQuarticActionIn); CC_DISALLOW_COPY_AND_ASSIGN(EaseQuarticActionIn);
}; };
/** /**
@brief Ease Quartic Out @brief Ease Quartic Out
@ingroup Actions @ingroup Actions
*/ */
class EaseQuarticActionOut:public cocos2d::ActionEase class CC_DLL EaseQuarticActionOut : public ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseQuarticActionOut* create(cocos2d::ActionInterval* action); static EaseQuarticActionOut* create(ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseQuarticActionOut* clone() const override; virtual EaseQuarticActionOut* clone() const override;
virtual EaseQuarticActionOut* reverse() const override; virtual EaseQuarticActionOut* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseQuarticActionOut() {} EaseQuarticActionOut() {}
virtual ~EaseQuarticActionOut() {} virtual ~EaseQuarticActionOut() {}
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(EaseQuarticActionOut); CC_DISALLOW_COPY_AND_ASSIGN(EaseQuarticActionOut);
}; };
/** /**
@brief Ease Quartic InOut @brief Ease Quartic InOut
@ingroup Actions @ingroup Actions
*/ */
class EaseQuarticActionInOut:public cocos2d::ActionEase class CC_DLL EaseQuarticActionInOut : public ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseQuarticActionInOut* create(cocos2d::ActionInterval* action); static EaseQuarticActionInOut* create(ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseQuarticActionInOut* clone() const override; virtual EaseQuarticActionInOut* clone() const override;
virtual EaseQuarticActionInOut* reverse() const override; virtual EaseQuarticActionInOut* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseQuarticActionInOut() {} EaseQuarticActionInOut() {}
virtual ~EaseQuarticActionInOut() {} virtual ~EaseQuarticActionInOut() {}
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(EaseQuarticActionInOut); CC_DISALLOW_COPY_AND_ASSIGN(EaseQuarticActionInOut);
}; };
@ -759,198 +795,198 @@ private:
@brief Ease Quintic In @brief Ease Quintic In
@ingroup Actions @ingroup Actions
*/ */
class EaseQuinticActionIn:public cocos2d::ActionEase class CC_DLL EaseQuinticActionIn : public ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseQuinticActionIn* create(cocos2d::ActionInterval* action); static EaseQuinticActionIn* create(ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseQuinticActionIn* clone() const override; virtual EaseQuinticActionIn* clone() const override;
virtual EaseQuinticActionIn* reverse() const override; virtual EaseQuinticActionIn* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseQuinticActionIn() {} EaseQuinticActionIn() {}
virtual ~EaseQuinticActionIn() {} virtual ~EaseQuinticActionIn() {}
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(EaseQuinticActionIn); CC_DISALLOW_COPY_AND_ASSIGN(EaseQuinticActionIn);
}; };
/** /**
@brief Ease Quintic Out @brief Ease Quintic Out
@ingroup Actions @ingroup Actions
*/ */
class EaseQuinticActionOut:public cocos2d::ActionEase class CC_DLL EaseQuinticActionOut : public ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseQuinticActionOut* create(cocos2d::ActionInterval* action); static EaseQuinticActionOut* create(ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseQuinticActionOut* clone() const override; virtual EaseQuinticActionOut* clone() const override;
virtual EaseQuinticActionOut* reverse() const override; virtual EaseQuinticActionOut* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseQuinticActionOut() {} EaseQuinticActionOut() {}
virtual ~EaseQuinticActionOut() {} virtual ~EaseQuinticActionOut() {}
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(EaseQuinticActionOut); CC_DISALLOW_COPY_AND_ASSIGN(EaseQuinticActionOut);
}; };
/** /**
@brief Ease Quintic InOut @brief Ease Quintic InOut
@ingroup Actions @ingroup Actions
*/ */
class EaseQuinticActionInOut:public cocos2d::ActionEase class CC_DLL EaseQuinticActionInOut : public ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseQuinticActionInOut* create(cocos2d::ActionInterval* action); static EaseQuinticActionInOut* create(ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseQuinticActionInOut* clone() const override; virtual EaseQuinticActionInOut* clone() const override;
virtual EaseQuinticActionInOut* reverse() const override; virtual EaseQuinticActionInOut* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseQuinticActionInOut() {} EaseQuinticActionInOut() {}
virtual ~EaseQuinticActionInOut() {} virtual ~EaseQuinticActionInOut() {}
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(EaseQuinticActionInOut); CC_DISALLOW_COPY_AND_ASSIGN(EaseQuinticActionInOut);
}; };
/** /**
@brief Ease Circle In @brief Ease Circle In
@ingroup Actions @ingroup Actions
*/ */
class EaseCircleActionIn:public cocos2d::ActionEase class CC_DLL EaseCircleActionIn : public ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseCircleActionIn* create(cocos2d::ActionInterval* action); static EaseCircleActionIn* create(ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseCircleActionIn* clone() const override; virtual EaseCircleActionIn* clone() const override;
virtual EaseCircleActionIn* reverse() const override; virtual EaseCircleActionIn* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseCircleActionIn() {} EaseCircleActionIn() {}
virtual ~EaseCircleActionIn() {} virtual ~EaseCircleActionIn() {}
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(EaseCircleActionIn); CC_DISALLOW_COPY_AND_ASSIGN(EaseCircleActionIn);
}; };
/** /**
@brief Ease Circle Out @brief Ease Circle Out
@ingroup Actions @ingroup Actions
*/ */
class EaseCircleActionOut:public cocos2d::ActionEase class CC_DLL EaseCircleActionOut : public ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseCircleActionOut* create(cocos2d::ActionInterval* action); static EaseCircleActionOut* create(ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseCircleActionOut* clone() const override; virtual EaseCircleActionOut* clone() const override;
virtual EaseCircleActionOut* reverse() const override; virtual EaseCircleActionOut* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseCircleActionOut() {} EaseCircleActionOut() {}
virtual ~EaseCircleActionOut() {} virtual ~EaseCircleActionOut() {}
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(EaseCircleActionOut); CC_DISALLOW_COPY_AND_ASSIGN(EaseCircleActionOut);
}; };
/** /**
@brief Ease Circle InOut @brief Ease Circle InOut
@ingroup Actions @ingroup Actions
*/ */
class EaseCircleActionInOut:public cocos2d::ActionEase class CC_DLL EaseCircleActionInOut:public ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseCircleActionInOut* create(cocos2d::ActionInterval* action); static EaseCircleActionInOut* create(ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseCircleActionInOut* clone() const override; virtual EaseCircleActionInOut* clone() const override;
virtual EaseCircleActionInOut* reverse() const override; virtual EaseCircleActionInOut* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseCircleActionInOut() {} EaseCircleActionInOut() {}
virtual ~EaseCircleActionInOut() {} virtual ~EaseCircleActionInOut() {}
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(EaseCircleActionInOut); CC_DISALLOW_COPY_AND_ASSIGN(EaseCircleActionInOut);
}; };
/** /**
@brief Ease Cubic In @brief Ease Cubic In
@ingroup Actions @ingroup Actions
*/ */
class EaseCubicActionIn:public cocos2d::ActionEase class CC_DLL EaseCubicActionIn:public ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseCubicActionIn* create(cocos2d::ActionInterval* action); static EaseCubicActionIn* create(ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseCubicActionIn* clone() const override; virtual EaseCubicActionIn* clone() const override;
virtual EaseCubicActionIn* reverse() const override; virtual EaseCubicActionIn* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseCubicActionIn() {} EaseCubicActionIn() {}
virtual ~EaseCubicActionIn() {} virtual ~EaseCubicActionIn() {}
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(EaseCubicActionIn); CC_DISALLOW_COPY_AND_ASSIGN(EaseCubicActionIn);
}; };
/** /**
@brief Ease Cubic Out @brief Ease Cubic Out
@ingroup Actions @ingroup Actions
*/ */
class EaseCubicActionOut:public cocos2d::ActionEase class CC_DLL EaseCubicActionOut : public ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseCubicActionOut* create(cocos2d::ActionInterval* action); static EaseCubicActionOut* create(ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseCubicActionOut* clone() const override; virtual EaseCubicActionOut* clone() const override;
virtual EaseCubicActionOut* reverse() const override; virtual EaseCubicActionOut* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseCubicActionOut() {} EaseCubicActionOut() {}
virtual ~EaseCubicActionOut() {} virtual ~EaseCubicActionOut() {}
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(EaseCubicActionOut); CC_DISALLOW_COPY_AND_ASSIGN(EaseCubicActionOut);
}; };
/** /**
@brief Ease Cubic InOut @brief Ease Cubic InOut
@ingroup Actions @ingroup Actions
*/ */
class EaseCubicActionInOut:public cocos2d::ActionEase class CC_DLL EaseCubicActionInOut : public ActionEase
{ {
public: public:
/** creates the action */ /** creates the action */
static EaseCubicActionInOut* create(cocos2d::ActionInterval* action); static EaseCubicActionInOut* create(ActionInterval* action);
virtual void update(float time) override; virtual void update(float time) override;
virtual EaseCubicActionInOut* clone() const override; virtual EaseCubicActionInOut* clone() const override;
virtual EaseCubicActionInOut* reverse() const override; virtual EaseCubicActionInOut* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
EaseCubicActionInOut() {} EaseCubicActionInOut() {}
virtual ~EaseCubicActionInOut() {} virtual ~EaseCubicActionInOut() {}
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(EaseCubicActionInOut); CC_DISALLOW_COPY_AND_ASSIGN(EaseCubicActionInOut);
}; };
// end of actions group // end of actions group

View File

@ -48,7 +48,11 @@ public:
virtual GridBase* getGrid(); virtual GridBase* getGrid();
// overrides // overrides
virtual GridAction * clone() const override = 0; virtual GridAction * clone() const override
{
CC_ASSERT(0);
return nullptr;
}
virtual GridAction* reverse() const override; virtual GridAction* reverse() const override;
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
@ -109,7 +113,11 @@ public:
void setVertex(const Vec2& position, const Vec3& vertex); void setVertex(const Vec2& position, const Vec3& vertex);
// Overrides // Overrides
virtual Grid3DAction * clone() const override = 0; virtual Grid3DAction * clone() const override
{
CC_ASSERT(0);
return nullptr;
}
}; };
/** @brief Base class for TiledGrid3D actions */ /** @brief Base class for TiledGrid3D actions */
@ -156,7 +164,11 @@ public:
virtual GridBase* getGrid(); virtual GridBase* getGrid();
// Override // Override
virtual TiledGrid3DAction * clone() const override = 0; virtual TiledGrid3DAction * clone() const override
{
CC_ASSERT(0);
return nullptr;
}
}; };
/** @brief AccelDeccelAmplitude action */ /** @brief AccelDeccelAmplitude action */
@ -174,8 +186,8 @@ public:
// Overrides // Overrides
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual void update(float time) override; virtual void update(float time) override;
virtual AccelDeccelAmplitude* clone() const override; virtual AccelDeccelAmplitude* clone() const override;
virtual AccelDeccelAmplitude* reverse() const override; virtual AccelDeccelAmplitude* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
AccelDeccelAmplitude() {} AccelDeccelAmplitude() {}
@ -207,8 +219,8 @@ public:
// Overrides // Overrides
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual void update(float time) override; virtual void update(float time) override;
virtual AccelAmplitude* clone() const override; virtual AccelAmplitude* clone() const override;
virtual AccelAmplitude* reverse() const override; virtual AccelAmplitude* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
AccelAmplitude() {} AccelAmplitude() {}
@ -239,8 +251,8 @@ public:
// overrides // overrides
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual void update(float time) override; virtual void update(float time) override;
virtual DeccelAmplitude* clone() const override; virtual DeccelAmplitude* clone() const override;
virtual DeccelAmplitude* reverse() const override; virtual DeccelAmplitude* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
DeccelAmplitude() {} DeccelAmplitude() {}
@ -270,8 +282,8 @@ public:
// Overrides // Overrides
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual StopGrid* clone() const override; virtual StopGrid* clone() const override;
virtual StopGrid* reverse() const override; virtual StopGrid* reverse() const override;
protected: protected:
StopGrid() {} StopGrid() {}
@ -294,8 +306,8 @@ public:
// Override // Override
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual ReuseGrid* clone() const override; virtual ReuseGrid* clone() const override;
virtual ReuseGrid* reverse() const override; virtual ReuseGrid* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
ReuseGrid() {} ReuseGrid() {}

View File

@ -51,8 +51,18 @@ public:
// //
// Overrides // Overrides
// //
virtual ActionInstant* clone() const override = 0; virtual ActionInstant* clone() const override
virtual ActionInstant * reverse() const override = 0; {
CC_ASSERT(0);
return nullptr;
}
virtual ActionInstant * reverse() const override
{
CC_ASSERT(0);
return nullptr;
}
virtual bool isDone() const override; virtual bool isDone() const override;
virtual void step(float dt) override; virtual void step(float dt) override;
virtual void update(float time) override; virtual void update(float time) override;
@ -72,7 +82,7 @@ public:
// //
virtual void update(float time) override; virtual void update(float time) override;
virtual ActionInstant* reverse() const override; virtual ActionInstant* reverse() const override;
virtual Show* clone() const override; virtual Show* clone() const override;
protected: protected:
Show(){} Show(){}
@ -95,8 +105,8 @@ public:
// Overrides // Overrides
// //
virtual void update(float time) override; virtual void update(float time) override;
virtual ActionInstant* reverse() const override; virtual ActionInstant* reverse() const override;
virtual Hide* clone() const override; virtual Hide* clone() const override;
protected: protected:
Hide(){} Hide(){}
@ -118,8 +128,8 @@ public:
// Overrides // Overrides
// //
virtual void update(float time) override; virtual void update(float time) override;
virtual ToggleVisibility* reverse() const override; virtual ToggleVisibility* reverse() const override;
virtual ToggleVisibility* clone() const override; virtual ToggleVisibility* clone() const override;
protected: protected:
ToggleVisibility(){} ToggleVisibility(){}
@ -135,25 +145,25 @@ private:
class CC_DLL RemoveSelf : public ActionInstant class CC_DLL RemoveSelf : public ActionInstant
{ {
public: public:
/** create the action */ /** create the action */
static RemoveSelf * create(bool isNeedCleanUp = true); static RemoveSelf * create(bool isNeedCleanUp = true);
// //
// Override // Override
// //
virtual void update(float time) override; virtual void update(float time) override;
virtual RemoveSelf* clone() const override; virtual RemoveSelf* clone() const override;
virtual RemoveSelf* reverse() const override; virtual RemoveSelf* reverse() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
RemoveSelf() : _isNeedCleanUp(true){} RemoveSelf() : _isNeedCleanUp(true){}
virtual ~RemoveSelf(){} virtual ~RemoveSelf(){}
/** init the action */ /** init the action */
bool init(bool isNeedCleanUp); bool init(bool isNeedCleanUp);
protected: protected:
bool _isNeedCleanUp; bool _isNeedCleanUp;
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(RemoveSelf); CC_DISALLOW_COPY_AND_ASSIGN(RemoveSelf);
@ -173,8 +183,8 @@ public:
// Overrides // Overrides
// //
virtual void update(float time) override; virtual void update(float time) override;
virtual FlipX* reverse() const override; virtual FlipX* reverse() const override;
virtual FlipX* clone() const override; virtual FlipX* clone() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
FlipX() :_flipX(false) {} FlipX() :_flipX(false) {}
@ -204,8 +214,8 @@ public:
// Overrides // Overrides
// //
virtual void update(float time) override; virtual void update(float time) override;
virtual FlipY* reverse() const override; virtual FlipY* reverse() const override;
virtual FlipY* clone() const override; virtual FlipY* clone() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
FlipY() :_flipY(false) {} FlipY() :_flipY(false) {}
@ -234,8 +244,8 @@ public:
// Overrides // Overrides
// //
virtual void update(float time) override; virtual void update(float time) override;
virtual Place* reverse() const override; virtual Place* reverse() const override;
virtual Place* clone() const override; virtual Place* clone() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
Place(){} Place(){}
@ -257,18 +267,18 @@ private:
class CC_DLL CallFunc : public ActionInstant //<NSCopying> class CC_DLL CallFunc : public ActionInstant //<NSCopying>
{ {
public: public:
/** creates the action with the callback of type std::function<void()>. /** creates the action with the callback of type std::function<void()>.
This is the preferred way to create the callback. This is the preferred way to create the callback.
* When this funtion bound in js or lua ,the input param will be changed * When this funtion bound in js or lua ,the input param will be changed
* In js: var create(var func, var this, var [data]) or var create(var func) * In js: var create(var func, var this, var [data]) or var create(var func)
* In lua:local create(local funcID) * In lua:local create(local funcID)
*/ */
static CallFunc * create(const std::function<void()>& func); static CallFunc * create(const std::function<void()>& func);
/** creates the action with the callback /** creates the action with the callback
typedef void (Ref::*SEL_CallFunc)(); typedef void (Ref::*SEL_CallFunc)();
@deprecated Use the std::function API instead. @deprecated Use the std::function API instead.
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
@ -296,8 +306,8 @@ public:
// Overrides // Overrides
// //
virtual void update(float time) override; virtual void update(float time) override;
virtual CallFunc* reverse() const override; virtual CallFunc* reverse() const override;
virtual CallFunc* clone() const override; virtual CallFunc* clone() const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
CallFunc() CallFunc()
@ -308,16 +318,16 @@ CC_CONSTRUCTOR_ACCESS:
} }
virtual ~CallFunc(); virtual ~CallFunc();
/** initializes the action with the callback /** initializes the action with the callback
typedef void (Ref::*SEL_CallFunc)(); typedef void (Ref::*SEL_CallFunc)();
@deprecated Use the std::function API instead. @deprecated Use the std::function API instead.
*/ */
CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Ref* target); CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Ref* target);
/** initializes the action with the std::function<void()> /** initializes the action with the std::function<void()>
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
bool initWithFunction(const std::function<void()>& func); bool initWithFunction(const std::function<void()>& func);
protected: protected:
@ -331,7 +341,7 @@ protected:
}; };
/** function that will be called */ /** function that will be called */
std::function<void()> _function; std::function<void()> _function;
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(CallFunc); CC_DISALLOW_COPY_AND_ASSIGN(CallFunc);
@ -345,8 +355,8 @@ class CC_DLL CallFuncN : public CallFunc
{ {
public: public:
/** creates the action with the callback of type std::function<void()>. /** creates the action with the callback of type std::function<void()>.
This is the preferred way to create the callback. This is the preferred way to create the callback.
*/ */
static CallFuncN * create(const std::function<void(Node*)>& func); static CallFuncN * create(const std::function<void(Node*)>& func);
/** creates the action with the callback /** creates the action with the callback
@ -359,7 +369,7 @@ public:
// //
// Overrides // Overrides
// //
virtual CallFuncN* clone() const override; virtual CallFuncN* clone() const override;
virtual void execute() override; virtual void execute() override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
@ -399,7 +409,7 @@ public:
// //
// Overrides // Overrides
// //
virtual __CCCallFuncND* clone() const override; virtual __CCCallFuncND* clone() const override;
virtual void execute() override; virtual void execute() override;
protected: protected:
@ -435,7 +445,7 @@ public:
// //
// Overrides // Overrides
// //
virtual __CCCallFuncO* clone() const override; virtual __CCCallFuncO* clone() const override;
virtual void execute() override; virtual void execute() override;
Ref* getObject() const; Ref* getObject() const;

View File

@ -77,13 +77,23 @@ public:
virtual bool isDone(void) const override; virtual bool isDone(void) const override;
virtual void step(float dt) override; virtual void step(float dt) override;
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual ActionInterval* reverse() const override = 0; virtual ActionInterval* reverse() const override
virtual ActionInterval *clone() const override = 0; {
CC_ASSERT(0);
return nullptr;
}
protected: virtual ActionInterval *clone() const override
{
CC_ASSERT(0);
return nullptr;
}
CC_CONSTRUCTOR_ACCESS:
/** initializes the action */ /** initializes the action */
bool initWithDuration(float d); bool initWithDuration(float d);
protected:
float _elapsed; float _elapsed;
bool _firstTick; bool _firstTick;
}; };
@ -131,7 +141,7 @@ public:
// Overrides // Overrides
// //
virtual Sequence* clone() const override; virtual Sequence* clone() const override;
virtual Sequence* reverse() const override; virtual Sequence* reverse() const override;
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual void stop(void) override; virtual void stop(void) override;
virtual void update(float t) override; virtual void update(float t) override;
@ -180,7 +190,7 @@ public:
// Overrides // Overrides
// //
virtual Repeat* clone() const override; virtual Repeat* clone() const override;
virtual Repeat* reverse() const override; virtual Repeat* reverse() const override;
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual void stop(void) override; virtual void stop(void) override;
virtual void update(float dt) override; virtual void update(float dt) override;
@ -234,7 +244,7 @@ public:
// Overrides // Overrides
// //
virtual RepeatForever* clone() const override; virtual RepeatForever* clone() const override;
virtual RepeatForever* reverse(void) const override; virtual RepeatForever* reverse(void) const override;
virtual void startWithTarget(Node* target) override; virtual void startWithTarget(Node* target) override;
virtual void step(float dt) override; virtual void step(float dt) override;
virtual bool isDone(void) const override; virtual bool isDone(void) const override;
@ -301,7 +311,7 @@ public:
// Overrides // Overrides
// //
virtual Spawn* clone() const override; virtual Spawn* clone() const override;
virtual Spawn* reverse(void) const override; virtual Spawn* reverse(void) const override;
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual void stop(void) override; virtual void stop(void) override;
virtual void update(float time) override; virtual void update(float time) override;
@ -378,7 +388,7 @@ public:
// Override // Override
// //
virtual RotateBy* clone() const override; virtual RotateBy* clone() const override;
virtual RotateBy* reverse(void) const override; virtual RotateBy* reverse(void) const override;
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual void update(float time) override; virtual void update(float time) override;
@ -422,7 +432,7 @@ public:
// Overrides // Overrides
// //
virtual MoveBy* clone() const override; virtual MoveBy* clone() const override;
virtual MoveBy* reverse(void) const override; virtual MoveBy* reverse(void) const override;
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual void update(float time) override; virtual void update(float time) override;
@ -486,7 +496,7 @@ public:
// Overrides // Overrides
// //
virtual SkewTo* clone() const override; virtual SkewTo* clone() const override;
virtual SkewTo* reverse(void) const override; virtual SkewTo* reverse(void) const override;
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual void update(float time) override; virtual void update(float time) override;
@ -524,7 +534,7 @@ public:
// //
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual SkewBy* clone() const override; virtual SkewBy* clone() const override;
virtual SkewBy* reverse(void) const override; virtual SkewBy* reverse(void) const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
SkewBy() {} SkewBy() {}
@ -548,7 +558,7 @@ public:
// Overrides // Overrides
// //
virtual JumpBy* clone() const override; virtual JumpBy* clone() const override;
virtual JumpBy* reverse(void) const override; virtual JumpBy* reverse(void) const override;
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual void update(float time) override; virtual void update(float time) override;
@ -583,11 +593,13 @@ public:
// //
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual JumpTo* clone() const override; virtual JumpTo* clone() const override;
virtual JumpTo* reverse(void) const override; virtual JumpTo* reverse(void) const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
JumpTo() {} JumpTo() {}
virtual ~JumpTo() {} virtual ~JumpTo() {}
private:
CC_DISALLOW_COPY_AND_ASSIGN(JumpTo); CC_DISALLOW_COPY_AND_ASSIGN(JumpTo);
}; };
@ -620,7 +632,7 @@ public:
// Overrides // Overrides
// //
virtual BezierBy* clone() const override; virtual BezierBy* clone() const override;
virtual BezierBy* reverse(void) const override; virtual BezierBy* reverse(void) const override;
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual void update(float time) override; virtual void update(float time) override;
@ -660,7 +672,7 @@ public:
// //
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual BezierTo* clone() const override; virtual BezierTo* clone() const override;
virtual BezierTo* reverse(void) const override; virtual BezierTo* reverse(void) const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
BezierTo() {} BezierTo() {}
@ -695,7 +707,7 @@ public:
// Overrides // Overrides
// //
virtual ScaleTo* clone() const override; virtual ScaleTo* clone() const override;
virtual ScaleTo* reverse(void) const override; virtual ScaleTo* reverse(void) const override;
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual void update(float time) override; virtual void update(float time) override;
@ -748,7 +760,7 @@ public:
// //
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual ScaleBy* clone() const override; virtual ScaleBy* clone() const override;
virtual ScaleBy* reverse(void) const override; virtual ScaleBy* reverse(void) const override;
CC_CONSTRUCTOR_ACCESS: CC_CONSTRUCTOR_ACCESS:
ScaleBy() {} ScaleBy() {}
@ -770,7 +782,7 @@ public:
// Overrides // Overrides
// //
virtual Blink* clone() const override; virtual Blink* clone() const override;
virtual Blink* reverse() const override; virtual Blink* reverse() const override;
virtual void update(float time) override; virtual void update(float time) override;
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual void stop() override; virtual void stop() override;
@ -804,7 +816,7 @@ public:
// Overrides // Overrides
// //
virtual FadeTo* clone() const override; virtual FadeTo* clone() const override;
virtual FadeTo* reverse(void) const override; virtual FadeTo* reverse(void) const override;
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual void update(float time) override; virtual void update(float time) override;
@ -838,7 +850,7 @@ public:
// //
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual FadeIn* clone() const override; virtual FadeIn* clone() const override;
virtual FadeTo* reverse(void) const override; virtual FadeTo* reverse(void) const override;
void setReverseAction(FadeTo* ac); void setReverseAction(FadeTo* ac);
@ -865,7 +877,7 @@ public:
// //
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual FadeOut* clone() const override; virtual FadeOut* clone() const override;
virtual FadeTo* reverse(void) const override; virtual FadeTo* reverse(void) const override;
void setReverseAction(FadeTo* ac); void setReverseAction(FadeTo* ac);
@ -890,7 +902,7 @@ public:
// Overrides // Overrides
// //
virtual TintTo* clone() const override; virtual TintTo* clone() const override;
virtual TintTo* reverse(void) const override; virtual TintTo* reverse(void) const override;
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual void update(float time) override; virtual void update(float time) override;
@ -922,7 +934,7 @@ public:
// Overrides // Overrides
// //
virtual TintBy* clone() const override; virtual TintBy* clone() const override;
virtual TintBy* reverse() const override; virtual TintBy* reverse() const override;
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual void update(float time) override; virtual void update(float time) override;
@ -985,7 +997,7 @@ public:
// //
// Overrides // Overrides
// //
virtual ReverseTime* reverse() const override; virtual ReverseTime* reverse() const override;
virtual ReverseTime* clone() const override; virtual ReverseTime* clone() const override;
virtual void startWithTarget(Node *target) override; virtual void startWithTarget(Node *target) override;
virtual void stop(void) override; virtual void stop(void) override;

View File

@ -30,6 +30,7 @@ THE SOFTWARE.
#include "base/CCRef.h" #include "base/CCRef.h"
#include "base/CCMap.h" #include "base/CCMap.h"
#include "base/CCValue.h" #include "base/CCValue.h"
#include "2d/CCAnimation.h"
#include <string> #include <string>

View File

@ -89,12 +89,33 @@ bool ComponentContainer::remove(const std::string& name)
com->setOwner(nullptr); com->setOwner(nullptr);
_components->erase(iter); _components->erase(iter);
ret = true; ret = true;
} while(0); } while(0);
return ret; return ret;
} }
bool ComponentContainer::remove(Component *com)
{
bool ret = false;
do
{
CC_BREAK_IF(!_components);
for (auto iter = _components->begin(); iter != _components->end(); ++iter)
{
if (iter->second == com)
{
com->onExit();
com->setOwner(nullptr);
_components->erase(iter);
break;
}
}
ret = true;
} while(0);
return ret;
}
void ComponentContainer::removeAll() void ComponentContainer::removeAll()
{ {
if (_components != nullptr) if (_components != nullptr)

View File

@ -50,6 +50,7 @@ public:
virtual Component* get(const std::string& name) const; virtual Component* get(const std::string& name) const;
virtual bool add(Component *com); virtual bool add(Component *com);
virtual bool remove(const std::string& name); virtual bool remove(const std::string& name);
virtual bool remove(Component *com);
virtual void removeAll(); virtual void removeAll();
virtual void visit(float delta); virtual void visit(float delta);
public: public:

View File

@ -79,85 +79,85 @@ class PointArray;
namespace DrawPrimitives namespace DrawPrimitives
{ {
/** Initializes the drawing primitives */ /** Initializes the drawing primitives */
void init(); void CC_DLL init();
/** Frees allocated resources by the drawing primitives */ /** Frees allocated resources by the drawing primitives */
void free(); void CC_DLL free();
/** draws a point given x and y coordinate measured in points */ /** draws a point given x and y coordinate measured in points */
void drawPoint(const Vec2& point); void CC_DLL drawPoint(const Vec2& point);
/** draws an array of points. /** draws an array of points.
@since v0.7.2 @since v0.7.2
*/ */
void drawPoints(const Vec2 *points, unsigned int numberOfPoints); void CC_DLL drawPoints(const Vec2 *points, unsigned int numberOfPoints);
/** draws a line given the origin and destination point measured in points */ /** draws a line given the origin and destination point measured in points */
void drawLine(const Vec2& origin, const Vec2& destination); void CC_DLL drawLine(const Vec2& origin, const Vec2& destination);
/** draws a rectangle given the origin and destination point measured in points. */ /** draws a rectangle given the origin and destination point measured in points. */
void drawRect(Vec2 origin, Vec2 destination); void CC_DLL drawRect(Vec2 origin, Vec2 destination);
/** draws a solid rectangle given the origin and destination point measured in points. /** draws a solid rectangle given the origin and destination point measured in points.
@since 1.1 @since 1.1
*/ */
void drawSolidRect(Vec2 origin, Vec2 destination, Color4F color); void CC_DLL drawSolidRect(Vec2 origin, Vec2 destination, Color4F color);
/** draws a polygon given a pointer to point coordinates and the number of vertices measured in points. /** draws a polygon given a pointer to point coordinates and the number of vertices measured in points.
The polygon can be closed or open The polygon can be closed or open
*/ */
void drawPoly(const Vec2 *vertices, unsigned int numOfVertices, bool closePolygon); void CC_DLL drawPoly(const Vec2 *vertices, unsigned int numOfVertices, bool closePolygon);
/** draws a solid polygon given a pointer to CGPoint coordinates, the number of vertices measured in points, and a color. /** draws a solid polygon given a pointer to CGPoint coordinates, the number of vertices measured in points, and a color.
*/ */
void drawSolidPoly(const Vec2 *poli, unsigned int numberOfPoints, Color4F color); void CC_DLL drawSolidPoly(const Vec2 *poli, unsigned int numberOfPoints, Color4F color);
/** draws a circle given the center, radius and number of segments. */ /** draws a circle given the center, radius and number of segments. */
void drawCircle(const Vec2& center, float radius, float angle, unsigned int segments, bool drawLineToCenter, float scaleX, float scaleY); void CC_DLL drawCircle(const Vec2& center, float radius, float angle, unsigned int segments, bool drawLineToCenter, float scaleX, float scaleY);
void drawCircle(const Vec2& center, float radius, float angle, unsigned int segments, bool drawLineToCenter); void CC_DLL drawCircle(const Vec2& center, float radius, float angle, unsigned int segments, bool drawLineToCenter);
/** draws a solid circle given the center, radius and number of segments. */ /** draws a solid circle given the center, radius and number of segments. */
void drawSolidCircle(const Vec2& center, float radius, float angle, unsigned int segments, float scaleX, float scaleY); void CC_DLL drawSolidCircle(const Vec2& center, float radius, float angle, unsigned int segments, float scaleX, float scaleY);
void drawSolidCircle(const Vec2& center, float radius, float angle, unsigned int segments); void CC_DLL drawSolidCircle(const Vec2& center, float radius, float angle, unsigned int segments);
/** draws a quad bezier path /** draws a quad bezier path
@warning This function could be pretty slow. Use it only for debugging purposes. @warning This function could be pretty slow. Use it only for debugging purposes.
@since v0.8 @since v0.8
*/ */
void drawQuadBezier(const Vec2& origin, const Vec2& control, const Vec2& destination, unsigned int segments); void CC_DLL drawQuadBezier(const Vec2& origin, const Vec2& control, const Vec2& destination, unsigned int segments);
/** draws a cubic bezier path /** draws a cubic bezier path
@warning This function could be pretty slow. Use it only for debugging purposes. @warning This function could be pretty slow. Use it only for debugging purposes.
@since v0.8 @since v0.8
*/ */
void drawCubicBezier(const Vec2& origin, const Vec2& control1, const Vec2& control2, const Vec2& destination, unsigned int segments); void CC_DLL drawCubicBezier(const Vec2& origin, const Vec2& control1, const Vec2& control2, const Vec2& destination, unsigned int segments);
/** draws a Catmull Rom path. /** draws a Catmull Rom path.
@warning This function could be pretty slow. Use it only for debugging purposes. @warning This function could be pretty slow. Use it only for debugging purposes.
@since v2.0 @since v2.0
*/ */
void drawCatmullRom(PointArray *arrayOfControlPoints, unsigned int segments); void CC_DLL drawCatmullRom(PointArray *arrayOfControlPoints, unsigned int segments);
/** draws a Cardinal Spline path. /** draws a Cardinal Spline path.
@warning This function could be pretty slow. Use it only for debugging purposes. @warning This function could be pretty slow. Use it only for debugging purposes.
@since v2.0 @since v2.0
*/ */
void drawCardinalSpline(PointArray *config, float tension, unsigned int segments); void CC_DLL drawCardinalSpline(PointArray *config, float tension, unsigned int segments);
/** set the drawing color with 4 unsigned bytes /** set the drawing color with 4 unsigned bytes
@since v2.0 @since v2.0
*/ */
void setDrawColor4B(GLubyte r, GLubyte g, GLubyte b, GLubyte a); void CC_DLL setDrawColor4B(GLubyte r, GLubyte g, GLubyte b, GLubyte a);
/** set the drawing color with 4 floats /** set the drawing color with 4 floats
@since v2.0 @since v2.0
*/ */
void setDrawColor4F(GLfloat r, GLfloat g, GLfloat b, GLfloat a); void CC_DLL setDrawColor4F(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
/** set the point size in points. Default 1. /** set the point size in points. Default 1.
@since v2.0 @since v2.0
*/ */
void setPointSize(GLfloat pointSize); void CC_DLL setPointSize(GLfloat pointSize);
}; };

View File

@ -49,15 +49,16 @@ THE SOFTWARE.
#include <algorithm> #include <algorithm>
NS_CC_BEGIN NS_CC_BEGIN
namespace experimental {
const int FastTMXLayer::FAST_TMX_ORIENTATION_ORTHO = 0; const int TMXLayer::FAST_TMX_ORIENTATION_ORTHO = 0;
const int FastTMXLayer::FAST_TMX_ORIENTATION_HEX = 1; const int TMXLayer::FAST_TMX_ORIENTATION_HEX = 1;
const int FastTMXLayer::FAST_TMX_ORIENTATION_ISO = 2; const int TMXLayer::FAST_TMX_ORIENTATION_ISO = 2;
// FastTMXLayer - init & alloc & dealloc // FastTMXLayer - init & alloc & dealloc
FastTMXLayer * FastTMXLayer::create(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo) TMXLayer * TMXLayer::create(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo)
{ {
FastTMXLayer *ret = new FastTMXLayer(); TMXLayer *ret = new TMXLayer();
if (ret->initWithTilesetInfo(tilesetInfo, layerInfo, mapInfo)) if (ret->initWithTilesetInfo(tilesetInfo, layerInfo, mapInfo))
{ {
ret->autorelease(); ret->autorelease();
@ -66,7 +67,7 @@ FastTMXLayer * FastTMXLayer::create(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *l
return nullptr; return nullptr;
} }
bool FastTMXLayer::initWithTilesetInfo(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo) bool TMXLayer::initWithTilesetInfo(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo)
{ {
if( tilesetInfo ) if( tilesetInfo )
@ -108,7 +109,7 @@ bool FastTMXLayer::initWithTilesetInfo(TMXTilesetInfo *tilesetInfo, TMXLayerInfo
return true; return true;
} }
FastTMXLayer::FastTMXLayer() TMXLayer::TMXLayer()
: _layerName("") : _layerName("")
, _layerSize(Size::ZERO) , _layerSize(Size::ZERO)
, _mapTileSize(Size::ZERO) , _mapTileSize(Size::ZERO)
@ -124,7 +125,7 @@ FastTMXLayer::FastTMXLayer()
_buffersVBO[0] = _buffersVBO[1] = 0; _buffersVBO[0] = _buffersVBO[1] = 0;
} }
FastTMXLayer::~FastTMXLayer() TMXLayer::~TMXLayer()
{ {
CC_SAFE_RELEASE(_tileSet); CC_SAFE_RELEASE(_tileSet);
CC_SAFE_RELEASE(_texture); CC_SAFE_RELEASE(_texture);
@ -140,7 +141,7 @@ FastTMXLayer::~FastTMXLayer()
} }
} }
void FastTMXLayer::draw(Renderer *renderer, const Mat4& transform, uint32_t flags) void TMXLayer::draw(Renderer *renderer, const Mat4& transform, uint32_t flags)
{ {
updateTotalQuads(); updateTotalQuads();
@ -169,13 +170,13 @@ void FastTMXLayer::draw(Renderer *renderer, const Mat4& transform, uint32_t flag
auto& cmd = _renderCommands[index++]; auto& cmd = _renderCommands[index++];
cmd.init(iter.first); cmd.init(iter.first);
cmd.func = CC_CALLBACK_0(FastTMXLayer::onDraw, this, _indicesVertexZOffsets[iter.first], iter.second); cmd.func = CC_CALLBACK_0(TMXLayer::onDraw, this, _indicesVertexZOffsets[iter.first], iter.second);
renderer->addCommand(&cmd); renderer->addCommand(&cmd);
} }
} }
void FastTMXLayer::onDraw(int offset, int count) void TMXLayer::onDraw(int offset, int count)
{ {
GL::bindTexture2D(_texture->getName()); GL::bindTexture2D(_texture->getName());
getGLProgramState()->apply(_modelViewTransform); getGLProgramState()->apply(_modelViewTransform);
@ -194,7 +195,7 @@ void FastTMXLayer::onDraw(int offset, int count)
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, count * 4); CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, count * 4);
} }
void FastTMXLayer::updateTiles(const Rect& culledRect) void TMXLayer::updateTiles(const Rect& culledRect)
{ {
Rect visibleTiles = culledRect; Rect visibleTiles = culledRect;
Size mapTileSize = CC_SIZE_PIXELS_TO_POINTS(_mapTileSize); Size mapTileSize = CC_SIZE_PIXELS_TO_POINTS(_mapTileSize);
@ -287,7 +288,7 @@ void FastTMXLayer::updateTiles(const Rect& culledRect)
} }
void FastTMXLayer::updateVertexBuffer() void TMXLayer::updateVertexBuffer()
{ {
GL::bindVAO(0); GL::bindVAO(0);
if(!glIsBuffer(_buffersVBO[0])) if(!glIsBuffer(_buffersVBO[0]))
@ -300,7 +301,7 @@ void FastTMXLayer::updateVertexBuffer()
glBindBuffer(GL_ARRAY_BUFFER, 0); glBindBuffer(GL_ARRAY_BUFFER, 0);
} }
void FastTMXLayer::updateIndexBuffer() void TMXLayer::updateIndexBuffer()
{ {
if(!glIsBuffer(_buffersVBO[1])) if(!glIsBuffer(_buffersVBO[1]))
{ {
@ -312,7 +313,7 @@ void FastTMXLayer::updateIndexBuffer()
} }
// FastTMXLayer - setup Tiles // FastTMXLayer - setup Tiles
void FastTMXLayer::setupTiles() void TMXLayer::setupTiles()
{ {
// Optimization: quick hack that sets the image size on the tileset // Optimization: quick hack that sets the image size on the tileset
_tileSet->_imageSize = _texture->getContentSizeInPixels(); _tileSet->_imageSize = _texture->getContentSizeInPixels();
@ -352,7 +353,7 @@ void FastTMXLayer::setupTiles()
} }
Mat4 FastTMXLayer::tileToNodeTransform() Mat4 TMXLayer::tileToNodeTransform()
{ {
float w = _mapTileSize.width / CC_CONTENT_SCALE_FACTOR(); float w = _mapTileSize.width / CC_CONTENT_SCALE_FACTOR();
float h = _mapTileSize.height / CC_CONTENT_SCALE_FACTOR(); float h = _mapTileSize.height / CC_CONTENT_SCALE_FACTOR();
@ -404,7 +405,7 @@ Mat4 FastTMXLayer::tileToNodeTransform()
} }
void FastTMXLayer::updateTotalQuads() void TMXLayer::updateTotalQuads()
{ {
if(_quadsDirty) if(_quadsDirty)
{ {
@ -536,7 +537,7 @@ void FastTMXLayer::updateTotalQuads()
} }
// removing / getting tiles // removing / getting tiles
Sprite* FastTMXLayer::getTileAt(const Vec2& tileCoordinate) Sprite* TMXLayer::getTileAt(const Vec2& tileCoordinate)
{ {
CCASSERT( tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >=0 && tileCoordinate.y >=0, "TMXLayer: invalid position"); CCASSERT( tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >=0 && tileCoordinate.y >=0, "TMXLayer: invalid position");
CCASSERT( _tiles, "TMXLayer: the tiles map has been released"); CCASSERT( _tiles, "TMXLayer: the tiles map has been released");
@ -576,7 +577,7 @@ Sprite* FastTMXLayer::getTileAt(const Vec2& tileCoordinate)
return tile; return tile;
} }
int FastTMXLayer::getTileGIDAt(const Vec2& tileCoordinate, TMXTileFlags* flags/* = nullptr*/) int TMXLayer::getTileGIDAt(const Vec2& tileCoordinate, TMXTileFlags* flags/* = nullptr*/)
{ {
CCASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >=0 && tileCoordinate.y >=0, "TMXLayer: invalid position"); CCASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >=0 && tileCoordinate.y >=0, "TMXLayer: invalid position");
CCASSERT(_tiles, "TMXLayer: the tiles map has been released"); CCASSERT(_tiles, "TMXLayer: the tiles map has been released");
@ -602,12 +603,12 @@ int FastTMXLayer::getTileGIDAt(const Vec2& tileCoordinate, TMXTileFlags* flags/*
return (tile & kTMXFlippedMask); return (tile & kTMXFlippedMask);
} }
Vec2 FastTMXLayer::getPositionAt(const Vec2& pos) Vec2 TMXLayer::getPositionAt(const Vec2& pos)
{ {
return PointApplyTransform(pos, _tileToNodeTransform); return PointApplyTransform(pos, _tileToNodeTransform);
} }
int FastTMXLayer::getVertexZForPos(const Vec2& pos) int TMXLayer::getVertexZForPos(const Vec2& pos)
{ {
int ret = 0; int ret = 0;
int maxVal = 0; int maxVal = 0;
@ -638,7 +639,7 @@ int FastTMXLayer::getVertexZForPos(const Vec2& pos)
return ret; return ret;
} }
void FastTMXLayer::removeTileAt(const Vec2& tileCoordinate) void TMXLayer::removeTileAt(const Vec2& tileCoordinate)
{ {
CCASSERT( tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >=0 && tileCoordinate.y >=0, "TMXLayer: invalid position"); CCASSERT( tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >=0 && tileCoordinate.y >=0, "TMXLayer: invalid position");
@ -661,7 +662,7 @@ void FastTMXLayer::removeTileAt(const Vec2& tileCoordinate)
} }
} }
void FastTMXLayer::setFlaggedTileGIDByIndex(int index, int gid) void TMXLayer::setFlaggedTileGIDByIndex(int index, int gid)
{ {
if(gid == _tiles[index]) return; if(gid == _tiles[index]) return;
_tiles[index] = gid; _tiles[index] = gid;
@ -669,7 +670,7 @@ void FastTMXLayer::setFlaggedTileGIDByIndex(int index, int gid)
_dirty = true; _dirty = true;
} }
void FastTMXLayer::removeChild(Node* node, bool cleanup) void TMXLayer::removeChild(Node* node, bool cleanup)
{ {
int tag = node->getTag(); int tag = node->getTag();
auto it = _spriteContainer.find(tag); auto it = _spriteContainer.find(tag);
@ -680,8 +681,8 @@ void FastTMXLayer::removeChild(Node* node, bool cleanup)
Node::removeChild(node, cleanup); Node::removeChild(node, cleanup);
} }
// FastTMXLayer - Properties // TMXLayer - Properties
Value FastTMXLayer::getProperty(const std::string& propertyName) const Value TMXLayer::getProperty(const std::string& propertyName) const
{ {
if (_properties.find(propertyName) != _properties.end()) if (_properties.find(propertyName) != _properties.end())
return _properties.at(propertyName); return _properties.at(propertyName);
@ -689,7 +690,7 @@ Value FastTMXLayer::getProperty(const std::string& propertyName) const
return Value(); return Value();
} }
void FastTMXLayer::parseInternalProperties() void TMXLayer::parseInternalProperties()
{ {
auto vertexz = getProperty("cc_vertexz"); auto vertexz = getProperty("cc_vertexz");
if (vertexz.isNull()) return; if (vertexz.isNull()) return;
@ -719,7 +720,7 @@ void FastTMXLayer::parseInternalProperties()
} }
//CCTMXLayer2 - obtaining positions, offset //CCTMXLayer2 - obtaining positions, offset
Vec2 FastTMXLayer::calculateLayerOffset(const Vec2& pos) Vec2 TMXLayer::calculateLayerOffset(const Vec2& pos)
{ {
Vec2 ret = Vec2::ZERO; Vec2 ret = Vec2::ZERO;
switch (_layerOrientation) switch (_layerOrientation)
@ -740,12 +741,12 @@ Vec2 FastTMXLayer::calculateLayerOffset(const Vec2& pos)
} }
// TMXLayer - adding / remove tiles // TMXLayer - adding / remove tiles
void FastTMXLayer::setTileGID(int gid, const Vec2& tileCoordinate) void TMXLayer::setTileGID(int gid, const Vec2& tileCoordinate)
{ {
setTileGID(gid, tileCoordinate, (TMXTileFlags)0); setTileGID(gid, tileCoordinate, (TMXTileFlags)0);
} }
void FastTMXLayer::setTileGID(int gid, const Vec2& tileCoordinate, TMXTileFlags flags) void TMXLayer::setTileGID(int gid, const Vec2& tileCoordinate, TMXTileFlags flags)
{ {
CCASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >=0 && tileCoordinate.y >=0, "TMXLayer: invalid position"); CCASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >=0 && tileCoordinate.y >=0, "TMXLayer: invalid position");
CCASSERT(_tiles, "TMXLayer: the tiles map has been released"); CCASSERT(_tiles, "TMXLayer: the tiles map has been released");
@ -796,7 +797,7 @@ void FastTMXLayer::setTileGID(int gid, const Vec2& tileCoordinate, TMXTileFlags
} }
} }
void FastTMXLayer::setupTileSprite(Sprite* sprite, Vec2 pos, int gid) void TMXLayer::setupTileSprite(Sprite* sprite, Vec2 pos, int gid)
{ {
sprite->setPosition(getPositionAt(pos)); sprite->setPosition(getPositionAt(pos));
sprite->setPositionZ((float)getVertexZForPos(pos)); sprite->setPositionZ((float)getVertexZForPos(pos));
@ -852,9 +853,11 @@ void FastTMXLayer::setupTileSprite(Sprite* sprite, Vec2 pos, int gid)
} }
} }
std::string FastTMXLayer::getDescription() const std::string TMXLayer::getDescription() const
{ {
return StringUtils::format("<FastTMXLayer | tag = %d, size = %d,%d>", _tag, (int)_mapTileSize.width, (int)_mapTileSize.height); return StringUtils::format("<FastTMXLayer | tag = %d, size = %d,%d>", _tag, (int)_mapTileSize.width, (int)_mapTileSize.height);
} }
} //end of namespace experimental
NS_CC_END NS_CC_END

View File

@ -45,6 +45,8 @@ class Texture2D;
class Sprite; class Sprite;
struct _ccCArray; struct _ccCArray;
namespace experimental{
/** /**
* @addtogroup tilemap_parallax_nodes * @addtogroup tilemap_parallax_nodes
* @{ * @{
@ -76,20 +78,20 @@ http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:tiled_maps
@since v3.2 @since v3.2
*/ */
class CC_DLL FastTMXLayer : public Node class CC_DLL TMXLayer : public Node
{ {
public: public:
/** creates a FastTMXLayer with an tileset info, a layer info and a map info */ /** creates a FastTMXLayer with an tileset info, a layer info and a map info */
static FastTMXLayer * create(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo); static TMXLayer * create(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo);
/** /**
* @js ctor * @js ctor
*/ */
FastTMXLayer(); TMXLayer();
/** /**
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
virtual ~FastTMXLayer(); virtual ~TMXLayer();
/** returns the tile gid at a given tile coordinate. It also returns the tile flags. /** returns the tile gid at a given tile coordinate. It also returns the tile flags.
*/ */
@ -256,7 +258,7 @@ public:
// end of tilemap_parallax_nodes group // end of tilemap_parallax_nodes group
/// @} /// @}
} //end of namespace experimental
NS_CC_END NS_CC_END
#endif //__CCTMX_LAYER2_H__ #endif //__CCTMX_LAYER2_H__

View File

@ -34,12 +34,13 @@ THE SOFTWARE.
#include "deprecated/CCString.h" #include "deprecated/CCString.h"
NS_CC_BEGIN NS_CC_BEGIN
namespace experimental {
// implementation FastTMXTiledMap // implementation FastTMXTiledMap
FastTMXTiledMap * FastTMXTiledMap::create(const std::string& tmxFile) TMXTiledMap * TMXTiledMap::create(const std::string& tmxFile)
{ {
FastTMXTiledMap *ret = new FastTMXTiledMap(); TMXTiledMap *ret = new TMXTiledMap();
if (ret->initWithTMXFile(tmxFile)) if (ret->initWithTMXFile(tmxFile))
{ {
ret->autorelease(); ret->autorelease();
@ -49,9 +50,9 @@ FastTMXTiledMap * FastTMXTiledMap::create(const std::string& tmxFile)
return nullptr; return nullptr;
} }
FastTMXTiledMap* FastTMXTiledMap::createWithXML(const std::string& tmxString, const std::string& resourcePath) TMXTiledMap* TMXTiledMap::createWithXML(const std::string& tmxString, const std::string& resourcePath)
{ {
FastTMXTiledMap *ret = new FastTMXTiledMap(); TMXTiledMap *ret = new TMXTiledMap();
if (ret->initWithXML(tmxString, resourcePath)) if (ret->initWithXML(tmxString, resourcePath))
{ {
ret->autorelease(); ret->autorelease();
@ -61,7 +62,7 @@ FastTMXTiledMap* FastTMXTiledMap::createWithXML(const std::string& tmxString, co
return nullptr; return nullptr;
} }
bool FastTMXTiledMap::initWithTMXFile(const std::string& tmxFile) bool TMXTiledMap::initWithTMXFile(const std::string& tmxFile)
{ {
CCASSERT(tmxFile.size()>0, "FastTMXTiledMap: tmx file should not be empty"); CCASSERT(tmxFile.size()>0, "FastTMXTiledMap: tmx file should not be empty");
@ -79,7 +80,7 @@ bool FastTMXTiledMap::initWithTMXFile(const std::string& tmxFile)
return true; return true;
} }
bool FastTMXTiledMap::initWithXML(const std::string& tmxString, const std::string& resourcePath) bool TMXTiledMap::initWithXML(const std::string& tmxString, const std::string& resourcePath)
{ {
setContentSize(Size::ZERO); setContentSize(Size::ZERO);
@ -91,21 +92,21 @@ bool FastTMXTiledMap::initWithXML(const std::string& tmxString, const std::strin
return true; return true;
} }
FastTMXTiledMap::FastTMXTiledMap() TMXTiledMap::TMXTiledMap()
:_mapSize(Size::ZERO) :_mapSize(Size::ZERO)
,_tileSize(Size::ZERO) ,_tileSize(Size::ZERO)
{ {
} }
FastTMXTiledMap::~FastTMXTiledMap() TMXTiledMap::~TMXTiledMap()
{ {
} }
// private // private
FastTMXLayer * FastTMXTiledMap::parseLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo) TMXLayer * TMXTiledMap::parseLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo)
{ {
TMXTilesetInfo *tileset = tilesetForLayer(layerInfo, mapInfo); TMXTilesetInfo *tileset = tilesetForLayer(layerInfo, mapInfo);
FastTMXLayer *layer = FastTMXLayer::create(tileset, layerInfo, mapInfo); TMXLayer *layer = TMXLayer::create(tileset, layerInfo, mapInfo);
// tell the layerinfo to release the ownership of the tiles map. // tell the layerinfo to release the ownership of the tiles map.
layerInfo->_ownTiles = false; layerInfo->_ownTiles = false;
@ -114,7 +115,7 @@ FastTMXLayer * FastTMXTiledMap::parseLayer(TMXLayerInfo *layerInfo, TMXMapInfo *
return layer; return layer;
} }
TMXTilesetInfo * FastTMXTiledMap::tilesetForLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo) TMXTilesetInfo * TMXTiledMap::tilesetForLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo)
{ {
Size size = layerInfo->_layerSize; Size size = layerInfo->_layerSize;
auto& tilesets = mapInfo->getTilesets(); auto& tilesets = mapInfo->getTilesets();
@ -155,7 +156,7 @@ TMXTilesetInfo * FastTMXTiledMap::tilesetForLayer(TMXLayerInfo *layerInfo, TMXMa
return nullptr; return nullptr;
} }
void FastTMXTiledMap::buildWithMapInfo(TMXMapInfo* mapInfo) void TMXTiledMap::buildWithMapInfo(TMXMapInfo* mapInfo)
{ {
_mapSize = mapInfo->getMapSize(); _mapSize = mapInfo->getMapSize();
_tileSize = mapInfo->getTileSize(); _tileSize = mapInfo->getTileSize();
@ -173,7 +174,7 @@ void FastTMXTiledMap::buildWithMapInfo(TMXMapInfo* mapInfo)
for(const auto &layerInfo : layers) { for(const auto &layerInfo : layers) {
if (layerInfo->_visible) if (layerInfo->_visible)
{ {
FastTMXLayer *child = parseLayer(layerInfo, mapInfo); TMXLayer *child = parseLayer(layerInfo, mapInfo);
addChild(child, idx, idx); addChild(child, idx, idx);
// update content size with the max size // update content size with the max size
@ -189,13 +190,13 @@ void FastTMXTiledMap::buildWithMapInfo(TMXMapInfo* mapInfo)
} }
// public // public
FastTMXLayer * FastTMXTiledMap::getLayer(const std::string& layerName) const TMXLayer * TMXTiledMap::getLayer(const std::string& layerName) const
{ {
CCASSERT(layerName.size() > 0, "Invalid layer name!"); CCASSERT(layerName.size() > 0, "Invalid layer name!");
for (auto& child : _children) for (auto& child : _children)
{ {
FastTMXLayer* layer = dynamic_cast<FastTMXLayer*>(child); TMXLayer* layer = dynamic_cast<TMXLayer*>(child);
if(layer) if(layer)
{ {
if(layerName.compare( layer->getLayerName()) == 0) if(layerName.compare( layer->getLayerName()) == 0)
@ -209,7 +210,7 @@ FastTMXLayer * FastTMXTiledMap::getLayer(const std::string& layerName) const
return nullptr; return nullptr;
} }
TMXObjectGroup * FastTMXTiledMap::getObjectGroup(const std::string& groupName) const TMXObjectGroup * TMXTiledMap::getObjectGroup(const std::string& groupName) const
{ {
CCASSERT(groupName.size() > 0, "Invalid group name!"); CCASSERT(groupName.size() > 0, "Invalid group name!");
@ -230,7 +231,7 @@ TMXObjectGroup * FastTMXTiledMap::getObjectGroup(const std::string& groupName) c
return nullptr; return nullptr;
} }
Value FastTMXTiledMap::getProperty(const std::string& propertyName) const Value TMXTiledMap::getProperty(const std::string& propertyName) const
{ {
if (_properties.find(propertyName) != _properties.end()) if (_properties.find(propertyName) != _properties.end())
return _properties.at(propertyName); return _properties.at(propertyName);
@ -238,7 +239,7 @@ Value FastTMXTiledMap::getProperty(const std::string& propertyName) const
return Value(); return Value();
} }
Value FastTMXTiledMap::getPropertiesForGID(int GID) const Value TMXTiledMap::getPropertiesForGID(int GID) const
{ {
if (_tileProperties.find(GID) != _tileProperties.end()) if (_tileProperties.find(GID) != _tileProperties.end())
return _tileProperties.at(GID); return _tileProperties.at(GID);
@ -246,11 +247,12 @@ Value FastTMXTiledMap::getPropertiesForGID(int GID) const
return Value(); return Value();
} }
std::string FastTMXTiledMap::getDescription() const std::string TMXTiledMap::getDescription() const
{ {
return StringUtils::format("<FastTMXTiledMap | Tag = %d, Layers = %d", _tag, static_cast<int>(_children.size())); return StringUtils::format("<FastTMXTiledMap | Tag = %d, Layers = %d", _tag, static_cast<int>(_children.size()));
} }
} //end of namespace experimental
NS_CC_END NS_CC_END

View File

@ -33,11 +33,14 @@ THE SOFTWARE.
NS_CC_BEGIN NS_CC_BEGIN
class TMXObjectGroup; class TMXObjectGroup;
class FastTMXLayer;
class TMXLayerInfo; class TMXLayerInfo;
class TMXTilesetInfo; class TMXTilesetInfo;
class TMXMapInfo; class TMXMapInfo;
namespace experimental {
class TMXLayer;
/** @brief FastTMXTiledMap knows how to parse and render a TMX map. /** @brief FastTMXTiledMap knows how to parse and render a TMX map.
It adds support for the TMX tiled map format used by http://www.mapeditor.org It adds support for the TMX tiled map format used by http://www.mapeditor.org
@ -89,17 +92,17 @@ object->getProperty(name_of_the_property);
@since v3.2 @since v3.2
*/ */
class CC_DLL FastTMXTiledMap : public Node class CC_DLL TMXTiledMap : public Node
{ {
public: public:
/** creates a TMX Tiled Map with a TMX file.*/ /** creates a TMX Tiled Map with a TMX file.*/
static FastTMXTiledMap* create(const std::string& tmxFile); static TMXTiledMap* create(const std::string& tmxFile);
/** initializes a TMX Tiled Map with a TMX formatted XML string and a path to TMX resources */ /** initializes a TMX Tiled Map with a TMX formatted XML string and a path to TMX resources */
static FastTMXTiledMap* createWithXML(const std::string& tmxString, const std::string& resourcePath); static TMXTiledMap* createWithXML(const std::string& tmxString, const std::string& resourcePath);
/** return the FastTMXLayer for the specific layer */ /** return the FastTMXLayer for the specific layer */
FastTMXLayer* getLayer(const std::string& layerName) const; TMXLayer* getLayer(const std::string& layerName) const;
/** return the TMXObjectGroup for the specific group */ /** return the TMXObjectGroup for the specific group */
TMXObjectGroup* getObjectGroup(const std::string& groupName) const; TMXObjectGroup* getObjectGroup(const std::string& groupName) const;
@ -141,12 +144,12 @@ protected:
/** /**
* @js ctor * @js ctor
*/ */
FastTMXTiledMap(); TMXTiledMap();
/** /**
* @js NA * @js NA
* @lua NA * @lua NA
*/ */
virtual ~FastTMXTiledMap(); virtual ~TMXTiledMap();
/** initializes a TMX Tiled Map with a TMX file */ /** initializes a TMX Tiled Map with a TMX file */
bool initWithTMXFile(const std::string& tmxFile); bool initWithTMXFile(const std::string& tmxFile);
@ -154,7 +157,7 @@ protected:
/** initializes a TMX Tiled Map with a TMX formatted XML string and a path to TMX resources */ /** initializes a TMX Tiled Map with a TMX formatted XML string and a path to TMX resources */
bool initWithXML(const std::string& tmxString, const std::string& resourcePath); bool initWithXML(const std::string& tmxString, const std::string& resourcePath);
FastTMXLayer * parseLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo); TMXLayer * parseLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo);
TMXTilesetInfo * tilesetForLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo); TMXTilesetInfo * tilesetForLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo);
void buildWithMapInfo(TMXMapInfo* mapInfo); void buildWithMapInfo(TMXMapInfo* mapInfo);
@ -173,12 +176,14 @@ protected:
ValueMapIntKey _tileProperties; ValueMapIntKey _tileProperties;
private: private:
CC_DISALLOW_COPY_AND_ASSIGN(FastTMXTiledMap); CC_DISALLOW_COPY_AND_ASSIGN(TMXTiledMap);
}; };
// end of tilemap_parallax_nodes group // end of tilemap_parallax_nodes group
/// @} /// @}
} //end of namespace experimental
NS_CC_END NS_CC_END

View File

@ -22,11 +22,11 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include <sstream>
#include "2d/CCFontAtlasCache.h" #include "2d/CCFontAtlasCache.h"
#include <iostream>
#include <sstream>
#include "2d/CCFontFNT.h" #include "2d/CCFontFNT.h"
#include "2d/CCFontFreeType.h" #include "2d/CCFontFreeType.h"
#include "CCFontCharMap.h" #include "CCFontCharMap.h"
@ -178,7 +178,10 @@ FontAtlas * FontAtlasCache::getFontAtlasCharMap(Texture2D* texture, int itemWidt
FontAtlas * FontAtlasCache::getFontAtlasCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap) FontAtlas * FontAtlasCache::getFontAtlasCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap)
{ {
std::string atlasName = generateFontName(charMapFile, 0, GlyphCollection::CUSTOM,false); char tmp[255];
snprintf(tmp,250,"name:%s_%d_%d_%d",charMapFile.c_str(),itemWidth,itemHeight,startCharMap);
std::string atlasName = generateFontName(tmp, 0, GlyphCollection::CUSTOM,false);
auto it = _atlasMap.find(atlasName); auto it = _atlasMap.find(atlasName);
if ( it == _atlasMap.end() ) if ( it == _atlasMap.end() )

View File

@ -26,7 +26,6 @@
#ifndef _CCFontAtlasCache_h_ #ifndef _CCFontAtlasCache_h_
#define _CCFontAtlasCache_h_ #define _CCFontAtlasCache_h_
#include <iostream>
#include <unordered_map> #include <unordered_map>
#include "2d/CCFontAtlas.h" #include "2d/CCFontAtlas.h"

View File

@ -186,7 +186,7 @@ bool LabelTextFormatter::alignText(Label *theLabel)
int i = 0; int i = 0;
int lineNumber = 0; int lineNumber = 0;
int strLen = static_cast<int>(theLabel->_currentUTF16String.length()); int strLen = theLabel->_limitShowCount;
std::vector<char16_t> lastLine; std::vector<char16_t> lastLine;
auto strWhole = theLabel->_currentUTF16String; auto strWhole = theLabel->_currentUTF16String;

View File

@ -173,9 +173,9 @@ CC_CONSTRUCTOR_ACCESS:
protected: protected:
//add the api for avoid use deprecated api //add the api for avoid use deprecated api
void _addTouchListener(); CC_DEPRECATED_ATTRIBUTE void _addTouchListener() {}
CC_DEPRECATED_ATTRIBUTE void addTouchListener() { _addTouchListener();}; CC_DEPRECATED_ATTRIBUTE void addTouchListener() {}
CC_DEPRECATED_ATTRIBUTE int executeScriptTouchHandler(EventTouch::EventCode eventType, Touch* touch, Event* event); CC_DEPRECATED_ATTRIBUTE int executeScriptTouchHandler(EventTouch::EventCode eventType, Touch* touch, Event* event);
CC_DEPRECATED_ATTRIBUTE int executeScriptTouchesHandler(EventTouch::EventCode eventType, const std::vector<Touch*>& touches, Event* event); CC_DEPRECATED_ATTRIBUTE int executeScriptTouchesHandler(EventTouch::EventCode eventType, const std::vector<Touch*>& touches, Event* event);

View File

@ -839,6 +839,18 @@ MenuItemToggle * MenuItemToggle::createWithTarget(Ref* target, SEL_MenuHandler s
return ret; return ret;
} }
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
MenuItemToggle * MenuItemToggle::createWithCallbackVA(const ccMenuCallback &callback, MenuItem* item, ...)
{
va_list args;
va_start(args, item);
MenuItemToggle *ret = new MenuItemToggle();
ret->initWithCallback(callback, item, args);
ret->autorelease();
va_end(args);
return ret;
}
#else
MenuItemToggle * MenuItemToggle::createWithCallback(const ccMenuCallback &callback, MenuItem* item, ...) MenuItemToggle * MenuItemToggle::createWithCallback(const ccMenuCallback &callback, MenuItem* item, ...)
{ {
va_list args; va_list args;
@ -849,6 +861,7 @@ MenuItemToggle * MenuItemToggle::createWithCallback(const ccMenuCallback &callba
va_end(args); va_end(args);
return ret; return ret;
} }
#endif
MenuItemToggle * MenuItemToggle::create() MenuItemToggle * MenuItemToggle::create()
{ {

View File

@ -478,7 +478,25 @@ public:
/** creates a menu item from a Array with a callable object */ /** creates a menu item from a Array with a callable object */
static MenuItemToggle * createWithCallback(const ccMenuCallback& callback, const Vector<MenuItem*>& menuItems); static MenuItemToggle * createWithCallback(const ccMenuCallback& callback, const Vector<MenuItem*>& menuItems);
/** creates a menu item from a list of items with a callable object */ /** creates a menu item from a list of items with a callable object */
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8) || (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
// WP8 in VS2012 does not support nullptr in variable args lists and variadic templates are also not supported
typedef MenuItem* M;
static MenuItemToggle* createWithCallback(const ccMenuCallback& callback, M m1, std::nullptr_t listEnd) { return createWithCallbackVA(callback, m1, NULL); }
static MenuItemToggle* createWithCallback(const ccMenuCallback& callback, M m1, M m2, std::nullptr_t listEnd) { return createWithCallbackVA(callback, m1, m2, NULL); }
static MenuItemToggle* createWithCallback(const ccMenuCallback& callback, M m1, M m2, M m3, std::nullptr_t listEnd) { return createWithCallbackVA(callback, m1, m2, m3, NULL); }
static MenuItemToggle* createWithCallback(const ccMenuCallback& callback, M m1, M m2, M m3, M m4, std::nullptr_t listEnd) { return createWithCallbackVA(callback, m1, m2, m3, m4, NULL); }
static MenuItemToggle* createWithCallback(const ccMenuCallback& callback, M m1, M m2, M m3, M m4, M m5, std::nullptr_t listEnd) { return createWithCallbackVA(callback, m1, m2, m3, m4, m5, NULL); }
static MenuItemToggle* createWithCallback(const ccMenuCallback& callback, M m1, M m2, M m3, M m4, M m5, M m6, std::nullptr_t listEnd) { return createWithCallbackVA(callback, m1, m2, m3, m4, m5, m6, NULL); }
static MenuItemToggle* createWithCallback(const ccMenuCallback& callback, M m1, M m2, M m3, M m4, M m5, M m6, M m7, std::nullptr_t listEnd) { return createWithCallbackVA(callback, m1, m2, m3, m4, m5, m6, m7, NULL); }
static MenuItemToggle* createWithCallback(const ccMenuCallback& callback, M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, std::nullptr_t listEnd) { return createWithCallbackVA(callback, m1, m2, m3, m4, m5, m6, m7, m8, NULL); }
static MenuItemToggle* createWithCallback(const ccMenuCallback& callback, M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, M m9, std::nullptr_t listEnd) { return createWithCallbackVA(callback, m1, m2, m3, m4, m5, m6, m7, m8, m9, NULL); }
static MenuItemToggle* createWithCallback(const ccMenuCallback& callback, M m1, M m2, M m3, M m4, M m5, M m6, M m7, M m8, M m9, M m10, std::nullptr_t listEnd) { return createWithCallbackVA(callback, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, NULL); }
// On WP8 for lists longer than 10 items, use createWithArray or variadicCreate with NULL as the last argument
static MenuItemToggle* createWithCallbackVA(const ccMenuCallback& callback, M item, ...);
#else
static MenuItemToggle* createWithCallback(const ccMenuCallback& callback, MenuItem* item, ...) CC_REQUIRES_NULL_TERMINATION; static MenuItemToggle* createWithCallback(const ccMenuCallback& callback, MenuItem* item, ...) CC_REQUIRES_NULL_TERMINATION;
#endif
/** creates a menu item with no target/selector and no items */ /** creates a menu item with no target/selector and no items */
static MenuItemToggle* create(); static MenuItemToggle* create();
/** creates a menu item with a item */ /** creates a menu item with a item */

View File

@ -1850,6 +1850,11 @@ bool Node::removeComponent(const std::string& name)
return false; return false;
} }
bool Node::removeComponent(Component *component)
{
return _componentContainer->remove(component);
}
void Node::removeAllComponents() void Node::removeAllComponents()
{ {
if( _componentContainer ) if( _componentContainer )

View File

@ -71,7 +71,7 @@ enum {
kNodeOnCleanup kNodeOnCleanup
}; };
bool nodeComparisonLess(Node* n1, Node* n2); bool CC_DLL nodeComparisonLess(Node* n1, Node* n2);
class EventListener; class EventListener;
@ -712,6 +712,15 @@ public:
* @since v3.2 * @since v3.2
*/ */
virtual Node* getChildByName(const std::string& name) const; virtual Node* getChildByName(const std::string& name) const;
/**
* Gets a child from the container with its name that can be cast to Type T
*
* @param name An identifier to find the child node.
*
* @return a Node with the given name that can be cast to Type T
*/
template <typename T>
inline T getChildByName(const std::string& name) const { return static_cast<T>(getChildByName(name)); }
/** Search the children of the receiving node to perform processing for nodes which share a name. /** Search the children of the receiving node to perform processing for nodes which share a name.
* *
* @param name The name to search for, supports c++11 regular expression. * @param name The name to search for, supports c++11 regular expression.
@ -1424,6 +1433,10 @@ public:
*/ */
virtual bool removeComponent(const std::string& name); virtual bool removeComponent(const std::string& name);
/**
* removes a component by its pointer
*/
virtual bool removeComponent(Component *component);
/** /**
* removes all components * removes all components
*/ */

View File

@ -33,7 +33,7 @@ NS_CC_BEGIN
class GridBase; class GridBase;
class NodeGrid : public Node class CC_DLL NodeGrid : public Node
{ {
public: public:
static NodeGrid* create(); static NodeGrid* create();

View File

@ -94,6 +94,9 @@ RenderTexture::~RenderTexture()
void RenderTexture::listenToBackground(EventCustom *event) void RenderTexture::listenToBackground(EventCustom *event)
{ {
// We have not found a way to dispatch the enter background message before the texture data are destroyed.
// So we disable this pair of message handler at present.
#if 0
#if CC_ENABLE_CACHE_TEXTURE_DATA #if CC_ENABLE_CACHE_TEXTURE_DATA
CC_SAFE_DELETE(_UITextureImage); CC_SAFE_DELETE(_UITextureImage);
@ -118,10 +121,12 @@ void RenderTexture::listenToBackground(EventCustom *event)
glDeleteFramebuffers(1, &_FBO); glDeleteFramebuffers(1, &_FBO);
_FBO = 0; _FBO = 0;
#endif #endif
#endif
} }
void RenderTexture::listenToForeground(EventCustom *event) void RenderTexture::listenToForeground(EventCustom *event)
{ {
#if 0
#if CC_ENABLE_CACHE_TEXTURE_DATA #if CC_ENABLE_CACHE_TEXTURE_DATA
// -- regenerate frame buffer object and attach the texture // -- regenerate frame buffer object and attach the texture
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &_oldFBO); glGetIntegerv(GL_FRAMEBUFFER_BINDING, &_oldFBO);
@ -139,6 +144,7 @@ void RenderTexture::listenToForeground(EventCustom *event)
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, _texture->getName(), 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, _texture->getName(), 0);
glBindFramebuffer(GL_FRAMEBUFFER, _oldFBO); glBindFramebuffer(GL_FRAMEBUFFER, _oldFBO);
#endif #endif
#endif
} }
RenderTexture * RenderTexture::create(int w, int h, Texture2D::PixelFormat eFormat) RenderTexture * RenderTexture::create(int w, int h, Texture2D::PixelFormat eFormat)
@ -564,6 +570,14 @@ void RenderTexture::onBegin()
Mat4::createOrthographicOffCenter((float)-1.0 / widthRatio, (float)1.0 / widthRatio, (float)-1.0 / heightRatio, (float)1.0 / heightRatio, -1, 1, &orthoMatrix); Mat4::createOrthographicOffCenter((float)-1.0 / widthRatio, (float)1.0 / widthRatio, (float)-1.0 / heightRatio, (float)1.0 / heightRatio, -1, 1, &orthoMatrix);
director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, orthoMatrix); director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, orthoMatrix);
} }
else
{
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
Mat4 modifiedProjection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
modifiedProjection = CCEGLView::sharedOpenGLView()->getReverseOrientationMatrix() * modifiedProjection;
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION, modifiedProjection);
#endif
}
//calculate viewport //calculate viewport
{ {

View File

@ -153,7 +153,7 @@ public:
// //
virtual void onEnter() override; virtual void onEnter() override;
protected: CC_CONSTRUCTOR_ACCESS:
TransitionRotoZoom(); TransitionRotoZoom();
virtual ~TransitionRotoZoom(); virtual ~TransitionRotoZoom();
@ -175,7 +175,7 @@ public:
// //
virtual void onEnter() override; virtual void onEnter() override;
protected: CC_CONSTRUCTOR_ACCESS:
TransitionJumpZoom(); TransitionJumpZoom();
virtual ~TransitionJumpZoom(); virtual ~TransitionJumpZoom();
@ -201,10 +201,11 @@ public:
// //
virtual void onEnter() override; virtual void onEnter() override;
protected: CC_CONSTRUCTOR_ACCESS:
TransitionMoveInL(); TransitionMoveInL();
virtual ~TransitionMoveInL(); virtual ~TransitionMoveInL();
protected:
/** initializes the scenes */ /** initializes the scenes */
virtual void initScenes(); virtual void initScenes();
@ -220,10 +221,11 @@ class CC_DLL TransitionMoveInR : public TransitionMoveInL
public: public:
static TransitionMoveInR* create(float t, Scene* scene); static TransitionMoveInR* create(float t, Scene* scene);
protected: CC_CONSTRUCTOR_ACCESS:
TransitionMoveInR(); TransitionMoveInR();
virtual ~TransitionMoveInR(); virtual ~TransitionMoveInR();
protected:
virtual void initScenes(); virtual void initScenes();
private: private:
@ -238,10 +240,11 @@ class CC_DLL TransitionMoveInT : public TransitionMoveInL
public: public:
static TransitionMoveInT* create(float t, Scene* scene); static TransitionMoveInT* create(float t, Scene* scene);
protected: CC_CONSTRUCTOR_ACCESS:
TransitionMoveInT(); TransitionMoveInT();
virtual ~TransitionMoveInT(); virtual ~TransitionMoveInT();
protected:
virtual void initScenes(); virtual void initScenes();
private: private:
@ -256,10 +259,11 @@ class CC_DLL TransitionMoveInB : public TransitionMoveInL
public: public:
static TransitionMoveInB* create(float t, Scene* scene); static TransitionMoveInB* create(float t, Scene* scene);
protected: CC_CONSTRUCTOR_ACCESS:
TransitionMoveInB(); TransitionMoveInB();
virtual ~TransitionMoveInB(); virtual ~TransitionMoveInB();
protected:
virtual void initScenes(); virtual void initScenes();
private: private:
@ -284,10 +288,11 @@ public:
// //
virtual void onEnter() override; virtual void onEnter() override;
protected: CC_CONSTRUCTOR_ACCESS:
TransitionSlideInL(); TransitionSlideInL();
virtual ~TransitionSlideInL(); virtual ~TransitionSlideInL();
protected:
/** initializes the scenes */ /** initializes the scenes */
virtual void initScenes(void); virtual void initScenes(void);
@ -308,10 +313,11 @@ public:
/** returns the action that will be performed by the incoming and outgoing scene */ /** returns the action that will be performed by the incoming and outgoing scene */
virtual ActionInterval* action(void); virtual ActionInterval* action(void);
protected: CC_CONSTRUCTOR_ACCESS:
TransitionSlideInR(); TransitionSlideInR();
virtual ~TransitionSlideInR(); virtual ~TransitionSlideInR();
protected:
/** initializes the scenes */ /** initializes the scenes */
virtual void initScenes(void); virtual void initScenes(void);
@ -332,10 +338,11 @@ public:
/** returns the action that will be performed by the incoming and outgoing scene */ /** returns the action that will be performed by the incoming and outgoing scene */
virtual ActionInterval* action(void); virtual ActionInterval* action(void);
protected: CC_CONSTRUCTOR_ACCESS:
TransitionSlideInB(); TransitionSlideInB();
virtual ~TransitionSlideInB(); virtual ~TransitionSlideInB();
protected:
/** initializes the scenes */ /** initializes the scenes */
virtual void initScenes(); virtual void initScenes();
@ -356,10 +363,11 @@ public:
/** returns the action that will be performed by the incoming and outgoing scene */ /** returns the action that will be performed by the incoming and outgoing scene */
virtual ActionInterval* action(void); virtual ActionInterval* action(void);
protected: CC_CONSTRUCTOR_ACCESS:
TransitionSlideInT(); TransitionSlideInT();
virtual ~TransitionSlideInT(); virtual ~TransitionSlideInT();
protected:
/** initializes the scenes */ /** initializes the scenes */
virtual void initScenes(void); virtual void initScenes(void);
@ -387,7 +395,7 @@ public:
virtual void onEnter() override; virtual void onEnter() override;
virtual ActionInterval* easeActionWithAction(ActionInterval * action) override; virtual ActionInterval* easeActionWithAction(ActionInterval * action) override;
protected: CC_CONSTRUCTOR_ACCESS:
TransitionShrinkGrow(); TransitionShrinkGrow();
virtual ~TransitionShrinkGrow(); virtual ~TransitionShrinkGrow();
@ -414,7 +422,7 @@ public:
*/ */
virtual void onEnter() override; virtual void onEnter() override;
protected: CC_CONSTRUCTOR_ACCESS:
TransitionFlipX(); TransitionFlipX();
virtual ~TransitionFlipX(); virtual ~TransitionFlipX();
@ -441,7 +449,7 @@ public:
*/ */
virtual void onEnter() override; virtual void onEnter() override;
protected: CC_CONSTRUCTOR_ACCESS:
TransitionFlipY(); TransitionFlipY();
virtual ~TransitionFlipY(); virtual ~TransitionFlipY();
@ -468,7 +476,7 @@ public:
*/ */
virtual void onEnter() override; virtual void onEnter() override;
protected: CC_CONSTRUCTOR_ACCESS:
TransitionFlipAngular(); TransitionFlipAngular();
virtual ~TransitionFlipAngular(); virtual ~TransitionFlipAngular();
@ -495,7 +503,7 @@ public:
*/ */
virtual void onEnter() override; virtual void onEnter() override;
protected: CC_CONSTRUCTOR_ACCESS:
TransitionZoomFlipX(); TransitionZoomFlipX();
virtual ~TransitionZoomFlipX(); virtual ~TransitionZoomFlipX();
@ -522,7 +530,7 @@ public:
*/ */
virtual void onEnter() override; virtual void onEnter() override;
protected: CC_CONSTRUCTOR_ACCESS:
TransitionZoomFlipY(); TransitionZoomFlipY();
virtual ~TransitionZoomFlipY(); virtual ~TransitionZoomFlipY();
@ -549,7 +557,7 @@ public:
*/ */
virtual void onEnter() override; virtual void onEnter() override;
protected: CC_CONSTRUCTOR_ACCESS:
TransitionZoomFlipAngular(); TransitionZoomFlipAngular();
virtual ~TransitionZoomFlipAngular(); virtual ~TransitionZoomFlipAngular();
@ -625,7 +633,7 @@ public :
*/ */
virtual void onExit() override; virtual void onExit() override;
protected: CC_CONSTRUCTOR_ACCESS:
TransitionCrossFade(); TransitionCrossFade();
virtual ~TransitionCrossFade(); virtual ~TransitionCrossFade();
@ -653,10 +661,11 @@ public :
virtual ActionInterval * easeActionWithAction(ActionInterval * action) override; virtual ActionInterval * easeActionWithAction(ActionInterval * action) override;
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override; virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
protected: CC_CONSTRUCTOR_ACCESS:
TransitionTurnOffTiles(); TransitionTurnOffTiles();
virtual ~TransitionTurnOffTiles(); virtual ~TransitionTurnOffTiles();
protected:
virtual void sceneOrder() override; virtual void sceneOrder() override;
NodeGrid* _outSceneProxy; NodeGrid* _outSceneProxy;
@ -685,9 +694,12 @@ public:
virtual ActionInterval * easeActionWithAction(ActionInterval * action) override; virtual ActionInterval * easeActionWithAction(ActionInterval * action) override;
virtual void onExit() override; virtual void onExit() override;
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override; virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
protected:
CC_CONSTRUCTOR_ACCESS:
TransitionSplitCols(); TransitionSplitCols();
virtual ~TransitionSplitCols(); virtual ~TransitionSplitCols();
protected:
void switchTargetToInscene(); void switchTargetToInscene();
NodeGrid* _gridProxy; NodeGrid* _gridProxy;
private: private:
@ -707,7 +719,7 @@ public:
// //
virtual ActionInterval* action(void) override; virtual ActionInterval* action(void) override;
protected: CC_CONSTRUCTOR_ACCESS:
TransitionSplitRows(); TransitionSplitRows();
virtual ~TransitionSplitRows(); virtual ~TransitionSplitRows();
@ -736,10 +748,12 @@ public:
virtual ActionInterval* easeActionWithAction(ActionInterval * action) override; virtual ActionInterval* easeActionWithAction(ActionInterval * action) override;
virtual void onExit() override; virtual void onExit() override;
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override; virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
protected:
CC_CONSTRUCTOR_ACCESS:
TransitionFadeTR(); TransitionFadeTR();
virtual ~TransitionFadeTR(); virtual ~TransitionFadeTR();
protected:
virtual void sceneOrder(); virtual void sceneOrder();
NodeGrid* _outSceneProxy; NodeGrid* _outSceneProxy;
@ -761,7 +775,7 @@ public:
// //
virtual ActionInterval* actionWithSize(const Size& size) override; virtual ActionInterval* actionWithSize(const Size& size) override;
protected: CC_CONSTRUCTOR_ACCESS:
TransitionFadeBL(); TransitionFadeBL();
virtual ~TransitionFadeBL(); virtual ~TransitionFadeBL();
@ -782,7 +796,7 @@ public:
// //
virtual ActionInterval* actionWithSize(const Size& size) override; virtual ActionInterval* actionWithSize(const Size& size) override;
protected: CC_CONSTRUCTOR_ACCESS:
TransitionFadeUp(); TransitionFadeUp();
virtual ~TransitionFadeUp(); virtual ~TransitionFadeUp();
@ -803,7 +817,7 @@ public:
// //
virtual ActionInterval* actionWithSize(const Size& size) override; virtual ActionInterval* actionWithSize(const Size& size) override;
protected: CC_CONSTRUCTOR_ACCESS:
TransitionFadeDown(); TransitionFadeDown();
virtual ~TransitionFadeDown(); virtual ~TransitionFadeDown();

View File

@ -59,15 +59,6 @@ public:
* scene is being turned from left over the outgoing scene. * scene is being turned from left over the outgoing scene.
*/ */
static TransitionPageTurn* create(float t,Scene* scene,bool backwards); static TransitionPageTurn* create(float t,Scene* scene,bool backwards);
/**
* @js ctor
*/
TransitionPageTurn();
/**
* @js NA
* @lua NA
*/
virtual ~TransitionPageTurn();
// //
// Overrides // Overrides
@ -89,6 +80,17 @@ public:
virtual void onEnter() override; virtual void onEnter() override;
virtual void onExit() override; virtual void onExit() override;
CC_CONSTRUCTOR_ACCESS:
/**
* @js ctor
*/
TransitionPageTurn();
/**
* @js NA
* @lua NA
*/
virtual ~TransitionPageTurn();
protected: protected:
virtual void sceneOrder() override; virtual void sceneOrder() override;

View File

@ -44,14 +44,16 @@ class CC_DLL TransitionProgress : public TransitionScene
public: public:
static TransitionProgress* create(float t, Scene* scene); static TransitionProgress* create(float t, Scene* scene);
TransitionProgress();
// //
// Overrides // Overrides
// //
virtual void onEnter() override; virtual void onEnter() override;
virtual void onExit() override; virtual void onExit() override;
CC_CONSTRUCTOR_ACCESS:
TransitionProgress();
virtual ~TransitionProgress(){}
protected: protected:
virtual void sceneOrder() override; virtual void sceneOrder() override;
@ -74,6 +76,13 @@ class CC_DLL TransitionProgressRadialCCW : public TransitionProgress
public: public:
static TransitionProgressRadialCCW* create(float t, Scene* scene); static TransitionProgressRadialCCW* create(float t, Scene* scene);
CC_CONSTRUCTOR_ACCESS:
/**
* @js ctor
*/
TransitionProgressRadialCCW(){}
virtual ~TransitionProgressRadialCCW(){}
protected: protected:
// //
// Overrides // Overrides
@ -91,6 +100,13 @@ class CC_DLL TransitionProgressRadialCW : public TransitionProgress
public: public:
static TransitionProgressRadialCW* create(float t, Scene* scene); static TransitionProgressRadialCW* create(float t, Scene* scene);
CC_CONSTRUCTOR_ACCESS:
/**
* @js ctor
*/
TransitionProgressRadialCW(){}
virtual ~TransitionProgressRadialCW(){}
protected: protected:
// //
// Overrides // Overrides
@ -107,6 +123,13 @@ class CC_DLL TransitionProgressHorizontal : public TransitionProgress
public: public:
static TransitionProgressHorizontal* create(float t, Scene* scene); static TransitionProgressHorizontal* create(float t, Scene* scene);
CC_CONSTRUCTOR_ACCESS:
/**
* @js ctor
*/
TransitionProgressHorizontal(){}
virtual ~TransitionProgressHorizontal(){}
protected: protected:
// //
// Overrides // Overrides
@ -119,6 +142,13 @@ class CC_DLL TransitionProgressVertical : public TransitionProgress
public: public:
static TransitionProgressVertical* create(float t, Scene* scene); static TransitionProgressVertical* create(float t, Scene* scene);
CC_CONSTRUCTOR_ACCESS:
/**
* @js ctor
*/
TransitionProgressVertical(){}
virtual ~TransitionProgressVertical(){}
protected: protected:
// //
// Overrides // Overrides
@ -131,6 +161,13 @@ class CC_DLL TransitionProgressInOut : public TransitionProgress
public: public:
static TransitionProgressInOut* create(float t, Scene* scene); static TransitionProgressInOut* create(float t, Scene* scene);
CC_CONSTRUCTOR_ACCESS:
/**
* @js ctor
*/
TransitionProgressInOut(){}
virtual ~TransitionProgressInOut(){}
protected: protected:
// //
// Overrides // Overrides
@ -145,6 +182,13 @@ class CC_DLL TransitionProgressOutIn : public TransitionProgress
public: public:
static TransitionProgressOutIn* create(float t, Scene* scene); static TransitionProgressOutIn* create(float t, Scene* scene);
CC_CONSTRUCTOR_ACCESS:
/**
* @js ctor
*/
TransitionProgressOutIn(){}
virtual ~TransitionProgressOutIn(){}
protected: protected:
// //
// Overrides // Overrides

View File

@ -84,63 +84,63 @@ namespace tweenfunc {
//tween functions for CCActionEase //tween functions for CCActionEase
float easeIn(float time, float rate); float CC_DLL easeIn(float time, float rate);
float easeOut(float time, float rate); float CC_DLL easeOut(float time, float rate);
float easeInOut(float time, float rate); float CC_DLL easeInOut(float time, float rate);
float bezieratFunction( float a, float b, float c, float d, float t ); float CC_DLL bezieratFunction( float a, float b, float c, float d, float t );
float quadraticIn(float time); float CC_DLL quadraticIn(float time);
float quadraticOut(float time); float CC_DLL quadraticOut(float time);
float quadraticInOut(float time); float CC_DLL quadraticInOut(float time);
float tweenTo(float time, TweenType type, float *easingParam); float CC_DLL tweenTo(float time, TweenType type, float *easingParam);
float linear(float time); float CC_DLL linear(float time);
float sineEaseIn(float time); float CC_DLL sineEaseIn(float time);
float sineEaseOut(float time); float CC_DLL sineEaseOut(float time);
float sineEaseInOut(float time); float CC_DLL sineEaseInOut(float time);
float quadEaseIn(float time); float CC_DLL quadEaseIn(float time);
float quadEaseOut(float time); float CC_DLL quadEaseOut(float time);
float quadEaseInOut(float time); float CC_DLL quadEaseInOut(float time);
float cubicEaseIn(float time); float CC_DLL cubicEaseIn(float time);
float cubicEaseOut(float time); float CC_DLL cubicEaseOut(float time);
float cubicEaseInOut(float time); float CC_DLL cubicEaseInOut(float time);
float quartEaseIn(float time); float CC_DLL quartEaseIn(float time);
float quartEaseOut(float time); float CC_DLL quartEaseOut(float time);
float quartEaseInOut(float time); float CC_DLL quartEaseInOut(float time);
float quintEaseIn(float time); float CC_DLL quintEaseIn(float time);
float quintEaseOut(float time); float CC_DLL quintEaseOut(float time);
float quintEaseInOut(float time); float CC_DLL quintEaseInOut(float time);
float expoEaseIn(float time); float CC_DLL expoEaseIn(float time);
float expoEaseOut(float time); float CC_DLL expoEaseOut(float time);
float expoEaseInOut(float time); float CC_DLL expoEaseInOut(float time);
float circEaseIn(float time); float CC_DLL circEaseIn(float time);
float circEaseOut(float time); float CC_DLL circEaseOut(float time);
float circEaseInOut(float time); float CC_DLL circEaseInOut(float time);
float elasticEaseIn(float time, float period); float CC_DLL elasticEaseIn(float time, float period);
float elasticEaseOut(float time, float period); float CC_DLL elasticEaseOut(float time, float period);
float elasticEaseInOut(float time, float period); float CC_DLL elasticEaseInOut(float time, float period);
float backEaseIn(float time); float CC_DLL backEaseIn(float time);
float backEaseOut(float time); float CC_DLL backEaseOut(float time);
float backEaseInOut(float time); float CC_DLL backEaseInOut(float time);
float bounceEaseIn(float time); float CC_DLL bounceEaseIn(float time);
float bounceEaseOut(float time); float CC_DLL bounceEaseOut(float time);
float bounceEaseInOut(float time); float CC_DLL bounceEaseInOut(float time);
float customEase(float time, float *easingParam); float CC_DLL customEase(float time, float *easingParam);
} }
NS_CC_END NS_CC_END

2
cocos/2d/cocos2d.def Normal file
View File

@ -0,0 +1,2 @@
LIBRARY

View File

@ -18,7 +18,7 @@
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
<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>
@ -27,7 +27,7 @@
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset> <PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>Unicode</CharacterSet>
<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>
@ -65,10 +65,10 @@
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LibraryPath>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\lib;$(LibraryPath)</LibraryPath> <LibraryPath>../../external/sqlite3/libraries/win32;$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LibraryPath>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\lib;$(LibraryPath)</LibraryPath> <LibraryPath>../../external/sqlite3/libraries/win32;$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\lib;$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent> <PreBuildEvent>
@ -78,7 +78,7 @@
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<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> <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;_DEBUG;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_USRDLL;_DEBUG;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -114,6 +114,8 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<ImportLibrary>$(TargetDir)$(TargetName).lib</ImportLibrary> <ImportLibrary>$(TargetDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
<ModuleDefinitionFile>cocos2d.def</ModuleDefinitionFile>
<AdditionalDependencies>libchipmunk.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link> </Link>
<PostBuildEvent> <PostBuildEvent>
<Command> <Command>
@ -127,7 +129,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
</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;$(EngineRoot)external;%(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;_USRDLL;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>
@ -155,7 +157,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
</Command> </Command>
</PreLinkEvent> </PreLinkEvent>
<Link> <Link>
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>libchipmunk.lib;sqlite3.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>$(OutDir)$(ProjectName).dll</OutputFile> <OutputFile>$(OutDir)$(ProjectName).dll</OutputFile>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreSpecificDefaultLibraries> ;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries> <IgnoreSpecificDefaultLibraries> ;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
@ -165,6 +167,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<ImportLibrary>$(TargetDir)$(TargetName).lib</ImportLibrary> <ImportLibrary>$(TargetDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
<ModuleDefinitionFile>cocos2d.def</ModuleDefinitionFile>
</Link> </Link>
<PostBuildEvent> <PostBuildEvent>
<Command> <Command>
@ -226,6 +229,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
<ClCompile Include="..\base\ccUtils.cpp" /> <ClCompile Include="..\base\ccUtils.cpp" />
<ClCompile Include="..\base\CCValue.cpp" /> <ClCompile Include="..\base\CCValue.cpp" />
<ClCompile Include="..\base\etc1.cpp" /> <ClCompile Include="..\base\etc1.cpp" />
<ClCompile Include="..\base\pvr.cpp" />
<ClCompile Include="..\base\ObjectFactory.cpp" /> <ClCompile Include="..\base\ObjectFactory.cpp" />
<ClCompile Include="..\base\s3tc.cpp" /> <ClCompile Include="..\base\s3tc.cpp" />
<ClCompile Include="..\base\TGAlib.cpp" /> <ClCompile Include="..\base\TGAlib.cpp" />
@ -284,6 +288,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
<ClCompile Include="..\renderer\CCTexture2D.cpp" /> <ClCompile Include="..\renderer\CCTexture2D.cpp" />
<ClCompile Include="..\renderer\CCTextureAtlas.cpp" /> <ClCompile Include="..\renderer\CCTextureAtlas.cpp" />
<ClCompile Include="..\renderer\CCTextureCache.cpp" /> <ClCompile Include="..\renderer\CCTextureCache.cpp" />
<ClCompile Include="..\storage\local-storage\LocalStorage.cpp" />
<ClCompile Include="CCAction.cpp" /> <ClCompile Include="CCAction.cpp" />
<ClCompile Include="CCActionCamera.cpp" /> <ClCompile Include="CCActionCamera.cpp" />
<ClCompile Include="CCActionCatmullRom.cpp" /> <ClCompile Include="CCActionCatmullRom.cpp" />
@ -418,6 +423,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
<ClInclude Include="..\base\etc1.h" /> <ClInclude Include="..\base\etc1.h" />
<ClInclude Include="..\base\firePngData.h" /> <ClInclude Include="..\base\firePngData.h" />
<ClInclude Include="..\base\ObjectFactory.h" /> <ClInclude Include="..\base\ObjectFactory.h" />
<ClInclude Include="..\base\pvr.h" />
<ClInclude Include="..\base\s3tc.h" /> <ClInclude Include="..\base\s3tc.h" />
<ClInclude Include="..\base\TGAlib.h" /> <ClInclude Include="..\base\TGAlib.h" />
<ClInclude Include="..\base\uthash.h" /> <ClInclude Include="..\base\uthash.h" />
@ -489,6 +495,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
<ClInclude Include="..\renderer\CCTexture2D.h" /> <ClInclude Include="..\renderer\CCTexture2D.h" />
<ClInclude Include="..\renderer\CCTextureAtlas.h" /> <ClInclude Include="..\renderer\CCTextureAtlas.h" />
<ClInclude Include="..\renderer\CCTextureCache.h" /> <ClInclude Include="..\renderer\CCTextureCache.h" />
<ClInclude Include="..\storage\local-storage\LocalStorage.h" />
<ClInclude Include="CCAction.h" /> <ClInclude Include="CCAction.h" />
<ClInclude Include="CCActionCamera.h" /> <ClInclude Include="CCActionCamera.h" />
<ClInclude Include="CCActionCatmullRom.h" /> <ClInclude Include="CCActionCatmullRom.h" />
@ -564,6 +571,12 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
<None Include="..\math\Vec2.inl" /> <None Include="..\math\Vec2.inl" />
<None Include="..\math\Vec3.inl" /> <None Include="..\math\Vec3.inl" />
<None Include="..\math\Vec4.inl" /> <None Include="..\math\Vec4.inl" />
<None Include="cocos2d.def" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\external\chipmunk\proj.win32\chipmunk.vcxproj">
<Project>{207bc7a9-ccf1-4f2f-a04d-45f72242ae25}</Project>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View File

@ -55,6 +55,9 @@
<Filter Include="3d"> <Filter Include="3d">
<UniqueIdentifier>{a20c4bdc-bd4c-40c1-a78a-fe31cd3ec76a}</UniqueIdentifier> <UniqueIdentifier>{a20c4bdc-bd4c-40c1-a78a-fe31cd3ec76a}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="storage">
<UniqueIdentifier>{44bdf58f-4af2-433c-b4af-58dc05ef96b5}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\physics\CCPhysicsBody.cpp"> <ClCompile Include="..\physics\CCPhysicsBody.cpp">
@ -403,9 +406,6 @@
<ClCompile Include="..\base\CCUserDefault.cpp"> <ClCompile Include="..\base\CCUserDefault.cpp">
<Filter>base</Filter> <Filter>base</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\base\CCUserDefaultAndroid.cpp">
<Filter>base</Filter>
</ClCompile>
<ClCompile Include="..\base\ccUTF8.cpp"> <ClCompile Include="..\base\ccUTF8.cpp">
<Filter>base</Filter> <Filter>base</Filter>
</ClCompile> </ClCompile>
@ -418,6 +418,9 @@
<ClCompile Include="..\base\etc1.cpp"> <ClCompile Include="..\base\etc1.cpp">
<Filter>base</Filter> <Filter>base</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\base\pvr.cpp">
<Filter>platform</Filter>
</ClCompile>
<ClCompile Include="..\base\s3tc.cpp"> <ClCompile Include="..\base\s3tc.cpp">
<Filter>base</Filter> <Filter>base</Filter>
</ClCompile> </ClCompile>
@ -589,6 +592,9 @@
<ClCompile Include="CCFastTMXTiledMap.cpp"> <ClCompile Include="CCFastTMXTiledMap.cpp">
<Filter>2d</Filter> <Filter>2d</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\storage\local-storage\LocalStorage.cpp">
<Filter>storage</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\physics\CCPhysicsBody.h"> <ClInclude Include="..\physics\CCPhysicsBody.h">
@ -988,6 +994,9 @@
<ClInclude Include="..\base\etc1.h"> <ClInclude Include="..\base\etc1.h">
<Filter>base</Filter> <Filter>base</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\base\pvr.h">
<Filter>platform</Filter>
</ClInclude>
<ClInclude Include="..\base\firePngData.h"> <ClInclude Include="..\base\firePngData.h">
<Filter>base</Filter> <Filter>base</Filter>
</ClInclude> </ClInclude>
@ -1198,6 +1207,9 @@
<ClInclude Include="CCFastTMXLayer.h"> <ClInclude Include="CCFastTMXLayer.h">
<Filter>2d</Filter> <Filter>2d</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\storage\local-storage\LocalStorage.h">
<Filter>storage</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="..\math\Mat4.inl"> <None Include="..\math\Mat4.inl">
@ -1224,5 +1236,6 @@
<None Include="..\3d\CCAnimationCurve.inl"> <None Include="..\3d\CCAnimationCurve.inl">
<Filter>3d</Filter> <Filter>3d</Filter>
</None> </None>
<None Include="cocos2d.def" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -38,11 +38,11 @@
NS_CC_BEGIN NS_CC_BEGIN
class Animation3D; class Animation3D;
class Bone; class Bone3D;
/** /**
* Animate3D, Animates a Sprite3D given with an Animation3D * Animate3D, Animates a Sprite3D given with an Animation3D
*/ */
class Animate3D: public ActionInterval class CC_DLL Animate3D: public ActionInterval
{ {
public: public:
@ -92,7 +92,7 @@ protected:
float _start; //start time 0 - 1, used to generate sub Animate3D float _start; //start time 0 - 1, used to generate sub Animate3D
float _last; //last time 0 - 1, used to generate sub Animate3D float _last; //last time 0 - 1, used to generate sub Animate3D
bool _playReverse; // is playing reverse bool _playReverse; // is playing reverse
std::map<Bone*, Animation3D::Curve*> _boneCurves; //weak ref std::map<Bone3D*, Animation3D::Curve*> _boneCurves; //weak ref
}; };
NS_CC_END NS_CC_END

View File

@ -39,7 +39,7 @@ NS_CC_BEGIN
/** /**
* static animation data, shared * static animation data, shared
*/ */
class Animation3D: public Ref class CC_DLL Animation3D: public Ref
{ {
friend class Bundle3D; friend class Bundle3D;
public: public:

View File

@ -87,7 +87,7 @@ public:
/** /**
* Returns the position of the file pointer. * Returns the position of the file pointer.
*/ */
long int tell(); ssize_t tell();
/** /**
* Sets the position of the file pointer. * Sets the position of the file pointer.

View File

@ -40,7 +40,7 @@ NS_CC_BEGIN
class EventListenerCustom; class EventListenerCustom;
class EventCustom; class EventCustom;
class RenderMeshData class CC_DLL RenderMeshData
{ {
friend class Mesh; friend class Mesh;
public: public:
@ -66,7 +66,7 @@ protected:
* Mesh: Geometry with a collection of vertex. * Mesh: Geometry with a collection of vertex.
* Supporting various vertex formats. * Supporting various vertex formats.
*/ */
class Mesh : public Ref class CC_DLL Mesh : public Ref
{ {
public: public:
/** Defines supported index formats. */ /** Defines supported index formats. */

View File

@ -36,22 +36,22 @@ NS_CC_BEGIN
* *
* @param m C3DMatrix representing the inverse bind pose for this Bone. * @param m C3DMatrix representing the inverse bind pose for this Bone.
*/ */
void Bone::setInverseBindPose(const Mat4& m) void Bone3D::setInverseBindPose(const Mat4& m)
{ {
_invBindPose = m; _invBindPose = m;
} }
const Mat4& Bone::getInverseBindPose() const Mat4& Bone3D::getInverseBindPose()
{ {
return _invBindPose; return _invBindPose;
} }
void Bone::setOriPose(const Mat4& m) void Bone3D::setOriPose(const Mat4& m)
{ {
_oriPose = m; _oriPose = m;
} }
void Bone::resetPose() void Bone3D::resetPose()
{ {
_local =_oriPose; _local =_oriPose;
@ -60,7 +60,7 @@ void Bone::resetPose()
} }
} }
void Bone::setWorldMatDirty(bool dirty) void Bone3D::setWorldMatDirty(bool dirty)
{ {
_worldDirty = dirty; _worldDirty = dirty;
for (auto it : _children) { for (auto it : _children) {
@ -69,7 +69,7 @@ void Bone::setWorldMatDirty(bool dirty)
} }
//update own world matrix and children's //update own world matrix and children's
void Bone::updateWorldMat() void Bone3D::updateWorldMat()
{ {
getWorldMat(); getWorldMat();
for (auto itor : _children) { for (auto itor : _children) {
@ -77,7 +77,7 @@ void Bone::updateWorldMat()
} }
} }
const Mat4& Bone::getWorldMat() const Mat4& Bone3D::getWorldMat()
{ {
if (_worldDirty) if (_worldDirty)
{ {
@ -95,7 +95,7 @@ const Mat4& Bone::getWorldMat()
return _world; return _world;
} }
void Bone::setAnimationValue(float* trans, float* rot, float* scale, void* tag, float weight) void Bone3D::setAnimationValue(float* trans, float* rot, float* scale, void* tag, float weight)
{ {
for (auto& it : _blendStates) { for (auto& it : _blendStates) {
if (it.tag == tag) if (it.tag == tag)
@ -124,7 +124,7 @@ void Bone::setAnimationValue(float* trans, float* rot, float* scale, void* tag,
_blendStates.push_back(state); _blendStates.push_back(state);
} }
void Bone::clearBoneBlendState() void Bone3D::clearBoneBlendState()
{ {
_blendStates.clear(); _blendStates.clear();
for (auto it : _children) { for (auto it : _children) {
@ -135,14 +135,14 @@ void Bone::clearBoneBlendState()
/** /**
* Creates C3DBone. * Creates C3DBone.
*/ */
Bone* Bone::create(const std::string& id) Bone3D* Bone3D::create(const std::string& id)
{ {
auto bone = new Bone(id); auto bone = new Bone3D(id);
bone->autorelease(); bone->autorelease();
return bone; return bone;
} }
void Bone::updateJointMatrix(Vec4* matrixPalette) void Bone3D::updateJointMatrix(Vec4* matrixPalette)
{ {
{ {
static Mat4 t; static Mat4 t;
@ -154,37 +154,37 @@ void Bone::updateJointMatrix(Vec4* matrixPalette)
} }
} }
Bone* Bone::getParentBone() Bone3D* Bone3D::getParentBone()
{ {
return _parent; return _parent;
} }
ssize_t Bone::getChildBoneCount() const ssize_t Bone3D::getChildBoneCount() const
{ {
return _children.size(); return _children.size();
} }
Bone* Bone::getChildBoneByIndex(int index) Bone3D* Bone3D::getChildBoneByIndex(int index)
{ {
return _children.at(index); return _children.at(index);
} }
void Bone::addChildBone(Bone* bone) void Bone3D::addChildBone(Bone3D* bone)
{ {
if (_children.find(bone) == _children.end()) if (_children.find(bone) == _children.end())
_children.pushBack(bone); _children.pushBack(bone);
} }
void Bone::removeChildBoneByIndex(int index) void Bone3D::removeChildBoneByIndex(int index)
{ {
_children.erase(index); _children.erase(index);
} }
void Bone::removeChildBone(Bone* bone) void Bone3D::removeChildBone(Bone3D* bone)
{ {
_children.eraseObject(bone); _children.eraseObject(bone);
} }
void Bone::removeAllChildBone() void Bone3D::removeAllChildBone()
{ {
_children.clear(); _children.clear();
} }
Bone::Bone(const std::string& id) Bone3D::Bone3D(const std::string& id)
: _name(id) : _name(id)
, _parent(nullptr) , _parent(nullptr)
, _worldDirty(true) , _worldDirty(true)
@ -192,12 +192,12 @@ Bone::Bone(const std::string& id)
} }
Bone::~Bone() Bone3D::~Bone3D()
{ {
removeAllChildBone(); removeAllChildBone();
} }
void Bone::updateLocalMat() void Bone3D::updateLocalMat()
{ {
if (_blendStates.size()) if (_blendStates.size())
{ {
@ -299,13 +299,13 @@ bool MeshSkin::initFromSkinData(const SkinData& skindata)
{ {
ssize_t i = 0; ssize_t i = 0;
for (; i < skindata.skinBoneNames.size(); i++) { for (; i < skindata.skinBoneNames.size(); i++) {
auto bone = Bone::create(skindata.skinBoneNames[i]); auto bone = Bone3D::create(skindata.skinBoneNames[i]);
bone->_invBindPose = skindata.inverseBindPoseMatrices[i]; bone->_invBindPose = skindata.inverseBindPoseMatrices[i];
bone->setOriPose(skindata.skinBoneOriginMatrices[i]); bone->setOriPose(skindata.skinBoneOriginMatrices[i]);
addSkinBone(bone); addSkinBone(bone);
} }
for (i = 0; i < skindata.nodeBoneNames.size(); i++) { for (i = 0; i < skindata.nodeBoneNames.size(); i++) {
auto bone = Bone::create(skindata.nodeBoneNames[i]); auto bone = Bone3D::create(skindata.nodeBoneNames[i]);
bone->setOriPose(skindata.nodeBoneOriginMatrices[i]); bone->setOriPose(skindata.nodeBoneOriginMatrices[i]);
addNodeBone(bone); addNodeBone(bone);
} }
@ -330,7 +330,7 @@ ssize_t MeshSkin::getBoneCount() const
} }
//get bone //get bone
Bone* MeshSkin::getBoneByIndex(unsigned int index) const Bone3D* MeshSkin::getBoneByIndex(unsigned int index) const
{ {
if (index < _skinBones.size()) if (index < _skinBones.size())
return _skinBones.at(index); return _skinBones.at(index);
@ -340,7 +340,7 @@ Bone* MeshSkin::getBoneByIndex(unsigned int index) const
return nullptr; return nullptr;
} }
Bone* MeshSkin::getBoneByName(const std::string& id) const Bone3D* MeshSkin::getBoneByName(const std::string& id) const
{ {
//search from skin bones //search from skin bones
for (auto it : _skinBones) { for (auto it : _skinBones) {
@ -355,18 +355,18 @@ Bone* MeshSkin::getBoneByName(const std::string& id) const
return nullptr; return nullptr;
} }
Bone* MeshSkin::getRootBone() const Bone3D* MeshSkin::getRootBone() const
{ {
return _rootBone; return _rootBone;
} }
void MeshSkin::setRootBone(Bone* joint) void MeshSkin::setRootBone(Bone3D* joint)
{ {
CC_SAFE_RETAIN(joint); CC_SAFE_RETAIN(joint);
CC_SAFE_RELEASE(_rootBone); CC_SAFE_RELEASE(_rootBone);
_rootBone = joint; _rootBone = joint;
} }
int MeshSkin::getBoneIndex(Bone* bone) const int MeshSkin::getBoneIndex(Bone3D* bone) const
{ {
int i = 0; int i = 0;
for (; i < _skinBones.size(); i++) { for (; i < _skinBones.size(); i++) {
@ -419,12 +419,12 @@ void MeshSkin::removeAllBones()
CC_SAFE_RELEASE(_rootBone); CC_SAFE_RELEASE(_rootBone);
} }
void MeshSkin::addSkinBone(Bone* bone) void MeshSkin::addSkinBone(Bone3D* bone)
{ {
_skinBones.pushBack(bone); _skinBones.pushBack(bone);
} }
void MeshSkin::addNodeBone(Bone* bone) void MeshSkin::addNodeBone(Bone3D* bone)
{ {
_nodeBones.pushBack(bone); _nodeBones.pushBack(bone);
} }

View File

@ -40,7 +40,7 @@ NS_CC_BEGIN
/** /**
* Defines a basic hierachial structure of transformation spaces. * Defines a basic hierachial structure of transformation spaces.
*/ */
class Bone : public Ref class Bone3D : public Ref
{ {
friend class MeshSkin; friend class MeshSkin;
public: public:
@ -76,7 +76,7 @@ public:
/** /**
* Creates C3DBone. * Creates C3DBone.
*/ */
static Bone* create(const std::string& id); static Bone3D* create(const std::string& id);
/** /**
* Sets the inverse bind pose matrix. * Sets the inverse bind pose matrix.
@ -105,17 +105,17 @@ public:
void updateJointMatrix(Vec4* matrixPalette); void updateJointMatrix(Vec4* matrixPalette);
/**bone tree, we do not inherit from Node, Node has too many properties that we do not need. A clean Node is needed.*/ /**bone tree, we do not inherit from Node, Node has too many properties that we do not need. A clean Node is needed.*/
Bone* getParentBone(); Bone3D* getParentBone();
/**get child bone count*/ /**get child bone count*/
ssize_t getChildBoneCount() const; ssize_t getChildBoneCount() const;
/**get child bone by index*/ /**get child bone by index*/
Bone* getChildBoneByIndex(int index); Bone3D* getChildBoneByIndex(int index);
/**add child bone*/ /**add child bone*/
void addChildBone(Bone* bone); void addChildBone(Bone3D* bone);
/**remove child bone by index*/ /**remove child bone by index*/
void removeChildBoneByIndex(int index); void removeChildBoneByIndex(int index);
/**remove child bone*/ /**remove child bone*/
void removeChildBone(Bone* bone); void removeChildBone(Bone3D* bone);
/**remove all child bone*/ /**remove all child bone*/
void removeAllChildBone(); void removeAllChildBone();
@ -143,12 +143,12 @@ protected:
/** /**
* Constructor. * Constructor.
*/ */
Bone(const std::string& id); Bone3D(const std::string& id);
/** /**
* Destructor. * Destructor.
*/ */
virtual ~Bone(); virtual ~Bone3D();
/** /**
* Update local matrix * Update local matrix
@ -166,9 +166,9 @@ protected:
Mat4 _oriPose; //original bone pose Mat4 _oriPose; //original bone pose
Bone* _parent; //parent bone Bone3D* _parent; //parent bone
Vector<Bone*> _children; Vector<Bone3D*> _children;
bool _worldDirty; bool _worldDirty;
Mat4 _world; Mat4 _world;
@ -193,15 +193,15 @@ public:
ssize_t getBoneCount() const; ssize_t getBoneCount() const;
/**get bone*/ /**get bone*/
Bone* getBoneByIndex(unsigned int index) const; Bone3D* getBoneByIndex(unsigned int index) const;
Bone* getBoneByName(const std::string& id) const; Bone3D* getBoneByName(const std::string& id) const;
/**get & set root bone*/ /**get & set root bone*/
Bone* getRootBone() const; Bone3D* getRootBone() const;
void setRootBone(Bone* bone); void setRootBone(Bone3D* bone);
/**get bone index*/ /**get bone index*/
int getBoneIndex(Bone* bone) const; int getBoneIndex(Bone3D* bone) const;
/**compute matrix palette used by gpu skin*/ /**compute matrix palette used by gpu skin*/
Vec4* getMatrixPalette(); Vec4* getMatrixPalette();
@ -225,17 +225,17 @@ CC_CONSTRUCTOR_ACCESS:
void removeAllBones(); void removeAllBones();
/**add skin bone*/ /**add skin bone*/
void addSkinBone(Bone* bone); void addSkinBone(Bone3D* bone);
/**add Node bone*/ /**add Node bone*/
void addNodeBone(Bone* bone); void addNodeBone(Bone3D* bone);
protected: protected:
Vector<Bone*> _skinBones; // bones with skin Vector<Bone3D*> _skinBones; // bones with skin
Vector<Bone*> _nodeBones; //bones without skin, only used to compute transform of children Vector<Bone3D*> _nodeBones; //bones without skin, only used to compute transform of children
Bone* _rootBone; Bone3D* _rootBone;
// Pointer to the array of palette matrices. // Pointer to the array of palette matrices.
// This array is passed to the vertex shader as a uniform. // This array is passed to the vertex shader as a uniform.

View File

@ -28,6 +28,7 @@
#include "CCObjLoader.h" #include "CCObjLoader.h"
#include "platform/CCFileUtils.h" #include "platform/CCFileUtils.h"
#include "base/ccUtils.h"
NS_CC_BEGIN NS_CC_BEGIN
@ -102,7 +103,7 @@ static inline int parseInt(const char*& token)
static inline float parseFloat(const char*& token) static inline float parseFloat(const char*& token)
{ {
token += strspn(token, " \t"); token += strspn(token, " \t");
float f = (float)atof(token); float f = (float)utils::atof(token);
token += strcspn(token, " \t\r"); token += strcspn(token, " \t\r");
return f; return f;
} }

View File

@ -41,7 +41,7 @@ class Texture2D;
class MeshSkin; class MeshSkin;
/** Sprite3D: A sprite can be loaded from 3D model files, .obj, .c3t, .c3b, then can be drawed as sprite */ /** Sprite3D: A sprite can be loaded from 3D model files, .obj, .c3t, .c3b, then can be drawed as sprite */
class Sprite3D : public Node, public BlendProtocol class CC_DLL Sprite3D : public Node, public BlendProtocol
{ {
public: public:
/** creates a Sprite3D*/ /** creates a Sprite3D*/
@ -94,7 +94,7 @@ protected:
BlendFunc _blend; BlendFunc _blend;
}; };
extern std::string s_attributeNames[];//attribute names array extern std::string CC_DLL s_attributeNames[];//attribute names array
NS_CC_END NS_CC_END
#endif // __SPRITE3D_H_ #endif // __SPRITE3D_H_

View File

@ -140,6 +140,7 @@ base/ccTypes.cpp \
base/ccUTF8.cpp \ base/ccUTF8.cpp \
base/ccUtils.cpp \ base/ccUtils.cpp \
base/etc1.cpp \ base/etc1.cpp \
base/pvr.cpp \
base/s3tc.cpp \ base/s3tc.cpp \
base/CCController.cpp \ base/CCController.cpp \
base/CCController-android.cpp \ base/CCController-android.cpp \
@ -206,12 +207,6 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH) \
$(LOCAL_PATH)/../external/ConvertUTF \ $(LOCAL_PATH)/../external/ConvertUTF \
$(LOCAL_PATH)/../external/nslog $(LOCAL_PATH)/../external/nslog
LOCAL_LDLIBS := -lGLESv2 \
-llog \
-lz \
-landroid
LOCAL_EXPORT_LDLIBS := -lGLESv2 \ LOCAL_EXPORT_LDLIBS := -lGLESv2 \
-llog \ -llog \
-lz \ -lz \
@ -220,15 +215,23 @@ LOCAL_EXPORT_LDLIBS := -lGLESv2 \
LOCAL_WHOLE_STATIC_LIBRARIES := cocos_freetype2_static LOCAL_WHOLE_STATIC_LIBRARIES := cocos_freetype2_static
LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dxandroid_static LOCAL_WHOLE_STATIC_LIBRARIES += cocos2dxandroid_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_png_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_jpeg_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_tiff_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_webp_static
# define the macro to compile through support/zip_support/ioapi.c # define the macro to compile through support/zip_support/ioapi.c
LOCAL_CFLAGS := -DUSE_FILE32API LOCAL_CFLAGS := -DUSE_FILE32API
LOCAL_CPPFLAGS := -Wno-deprecated-declarations LOCAL_CPPFLAGS := -Wno-deprecated-declarations -Wno-extern-c-compat
LOCAL_EXPORT_CFLAGS := -DUSE_FILE32API LOCAL_EXPORT_CFLAGS := -DUSE_FILE32API
LOCAL_EXPORT_CPPFLAGS := -Wno-deprecated-declarations LOCAL_EXPORT_CPPFLAGS := -Wno-deprecated-declarations -Wno-extern-c-compat
include $(BUILD_STATIC_LIBRARY) include $(BUILD_STATIC_LIBRARY)
$(call import-module,freetype2/prebuilt/android) $(call import-module,freetype2/prebuilt/android)
$(call import-module,chipmunk) $(call import-module,chipmunk)
$(call import-module,platform/android) $(call import-module,platform/android)
$(call import-module,jpeg/prebuilt/android)
$(call import-module,png/prebuilt/android)
$(call import-module,tiff/prebuilt/android)
$(call import-module,webp/prebuilt/android)

View File

@ -30,11 +30,11 @@ THE SOFTWARE.
#define EXPORT_DLL _EXPORT_ #define EXPORT_DLL _EXPORT_
#elif defined(_WIN32) #elif defined(_WIN32)
#if defined(_EXPORT_DLL_) #if defined(_EXPORT_DLL_)
#define EXPORT_DLL// __declspec(dllexport) #define EXPORT_DLL __declspec(dllexport)
#elif defined(IGNORE_EXPORT) #elif defined(IGNORE_EXPORT)
#define EXPORT_DLL #define EXPORT_DLL
#else /* use a DLL library */ #else /* use a DLL library */
#define EXPORT_DLL// __declspec(dllimport) #define EXPORT_DLL __declspec(dllimport)
#endif #endif
#else #else
#if defined(_SHARED_) #if defined(_SHARED_)

View File

@ -18,7 +18,7 @@
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>NotSet</CharacterSet> <CharacterSet>NotSet</CharacterSet>
<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>
@ -27,7 +27,7 @@
<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset> <PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v120_xp</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<CharacterSet>NotSet</CharacterSet> <CharacterSet>NotSet</CharacterSet>
<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>
@ -74,7 +74,7 @@
<ClCompile> <ClCompile>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;..\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;..\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_EXPORT_DLL_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild> <MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -90,7 +90,7 @@
<OutputFile>$(OutDir)$(ProjectName).dll</OutputFile> <OutputFile>$(OutDir)$(ProjectName).dll</OutputFile>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<ImportLibrary>$(TargetDir)$(TargetName).lib</ImportLibrary> <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link> </Link>
@ -98,7 +98,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile> <ClCompile>
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;..\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;..\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_EXPORT_DLL_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader> <PrecompiledHeader>
</PrecompiledHeader> </PrecompiledHeader>
@ -116,7 +116,7 @@
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<ImportLibrary>$(TargetDir)$(TargetName).lib</ImportLibrary> <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary>
<TargetMachine>MachineX86</TargetMachine> <TargetMachine>MachineX86</TargetMachine>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link> </Link>
@ -130,6 +130,11 @@
<ClCompile Include="..\win32\MciPlayer.cpp" /> <ClCompile Include="..\win32\MciPlayer.cpp" />
<ClCompile Include="..\win32\SimpleAudioEngine.cpp" /> <ClCompile Include="..\win32\SimpleAudioEngine.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\2d\cocos2d.vcxproj">
<Project>{98a51ba8-fc3a-415b-ac8f-8c7bd464e93e}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View File

@ -63,6 +63,7 @@
#include "renderer/CCTextureCache.h" #include "renderer/CCTextureCache.h"
#include "CCGLView.h" #include "CCGLView.h"
#include "base/base64.h" #include "base/base64.h"
#include "base/ccUtils.h"
NS_CC_BEGIN NS_CC_BEGIN
extern const char* cocos2dVersion(void); extern const char* cocos2dVersion(void);
@ -660,8 +661,8 @@ void Console::commandTouch(int fd, const std::string& args)
if((argv.size() == 3) && (isFloat(argv[1]) && isFloat(argv[2]))) if((argv.size() == 3) && (isFloat(argv[1]) && isFloat(argv[2])))
{ {
float x = std::atof(argv[1].c_str()); float x = utils::atof(argv[1].c_str());
float y = std::atof(argv[2].c_str()); float y = utils::atof(argv[2].c_str());
srand ((unsigned)time(nullptr)); srand ((unsigned)time(nullptr));
_touchId = rand(); _touchId = rand();
@ -686,10 +687,10 @@ void Console::commandTouch(int fd, const std::string& args)
&& (isFloat(argv[3])) && (isFloat(argv[4]))) && (isFloat(argv[3])) && (isFloat(argv[4])))
{ {
float x1 = std::atof(argv[1].c_str()); float x1 = utils::atof(argv[1].c_str());
float y1 = std::atof(argv[2].c_str()); float y1 = utils::atof(argv[2].c_str());
float x2 = std::atof(argv[3].c_str()); float x2 = utils::atof(argv[3].c_str());
float y2 = std::atof(argv[4].c_str()); float y2 = utils::atof(argv[4].c_str());
srand ((unsigned)time(nullptr)); srand ((unsigned)time(nullptr));
_touchId = rand(); _touchId = rand();

View File

@ -30,7 +30,7 @@
#include "ccMacros.h" #include "ccMacros.h"
#include "CCDirector.h" #include "CCDirector.h"
#include "jni/JniHelper.h" #include "jni/JniHelper.h"
#include "base/CCEventController.h"
NS_CC_BEGIN NS_CC_BEGIN

View File

@ -196,7 +196,7 @@ void Controller::registerListeners()
}; };
_impl->_gcController.extendedGamepad.leftThumbstick.yAxis.valueChangedHandler = ^(GCControllerAxisInput *axis, float value){ _impl->_gcController.extendedGamepad.leftThumbstick.yAxis.valueChangedHandler = ^(GCControllerAxisInput *axis, float value){
onAxisEvent(Key::JOYSTICK_LEFT_Y, value, axis.isAnalog); onAxisEvent(Key::JOYSTICK_LEFT_Y, -value, axis.isAnalog);
}; };
_impl->_gcController.extendedGamepad.rightThumbstick.xAxis.valueChangedHandler = ^(GCControllerAxisInput *axis, float value){ _impl->_gcController.extendedGamepad.rightThumbstick.xAxis.valueChangedHandler = ^(GCControllerAxisInput *axis, float value){
@ -204,7 +204,7 @@ void Controller::registerListeners()
}; };
_impl->_gcController.extendedGamepad.rightThumbstick.yAxis.valueChangedHandler = ^(GCControllerAxisInput *axis, float value){ _impl->_gcController.extendedGamepad.rightThumbstick.yAxis.valueChangedHandler = ^(GCControllerAxisInput *axis, float value){
onAxisEvent(Key::JOYSTICK_RIGHT_Y, value, axis.isAnalog); onAxisEvent(Key::JOYSTICK_RIGHT_Y, -value, axis.isAnalog);
}; };
_impl->_gcController.extendedGamepad.valueChangedHandler = ^(GCExtendedGamepad *gamepad, GCControllerElement *element){ _impl->_gcController.extendedGamepad.valueChangedHandler = ^(GCExtendedGamepad *gamepad, GCControllerElement *element){

View File

@ -41,6 +41,9 @@ class EventDispatcher;
class Controller class Controller
{ {
public: public:
/** Controllers' standard key
* Controller receives only standard key which contained within enum Key by default.
*/
enum Key enum Key
{ {
JOYSTICK_LEFT_X = 1000, JOYSTICK_LEFT_X = 1000,
@ -87,9 +90,17 @@ public:
static const int TAG_UNSET = -1; static const int TAG_UNSET = -1;
static const std::vector<Controller*>& getAllController(){ return s_allController;} static const std::vector<Controller*>& getAllController(){ return s_allController;}
/** Gets a controller with its tag
* @param tag An identifier to find the controller.
*/
static Controller* getControllerByTag(int tag); static Controller* getControllerByTag(int tag);
/** To start discovering new controllers
* @warning The API only work on the IOS platform.Empty implementation on Android
*/
static void startDiscoveryController(); static void startDiscoveryController();
/** End the discovery process
* @warning The API only work on the IOS platform.Empty implementation on Android
*/
static void stopDiscoveryController(); static void stopDiscoveryController();
const std::string& getDeviceName() const { return _deviceName;} const std::string& getDeviceName() const { return _deviceName;}
@ -108,7 +119,15 @@ public:
*/ */
void receiveExternalKeyEvent(int externalKeyCode,bool receive); void receiveExternalKeyEvent(int externalKeyCode,bool receive);
/** Changes the tag that is used to identify the controller easily.
* @param tag A integer that identifies the controller.
*/
void setTag(int tag) { _controllerTag = tag;} void setTag(int tag) { _controllerTag = tag;}
/**
* Returns a tag that is used to identify the controller easily.
*
* @return An integer that identifies the controller.
*/
int getTag() const { return _controllerTag;} int getTag() const { return _controllerTag;}
private: private:

View File

@ -100,7 +100,7 @@ ssize_t Data::getSize() const
return _size; return _size;
} }
void Data::copy(unsigned char* bytes, const ssize_t size) void Data::copy(const unsigned char* bytes, const ssize_t size)
{ {
clear(); clear();

View File

@ -63,7 +63,7 @@ public:
* Developer should free the pointer after invoking this method. * Developer should free the pointer after invoking this method.
* @see Data::fastSet * @see Data::fastSet
*/ */
void copy(unsigned char* bytes, const ssize_t size); void copy(const unsigned char* bytes, const ssize_t size);
/** Fast set the buffer pointer and its size. Please use it carefully. /** Fast set the buffer pointer and its size. Please use it carefully.
* @param bytes The buffer pointer, note that it have to be allocated by 'malloc' or 'calloc', * @param bytes The buffer pointer, note that it have to be allocated by 'malloc' or 'calloc',

View File

@ -36,6 +36,7 @@ THE SOFTWARE.
#include "base/CCVector.h" #include "base/CCVector.h"
#include "CCGL.h" #include "CCGL.h"
#include "2d/CCLabelAtlas.h" #include "2d/CCLabelAtlas.h"
#include "2d/CCScene.h"
#include <stack> #include <stack>
#include "math/CCMath.h" #include "math/CCMath.h"

View File

@ -39,7 +39,7 @@ class Node;
/** /**
* Base class of all kinds of events. * Base class of all kinds of events.
*/ */
class Event : public Ref class CC_DLL Event : public Ref
{ {
public: public:
enum class Type enum class Type

View File

@ -30,7 +30,7 @@
NS_CC_BEGIN NS_CC_BEGIN
class EventAcceleration : public Event class CC_DLL EventAcceleration : public Event
{ {
public: public:
EventAcceleration(const Acceleration& acc); EventAcceleration(const Acceleration& acc);

View File

@ -29,7 +29,7 @@
NS_CC_BEGIN NS_CC_BEGIN
class EventCustom : public Event class CC_DLL EventCustom : public Event
{ {
public: public:
/** Constructor */ /** Constructor */

View File

@ -53,7 +53,7 @@ event listeners can be added and removed even
from within an EventListener, while events are being from within an EventListener, while events are being
dispatched. dispatched.
*/ */
class EventDispatcher : public Ref class CC_DLL EventDispatcher : public Ref
{ {
public: public:
// Adds event listener // Adds event listener

View File

@ -35,7 +35,7 @@ namespace ui {
class Widget; class Widget;
} }
class EventFocus : public Event class CC_DLL EventFocus : public Event
{ {
public: public:
EventFocus(ui::Widget* widgetLoseFocus, ui::Widget* widgetGetFocus); EventFocus(ui::Widget* widgetLoseFocus, ui::Widget* widgetGetFocus);

View File

@ -30,7 +30,7 @@
NS_CC_BEGIN NS_CC_BEGIN
class EventKeyboard : public Event class CC_DLL EventKeyboard : public Event
{ {
public: public:
/** /**

View File

@ -43,7 +43,7 @@ class Node;
* If you need custom listener which with different callback, you need to inherit this class. * If you need custom listener which with different callback, you need to inherit this class.
* For instance, you could refer to EventListenerAcceleration, EventListenerKeyboard, EventListenerTouchOneByOne, EventListenerCustom. * For instance, you could refer to EventListenerAcceleration, EventListenerKeyboard, EventListenerTouchOneByOne, EventListenerCustom.
*/ */
class EventListener : public Ref class CC_DLL EventListener : public Ref
{ {
public: public:
enum class Type enum class Type

View File

@ -30,7 +30,7 @@
NS_CC_BEGIN NS_CC_BEGIN
class EventListenerAcceleration : public EventListener class CC_DLL EventListenerAcceleration : public EventListener
{ {
public: public:
static const std::string LISTENER_ID; static const std::string LISTENER_ID;

View File

@ -49,7 +49,7 @@ class EventCustom;
* *
* dispatcher->removeEventListener(listener); * dispatcher->removeEventListener(listener);
*/ */
class EventListenerCustom : public EventListener class CC_DLL EventListenerCustom : public EventListener
{ {
public: public:
/** Creates an event listener with type and callback. /** Creates an event listener with type and callback.

View File

@ -35,7 +35,7 @@ namespace ui {
class Widget; class Widget;
} }
class EventListenerFocus : public EventListener class CC_DLL EventListenerFocus : public EventListener
{ {
public: public:
static const std::string LISTENER_ID; static const std::string LISTENER_ID;

View File

@ -33,7 +33,7 @@ NS_CC_BEGIN
class Event; class Event;
class EventListenerKeyboard : public EventListener class CC_DLL EventListenerKeyboard : public EventListener
{ {
public: public:
static const std::string LISTENER_ID; static const std::string LISTENER_ID;

View File

@ -33,7 +33,7 @@ NS_CC_BEGIN
class Event; class Event;
class EventListenerMouse : public EventListener class CC_DLL EventListenerMouse : public EventListener
{ {
public: public:
static const std::string LISTENER_ID; static const std::string LISTENER_ID;

View File

@ -33,7 +33,7 @@
NS_CC_BEGIN NS_CC_BEGIN
class EventListenerTouchOneByOne : public EventListener class CC_DLL EventListenerTouchOneByOne : public EventListener
{ {
public: public:
static const std::string LISTENER_ID; static const std::string LISTENER_ID;
@ -67,7 +67,7 @@ private:
}; };
class EventListenerTouchAllAtOnce : public EventListener class CC_DLL EventListenerTouchAllAtOnce : public EventListener
{ {
public: public:
static const std::string LISTENER_ID; static const std::string LISTENER_ID;

View File

@ -39,7 +39,7 @@
NS_CC_BEGIN NS_CC_BEGIN
class EventMouse : public Event class CC_DLL EventMouse : public Event
{ {
public: public:
/** /**

View File

@ -33,7 +33,7 @@ NS_CC_BEGIN
#define TOUCH_PERF_DEBUG 1 #define TOUCH_PERF_DEBUG 1
class EventTouch : public Event class CC_DLL EventTouch : public Event
{ {
public: public:
static const int MAX_TOUCHES = 5; static const int MAX_TOUCHES = 5;

View File

@ -30,7 +30,7 @@ THE SOFTWARE.
#include "math/CCGeometry.h" #include "math/CCGeometry.h"
NS_CC_BEGIN NS_CC_BEGIN
extern const std::string STD_STRING_EMPTY; extern const std::string CC_DLL STD_STRING_EMPTY;
/** /**
* @addtogroup input * @addtogroup input

View File

@ -45,7 +45,7 @@ NS_CC_BEGIN
*/ */
template <class K, class V> template <class K, class V>
class CC_DLL Map class Map
{ {
public: public:
// ------------------------------------------ // ------------------------------------------

View File

@ -28,6 +28,8 @@ THE SOFTWARE.
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include "base/ccUtils.h"
using namespace std; using namespace std;
NS_CC_BEGIN NS_CC_BEGIN
@ -133,10 +135,10 @@ Rect RectFromString(const std::string& str)
strArray sizeInfo; strArray sizeInfo;
CC_BREAK_IF(!splitWithForm(sizeStr.c_str(), sizeInfo)); CC_BREAK_IF(!splitWithForm(sizeStr.c_str(), sizeInfo));
float x = (float) atof(pointInfo[0].c_str()); float x = (float) utils::atof(pointInfo[0].c_str());
float y = (float) atof(pointInfo[1].c_str()); float y = (float) utils::atof(pointInfo[1].c_str());
float width = (float) atof(sizeInfo[0].c_str()); float width = (float) utils::atof(sizeInfo[0].c_str());
float height = (float) atof(sizeInfo[1].c_str()); float height = (float) utils::atof(sizeInfo[1].c_str());
result = Rect(x, y, width, height); result = Rect(x, y, width, height);
} while (0); } while (0);
@ -153,8 +155,8 @@ Vec2 PointFromString(const std::string& str)
strArray strs; strArray strs;
CC_BREAK_IF(!splitWithForm(str, strs)); CC_BREAK_IF(!splitWithForm(str, strs));
float x = (float) atof(strs[0].c_str()); float x = (float) utils::atof(strs[0].c_str());
float y = (float) atof(strs[1].c_str()); float y = (float) utils::atof(strs[1].c_str());
ret = Vec2(x, y); ret = Vec2(x, y);
} while (0); } while (0);
@ -171,8 +173,8 @@ Size SizeFromString(const std::string& pszContent)
strArray strs; strArray strs;
CC_BREAK_IF(!splitWithForm(pszContent, strs)); CC_BREAK_IF(!splitWithForm(pszContent, strs));
float width = (float) atof(strs[0].c_str()); float width = (float) utils::atof(strs[0].c_str());
float height = (float) atof(strs[1].c_str()); float height = (float) utils::atof(strs[1].c_str());
ret = Size(width, height); ret = Size(width, height);
} while (0); } while (0);

View File

@ -143,9 +143,9 @@ public:
long numberOfCalls; long numberOfCalls;
}; };
extern void ProfilingBeginTimingBlock(const char *timerName); extern void CC_DLL ProfilingBeginTimingBlock(const char *timerName);
extern void ProfilingEndTimingBlock(const char *timerName); extern void CC_DLL ProfilingEndTimingBlock(const char *timerName);
extern void ProfilingResetTimingBlock(const char *timerName); extern void CC_DLL ProfilingResetTimingBlock(const char *timerName);
/* /*
* cocos2d profiling categories * cocos2d profiling categories

View File

@ -27,6 +27,7 @@ THE SOFTWARE.
#include "platform/CCFileUtils.h" #include "platform/CCFileUtils.h"
#include "tinyxml2.h" #include "tinyxml2.h"
#include "base/base64.h" #include "base/base64.h"
#include "base/ccUtils.h"
#if (CC_TARGET_PLATFORM != CC_PLATFORM_IOS && CC_TARGET_PLATFORM != CC_PLATFORM_MAC && CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID) #if (CC_TARGET_PLATFORM != CC_PLATFORM_IOS && CC_TARGET_PLATFORM != CC_PLATFORM_MAC && CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID)
@ -250,7 +251,7 @@ double UserDefault::getDoubleForKey(const char* pKey, double defaultValue)
if (value) if (value)
{ {
ret = atof(value); ret = utils::atof(value);
} }
if (doc) delete doc; if (doc) delete doc;

View File

@ -173,7 +173,7 @@ public:
/** /**
* @js NA * @js NA
*/ */
const static std::string& getXMLFilePath(); static const std::string& getXMLFilePath();
/** /**
* @js NA * @js NA
*/ */

View File

@ -24,6 +24,7 @@ THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include "base/CCUserDefault.h" #include "base/CCUserDefault.h"
#include "base/CCPlatformConfig.h" #include "base/CCPlatformConfig.h"
#include "base/ccUtils.h"
#include "platform/CCCommon.h" #include "platform/CCCommon.h"
#include "base/base64.h" #include "base/base64.h"
@ -243,7 +244,7 @@ float UserDefault::getFloatForKey(const char* pKey, float defaultValue)
{ {
if (node->FirstChild()) if (node->FirstChild())
{ {
float ret = atof((const char*)node->FirstChild()->Value()); float ret = utils::atof((const char*)node->FirstChild()->Value());
// set value in NSUserDefaults // set value in NSUserDefaults
setFloatForKey(pKey, ret); setFloatForKey(pKey, ret);
@ -279,7 +280,7 @@ double UserDefault::getDoubleForKey(const char* pKey, double defaultValue)
{ {
if (node->FirstChild()) if (node->FirstChild())
{ {
double ret = atof((const char*)node->FirstChild()->Value()); double ret = utils::atof((const char*)node->FirstChild()->Value());
// set value in NSUserDefaults // set value in NSUserDefaults
setDoubleForKey(pKey, ret); setDoubleForKey(pKey, ret);
@ -455,7 +456,7 @@ void UserDefault::setDataForKey(const char* pKey, const Data& value)
deleteNodeByKey(pKey); deleteNodeByKey(pKey);
#endif #endif
CCLOG("SET DATA FOR KEY: --%s--%d", value.getBytes(), value.getSize()); CCLOG("SET DATA FOR KEY: --%s--%d", value.getBytes(), (int)(value.getSize()));
char * encodedData = nullptr; char * encodedData = nullptr;
unsigned int encodedDataLen = base64Encode(value.getBytes(), value.getSize(), &encodedData); unsigned int encodedDataLen = base64Encode(value.getBytes(), value.getSize(), &encodedData);

View File

@ -25,6 +25,7 @@
#include "base/CCValue.h" #include "base/CCValue.h"
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
#include "base/ccUtils.h"
NS_CC_BEGIN NS_CC_BEGIN
@ -504,7 +505,7 @@ float Value::asFloat() const
if (_type == Type::STRING) if (_type == Type::STRING)
{ {
return atof(_field.strVal->c_str()); return utils::atof(_field.strVal->c_str());
} }
if (_type == Type::INTEGER) if (_type == Type::INTEGER)
@ -540,7 +541,7 @@ double Value::asDouble() const
if (_type == Type::STRING) if (_type == Type::STRING)
{ {
return static_cast<double>(atof(_field.strVal->c_str())); return static_cast<double>(utils::atof(_field.strVal->c_str()));
} }
if (_type == Type::INTEGER) if (_type == Type::INTEGER)

View File

@ -43,7 +43,7 @@ extern const ValueVector ValueVectorNull;
extern const ValueMap ValueMapNull; extern const ValueMap ValueMapNull;
extern const ValueMapIntKey ValueMapIntKeyNull; extern const ValueMapIntKey ValueMapIntKeyNull;
class Value class CC_DLL Value
{ {
public: public:
static const Value Null; static const Value Null;

View File

@ -35,7 +35,7 @@ THE SOFTWARE.
NS_CC_BEGIN NS_CC_BEGIN
template<class T> template<class T>
class CC_DLL Vector class Vector
{ {
public: public:
// ------------------------------------------ // ------------------------------------------

View File

@ -40,6 +40,7 @@ set(COCOS_BASE_SRC
base/ccUTF8.cpp base/ccUTF8.cpp
base/ccUtils.cpp base/ccUtils.cpp
base/etc1.cpp base/etc1.cpp
base/pvr.cpp
base/s3tc.cpp base/s3tc.cpp
base/ObjectFactory.cpp base/ObjectFactory.cpp
) )

View File

@ -32,11 +32,11 @@ THE SOFTWARE.
NS_CC_BEGIN NS_CC_BEGIN
class ObjectFactory class CC_DLL ObjectFactory
{ {
public: public:
typedef cocos2d::Ref* (*Instance)(void); typedef cocos2d::Ref* (*Instance)(void);
struct TInfo struct CC_DLL TInfo
{ {
TInfo(void); TInfo(void);
TInfo(const std::string& type, Instance ins = NULL); TInfo(const std::string& type, Instance ins = NULL);

View File

@ -68,7 +68,7 @@ int _base64Decode(const unsigned char *input, unsigned int input_len, unsigned c
switch (char_count) { switch (char_count) {
case 1: case 1:
#if (CC_TARGET_PLATFORM != CC_PLATFORM_BADA) #if (CC_TARGET_PLATFORM != CC_PLATFORM_BADA)
std::fprintf(stderr, "base64Decode: encoding incomplete: at least 2 bits missing"); fprintf(stderr, "base64Decode: encoding incomplete: at least 2 bits missing");
#endif #endif
errors++; errors++;
break; break;
@ -83,7 +83,7 @@ int _base64Decode(const unsigned char *input, unsigned int input_len, unsigned c
} else if ( input_idx < input_len ) { } else if ( input_idx < input_len ) {
if (char_count) { if (char_count) {
#if (CC_TARGET_PLATFORM != CC_PLATFORM_BADA) #if (CC_TARGET_PLATFORM != CC_PLATFORM_BADA)
std::fprintf(stderr, "base64 encoding incomplete: at least %d bits truncated", fprintf(stderr, "base64 encoding incomplete: at least %d bits truncated",
((4 - char_count) * 6)); ((4 - char_count) * 6));
#endif #endif
errors++; errors++;

View File

@ -26,6 +26,8 @@ THE SOFTWARE.
#ifndef __SUPPORT_BASE64_H__ #ifndef __SUPPORT_BASE64_H__
#define __SUPPORT_BASE64_H__ #define __SUPPORT_BASE64_H__
#include "base/CCPlatformMacros.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -44,7 +46,7 @@ namespace cocos2d {
* *
@since v0.8.1 @since v0.8.1
*/ */
int base64Decode(const unsigned char *in, unsigned int inLength, unsigned char **out); int CC_DLL base64Decode(const unsigned char *in, unsigned int inLength, unsigned char **out);
/** /**
* Encodes bytes into a 64base encoded memory with terminating '\0' character. * Encodes bytes into a 64base encoded memory with terminating '\0' character.
@ -54,7 +56,7 @@ int base64Decode(const unsigned char *in, unsigned int inLength, unsigned char *
* *
@since v2.1.4 @since v2.1.4
*/ */
int base64Encode(const unsigned char *in, unsigned int inLength, char **out); int CC_DLL base64Encode(const unsigned char *in, unsigned int inLength, char **out);
}//namespace cocos2d }//namespace cocos2d

View File

@ -283,5 +283,5 @@ To enable set it to a value different than 0. Disabled by default.
#ifndef CC_CONSTRUCTOR_ACCESS #ifndef CC_CONSTRUCTOR_ACCESS
#define CC_CONSTRUCTOR_ACCESS protected #define CC_CONSTRUCTOR_ACCESS protected
#endif #endif
#endif // __CCCONFIG_H__ #endif // __CCCONFIG_H__

View File

@ -43,7 +43,7 @@ struct Color4F;
/** RGB color composed of bytes 3 bytes /** RGB color composed of bytes 3 bytes
@since v3.0 @since v3.0
*/ */
struct Color3B struct CC_DLL Color3B
{ {
Color3B(); Color3B();
Color3B(GLubyte _r, GLubyte _g, GLubyte _b); Color3B(GLubyte _r, GLubyte _g, GLubyte _b);
@ -66,21 +66,21 @@ struct Color3B
GLubyte g; GLubyte g;
GLubyte b; GLubyte b;
const static Color3B WHITE; static const Color3B WHITE;
const static Color3B YELLOW; static const Color3B YELLOW;
const static Color3B BLUE; static const Color3B BLUE;
const static Color3B GREEN; static const Color3B GREEN;
const static Color3B RED; static const Color3B RED;
const static Color3B MAGENTA; static const Color3B MAGENTA;
const static Color3B BLACK; static const Color3B BLACK;
const static Color3B ORANGE; static const Color3B ORANGE;
const static Color3B GRAY; static const Color3B GRAY;
}; };
/** RGBA color composed of 4 bytes /** RGBA color composed of 4 bytes
@since v3.0 @since v3.0
*/ */
struct Color4B struct CC_DLL Color4B
{ {
Color4B(); Color4B();
Color4B(GLubyte _r, GLubyte _g, GLubyte _b, GLubyte _a); Color4B(GLubyte _r, GLubyte _g, GLubyte _b, GLubyte _a);
@ -99,22 +99,22 @@ struct Color4B
GLubyte b; GLubyte b;
GLubyte a; GLubyte a;
const static Color4B WHITE; static const Color4B WHITE;
const static Color4B YELLOW; static const Color4B YELLOW;
const static Color4B BLUE; static const Color4B BLUE;
const static Color4B GREEN; static const Color4B GREEN;
const static Color4B RED; static const Color4B RED;
const static Color4B MAGENTA; static const Color4B MAGENTA;
const static Color4B BLACK; static const Color4B BLACK;
const static Color4B ORANGE; static const Color4B ORANGE;
const static Color4B GRAY; static const Color4B GRAY;
}; };
/** RGBA color composed of 4 floats /** RGBA color composed of 4 floats
@since v3.0 @since v3.0
*/ */
struct Color4F struct CC_DLL Color4F
{ {
Color4F(); Color4F();
Color4F(float _r, float _g, float _b, float _a); Color4F(float _r, float _g, float _b, float _a);
@ -138,15 +138,15 @@ struct Color4F
GLfloat b; GLfloat b;
GLfloat a; GLfloat a;
const static Color4F WHITE; static const Color4F WHITE;
const static Color4F YELLOW; static const Color4F YELLOW;
const static Color4F BLUE; static const Color4F BLUE;
const static Color4F GREEN; static const Color4F GREEN;
const static Color4F RED; static const Color4F RED;
const static Color4F MAGENTA; static const Color4F MAGENTA;
const static Color4F BLACK; static const Color4F BLACK;
const static Color4F ORANGE; static const Color4F ORANGE;
const static Color4F GRAY; static const Color4F GRAY;
}; };
/** A vertex composed of 2 floats: x, y /** A vertex composed of 2 floats: x, y
@ -184,7 +184,7 @@ struct Color4F
/** A texcoord composed of 2 floats: u, y /** A texcoord composed of 2 floats: u, y
@since v3.0 @since v3.0
*/ */
struct Tex2F { struct CC_DLL Tex2F {
Tex2F(float _u, float _v): u(_u), v(_v) {} Tex2F(float _u, float _v): u(_u), v(_v) {}
Tex2F(): u(0.f), v(0.f) {} Tex2F(): u(0.f), v(0.f) {}
@ -195,7 +195,7 @@ struct Tex2F {
//! Vec2 Sprite component //! Vec2 Sprite component
struct PointSprite struct CC_DLL PointSprite
{ {
Vec2 pos; // 8 bytes Vec2 pos; // 8 bytes
Color4B color; // 4 bytes Color4B color; // 4 bytes
@ -203,7 +203,7 @@ struct PointSprite
}; };
//! A 2D Quad. 4 * 2 floats //! A 2D Quad. 4 * 2 floats
struct Quad2 struct CC_DLL Quad2
{ {
Vec2 tl; Vec2 tl;
Vec2 tr; Vec2 tr;
@ -213,7 +213,7 @@ struct Quad2
//! A 3D Quad. 4 * 3 floats //! A 3D Quad. 4 * 3 floats
struct Quad3 { struct CC_DLL Quad3 {
Vec3 bl; Vec3 bl;
Vec3 br; Vec3 br;
Vec3 tl; Vec3 tl;
@ -232,7 +232,7 @@ struct V2F_C4B_T2F
}; };
//! a Vec2 with a vertex point, a tex coord point and a color 4F //! a Vec2 with a vertex point, a tex coord point and a color 4F
struct V2F_C4F_T2F struct CC_DLL V2F_C4F_T2F
{ {
//! vertices (2F) //! vertices (2F)
Vec2 vertices; Vec2 vertices;
@ -243,7 +243,7 @@ struct V2F_C4F_T2F
}; };
//! a Vec2 with a vertex point, a tex coord point and a color 4B //! a Vec2 with a vertex point, a tex coord point and a color 4B
struct V3F_C4B_T2F struct CC_DLL V3F_C4B_T2F
{ {
//! vertices (3F) //! vertices (3F)
Vec3 vertices; // 12 bytes Vec3 vertices; // 12 bytes
@ -256,7 +256,7 @@ struct V3F_C4B_T2F
}; };
//! a Vec2 with a vertex point, a tex coord point //! a Vec2 with a vertex point, a tex coord point
struct V3F_T2F struct CC_DLL V3F_T2F
{ {
//! vertices (2F) //! vertices (2F)
Vec3 vertices; Vec3 vertices;
@ -265,7 +265,7 @@ struct V3F_T2F
}; };
//! A Triangle of V2F_C4B_T2F //! A Triangle of V2F_C4B_T2F
struct V2F_C4B_T2F_Triangle struct CC_DLL V2F_C4B_T2F_Triangle
{ {
//! Vec2 A //! Vec2 A
V2F_C4B_T2F a; V2F_C4B_T2F a;
@ -276,7 +276,7 @@ struct V2F_C4B_T2F_Triangle
}; };
//! A Quad of V2F_C4B_T2F //! A Quad of V2F_C4B_T2F
struct V2F_C4B_T2F_Quad struct CC_DLL V2F_C4B_T2F_Quad
{ {
//! bottom left //! bottom left
V2F_C4B_T2F bl; V2F_C4B_T2F bl;
@ -289,7 +289,7 @@ struct V2F_C4B_T2F_Quad
}; };
//! 4 Vertex3FTex2FColor4B //! 4 Vertex3FTex2FColor4B
struct V3F_C4B_T2F_Quad struct CC_DLL V3F_C4B_T2F_Quad
{ {
//! top left //! top left
V3F_C4B_T2F tl; V3F_C4B_T2F tl;
@ -302,7 +302,7 @@ struct V3F_C4B_T2F_Quad
}; };
//! 4 Vertex2FTex2FColor4F Quad //! 4 Vertex2FTex2FColor4F Quad
struct V2F_C4F_T2F_Quad struct CC_DLL V2F_C4F_T2F_Quad
{ {
//! bottom left //! bottom left
V2F_C4F_T2F bl; V2F_C4F_T2F bl;
@ -314,7 +314,7 @@ struct V2F_C4F_T2F_Quad
V2F_C4F_T2F tr; V2F_C4F_T2F tr;
}; };
struct V3F_T2F_Quad struct CC_DLL V3F_T2F_Quad
{ {
//! bottom left //! bottom left
V3F_T2F bl; V3F_T2F bl;
@ -327,7 +327,7 @@ struct V3F_T2F_Quad
}; };
//! Blend Function used for textures //! Blend Function used for textures
struct BlendFunc struct CC_DLL BlendFunc
{ {
//! source blend function //! source blend function
GLenum src; GLenum src;
@ -335,13 +335,13 @@ struct BlendFunc
GLenum dst; GLenum dst;
//! Blending disabled. Uses {GL_ONE, GL_ZERO} //! Blending disabled. Uses {GL_ONE, GL_ZERO}
const static BlendFunc DISABLE; static const BlendFunc DISABLE;
//! Blending enabled for textures with Alpha premultiplied. Uses {GL_ONE, GL_ONE_MINUS_SRC_ALPHA} //! Blending enabled for textures with Alpha premultiplied. Uses {GL_ONE, GL_ONE_MINUS_SRC_ALPHA}
const static BlendFunc ALPHA_PREMULTIPLIED; static const BlendFunc ALPHA_PREMULTIPLIED;
//! Blending enabled for textures with Alpha NON premultiplied. Uses {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA} //! Blending enabled for textures with Alpha NON premultiplied. Uses {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA}
const static BlendFunc ALPHA_NON_PREMULTIPLIED; static const BlendFunc ALPHA_NON_PREMULTIPLIED;
//! Enables Additive blending. Uses {GL_SRC_ALPHA, GL_ONE} //! Enables Additive blending. Uses {GL_SRC_ALPHA, GL_ONE}
const static BlendFunc ADDITIVE; static const BlendFunc ADDITIVE;
bool operator==(const BlendFunc &a) const bool operator==(const BlendFunc &a) const
{ {
@ -359,7 +359,7 @@ struct BlendFunc
// XXX: If any of these enums are edited and/or reordered, update Texture2D.m // XXX: If any of these enums are edited and/or reordered, update Texture2D.m
//! Vertical text alignment type //! Vertical text alignment type
enum class TextVAlignment enum class CC_DLL TextVAlignment
{ {
TOP, TOP,
CENTER, CENTER,
@ -368,7 +368,7 @@ enum class TextVAlignment
// XXX: If any of these enums are edited and/or reordered, update Texture2D.m // XXX: If any of these enums are edited and/or reordered, update Texture2D.m
//! Horizontal text alignment type //! Horizontal text alignment type
enum class TextHAlignment enum class CC_DLL TextHAlignment
{ {
LEFT, LEFT,
CENTER, CENTER,
@ -378,7 +378,7 @@ enum class TextHAlignment
// types for animation in particle systems // types for animation in particle systems
// texture coordinates for a quad // texture coordinates for a quad
struct T2F_Quad struct CC_DLL T2F_Quad
{ {
//! bottom left //! bottom left
Tex2F bl; Tex2F bl;
@ -391,7 +391,7 @@ struct T2F_Quad
}; };
// struct that holds the size in pixels, texture coordinates and delays for animated ParticleSystemQuad // struct that holds the size in pixels, texture coordinates and delays for animated ParticleSystemQuad
struct AnimationFrameData struct CC_DLL AnimationFrameData
{ {
T2F_Quad texCoords; T2F_Quad texCoords;
float delay; float delay;
@ -404,7 +404,7 @@ struct AnimationFrameData
// shadow attributes // shadow attributes
struct FontShadow struct CC_DLL FontShadow
{ {
public: public:
@ -426,7 +426,7 @@ public:
}; };
// stroke attributes // stroke attributes
struct FontStroke struct CC_DLL FontStroke
{ {
public: public:
@ -447,7 +447,7 @@ public:
}; };
// font attributes // font attributes
struct FontDefinition struct CC_DLL FontDefinition
{ {
public: public:
/** /**
@ -484,7 +484,7 @@ public:
/** /**
@brief The device accelerometer reports values for each axis in units of g-force @brief The device accelerometer reports values for each axis in units of g-force
*/ */
class Acceleration class CC_DLL Acceleration
: public Ref : public Ref
{ {
public: public:
@ -497,8 +497,8 @@ public:
Acceleration(): x(0), y(0), z(0), timestamp(0) {} Acceleration(): x(0), y(0), z(0), timestamp(0) {}
}; };
extern const std::string STD_STRING_EMPTY; extern const std::string CC_DLL STD_STRING_EMPTY;
extern const ssize_t CC_INVALID_INDEX; extern const ssize_t CC_DLL CC_INVALID_INDEX;
NS_CC_END NS_CC_END

View File

@ -133,7 +133,7 @@ CC_DEPRECATED_ATTRIBUTE CC_DLL int cc_wcslen(const unsigned short* str);
* @deprecated Please use `StringUtils::trimUTF16Vector` instead * @deprecated Please use `StringUtils::trimUTF16Vector` instead
*/ */
CC_DEPRECATED_ATTRIBUTE void cc_utf8_trim_ws(std::vector<unsigned short>* str); CC_DEPRECATED_ATTRIBUTE CC_DLL void cc_utf8_trim_ws(std::vector<unsigned short>* str);
/** /**
* Whether the character is a whitespace character. * Whether the character is a whitespace character.
@ -144,7 +144,7 @@ CC_DEPRECATED_ATTRIBUTE void cc_utf8_trim_ws(std::vector<unsigned short>* str);
* *
* @see http://en.wikipedia.org/wiki/Whitespace_character#Unicode * @see http://en.wikipedia.org/wiki/Whitespace_character#Unicode
* */ * */
CC_DEPRECATED_ATTRIBUTE bool isspace_unicode(unsigned short ch); CC_DEPRECATED_ATTRIBUTE CC_DLL bool isspace_unicode(unsigned short ch);
/** /**
* Whether the character is a Chinese/Japanese/Korean character. * Whether the character is a Chinese/Japanese/Korean character.
@ -156,7 +156,7 @@ CC_DEPRECATED_ATTRIBUTE bool isspace_unicode(unsigned short ch);
* @see http://www.searchtb.com/2012/04/chinese_encode.html * @see http://www.searchtb.com/2012/04/chinese_encode.html
* @see http://tieba.baidu.com/p/748765987 * @see http://tieba.baidu.com/p/748765987
* */ * */
CC_DEPRECATED_ATTRIBUTE bool iscjk_unicode(unsigned short ch); CC_DEPRECATED_ATTRIBUTE CC_DLL bool iscjk_unicode(unsigned short ch);
/** /**
* Returns the length of the string in characters. * Returns the length of the string in characters.
@ -166,7 +166,7 @@ CC_DEPRECATED_ATTRIBUTE bool iscjk_unicode(unsigned short ch);
* @deprecated Please use `StringUtils::getCharacterCountInUTF8String` instead * @deprecated Please use `StringUtils::getCharacterCountInUTF8String` instead
* @returns the length of the string in characters * @returns the length of the string in characters
**/ **/
CC_DEPRECATED_ATTRIBUTE long cc_utf8_strlen (const char * p, int max = -1); CC_DEPRECATED_ATTRIBUTE CC_DLL long cc_utf8_strlen (const char * p, int max = -1);
/** /**
* Find the last character that is not equal to the character given. * Find the last character that is not equal to the character given.
@ -176,13 +176,13 @@ CC_DEPRECATED_ATTRIBUTE long cc_utf8_strlen (const char * p, int max = -1);
* @deprecated Please use `StringUtils::getIndexOfLastNotChar16` instead * @deprecated Please use `StringUtils::getIndexOfLastNotChar16` instead
* @returns the index of the last character that is not \p c. * @returns the index of the last character that is not \p c.
* */ * */
CC_DEPRECATED_ATTRIBUTE unsigned int cc_utf8_find_last_not_char(const std::vector<unsigned short>& str, unsigned short c); CC_DEPRECATED_ATTRIBUTE CC_DLL unsigned int cc_utf8_find_last_not_char(const std::vector<unsigned short>& str, unsigned short c);
/** /**
* @brief Gets `unsigned short` vector from a given utf16 string * @brief Gets `unsigned short` vector from a given utf16 string
* @deprecated Please use `StringUtils::getChar16VectorFromUTF16String` instead * @deprecated Please use `StringUtils::getChar16VectorFromUTF16String` instead
*/ */
CC_DEPRECATED_ATTRIBUTE std::vector<unsigned short> cc_utf16_vec_from_utf16_str(const unsigned short* str); CC_DEPRECATED_ATTRIBUTE CC_DLL std::vector<unsigned short> cc_utf16_vec_from_utf16_str(const unsigned short* str);
/** /**
* Creates an utf8 string from a c string. The result will be null terminated. * Creates an utf8 string from a c string. The result will be null terminated.
@ -194,7 +194,7 @@ CC_DEPRECATED_ATTRIBUTE std::vector<unsigned short> cc_utf16_vec_from_utf16_str(
* @returns the newly created utf16 string, it must be released with `delete[]`, * @returns the newly created utf16 string, it must be released with `delete[]`,
* If an error occurs, %NULL will be returned. * If an error occurs, %NULL will be returned.
* */ * */
CC_DEPRECATED_ATTRIBUTE unsigned short* cc_utf8_to_utf16(const char* str_old, int length = -1, int* rUtf16Size = nullptr); CC_DEPRECATED_ATTRIBUTE CC_DLL unsigned short* cc_utf8_to_utf16(const char* str_old, int length = -1, int* rUtf16Size = nullptr);
/** /**
* Converts a string from UTF-16 to UTF-8. The result will be null terminated. * Converts a string from UTF-16 to UTF-8. The result will be null terminated.
@ -207,7 +207,7 @@ CC_DEPRECATED_ATTRIBUTE unsigned short* cc_utf8_to_utf16(const char* str_old, in
* @returns a pointer to a newly allocated UTF-8 string. This value must be * @returns a pointer to a newly allocated UTF-8 string. This value must be
* released with `delete[]`. If an error occurs, %NULL will be returned. * released with `delete[]`. If an error occurs, %NULL will be returned.
**/ **/
CC_DEPRECATED_ATTRIBUTE char * cc_utf16_to_utf8 (const unsigned short *str, CC_DEPRECATED_ATTRIBUTE CC_DLL char * cc_utf16_to_utf8 (const unsigned short *str,
int len = -1, int len = -1,
long *items_read = nullptr, long *items_read = nullptr,
long *items_written = nullptr); long *items_written = nullptr);

View File

@ -24,6 +24,9 @@ THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include "base/ccUtils.h" #include "base/ccUtils.h"
#include <stdlib.h>
#include "base/CCDirector.h" #include "base/CCDirector.h"
#include "renderer/CCCustomCommand.h" #include "renderer/CCCustomCommand.h"
#include "renderer/CCRenderer.h" #include "renderer/CCRenderer.h"
@ -160,6 +163,27 @@ std::vector<Node*> findChildren(const Node &node, const std::string &name)
return vec; return vec;
} }
#define MAX_ITOA_BUFFER_SIZE 256
double atof(const char* str)
{
if (str == nullptr)
{
return 0.0;
}
char buf[MAX_ITOA_BUFFER_SIZE];
strncpy(buf, str, MAX_ITOA_BUFFER_SIZE);
// strip string, only remain 7 numbers after '.'
char* dot = strchr(buf, '.');
if (dot != nullptr && dot - buf + 8 < MAX_ITOA_BUFFER_SIZE)
{
dot[8] = '\0';
}
return ::atof(buf);
}
} }

View File

@ -61,7 +61,7 @@ namespace utils
* base filename ("hello.png" etc.), don't use a relative path containing directory names.("mydir/hello.png" etc.) * base filename ("hello.png" etc.), don't use a relative path containing directory names.("mydir/hello.png" etc.)
* @since v3.2 * @since v3.2
*/ */
void captureScreen(const std::function<void(bool, const std::string&)>& afterCaptured, const std::string& filename); void CC_DLL captureScreen(const std::function<void(bool, const std::string&)>& afterCaptured, const std::string& filename);
/** Find children by name, it will return all child that has the same name. /** Find children by name, it will return all child that has the same name.
* It supports c++ 11 regular expression. It is a helper function of `Node::enumerateChildren()`. * It supports c++ 11 regular expression. It is a helper function of `Node::enumerateChildren()`.
@ -72,7 +72,12 @@ namespace utils
* @return Array of Nodes that matches the name * @return Array of Nodes that matches the name
* @since v3.2 * @since v3.2
*/ */
std::vector<Node*> findChildren(const Node &node, const std::string &name); std::vector<Node*> CC_DLL findChildren(const Node &node, const std::string &name);
/** Same to ::atof, but strip the string, remain 7 numbers after '.' before call atof。
* Why we need this? Because in android c++_static, atof ( and std::atof ) is unsupported for numbers have long decimal part and contain several numbers can approximate to 1 like 90.099998474121094 ), it will return inf. this function is used to fix this bug.
*/
double CC_DLL atof(const char* str);
} }
NS_CC_END NS_CC_END

713
cocos/base/pvr.cpp Normal file
View File

@ -0,0 +1,713 @@
/******************************************************************************
@File PVRTDecompress.cpp
@Title
@Copyright Copyright (C) 2000 - 2008 by Imagination Technologies Limited.
@Platform ANSI compatible
@Description PVRTC Texture Decompression.
******************************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <math.h>
#include <string.h>
#include <assert.h>
#include <cstdint>
#include "pvr.h"
#define PVRT_MIN(a,b) (((a) < (b)) ? (a) : (b))
#define PVRT_MAX(a,b) (((a) > (b)) ? (a) : (b))
#define PVRT_CLAMP(x, l, h) (PVRT_MIN((h), PVRT_MAX((x), (l))))
/*****************************************************************************
* defines and consts
*****************************************************************************/
#define PT_INDEX (2) // The Punch-through index
#define BLK_Y_SIZE (4) // always 4 for all 2D block types
#define BLK_X_MAX (8) // Max X dimension for blocks
#define BLK_X_2BPP (8) // dimensions for the two formats
#define BLK_X_4BPP (4)
#define WRAP_COORD(Val, Size) ((Val) & ((Size)-1))
#define POWER_OF_2(X) util_number_is_power_2(X)
/*
Define an expression to either wrap or clamp large or small vals to the
legal coordinate range
*/
#define LIMIT_COORD(Val, Size, AssumeImageTiles) \
((AssumeImageTiles)? WRAP_COORD((Val), (Size)): PVRT_CLAMP((Val), 0, (Size)-1))
/*****************************************************************************
* Useful typedefs
*****************************************************************************/
typedef uint32_t U32;
typedef uint8_t U8;
/***********************************************************
DECOMPRESSION ROUTINES
************************************************************/
/*!***********************************************************************
@Struct AMTC_BLOCK_STRUCT
@Brief
*************************************************************************/
typedef struct
{
// Uses 64 bits pre block
U32 PackedData[2];
}AMTC_BLOCK_STRUCT;
static void PVRDecompress(AMTC_BLOCK_STRUCT *pCompressedData,
const bool Do2bitMode,
const int XDim,
const int YDim,
const int AssumeImageTiles,
unsigned char* pResultImage);
/*!***********************************************************************
@Function PVRTDecompressPVRTC
@Input pCompressedData The PVRTC texture data to decompress
@Input Do2bitMode Signifies whether the data is PVRTC2 or PVRTC4
@Input XDim X dimension of the texture
@Input YDim Y dimension of the texture
@Modified pResultImage The decompressed texture data
@Description Decompresses PVRTC to RGBA 8888
*************************************************************************/
int PVRTDecompressPVRTC(const void * const pCompressedData,const int XDim,const int YDim, void *pDestData,const bool Do2bitMode)
{
PVRDecompress((AMTC_BLOCK_STRUCT*)pCompressedData,Do2bitMode,XDim,YDim,1,(unsigned char*)pDestData);
return XDim*YDim/2;
}
/*!***********************************************************************
@Function util_number_is_power_2
@Input input A number
@Returns TRUE if the number is an integer power of two, else FALSE.
@Description Check that a number is an integer power of two, i.e.
1, 2, 4, 8, ... etc.
Returns FALSE for zero.
*************************************************************************/
int util_number_is_power_2( unsigned input )
{
unsigned minus1;
if( !input ) return 0;
minus1 = input - 1;
return ( (input | minus1) == (input ^ minus1) ) ? 1 : 0;
}
/*!***********************************************************************
@Function Unpack5554Colour
@Input pBlock
@Input ABColours
@Description Given a block, extract the colour information and convert
to 5554 formats
*************************************************************************/
static void Unpack5554Colour(const AMTC_BLOCK_STRUCT *pBlock,
int ABColours[2][4])
{
U32 RawBits[2];
int i;
// Extract A and B
RawBits[0] = pBlock->PackedData[1] & (0xFFFE); // 15 bits (shifted up by one)
RawBits[1] = pBlock->PackedData[1] >> 16; // 16 bits
// step through both colours
for(i = 0; i < 2; i++)
{
// If completely opaque
if(RawBits[i] & (1<<15))
{
// Extract R and G (both 5 bit)
ABColours[i][0] = (RawBits[i] >> 10) & 0x1F;
ABColours[i][1] = (RawBits[i] >> 5) & 0x1F;
/*
The precision of Blue depends on A or B. If A then we need to
replicate the top bit to get 5 bits in total
*/
ABColours[i][2] = RawBits[i] & 0x1F;
if(i==0)
{
ABColours[0][2] |= ABColours[0][2] >> 4;
}
// set 4bit alpha fully on...
ABColours[i][3] = 0xF;
}
else // Else if colour has variable translucency
{
/*
Extract R and G (both 4 bit).
(Leave a space on the end for the replication of bits
*/
ABColours[i][0] = (RawBits[i] >> (8-1)) & 0x1E;
ABColours[i][1] = (RawBits[i] >> (4-1)) & 0x1E;
// replicate bits to truly expand to 5 bits
ABColours[i][0] |= ABColours[i][0] >> 4;
ABColours[i][1] |= ABColours[i][1] >> 4;
// grab the 3(+padding) or 4 bits of blue and add an extra padding bit
ABColours[i][2] = (RawBits[i] & 0xF) << 1;
/*
expand from 3 to 5 bits if this is from colour A, or 4 to 5 bits if from
colour B
*/
if(i==0)
{
ABColours[0][2] |= ABColours[0][2] >> 3;
}
else
{
ABColours[0][2] |= ABColours[0][2] >> 4;
}
// Set the alpha bits to be 3 + a zero on the end
ABColours[i][3] = (RawBits[i] >> 11) & 0xE;
}
}
}
/*!***********************************************************************
@Function UnpackModulations
@Input pBlock
@Input Do2bitMode
@Input ModulationVals
@Input ModulationModes
@Input StartX
@Input StartY
@Description Given the block and the texture type and it's relative
position in the 2x2 group of blocks, extract the bit
patterns for the fully defined pixels.
*************************************************************************/
static void UnpackModulations(const AMTC_BLOCK_STRUCT *pBlock,
const int Do2bitMode,
int ModulationVals[8][16],
int ModulationModes[8][16],
int StartX,
int StartY)
{
int BlockModMode;
U32 ModulationBits;
int x, y;
BlockModMode= pBlock->PackedData[1] & 1;
ModulationBits = pBlock->PackedData[0];
// if it's in an interpolated mode
if(Do2bitMode && BlockModMode)
{
/*
run through all the pixels in the block. Note we can now treat all the
"stored" values as if they have 2bits (even when they didn't!)
*/
for(y = 0; y < BLK_Y_SIZE; y++)
{
for(x = 0; x < BLK_X_2BPP; x++)
{
ModulationModes[y+StartY][x+StartX] = BlockModMode;
// if this is a stored value...
if(((x^y)&1) == 0)
{
ModulationVals[y+StartY][x+StartX] = ModulationBits & 3;
ModulationBits >>= 2;
}
}
}
}
else if(Do2bitMode) // else if direct encoded 2bit mode - i.e. 1 mode bit per pixel
{
for(y = 0; y < BLK_Y_SIZE; y++)
{
for(x = 0; x < BLK_X_2BPP; x++)
{
ModulationModes[y+StartY][x+StartX] = BlockModMode;
// double the bits so 0=> 00, and 1=>11
if(ModulationBits & 1)
{
ModulationVals[y+StartY][x+StartX] = 0x3;
}
else
{
ModulationVals[y+StartY][x+StartX] = 0x0;
}
ModulationBits >>= 1;
}
}
}
else // else its the 4bpp mode so each value has 2 bits
{
for(y = 0; y < BLK_Y_SIZE; y++)
{
for(x = 0; x < BLK_X_4BPP; x++)
{
ModulationModes[y+StartY][x+StartX] = BlockModMode;
ModulationVals[y+StartY][x+StartX] = ModulationBits & 3;
ModulationBits >>= 2;
}
}
}
// make sure nothing is left over
assert(ModulationBits==0);
}
/*!***********************************************************************
@Function InterpolateColours
@Input ColourP
@Input ColourQ
@Input ColourR
@Input ColourS
@Input Do2bitMode
@Input x
@Input y
@Modified Result
@Description This performs a HW bit accurate interpolation of either the
A or B colours for a particular pixel.
NOTE: It is assumed that the source colours are in ARGB 5554
format - This means that some "preparation" of the values will
be necessary.
*************************************************************************/
static void InterpolateColours(const int ColourP[4],
const int ColourQ[4],
const int ColourR[4],
const int ColourS[4],
const int Do2bitMode,
const int x,
const int y,
int Result[4])
{
int u, v, uscale;
int k;
int tmp1, tmp2;
int P[4], Q[4], R[4], S[4];
// Copy the colours
for(k = 0; k < 4; k++)
{
P[k] = ColourP[k];
Q[k] = ColourQ[k];
R[k] = ColourR[k];
S[k] = ColourS[k];
}
// put the x and y values into the right range
v = (y & 0x3) | ((~y & 0x2) << 1);
if(Do2bitMode)
u = (x & 0x7) | ((~x & 0x4) << 1);
else
u = (x & 0x3) | ((~x & 0x2) << 1);
// get the u and v scale amounts
v = v - BLK_Y_SIZE/2;
if(Do2bitMode)
{
u = u - BLK_X_2BPP/2;
uscale = 8;
}
else
{
u = u - BLK_X_4BPP/2;
uscale = 4;
}
for(k = 0; k < 4; k++)
{
tmp1 = P[k] * uscale + u * (Q[k] - P[k]);
tmp2 = R[k] * uscale + u * (S[k] - R[k]);
tmp1 = tmp1 * 4 + v * (tmp2 - tmp1);
Result[k] = tmp1;
}
// Lop off the appropriate number of bits to get us to 8 bit precision
if(Do2bitMode)
{
// do RGB
for(k = 0; k < 3; k++)
{
Result[k] >>= 2;
}
Result[3] >>= 1;
}
else
{
// do RGB (A is ok)
for(k = 0; k < 3; k++)
{
Result[k] >>= 1;
}
}
// sanity check
for(k = 0; k < 4; k++)
{
assert(Result[k] < 256);
}
/*
Convert from 5554 to 8888
do RGB 5.3 => 8
*/
for(k = 0; k < 3; k++)
{
Result[k] += Result[k] >> 5;
}
Result[3] += Result[3] >> 4;
// 2nd sanity check
for(k = 0; k < 4; k++)
{
assert(Result[k] < 256);
}
}
/*!***********************************************************************
@Function GetModulationValue
@Input x
@Input y
@Input Do2bitMode
@Input ModulationVals
@Input ModulationModes
@Input Mod
@Input DoPT
@Description Get the modulation value as a numerator of a fraction of 8ths
*************************************************************************/
static void GetModulationValue(int x,
int y,
const int Do2bitMode,
const int ModulationVals[8][16],
const int ModulationModes[8][16],
int *Mod,
int *DoPT)
{
static const int RepVals0[4] = {0, 3, 5, 8};
static const int RepVals1[4] = {0, 4, 4, 8};
int ModVal;
// Map X and Y into the local 2x2 block
y = (y & 0x3) | ((~y & 0x2) << 1);
if(Do2bitMode)
x = (x & 0x7) | ((~x & 0x4) << 1);
else
x = (x & 0x3) | ((~x & 0x2) << 1);
// assume no PT for now
*DoPT = 0;
// extract the modulation value. If a simple encoding
if(ModulationModes[y][x]==0)
{
ModVal = RepVals0[ModulationVals[y][x]];
}
else if(Do2bitMode)
{
// if this is a stored value
if(((x^y)&1)==0)
ModVal = RepVals0[ModulationVals[y][x]];
else if(ModulationModes[y][x] == 1) // else average from the neighbours if H&V interpolation..
{
ModVal = (RepVals0[ModulationVals[y-1][x]] +
RepVals0[ModulationVals[y+1][x]] +
RepVals0[ModulationVals[y][x-1]] +
RepVals0[ModulationVals[y][x+1]] + 2) / 4;
}
else if(ModulationModes[y][x] == 2) // else if H-Only
{
ModVal = (RepVals0[ModulationVals[y][x-1]] +
RepVals0[ModulationVals[y][x+1]] + 1) / 2;
}
else // else it's V-Only
{
ModVal = (RepVals0[ModulationVals[y-1][x]] +
RepVals0[ModulationVals[y+1][x]] + 1) / 2;
}
}
else // else it's 4BPP and PT encoding
{
ModVal = RepVals1[ModulationVals[y][x]];
*DoPT = ModulationVals[y][x] == PT_INDEX;
}
*Mod =ModVal;
}
/*!***********************************************************************
@Function TwiddleUV
@Input YSize Y dimension of the texture in pixels
@Input XSize X dimension of the texture in pixels
@Input YPos Pixel Y position
@Input XPos Pixel X position
@Returns The twiddled offset of the pixel
@Description Given the Block (or pixel) coordinates and the dimension of
the texture in blocks (or pixels) this returns the twiddled
offset of the block (or pixel) from the start of the map.
NOTE the dimensions of the texture must be a power of 2
*************************************************************************/
static int DisableTwiddlingRoutine = 0;
static U32 TwiddleUV(U32 YSize, U32 XSize, U32 YPos, U32 XPos)
{
U32 Twiddled;
U32 MinDimension;
U32 MaxValue;
U32 SrcBitPos;
U32 DstBitPos;
int ShiftCount;
assert(YPos < YSize);
assert(XPos < XSize);
assert(POWER_OF_2(YSize));
assert(POWER_OF_2(XSize));
if(YSize < XSize)
{
MinDimension = YSize;
MaxValue = XPos;
}
else
{
MinDimension = XSize;
MaxValue = YPos;
}
// Nasty hack to disable twiddling
if(DisableTwiddlingRoutine)
return (YPos* XSize + XPos);
// Step through all the bits in the "minimum" dimension
SrcBitPos = 1;
DstBitPos = 1;
Twiddled = 0;
ShiftCount = 0;
while(SrcBitPos < MinDimension)
{
if(YPos & SrcBitPos)
{
Twiddled |= DstBitPos;
}
if(XPos & SrcBitPos)
{
Twiddled |= (DstBitPos << 1);
}
SrcBitPos <<= 1;
DstBitPos <<= 2;
ShiftCount += 1;
}
// prepend any unused bits
MaxValue >>= ShiftCount;
Twiddled |= (MaxValue << (2*ShiftCount));
return Twiddled;
}
/*!***********************************************************************
@Function Decompress
@Input pCompressedData The PVRTC texture data to decompress
@Input Do2BitMode Signifies whether the data is PVRTC2 or PVRTC4
@Input XDim X dimension of the texture
@Input YDim Y dimension of the texture
@Input AssumeImageTiles Assume the texture data tiles
@Modified pResultImage The decompressed texture data
@Description Decompresses PVRTC to RGBA 8888
*************************************************************************/
static void PVRDecompress(AMTC_BLOCK_STRUCT *pCompressedData,
const bool Do2bitMode,
const int XDim,
const int YDim,
const int AssumeImageTiles,
unsigned char* pResultImage)
{
int x, y;
int i, j;
int BlkX, BlkY;
int BlkXp1, BlkYp1;
int XBlockSize;
int BlkXDim, BlkYDim;
int StartX, StartY;
int ModulationVals[8][16];
int ModulationModes[8][16];
int Mod, DoPT;
unsigned int uPosition;
// local neighbourhood of blocks
AMTC_BLOCK_STRUCT *pBlocks[2][2];
AMTC_BLOCK_STRUCT *pPrevious[2][2] = {{NULL, NULL}, {NULL, NULL}};
// Low precision colours extracted from the blocks
struct
{
int Reps[2][4];
}Colours5554[2][2];
// Interpolated A and B colours for the pixel
int ASig[4], BSig[4];
int Result[4];
if(Do2bitMode)
XBlockSize = BLK_X_2BPP;
else
XBlockSize = BLK_X_4BPP;
// For MBX don't allow the sizes to get too small
BlkXDim = PVRT_MAX(2, XDim / XBlockSize);
BlkYDim = PVRT_MAX(2, YDim / BLK_Y_SIZE);
/*
Step through the pixels of the image decompressing each one in turn
Note that this is a hideously inefficient way to do this!
*/
for(y = 0; y < YDim; y++)
{
for(x = 0; x < XDim; x++)
{
// map this pixel to the top left neighbourhood of blocks
BlkX = (x - XBlockSize/2);
BlkY = (y - BLK_Y_SIZE/2);
BlkX = LIMIT_COORD(BlkX, XDim, AssumeImageTiles);
BlkY = LIMIT_COORD(BlkY, YDim, AssumeImageTiles);
BlkX /= XBlockSize;
BlkY /= BLK_Y_SIZE;
// compute the positions of the other 3 blocks
BlkXp1 = LIMIT_COORD(BlkX+1, BlkXDim, AssumeImageTiles);
BlkYp1 = LIMIT_COORD(BlkY+1, BlkYDim, AssumeImageTiles);
// Map to block memory locations
pBlocks[0][0] = pCompressedData +TwiddleUV(BlkYDim, BlkXDim, BlkY, BlkX);
pBlocks[0][1] = pCompressedData +TwiddleUV(BlkYDim, BlkXDim, BlkY, BlkXp1);
pBlocks[1][0] = pCompressedData +TwiddleUV(BlkYDim, BlkXDim, BlkYp1, BlkX);
pBlocks[1][1] = pCompressedData +TwiddleUV(BlkYDim, BlkXDim, BlkYp1, BlkXp1);
/*
extract the colours and the modulation information IF the previous values
have changed.
*/
if(memcmp(pPrevious, pBlocks, 4*sizeof(void*)) != 0)
{
StartY = 0;
for(i = 0; i < 2; i++)
{
StartX = 0;
for(j = 0; j < 2; j++)
{
Unpack5554Colour(pBlocks[i][j], Colours5554[i][j].Reps);
UnpackModulations(pBlocks[i][j],
Do2bitMode,
ModulationVals,
ModulationModes,
StartX, StartY);
StartX += XBlockSize;
}
StartY += BLK_Y_SIZE;
}
// make a copy of the new pointers
memcpy(pPrevious, pBlocks, 4*sizeof(void*));
}
// decompress the pixel. First compute the interpolated A and B signals
InterpolateColours(Colours5554[0][0].Reps[0],
Colours5554[0][1].Reps[0],
Colours5554[1][0].Reps[0],
Colours5554[1][1].Reps[0],
Do2bitMode, x, y,
ASig);
InterpolateColours(Colours5554[0][0].Reps[1],
Colours5554[0][1].Reps[1],
Colours5554[1][0].Reps[1],
Colours5554[1][1].Reps[1],
Do2bitMode, x, y,
BSig);
GetModulationValue(x,y, Do2bitMode, (const int (*)[16])ModulationVals, (const int (*)[16])ModulationModes,
&Mod, &DoPT);
// compute the modulated colour
for(i = 0; i < 4; i++)
{
Result[i] = ASig[i] * 8 + Mod * (BSig[i] - ASig[i]);
Result[i] >>= 3;
}
if(DoPT)
Result[3] = 0;
// Store the result in the output image
uPosition = (x+y*XDim)<<2;
pResultImage[uPosition+0] = (U8)Result[0];
pResultImage[uPosition+1] = (U8)Result[1];
pResultImage[uPosition+2] = (U8)Result[2];
pResultImage[uPosition+3] = (U8)Result[3];
}
}
}
/*****************************************************************************
End of file (pvr.cpp)
*****************************************************************************/

22
cocos/base/pvr.h Normal file
View File

@ -0,0 +1,22 @@
/******************************************************************************
@File PVRTDecompress.h
@Title
@Copyright Copyright (C) 2000 - 2008 by Imagination Technologies Limited.
@Platform ANSI compatible
@Description PVRTC Texture Decompression.
******************************************************************************/
#ifndef __PVR_H__
#define __PVR_H__
int PVRTDecompressPVRTC(const void * const pCompressedData,const int XDim,const int YDim,void *pDestData,const bool Do2bitMode);
#endif //__PVR_H__

View File

@ -31,7 +31,7 @@ NS_CC_BEGIN
const char* cocos2dVersion() const char* cocos2dVersion()
{ {
return "cocos2d-x 3.2beta0"; return "cocos2d-x 3.2";
} }
NS_CC_END NS_CC_END

View File

@ -253,6 +253,8 @@ THE SOFTWARE.
#include "2d/CCTMXTiledMap.h" #include "2d/CCTMXTiledMap.h"
#include "2d/CCTMXXMLParser.h" #include "2d/CCTMXXMLParser.h"
#include "2d/CCTileMapAtlas.h" #include "2d/CCTileMapAtlas.h"
#include "2d/CCFastTMXTiledMap.h"
#include "2d/CCFastTMXLayer.h"
// component // component
#include "2d/CCComponent.h" #include "2d/CCComponent.h"

View File

@ -29,6 +29,7 @@ Copyright (c) 2013-2014 Chukong Technologies
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "CCArray.h" #include "CCArray.h"
#include "base/ccUtils.h"
NS_CC_BEGIN NS_CC_BEGIN
@ -118,7 +119,7 @@ float __String::floatValue() const
{ {
return 0.0f; return 0.0f;
} }
return (float)atof(_string.c_str()); return (float)utils::atof(_string.c_str());
} }
double __String::doubleValue() const double __String::doubleValue() const
@ -127,7 +128,7 @@ double __String::doubleValue() const
{ {
return 0.0; return 0.0;
} }
return atof(_string.c_str()); return utils::atof(_string.c_str());
} }
bool __String::boolValue() const bool __String::boolValue() const

View File

@ -215,7 +215,7 @@ std::string toString(T arg)
return ss.str(); return ss.str();
} }
std::string format(const char* format, ...) CC_FORMAT_PRINTF(1, 2); std::string CC_DLL format(const char* format, ...) CC_FORMAT_PRINTF(1, 2);
} // namespace StringUtils { } // namespace StringUtils {

View File

@ -82,7 +82,7 @@
<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;CC_CONSTRUCTOR_ACCESS=public;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DebugInformationFormat>None</DebugInformationFormat> <DebugInformationFormat>None</DebugInformationFormat>
<WholeProgramOptimization>false</WholeProgramOptimization> <WholeProgramOptimization>false</WholeProgramOptimization>
</ClCompile> </ClCompile>
@ -145,6 +145,14 @@
<ClInclude Include="..\CCSpriteLoader.h" /> <ClInclude Include="..\CCSpriteLoader.h" />
<ClInclude Include="..\CocosBuilder.h" /> <ClInclude Include="..\CocosBuilder.h" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\extensions\proj.win32\libExtensions.vcxproj">
<Project>{21b2c324-891f-48ea-ad1a-5ae13de12e28}</Project>
</ProjectReference>
<ProjectReference Include="..\..\..\2d\cocos2d.vcxproj">
<Project>{98a51ba8-fc3a-415b-ac8f-8c7bd464e93e}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View File

@ -215,13 +215,17 @@ void ActionTimeline::startWithTarget(Node *target)
[this, target](Node* child) [this, target](Node* child)
{ {
ActionTimelineData* data = dynamic_cast<ActionTimelineData*>(child->getUserObject()); ActionTimelineData* data = dynamic_cast<ActionTimelineData*>(child->getUserObject());
int actionTag = data->getActionTag();
if(_timelineMap.find(actionTag) != _timelineMap.end()) if(data)
{ {
auto timelines = this->_timelineMap[actionTag]; int actionTag = data->getActionTag();
for (auto timeline : timelines) if(_timelineMap.find(actionTag) != _timelineMap.end())
{ {
timeline->setNode(child); auto timelines = this->_timelineMap[actionTag];
for (auto timeline : timelines)
{
timeline->setNode(child);
}
} }
} }
}); });

View File

@ -27,10 +27,11 @@ THE SOFTWARE.
#include "CCTimeLine.h" #include "CCTimeLine.h"
#include "renderer/CCRenderer.h" #include "renderer/CCRenderer.h"
#include "cocostudio/CocosStudioExport.h"
NS_TIMELINE_BEGIN NS_TIMELINE_BEGIN
class ActionTimelineData : public cocos2d::Ref class CC_STUDIO_DLL ActionTimelineData : public cocos2d::Ref
{ {
public: public:
static ActionTimelineData* create(int actionTag); static ActionTimelineData* create(int actionTag);
@ -45,7 +46,7 @@ protected:
}; };
class ActionTimeline : public cocos2d::Action class CC_STUDIO_DLL ActionTimeline : public cocos2d::Action
{ {
public: public:
friend class Frame; friend class Frame;

View File

@ -28,6 +28,7 @@ THE SOFTWARE.
#include "cocos2d.h" #include "cocos2d.h"
#include "cocostudio/DictionaryHelper.h" #include "cocostudio/DictionaryHelper.h"
#include "CCTimelineMacro.h" #include "CCTimelineMacro.h"
#include "cocostudio/CocosStudioExport.h"
NS_TIMELINE_BEGIN NS_TIMELINE_BEGIN
@ -35,7 +36,7 @@ class ActionTimeline;
class Timeline; class Timeline;
class Frame; class Frame;
class ActionTimelineCache class CC_STUDIO_DLL ActionTimelineCache
{ {
public: public:
/** Gets the singleton */ /** Gets the singleton */

Some files were not shown because too many files have changed in this diff Show More