diff --git a/CHANGELOG b/CHANGELOG index 0db695f018..7139a01260 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,91 @@ -cocos2d-x-3.0alpha0-pre @Jul.24 2013 +cocos2d-x-3.0alpha0-pre @Jul.30 2013 [all platforms] - Feature #XXXX: Add support for std::function<> in CCMemuItem and CCCallFunc + [FIX] #2124: Image::initWithImageFileThreadSafe is not thread safe + [FIX] #2230: Node::onEnterTransitionDidFinish was called twice when a node is added in Node::onEnter + [FIX] #2237: calculation offset in font rendering + [FIX] #2303: missing precision when getting strokeColor and fontFillColor + [FIX] #2312: WebSocket can not parse url like "ws://domain.com/websocket" + [FIX] #2327: implement Node::isScheduled + [FIX] #2338: ccbRootPath is not passed to sub ccb nodes + [FIX] #2346: OpenGL error 0x0502 in TextureAtlas::drawNumberOfQuads + [FIX] #2359: Sprite will become white block when using ControlSwitch + [FIX] #2361: some bug fixed of the Set class + [FIX] #2366: text shadow + [FIX] #2367: ClippingNode works differently on different platforms + [FIX] #2370: Pivotjoint constructor and pointQueryFirst in Space class will return false instead of invalid shape object + [FIX] #2381: ControlSwitch wasn't displayed correctly when adding more than one switch + [FIX] #2384: The submenu of ExtensionTest in TestCpp can't scroll + [FIX] #2386: ClippingNode works wrongly when being set as a child + [FIX] #2396: Scale9Sprite::setInsetLeft/XXX can't work for rotated sprite frame + [FIX] #2401: LabelBMFont crashes in glDrawElements of CCTextureAtlas::drawNumberOfQuads randombly + [FIX] #2410: Black screen appears on android randomly + [FIX] #2411: Opacity option for shadow in CCLabelTTF is not working + [FIX] #2406: Color and Opacity of Scale9Sprite will not be changed when it's added to NodeRGBA and run with FadeIn/Out actions + [FIX] #2415: Warning of AL_INVALID_NAME and AL_INVALID_OPERATION in SimpleAudioEngineOpenAL.cpp + [FIX] #2418: Unused spriteframes also need to be removed when purgeCachedData + [FIX] #2431: Potential crash when loading js files + [FIX] #2229: Explicitly initialising CCAcceleration structure + [FIX] #2234: Add destructor to CCGLBufferedNode + [Feature] #2232: adding Norwegian language support + [Feature] #2235: Ability to save/retrieve CCData into/from CCUserDefault + [Feature] #2250: add support for std::function<> in CCMemuItem and CCCallFunc + [Feature] #2273: Hardware keyboard support + [Feature] #2278: Adds CALLBACK_0, CALLBACK_1 and CALLBACK_2 macros for MenuItems + [Feature] #2279: Updates chipmunk2d to v6.1.5 + [Feature] #2283: Adds Polish language support + [Feature] #2289: Uses clone() pattern for actions + [Feature] #2332: Adding project for QtCreator + [Feature] #2364: Adds DrawPrimitives::DrawSolidCircle + [Feature] #2365: Adds Rect::unionWithRect + [Feature] #2385: Implemented pitch, pan and gain for SimpleAudioEngine + [Feature] #2389: Adding cookie support for HttpClient + [Feature] #2392: Adds append() function for String class + [Feature] #2395: Adds Scale9SpriteTest for TestCpp + [Feature] #2399: Adds SocketIO support + [Feature] #2408: Adds String::componentsSeparatedByString function for splitting string + [Feature] #2414: Bindings-generator could bind std::function<> argument + [Refactor] #2129: Removes Hungarian notation from ivars. Removes CC and cc prefixes from name classes and free functions. + [Refactor] #2242: Enables c++11 + [Refactor] #2300: Using clone() pattern instead of 'copyWithZone' pattern + [Refactor] #2305: Use std::thread instead of pthread + [Refactor] #2328: ETC support for all platforms + [Refactor] #2373: Change some member functions to const + [Refactor] #2378: Remove the usage of CC_PROPERTY_XXX in engine code + [Refactor] #2388: Creating a default texture for CCSprite if setTexture(nullptr) is invoked + [Refactor] #2397: Singleton refactor, sharedXXX --> getInstance, purgeXXX --> destroyInstance + [Refactor] #2404: Move all deprecated global functions and variables into CCDeprecated.h + [Refactor] #2430: Uses strongly typed enums (enum class) instead of simple enums +[iOS] + [FIX] #2274: compile and run for iOS7 and Xcode5 + [Refactor] #2371: use one single Xcode project for iOS and Mac projects +[Android] + [FIX] #2306: CCLabelTTF::setString crash + [Refactor] #2329: use Android "asset manager" to improve file system read performance + [Refactor] #2400: use onWindowFocusChanged(bool) instead of onResume()/onPause() +[OS X] + [FIX] #2275: LabelTTF vertical alignment + [FIX] #2398: Add support for initializing Image with raw data +[windows] + [FIX] #2322: link error becasue of using multiply inheritance +[javascript binding] + [FIX] #2307: PhysicsSprite::getCPBody return wrong type + [FIX] #2313: bind cc.ClippingNode + [FIX] #2315: iterating through cc.Node children crash + [Feature] #2285: bind MontionStreak + [Feature] #2340: Updates SpiderMonekey to Firefox v22 (JS Bindings) + [Feature] #2427: bind FileUtils.getInstance().createDictionaryWithContentsOfFile +[lua binding] + [Feature] #2276: Add CCScrollView lua binding and corresponding test sample + [Feature] #2277: Add OpenGL lua binding and corresponding test sample + [Feature] #2324: Add OpenGL lua module + [Feature] #2343: Redesign the mechanism of invoking lua func from c++ + [Feature] #2344: make some execute functions into one function in ScriptEngineProtocol + [Feature] #2426: Add DrawPrimitives test sample + [Feature] #2429: LuaWebSocket supports sending binary string +[plugin-x] + [FIX] #2348: event will not be sent to server when paramMap argument of logEvent function is nil +[Emscript] + [Feature] #2289: Asynchronous Image loading 2.1rc0-x-2.1.4 @Jnue.12 2013 diff --git a/CocosDenshion/proj.tizen/src/OspPlayer.cpp b/CocosDenshion/proj.tizen/src/OspPlayer.cpp new file mode 100644 index 0000000000..f152d8d8c7 --- /dev/null +++ b/CocosDenshion/proj.tizen/src/OspPlayer.cpp @@ -0,0 +1,246 @@ +/**************************************************************************** +Copyright (c) 2013 cocos2d-x.org +Copyright (c) 2013 Lee, Jae-Hong + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#include "OspPlayer.h" + +using namespace Tizen::Media; + +OspPlayer::OspPlayer() + : __pPlayer(null) + , m_nSoundID(0) +{ + Initialize(); +} + +OspPlayer::~OspPlayer() +{ + Close(); +} + +result +OspPlayer::Initialize() +{ + result r = E_SUCCESS; + + __pPlayer = new (std::nothrow) Player(); + if (__pPlayer == null) + { + AppLogException("pPlyaer = new (std::nothrow) Player() has failed"); + return E_FAILURE; + } + + r = __pPlayer->Construct(*this, null); + if (IsFailed(r)) + { + AppLog("pPlayer->Construct has failed\n"); + return E_FAILURE; + } + + return r; +} + +void +OspPlayer::Open(const char* pFileName, unsigned int uId) +{ + result r = E_SUCCESS; + + Close(); + + r = __pPlayer->OpenFile(pFileName); + if (IsFailed(r)) + { + AppLog("pPlayer->OpenFile has failed\n"); + } + + m_nSoundID = uId; +} + +void +OspPlayer::Play(bool bLoop) +{ + result r = E_SUCCESS; + + r = __pPlayer->SetLooping(bLoop); + if (IsFailed(r)) + { + AppLog("pPlayer->SetLooping has failed\n"); + return; + } + + r = __pPlayer->Play(); + if (IsFailed(r)) + { + AppLog("pPlayer->Play has failed\n"); + } +} + +void +OspPlayer::Pause() +{ + result r = E_SUCCESS; + + r = __pPlayer->Pause(); + if (IsFailed(r)) + { + AppLog("pPlayer->Pause has failed\n"); + } +} + +void +OspPlayer::Stop() +{ + result r = E_SUCCESS; + + r = __pPlayer->Stop(); + if (IsFailed(r)) + { + AppLog("pPlayer->Stop has failed\n"); + } +} + +void +OspPlayer::Resume() +{ + result r = E_SUCCESS; + + if (__pPlayer->GetState() == PLAYER_STATE_PAUSED) + { + r = __pPlayer->Play(); + if (IsFailed(r)) + { + AppLog("pPlayer->Play has failed\n"); + } + } +} + +void +OspPlayer::Rewind() +{ + result r = E_SUCCESS; + + r = __pPlayer->SeekTo(0); + if (IsFailed(r)) + { + AppLog("pPlayer->SeekTo has failed\n"); + } +} + +bool +OspPlayer::IsPlaying() +{ + PlayerState state = __pPlayer->GetState(); + + return (state == PLAYER_STATE_PLAYING) ? true : false; +} + +void +OspPlayer::Close() +{ + result r = E_SUCCESS; + + if (__pPlayer->GetState() == PLAYER_STATE_PLAYING) + { + r = __pPlayer->Stop(); + if (IsFailed(r)) + { + AppLog("pPlayer->Stop has failed\n"); + } + } + + r = __pPlayer->Close(); + if (IsFailed(r)) + { + AppLog("pPlayer->Close has failed\n"); + } +} + +unsigned int +OspPlayer::GetSoundID() +{ + return m_nSoundID; +} + +void +OspPlayer::SetVolume(int volume) +{ + result r = E_SUCCESS; + + if (volume > 100 || volume < 0) + { + return; + } + + r = __pPlayer->SetVolume(volume); + if (IsFailed(r)) + { + AppLog("pPlayer->SetVolume has failed\n"); + } +} + +int +OspPlayer::GetVolume() +{ + return __pPlayer->GetVolume(); +} + +void +OspPlayer::OnPlayerOpened(result r) +{ +} + +void +OspPlayer::OnPlayerEndOfClip(void) +{ +} + +void +OspPlayer::OnPlayerBuffering(int percent) +{ +} + +void +OspPlayer::OnPlayerErrorOccurred(Tizen::Media::PlayerErrorReason r) +{ +} + +void +OspPlayer::OnPlayerInterrupted(void) +{ +} + +void +OspPlayer::OnPlayerReleased(void) +{ +} + +void +OspPlayer::OnPlayerSeekCompleted(result r) +{ +} + +void +OspPlayer::OnPlayerAudioFocusChanged(void) +{ +} diff --git a/CocosDenshion/proj.tizen/src/OspPlayer.h b/CocosDenshion/proj.tizen/src/OspPlayer.h new file mode 100644 index 0000000000..78d54d3571 --- /dev/null +++ b/CocosDenshion/proj.tizen/src/OspPlayer.h @@ -0,0 +1,65 @@ +/**************************************************************************** +Copyright (c) 2013 cocos2d-x.org +Copyright (c) 2013 Lee, Jae-Hong + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#ifndef _OSP_PLAYER_H_ +#define _OSP_PLAYER_H_ + +#include + +class OspPlayer : public Tizen::Media::IPlayerEventListener +{ +public: + OspPlayer(); + ~OspPlayer(); + + result Initialize(); + void Open(const char* pFileName, unsigned int uId); + void Play(bool bLoop); + void Pause(); + void Stop(); + void Resume(); + void Rewind(); + bool IsPlaying(); + void SetVolume(int volume); + int GetVolume(); + void Close(); + unsigned int GetSoundID(); + +protected: + void OnPlayerOpened(result r); + void OnPlayerEndOfClip(void); + void OnPlayerBuffering(int percent); + void OnPlayerErrorOccurred(Tizen::Media::PlayerErrorReason r); + void OnPlayerInterrupted(void); + void OnPlayerReleased(void); + void OnPlayerSeekCompleted(result r); + void OnPlayerAudioFocusChanged(void); + +private: + Tizen::Media::Player* __pPlayer; + unsigned int m_nSoundID; +}; + +#endif // _OSP_PLAYER_H_ diff --git a/CocosDenshion/proj.tizen/src/SimpleAudioEngine.cpp b/CocosDenshion/proj.tizen/src/SimpleAudioEngine.cpp new file mode 100644 index 0000000000..f2f01e2a8d --- /dev/null +++ b/CocosDenshion/proj.tizen/src/SimpleAudioEngine.cpp @@ -0,0 +1,295 @@ +/**************************************************************************** +Copyright (c) 2013 cocos2d-x.org +Copyright (c) 2013 Lee, Jae-Hong + +http://www.cocos2d-x.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +****************************************************************************/ + +#include "SimpleAudioEngine.h" +#include "OspPlayer.h" +#include "cocos2d.h" +#include + +USING_NS_CC; +using namespace std; + +namespace CocosDenshion { + +typedef map EffectList; +typedef pair Effect; + +static std::string _FullPath(const char * szPath); +static unsigned int _Hash(const char *key); + +#define BREAK_IF(cond) if (cond) break; + +static EffectList& sharedList() +{ + static EffectList s_List; + return s_List; +} + +static OspPlayer& sharedMusic() +{ + static OspPlayer s_Music; + return s_Music; +} + +SimpleAudioEngine::SimpleAudioEngine() +{ +} + +SimpleAudioEngine::~SimpleAudioEngine() +{ +} + +SimpleAudioEngine* SimpleAudioEngine::getInstance() +{ + static SimpleAudioEngine s_SharedEngine; + return &s_SharedEngine; +} + +void SimpleAudioEngine::end() +{ + sharedMusic().Close(); + + EffectList::iterator p = sharedList().begin(); + while (p != sharedList().end()) + { + delete p->second; + p->second = NULL; + p++; + } + sharedList().clear(); +} + +void SimpleAudioEngine::preloadBackgroundMusic(const char* pszFilePath) +{ +} + +void SimpleAudioEngine::playBackgroundMusic(const char* pszFilePath, bool bLoop) +{ + if (!pszFilePath) + { + return; + } + + sharedMusic().Open(_FullPath(pszFilePath).c_str(), _Hash(pszFilePath)); + sharedMusic().Play(bLoop); +} + +void SimpleAudioEngine::stopBackgroundMusic(bool bReleaseData) +{ + if (bReleaseData) + { + sharedMusic().Close(); + } + else + { + sharedMusic().Stop(); + } +} + +void SimpleAudioEngine::pauseBackgroundMusic() +{ + sharedMusic().Pause(); +} + +void SimpleAudioEngine::resumeBackgroundMusic() +{ + sharedMusic().Resume(); +} + +void SimpleAudioEngine::rewindBackgroundMusic() +{ + sharedMusic().Rewind(); +} + +bool SimpleAudioEngine::willPlayBackgroundMusic() +{ + return false; +} + +bool SimpleAudioEngine::isBackgroundMusicPlaying() +{ + return sharedMusic().IsPlaying(); +} + +float SimpleAudioEngine::getBackgroundMusicVolume() +{ + return float(sharedMusic().GetVolume()) / 100.f; +} + +void SimpleAudioEngine::setBackgroundMusicVolume(float volume) +{ + sharedMusic().SetVolume(int(volume * 100)); +} + +float SimpleAudioEngine::getEffectsVolume() +{ + EffectList::iterator iter; + iter = sharedList().begin(); + if (iter != sharedList().end()) + { + return float(iter->second->GetVolume()) / 100.f; + } + return 0.0f; +} + +void SimpleAudioEngine::setEffectsVolume(float volume) +{ + EffectList::iterator iter; + for (iter = sharedList().begin(); iter != sharedList().end(); iter++) + { + iter->second->SetVolume(int(volume * 100)); + } +} + +unsigned int SimpleAudioEngine::playEffect(const char* pszFilePath, bool bLoop/* = false*/, + float pitch/* = 1.0f*/, float pan/* = 0.0f*/, float gain/* = 1.0f*/) +{ + unsigned int nRet = _Hash(pszFilePath); + + preloadEffect(pszFilePath); + + EffectList::iterator p = sharedList().find(nRet); + if (p != sharedList().end()) + { + p->second->Play(bLoop); + } + + return nRet; +} + +void SimpleAudioEngine::stopEffect(unsigned int nSoundId) +{ + EffectList::iterator p = sharedList().find(nSoundId); + if (p != sharedList().end()) + { + p->second->Stop(); + } +} + +void SimpleAudioEngine::preloadEffect(const char* pszFilePath) +{ + int nRet = 0; + do + { + BREAK_IF(! pszFilePath); + + nRet = _Hash(pszFilePath); + + BREAK_IF(sharedList().end() != sharedList().find(nRet)); + + sharedList().insert(Effect(nRet, new (std::nothrow) OspPlayer())); + OspPlayer * pPlayer = sharedList()[nRet]; + pPlayer->Open(_FullPath(pszFilePath).c_str(), nRet); + + BREAK_IF(nRet == pPlayer->GetSoundID()); + + sharedList().erase(nRet); + nRet = 0; + } + while (0); +} + +void SimpleAudioEngine::unloadEffect(const char* pszFilePath) +{ + unsigned nId = _Hash(pszFilePath); + + EffectList::iterator p = sharedList().find(nId); + if (p != sharedList().end()) + { + delete p->second; + p->second = NULL; + sharedList().erase(nId); + } +} + +void SimpleAudioEngine::pauseEffect(unsigned int nSoundId) +{ + EffectList::iterator p = sharedList().find(nSoundId); + if (p != sharedList().end()) + { + p->second->Pause(); + } +} + +void SimpleAudioEngine::pauseAllEffects() +{ + EffectList::iterator iter; + for (iter = sharedList().begin(); iter != sharedList().end(); iter++) + { + iter->second->Pause(); + } +} + +void SimpleAudioEngine::resumeEffect(unsigned int nSoundId) +{ + EffectList::iterator p = sharedList().find(nSoundId); + if (p != sharedList().end()) + { + p->second->Resume(); + } +} + +void SimpleAudioEngine::resumeAllEffects() +{ + EffectList::iterator iter; + for (iter = sharedList().begin(); iter != sharedList().end(); iter++) + { + iter->second->Resume(); + } +} + +void SimpleAudioEngine::stopAllEffects() +{ + EffectList::iterator iter; + for (iter = sharedList().begin(); iter != sharedList().end(); iter++) + { + iter->second->Stop(); + } +} + +////////////////////////////////////////////////////////////////////////// +// static function +////////////////////////////////////////////////////////////////////////// + +static std::string _FullPath(const char * szPath) +{ + return CCFileUtils::getInstance()->fullPathForFilename(szPath); +} + +unsigned int _Hash(const char *key) +{ + unsigned int len = strlen(key); + const char *end=key+len; + unsigned int hash; + + for (hash = 0; key < end; key++) + { + hash *= 16777619; + hash ^= (unsigned int) (unsigned char) toupper(*key); + } + return (hash); +} + +} diff --git a/cocos2dx/actions/CCActionInterval.cpp b/cocos2dx/actions/CCActionInterval.cpp index aae2e323de..66ccbe88f8 100644 --- a/cocos2dx/actions/CCActionInterval.cpp +++ b/cocos2dx/actions/CCActionInterval.cpp @@ -1273,7 +1273,7 @@ void JumpTo::startWithTarget(Node *target) // Bezier cubic formula: // ((1 - t) + t)3 = 1 -// Expands toĦ­ +// Expands to ... // (1 - t)3 + 3t(1-t)2 + 3t2(1 - t) + t3 = 1 static inline float bezierat( float a, float b, float c, float d, float t ) { @@ -1987,11 +1987,11 @@ Animate* Animate::create(Animation *pAnimation) } Animate::Animate() -: _animation(NULL) -, _splitTimes(new std::vector) +: _splitTimes(new std::vector) , _nextFrame(0) , _origFrame(NULL) , _executedLoops(0) +, _animation(NULL) { } @@ -2155,8 +2155,8 @@ Animate* Animate::reverse() const // TargetedAction TargetedAction::TargetedAction() -: _forcedTarget(NULL) -, _action(NULL) +: _action(NULL) +, _forcedTarget(NULL) { } diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/base_nodes/CCNode.cpp index 044d05436e..2c5657e677 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/base_nodes/CCNode.cpp @@ -64,6 +64,11 @@ Node::Node(void) , _anchorPoint(Point::ZERO) , _contentSize(Size::ZERO) , _additionalTransform(AffineTransformMakeIdentity()) +, _transform(AffineTransformMakeIdentity()) +, _inverse(AffineTransformMakeIdentity()) +, _additionalTransformDirty(false) +, _transformDirty(true) +, _inverseDirty(true) , _camera(NULL) // children (lazy allocs) // lazy alloc @@ -79,9 +84,6 @@ Node::Node(void) , _shaderProgram(NULL) , _orderOfArrival(0) , _running(false) -, _transformDirty(true) -, _inverseDirty(true) -, _additionalTransformDirty(false) , _visible(true) , _ignoreAnchorPointForPosition(false) , _reorderChildDirty(false) diff --git a/cocos2dx/include/ccTypes.h b/cocos2dx/include/ccTypes.h index bc8a163796..9cc3baf67e 100644 --- a/cocos2dx/include/ccTypes.h +++ b/cocos2dx/include/ccTypes.h @@ -412,8 +412,8 @@ public: : _fontSize(0) , _alignment(Label::HAlignment::CENTER) , _vertAlignment(Label::VAlignment::TOP) + , _dimensions(Size::ZERO) , _fontFillColor(Color3B::WHITE) - , _dimensions(Size::ZERO) {} // font name diff --git a/cocos2dx/menu_nodes/CCMenuItem.h b/cocos2dx/menu_nodes/CCMenuItem.h index 592d3f9ebb..b6136f14d5 100644 --- a/cocos2dx/menu_nodes/CCMenuItem.h +++ b/cocos2dx/menu_nodes/CCMenuItem.h @@ -128,8 +128,8 @@ public: static MenuItemLabel* create(Node *label); MenuItemLabel() - : _label(NULL) - , _originalScale(0.0) + : _originalScale(0.0) + , _label(NULL) {} virtual ~MenuItemLabel(); diff --git a/cocos2dx/misc_nodes/CCMotionStreak.cpp b/cocos2dx/misc_nodes/CCMotionStreak.cpp index 1e65cbd587..8e3d5dc081 100644 --- a/cocos2dx/misc_nodes/CCMotionStreak.cpp +++ b/cocos2dx/misc_nodes/CCMotionStreak.cpp @@ -37,6 +37,7 @@ MotionStreak::MotionStreak() : _fastMode(false) , _startingPositionInitialized(false) , _texture(NULL) +, _blendFunc(BlendFunc::ALPHA_NON_PREMULTIPLIED) , _positionR(Point::ZERO) , _stroke(0.0f) , _fadeDelta(0.0f) @@ -49,7 +50,6 @@ MotionStreak::MotionStreak() , _vertices(NULL) , _colorPointer(NULL) , _texCoords(NULL) -, _blendFunc(BlendFunc::ALPHA_NON_PREMULTIPLIED) { } diff --git a/cocos2dx/misc_nodes/CCProgressTimer.cpp b/cocos2dx/misc_nodes/CCProgressTimer.cpp index dbc09d05c4..3493ad9313 100644 --- a/cocos2dx/misc_nodes/CCProgressTimer.cpp +++ b/cocos2dx/misc_nodes/CCProgressTimer.cpp @@ -46,12 +46,12 @@ const char kProgressTextureCoords = 0x4b; ProgressTimer::ProgressTimer() :_type(Type::RADIAL) +,_midpoint(0,0) +,_barChangeRate(0,0) ,_percentage(0.0f) ,_sprite(NULL) ,_vertexDataCount(0) ,_vertexData(NULL) -,_midpoint(0,0) -,_barChangeRate(0,0) ,_reverseDirection(false) {} diff --git a/cocos2dx/misc_nodes/CCRenderTexture.cpp b/cocos2dx/misc_nodes/CCRenderTexture.cpp index 5f321b9c75..4281bd92d9 100644 --- a/cocos2dx/misc_nodes/CCRenderTexture.cpp +++ b/cocos2dx/misc_nodes/CCRenderTexture.cpp @@ -44,8 +44,7 @@ NS_CC_BEGIN // implementation RenderTexture RenderTexture::RenderTexture() -: _sprite(NULL) -, _FBO(0) +: _FBO(0) , _depthRenderBufffer(0) , _oldFBO(0) , _texture(0) @@ -57,6 +56,7 @@ RenderTexture::RenderTexture() , _clearDepth(0.0f) , _clearStencil(0) , _autoDraw(false) +, _sprite(NULL) { #if CC_ENABLE_CACHE_TEXTURE_DATA // Listen this event to save render texture before come to background. diff --git a/cocos2dx/particle_nodes/CCParticleSystem.cpp b/cocos2dx/particle_nodes/CCParticleSystem.cpp index 90aa34e547..865d05ec86 100644 --- a/cocos2dx/particle_nodes/CCParticleSystem.cpp +++ b/cocos2dx/particle_nodes/CCParticleSystem.cpp @@ -81,7 +81,9 @@ NS_CC_BEGIN // ParticleSystem::ParticleSystem() -: _plistFile("") +: _isBlendAdditive(false) +, _isAutoRemoveOnFinish(false) +, _plistFile("") , _elapsed(0) , _particles(NULL) , _emitCounter(0) @@ -99,6 +101,7 @@ ParticleSystem::ParticleSystem() , _lifeVar(0) , _angle(0) , _angleVar(0) +, _emitterMode(Mode::GRAVITY) , _startSize(0) , _startSizeVar(0) , _endSize(0) @@ -110,12 +113,9 @@ ParticleSystem::ParticleSystem() , _emissionRate(0) , _totalParticles(0) , _texture(NULL) -, _opacityModifyRGB(false) -, _isBlendAdditive(false) -, _positionType(PositionType::FREE) -, _isAutoRemoveOnFinish(false) -, _emitterMode(Mode::GRAVITY) , _blendFunc(BlendFunc::ALPHA_PREMULTIPLIED) +, _opacityModifyRGB(false) +, _positionType(PositionType::FREE) { modeA.gravity = Point::ZERO; modeA.speed = 0; diff --git a/cocos2dx/platform/android/CCCommon.cpp b/cocos2dx/platform/android/CCCommon.cpp index b76fa083f7..277db4b14d 100644 --- a/cocos2dx/platform/android/CCCommon.cpp +++ b/cocos2dx/platform/android/CCCommon.cpp @@ -51,7 +51,7 @@ void log(const char * pszFormat, ...) vsnprintf(buf, MAX_LEN, pszFormat, args); va_end(args); - __android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", buf); + __android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", "%s", buf); } void MessageBox(const char * pszMsg, const char * pszTitle) diff --git a/cocos2dx/platform/emscripten/CCImage.cpp b/cocos2dx/platform/emscripten/CCImage.cpp index 69935f0c5f..00fb16880b 100644 --- a/cocos2dx/platform/emscripten/CCImage.cpp +++ b/cocos2dx/platform/emscripten/CCImage.cpp @@ -130,7 +130,7 @@ public: * while -1 means fail * */ - int computeLineStart(TTF_Font *face, Image::ETextAlign eAlignMask, char cText, + int computeLineStart(TTF_Font *face, Image::TextAlign eAlignMask, char cText, int iLineIndex) { return 0; /* @@ -156,7 +156,7 @@ public: */ } - int computeLineStartY( TTF_Font *face, Image::ETextAlign eAlignMask, int txtHeight, int borderHeight ){ + int computeLineStartY( TTF_Font *face, Image::TextAlign eAlignMask, int txtHeight, int borderHeight ){ return 0; /* int iRet; @@ -178,7 +178,7 @@ public: */ } - bool getBitmap(const char *text, int nWidth, int nHeight, Image::ETextAlign eAlignMask, const char * pFontName, float fontSize) { + bool getBitmap(const char *text, int nWidth, int nHeight, Image::TextAlign eAlignMask, const char * pFontName, float fontSize) { const char* pText = text; int pxSize = (int)fontSize; @@ -284,7 +284,7 @@ bool Image::initWithString( const char * pText, int nWidth/* = 0*/, int nHeight/* = 0*/, - ETextAlign eAlignMask/* = kAlignCenter*/, + TextAlign eAlignMask/* = kAlignCenter*/, const char * pFontName/* = nil*/, int nSize/* = 0*/) { diff --git a/cocos2dx/platform/mac/CCImage.mm b/cocos2dx/platform/mac/CCImage.mm index 80a1402727..42c2387724 100644 --- a/cocos2dx/platform/mac/CCImage.mm +++ b/cocos2dx/platform/mac/CCImage.mm @@ -303,8 +303,8 @@ static bool _isValidFontName(const char *fontName) } } } -#endif out: +#endif return ret; } diff --git a/cocos2dx/platform/tizen/CCImage.cpp b/cocos2dx/platform/tizen/CCImage.cpp index fc9af7ad3a..a6200e4930 100644 --- a/cocos2dx/platform/tizen/CCImage.cpp +++ b/cocos2dx/platform/tizen/CCImage.cpp @@ -244,7 +244,7 @@ public: int lineWidth = textLines.at(line).lineWidth; if (eAlignMask == Image::TextAlign::CENTER || eAlignMask == Image::TextAlign::TOP || eAlignMask == Image::TextAlign::BOTTOM) { return (iMaxLineWidth - lineWidth) / 2; - } else if (eAlignMask == Image::TextAlign::RIGHT || eAlignMask == Image::TextAlign::TO_RIGHT || eAlignMask == Image::TextAlign::BOTTOM_RIGHT) { + } else if (eAlignMask == Image::TextAlign::RIGHT || eAlignMask == Image::TextAlign::TOP_RIGHT || eAlignMask == Image::TextAlign::BOTTOM_RIGHT) { return (iMaxLineWidth - lineWidth); } @@ -428,7 +428,7 @@ bool Image::initWithString( const char * pText, int nWidth/* = 0*/, int nHeight/* = 0*/, - ETextAlign eAlignMask/* = kAlignCenter*/, + TextAlign eAlignMask/* = kAlignCenter*/, const char * pFontName/* = nil*/, int nSize/* = 0*/) { diff --git a/cocos2dx/platform/win32/CCFileUtilsWin32.cpp b/cocos2dx/platform/win32/CCFileUtilsWin32.cpp index 460e2400df..627747ecad 100644 --- a/cocos2dx/platform/win32/CCFileUtilsWin32.cpp +++ b/cocos2dx/platform/win32/CCFileUtilsWin32.cpp @@ -43,6 +43,36 @@ static void _checkPath() } } +// D:/aaa/bbb/ccc/ddd/abc.txt --> D:\aaa\bbb\ccc\ddd\abc.txt +static inline std::string convertPathFormatToWindowStyle(const std::string& path) +{ + std::string ret = path; + int len = ret.length(); + for (int i = 0; i < len; ++i) + { + if (ret[i] == '/') + { + ret[i] = '\\'; + } + } + return ret; +} + +// D:\aaa\bbb\ccc\ddd\abc.txt --> D:/aaa/bbb/ccc/ddd/abc.txt +static inline std::string convertPathFormatToUnixStyle(const std::string& path) +{ + std::string ret = path; + int len = ret.length(); + for (int i = 0; i < len; ++i) + { + if (ret[i] == '\\') + { + ret[i] = '/'; + } + } + return ret; +} + FileUtils* FileUtils::getInstance() { if (s_sharedFileUtils == NULL) @@ -81,7 +111,12 @@ bool FileUtilsWin32::isFileExist(const std::string& strFilePath) { // Not absolute path, add the default root path at the beginning. strPath.insert(0, _defaultResRootPath); } - return GetFileAttributesA(strPath.c_str()) != -1 ? true : false; + + convertPathFormatToWindowStyle(strPath); + WCHAR wszBuf[MAX_PATH] = {0}; + MultiByteToWideChar(CP_UTF8, 0, strPath.c_str(), -1, wszBuf, sizeof(wszBuf)); + + return GetFileAttributesW(wszBuf) != -1 ? true : false; } bool FileUtilsWin32::isAbsolutePath(const std::string& strPath) @@ -95,6 +130,68 @@ bool FileUtilsWin32::isAbsolutePath(const std::string& strPath) return false; } +unsigned char* FileUtilsWin32::getFileData(const char* filename, const char* mode, unsigned long* size) +{ + unsigned char * pBuffer = NULL; + CCASSERT(filename != NULL && size != NULL && mode != NULL, "Invalid parameters."); + *size = 0; + do + { + // read the file from hardware + std::string fullPath = fullPathForFilename(filename); + + WCHAR wszBuf[MAX_PATH] = {0}; + MultiByteToWideChar(CP_UTF8, 0, fullPath.c_str(), -1, wszBuf, sizeof(wszBuf)); + + + HANDLE fileHandle = ::CreateFileW(wszBuf, GENERIC_READ, 0, NULL, OPEN_EXISTING, NULL, NULL); + CC_BREAK_IF(fileHandle == INVALID_HANDLE_VALUE); + + *size = ::GetFileSize(fileHandle, NULL); + + pBuffer = new unsigned char[*size]; + DWORD sizeRead = 0; + BOOL successed = FALSE; + successed = ::ReadFile(fileHandle, pBuffer, *size, &sizeRead, NULL); + ::CloseHandle(fileHandle); + + if (!successed) + { + CC_SAFE_DELETE_ARRAY(pBuffer); + } + } while (0); + + if (! pBuffer) + { + std::string msg = "Get data from file("; + // Gets error code. + DWORD errorCode = ::GetLastError(); + char errorCodeBuffer[20] = {0}; + snprintf(errorCodeBuffer, sizeof(errorCodeBuffer), "%d", errorCode); + + msg = msg + filename + ") failed, error code is " + errorCodeBuffer; + CCLOG("%s", msg.c_str()); + } + return pBuffer; +} + +std::string FileUtilsWin32::getPathForFilename(const std::string& filename, const std::string& resolutionDirectory, const std::string& searchPath) +{ + std::string unixFileName = convertPathFormatToUnixStyle(filename); + std::string unixResolutionDirector = convertPathFormatToUnixStyle(resolutionDirectory); + std::string unixSearchPath = convertPathFormatToUnixStyle(searchPath); + + return FileUtils::getPathForFilename(unixFileName, unixResolutionDirector, unixSearchPath); +} + +std::string FileUtilsWin32::getFullPathForDirectoryAndFilename(const std::string& strDirectory, const std::string& strFilename) +{ + std::string dosDirectory = convertPathFormatToWindowStyle(strDirectory); + std::string dosFilename = convertPathFormatToWindowStyle(strFilename); + + return FileUtils::getFullPathForDirectoryAndFilename(dosDirectory, dosFilename); +} + string FileUtilsWin32::getWritablePath() { // Get full path of executable, e.g. c:\Program Files (x86)\My Game Folder\MyGame.exe diff --git a/cocos2dx/platform/win32/CCFileUtilsWin32.h b/cocos2dx/platform/win32/CCFileUtilsWin32.h index 3dc975a559..38656cf7f2 100644 --- a/cocos2dx/platform/win32/CCFileUtilsWin32.h +++ b/cocos2dx/platform/win32/CCFileUtilsWin32.h @@ -49,6 +49,39 @@ public: virtual std::string getWritablePath(); virtual bool isFileExist(const std::string& strFilePath); virtual bool isAbsolutePath(const std::string& strPath); +protected: + /** + * Gets resource file data + * + * @param[in] filename The resource file name which contains the path. + * @param[in] pszMode The read mode of the file. + * @param[out] pSize If the file read operation succeeds, it will be the data size, otherwise 0. + * @return Upon success, a pointer to the data is returned, otherwise NULL. + * @warning Recall: you are responsible for calling delete[] on any Non-NULL pointer returned. + */ + virtual unsigned char* getFileData(const char* filename, const char* mode, unsigned long * size) override; + + /** + * Gets full path for filename, resolution directory and search path. + * + * @param filename The file name. + * @param resolutionDirectory The resolution directory. + * @param searchPath The search path. + * @return The full path of the file. It will return an empty string if the full path of the file doesn't exist. + */ + virtual std::string getPathForFilename(const std::string& filename, const std::string& resolutionDirectory, const std::string& searchPath) override; + + /** + * Gets full path for the directory and the filename. + * + * @note Only iOS and Mac need to override this method since they are using + * `[[NSBundle mainBundle] pathForResource: ofType: inDirectory:]` to make a full path. + * Other platforms will use the default implementation of this method. + * @param strDirectory The directory contains the file we are looking for. + * @param strFilename The name of the file. + * @return The full path of the file, if the file can't be found, it will return an empty string. + */ + virtual std::string getFullPathForDirectoryAndFilename(const std::string& strDirectory, const std::string& strFilename) override; }; // end of platform group diff --git a/cocos2dx/proj.emscripten/Makefile b/cocos2dx/proj.emscripten/Makefile index 50987c8847..233981553a 100644 --- a/cocos2dx/proj.emscripten/Makefile +++ b/cocos2dx/proj.emscripten/Makefile @@ -66,7 +66,6 @@ SOURCES = ../actions/CCAction.cpp \ ../particle_nodes/CCParticleBatchNode.cpp \ ../platform/CCSAXParser.cpp \ ../platform/CCThread.cpp \ -../platform/platform.cpp \ ../platform/CCImageCommonWebp.cpp \ ../platform/CCEGLViewProtocol.cpp \ ../platform/CCFileUtils.cpp \ diff --git a/cocos2dx/proj.tizen/.project b/cocos2dx/proj.tizen/.project index f2080913f9..96199d85bb 100644 --- a/cocos2dx/proj.tizen/.project +++ b/cocos2dx/proj.tizen/.project @@ -7,8 +7,11 @@ org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, + + ?children? + ?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|?name?=entry\\\\\\\|\\\|?name?=entry\\\\\\\|\\\|\|| + ?name? @@ -31,7 +34,7 @@ org.eclipse.cdt.make.core.buildLocation - ${workspace_loc:/cocos2dx/Debug-Tizen-Device} + ${workspace_loc:/cocos2dx/Debug-Tizen-Emulator} org.eclipse.cdt.make.core.cleanBuildTarget @@ -43,7 +46,7 @@ org.eclipse.cdt.make.core.enableAutoBuild - false + true org.eclipse.cdt.make.core.enableCleanBuild @@ -347,16 +350,6 @@ 1 PARENT-1-PROJECT_LOC/platform/CCThread.h - - src/platform/platform.cpp - 1 - PARENT-1-PROJECT_LOC/platform/platform.cpp - - - src/platform/platform.h - 1 - PARENT-1-PROJECT_LOC/platform/platform.h - src/platform/tizen 2 diff --git a/cocos2dx/textures/CCTexture2D.cpp b/cocos2dx/textures/CCTexture2D.cpp index f31df24b7a..78e8a79380 100644 --- a/cocos2dx/textures/CCTexture2D.cpp +++ b/cocos2dx/textures/CCTexture2D.cpp @@ -57,14 +57,12 @@ NS_CC_BEGIN // Default is: RGBA8888 (32-bit textures) static Texture2D::PixelFormat g_defaultAlphaPixelFormat = Texture2D::PixelFormat::DEFAULT; -// By default PVR images are treated as if they don't have the alpha channel premultiplied -static bool PVRHaveAlphaPremultiplied_ = false; +static bool _PVRHaveAlphaPremultiplied = false; Texture2D::Texture2D() -: _PVRHaveAlphaPremultiplied(true) +: _pixelFormat(Texture2D::PixelFormat::DEFAULT) , _pixelsWide(0) , _pixelsHigh(0) -, _pixelFormat(Texture2D::PixelFormat::DEFAULT) , _name(0) , _maxS(0.0) , _maxT(0.0) @@ -664,7 +662,7 @@ bool Texture2D::initWithPVRFile(const char* file) _contentSize = Size((float)_pixelsWide, (float)_pixelsHigh); // FIX ME, if premultiply should be false, or the test case in RenderTextureTest(RenderTextureTargetNode) works in wrong effect //_hasPremultipliedAlpha = (pvr->isForcePremultipliedAlpha()) ? pvr->hasPremultipliedAlpha() : _PVRHaveAlphaPremultiplied; - _hasPremultipliedAlpha =PVRHaveAlphaPremultiplied_; + _hasPremultipliedAlpha = _PVRHaveAlphaPremultiplied; _pixelFormat = pvr->getFormat(); _hasMipmaps = pvr->getNumberOfMipmaps() > 1; @@ -708,7 +706,7 @@ bool Texture2D::initWithETCFile(const char* file) void Texture2D::PVRImagesHavePremultipliedAlpha(bool haveAlphaPremultiplied) { - PVRHaveAlphaPremultiplied_ = haveAlphaPremultiplied; + _PVRHaveAlphaPremultiplied = haveAlphaPremultiplied; } diff --git a/cocos2dx/textures/CCTexture2D.h b/cocos2dx/textures/CCTexture2D.h index 0a5a234678..ad922d249a 100644 --- a/cocos2dx/textures/CCTexture2D.h +++ b/cocos2dx/textures/CCTexture2D.h @@ -268,9 +268,6 @@ public: private: bool initPremultipliedATextureWithImage(Image * image, unsigned int pixelsWide, unsigned int pixelsHigh); - - // By default PVR images are treated as if they don't have the alpha channel premultiplied - bool _PVRHaveAlphaPremultiplied; protected: /** pixel format of the texture */ diff --git a/cocos2dx/tilemap_parallax_nodes/CCTMXLayer.cpp b/cocos2dx/tilemap_parallax_nodes/CCTMXLayer.cpp index 4929e12d70..61bd2a07b4 100644 --- a/cocos2dx/tilemap_parallax_nodes/CCTMXLayer.cpp +++ b/cocos2dx/tilemap_parallax_nodes/CCTMXLayer.cpp @@ -98,14 +98,21 @@ bool TMXLayer::initWithTilesetInfo(TMXTilesetInfo *tilesetInfo, TMXLayerInfo *la } TMXLayer::TMXLayer() -:_layerSize(Size::ZERO) +:_layerName("") +,_opacity(0) +,_minGID(0) +,_maxGID(0) +,_vertexZvalue(0) +,_useAutomaticVertexZ(false) +,_reusedTile(NULL) +,_atlasIndexArray(NULL) +,_contentScaleFactor(1.0f) +,_layerSize(Size::ZERO) ,_mapTileSize(Size::ZERO) ,_tiles(NULL) ,_tileSet(NULL) +,_layerOrientation(TMXOrientationOrtho) ,_properties(NULL) -,_layerName("") -,_reusedTile(NULL) -,_atlasIndexArray(NULL) {} TMXLayer::~TMXLayer() diff --git a/cocos2dx/tilemap_parallax_nodes/CCTMXObjectGroup.cpp b/cocos2dx/tilemap_parallax_nodes/CCTMXObjectGroup.cpp index 12fce07617..b4652873a4 100644 --- a/cocos2dx/tilemap_parallax_nodes/CCTMXObjectGroup.cpp +++ b/cocos2dx/tilemap_parallax_nodes/CCTMXObjectGroup.cpp @@ -32,8 +32,8 @@ NS_CC_BEGIN //implementation TMXObjectGroup TMXObjectGroup::TMXObjectGroup() - :_positionOffset(Point::ZERO) - ,_groupName("") + : _groupName("") + , _positionOffset(Point::ZERO) { _objects = Array::create(); _objects->retain(); diff --git a/cocos2dx/tilemap_parallax_nodes/CCTileMapAtlas.cpp b/cocos2dx/tilemap_parallax_nodes/CCTileMapAtlas.cpp index 483e607f85..8adfec66de 100644 --- a/cocos2dx/tilemap_parallax_nodes/CCTileMapAtlas.cpp +++ b/cocos2dx/tilemap_parallax_nodes/CCTileMapAtlas.cpp @@ -65,9 +65,9 @@ bool TileMapAtlas::initWithTileFile(const char *tile, const char *mapFile, int t } TileMapAtlas::TileMapAtlas() - :_TGAInfo(NULL) - ,_posToAtlasIndex(NULL) - ,_itemsToRender(0) + : _posToAtlasIndex(NULL) + , _itemsToRender(0) + , _TGAInfo(NULL) { } diff --git a/extensions/CCArmature/physics/CCPhysicsWorld.cpp b/extensions/CCArmature/physics/CCPhysicsWorld.cpp index 644c604ca3..0ccf8eb617 100644 --- a/extensions/CCArmature/physics/CCPhysicsWorld.cpp +++ b/extensions/CCArmature/physics/CCPhysicsWorld.cpp @@ -41,7 +41,7 @@ public: class ContactListener : public b2ContactListener { //! Callbacks for derived classes. - virtual void BeginContact(b2Contact *contact) + virtual void BeginContact(b2Contact *contact) override { if (contact) { @@ -53,17 +53,17 @@ class ContactListener : public b2ContactListener } B2_NOT_USED(contact); } - virtual void EndContact(b2Contact *contact) + virtual void EndContact(b2Contact *contact) override { contact_list.clear(); B2_NOT_USED(contact); } - virtual void PreSolve(b2Contact *contact, const b2Manifold *oldManifold) + virtual void PreSolve(b2Contact *contact, const b2Manifold *oldManifold) override { B2_NOT_USED(contact); B2_NOT_USED(oldManifold); } - virtual void PostSolve(const b2Contact *contact, const b2ContactImpulse *impulse) + virtual void PostSolve(b2Contact *contact, const b2ContactImpulse *impulse) override { B2_NOT_USED(contact); B2_NOT_USED(impulse); diff --git a/extensions/CCBReader/CCBAnimationManager.cpp b/extensions/CCBReader/CCBAnimationManager.cpp index 2c89f4aeeb..bd30b0a168 100644 --- a/extensions/CCBReader/CCBAnimationManager.cpp +++ b/extensions/CCBReader/CCBAnimationManager.cpp @@ -17,7 +17,9 @@ NS_CC_EXT_BEGIN // Implementation of CCBAinmationManager CCBAnimationManager::CCBAnimationManager() -: _sequences(NULL) +: _jsControlled(false) +, _owner(NULL) +, _sequences(NULL) , _nodeSequences(NULL) , _baseValues(NULL) , _autoPlaySequenceId(0) @@ -25,8 +27,7 @@ CCBAnimationManager::CCBAnimationManager() , _rootContainerSize(Size::ZERO) , _delegate(NULL) , _runningSequence(NULL) -, _jsControlled(false) -, _owner(NULL) + { init(); } diff --git a/extensions/GUI/CCControlExtension/CCControl.cpp b/extensions/GUI/CCControlExtension/CCControl.cpp index b32ee30225..03aeab0594 100644 --- a/extensions/GUI/CCControlExtension/CCControl.cpp +++ b/extensions/GUI/CCControlExtension/CCControl.cpp @@ -37,13 +37,13 @@ NS_CC_EXT_BEGIN Control::Control() -: _isOpacityModifyRGB(false) -, _state(State::NORMAL) -, _hasVisibleParents(false) -, _enabled(false) +: _enabled(false) , _selected(false) , _highlighted(false) +, _hasVisibleParents(false) , _dispatchTable(NULL) +, _isOpacityModifyRGB(false) +, _state(State::NORMAL) { } diff --git a/extensions/GUI/CCControlExtension/CCControlButton.cpp b/extensions/GUI/CCControlExtension/CCControlButton.cpp index 7f3a521612..ddbee20262 100644 --- a/extensions/GUI/CCControlExtension/CCControlButton.cpp +++ b/extensions/GUI/CCControlExtension/CCControlButton.cpp @@ -42,14 +42,14 @@ enum }; ControlButton::ControlButton() -: _currentTitle(NULL) -, _currentTitleColor(Color3B::WHITE) +: _isPushed(false) +, _parentInited(false) , _doesAdjustBackgroundImage(false) +, _currentTitle(NULL) +, _currentTitleColor(Color3B::WHITE) , _titleLabel(NULL) , _backgroundSprite(NULL) , _zoomOnTouchDown(false) -, _isPushed(false) -, _parentInited(false) , _titleDispatchTable(NULL) , _titleColorDispatchTable(NULL) , _titleLabelDispatchTable(NULL) diff --git a/extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp b/extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp index fdc957e608..40907afca8 100644 --- a/extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp +++ b/extensions/GUI/CCControlExtension/CCControlPotentiometer.cpp @@ -31,11 +31,11 @@ NS_CC_EXT_BEGIN ControlPotentiometer::ControlPotentiometer() -: _thumbSprite(NULL) -, _progressTimer(NULL) -, _value(0.0f) +: _value(0.0f) , _minimumValue(0.0f) , _maximumValue(0.0f) +, _thumbSprite(NULL) +, _progressTimer(NULL) { } diff --git a/extensions/GUI/CCControlExtension/CCControlStepper.cpp b/extensions/GUI/CCControlExtension/CCControlStepper.cpp index f1c504d528..a14343b5ad 100644 --- a/extensions/GUI/CCControlExtension/CCControlStepper.cpp +++ b/extensions/GUI/CCControlExtension/CCControlStepper.cpp @@ -39,11 +39,7 @@ NS_CC_EXT_BEGIN #define kAutorepeatIncreaseTimeIncrement 12 ControlStepper::ControlStepper() -: _minusSprite(NULL) -, _plusSprite(NULL) -, _minusLabel(NULL) -, _plusLabel(NULL) -, _value(0.0) +: _value(0.0) , _continuous(false) , _autorepeat(false) , _wraps(false) @@ -53,6 +49,10 @@ ControlStepper::ControlStepper() , _touchInsideFlag(false) , _touchedPart(Part::NONE) , _autorepeatCount(0) +, _minusSprite(NULL) +, _plusSprite(NULL) +, _minusLabel(NULL) +, _plusLabel(NULL) { } diff --git a/extensions/GUI/CCControlExtension/CCScale9Sprite.cpp b/extensions/GUI/CCControlExtension/CCScale9Sprite.cpp index 8e588b5706..a086e475b5 100644 --- a/extensions/GUI/CCControlExtension/CCScale9Sprite.cpp +++ b/extensions/GUI/CCControlExtension/CCScale9Sprite.cpp @@ -43,11 +43,7 @@ enum positions }; Scale9Sprite::Scale9Sprite() -: _insetLeft(0) -, _insetTop(0) -, _insetRight(0) -, _insetBottom(0) -, _spritesGenerated(false) +: _spritesGenerated(false) , _spriteFrameRotated(false) , _positionsAreDirty(false) , _scale9Image(NULL) @@ -61,6 +57,10 @@ Scale9Sprite::Scale9Sprite() , _bottom(NULL) , _bottomRight(NULL) , _opacityModifyRGB(false) +, _insetLeft(0) +, _insetTop(0) +, _insetRight(0) +, _insetBottom(0) { } diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm index 0848178220..a4cbae50ba 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplIOS.mm @@ -257,8 +257,8 @@ EditBoxImplIOS::EditBoxImplIOS(EditBox* pEditText) : EditBoxImpl(pEditText) , _label(NULL) , _labelPlaceHolder(NULL) -, _systemControl(NULL) , _anchorPoint(Point(0.5f, 0.5f)) +, _systemControl(NULL) , _maxTextLength(-1) { _inRetinaMode = [[CCEAGLView sharedEGLView] contentScaleFactor] == 2.0f ? true : false; diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm b/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm index 0dfac0adc0..941687acec 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm +++ b/extensions/GUI/CCEditBox/CCEditBoxImplMac.mm @@ -234,8 +234,10 @@ EditBoxImpl* __createSystemEditBox(EditBox* pEditBox) } EditBoxImplMac::EditBoxImplMac(EditBox* pEditText) -: EditBoxImpl(pEditText), _sysEdit(NULL), _maxTextLength(-1) +: EditBoxImpl(pEditText) , _anchorPoint(Point(0.5f, 0.5f)) +, _maxTextLength(-1) +, _sysEdit(NULL) { //! TODO: Retina on Mac //! _inRetinaMode = [[CCEAGLView sharedEGLView] contentScaleFactor] == 2.0f ? true : false; diff --git a/extensions/GUI/CCEditBox/CCEditBoxImplTizen.cpp b/extensions/GUI/CCEditBox/CCEditBoxImplTizen.cpp index c5d6fda658..705034c0af 100644 --- a/extensions/GUI/CCEditBox/CCEditBoxImplTizen.cpp +++ b/extensions/GUI/CCEditBox/CCEditBoxImplTizen.cpp @@ -46,7 +46,7 @@ EditBoxImplTizen::EditBoxImplTizen(EditBox* pEditText) , _labelPlaceHolder(NULL) , _editBoxInputMode(EditBox::InputMode::SINGLE_LINE) , _editBoxInputFlag(EditBox::InputFlag::INTIAL_CAPS_ALL_CHARACTERS) -, _keyboardReturnType(kKeyboardReturnTypeDefault) +, _keyboardReturnType(EditBox::KeyboardReturnType::DEFAULT) , _colText(Color3B::WHITE) , _colPlaceHolder(Color3B::GRAY) , _maxLength(-1) @@ -65,7 +65,7 @@ static const int CC_EDIT_BOX_PADDING = 5; bool EditBoxImplTizen::initWithSize(const Size& size) { - int fontSize = (int)size.height-12; +// int fontSize = (int)size.height-12; _label = LabelTTF::create("", "", size.height-12); // align the text vertically center _label->setAnchorPoint(Point(0, 0.5f)); @@ -160,7 +160,7 @@ void EditBoxImplTizen::setText(const char* pText) std::string strToShow; - if (kEditBoxInputFlagPassword == _editBoxInputFlag) + if (EditBox::InputFlag::PASSWORD == _editBoxInputFlag) { long length = cc_utf8_strlen(_text.c_str(), -1); for (long i = 0; i < length; i++) @@ -284,21 +284,21 @@ void EditBoxImplTizen::openKeyboard() bool bSingleLineEnabled = false; switch (_editBoxInputMode) { - case kEditBoxInputModeAny: + case EditBox::InputMode::ANY: keypadStyle = KEYPAD_STYLE_NORMAL; break; - case kEditBoxInputModeEmailAddr: + case EditBox::InputMode::EMAIL_ADDRESS: keypadStyle = KEYPAD_STYLE_EMAIL; break; - case kEditBoxInputModeNumeric: - case kEditBoxInputModeDecimal: + case EditBox::InputMode::NUMERIC: + case EditBox::InputMode::DECIMAL: keypadStyle = KEYPAD_STYLE_NUMBER; keypadCategory = KEYPAD_MODE_NUMERIC; break; - case kEditBoxInputModePhoneNumber: + case EditBox::InputMode::PHONE_NUMBER: keypadStyle = KEYPAD_STYLE_PHONE_NUMBER; break; - case kEditBoxInputModeUrl: + case EditBox::InputMode::URL: keypadStyle = KEYPAD_STYLE_URL; break; case EditBox::InputMode::SINGLE_LINE: @@ -312,10 +312,10 @@ void EditBoxImplTizen::openKeyboard() bool bTextPrediction = true; switch (_editBoxInputFlag) { - case kEditBoxInputFlagPassword: + case EditBox::InputFlag::PASSWORD: keypadStyle = KEYPAD_STYLE_PASSWORD; break; - case kEditBoxInputFlagSensitive: + case EditBox::InputFlag::SENSITIVE: bTextPrediction = false; break; default: diff --git a/extensions/network/SocketIO.cpp b/extensions/network/SocketIO.cpp index b1f4131602..3921e3cdcd 100644 --- a/extensions/network/SocketIO.cpp +++ b/extensions/network/SocketIO.cpp @@ -490,11 +490,11 @@ void SIOClientImpl::onError(cocos2d::extension::WebSocket* ws, const cocos2d::ex //begin SIOClient methods SIOClient::SIOClient(const std::string& host, int port, const std::string& path, SIOClientImpl* impl, SocketIO::SIODelegate& delegate) - : _host(host) - , _port(port) + : _port(port) + , _host(host) , _path(path) + , _connected(false) , _socket(impl) - , _connected(false) , _delegate(&delegate) { diff --git a/extensions/proj.emscripten/Makefile b/extensions/proj.emscripten/Makefile index 1d6c663a08..840e7564a5 100644 --- a/extensions/proj.emscripten/Makefile +++ b/extensions/proj.emscripten/Makefile @@ -88,7 +88,7 @@ SOURCES = ../CCBReader/CCBFileLoader.cpp \ ../CCArmature/utils/CCTransformHelp.cpp \ ../CCArmature/utils/CCTweenFunction.cpp \ ../CCArmature/utils/CCUtilMath.cpp \ -../CCDprecated-ext.cpp +../CCDeprecated-ext.cpp include $(COCOS_ROOT)/cocos2dx/proj.emscripten/cocos2dx.mk diff --git a/external/chipmunk/proj.tizen/.project b/external/chipmunk/proj.tizen/.project index 1f7cbcd8ee..0542d33de2 100644 --- a/external/chipmunk/proj.tizen/.project +++ b/external/chipmunk/proj.tizen/.project @@ -7,7 +7,6 @@ org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, ?name? @@ -31,7 +30,7 @@ org.eclipse.cdt.make.core.buildLocation - ${workspace_loc:/chipmunk/Debug-Tizen-Device} + ${workspace_loc:/chipmunk/Debug-Tizen-Emulator} org.eclipse.cdt.make.core.cleanBuildTarget @@ -43,7 +42,7 @@ org.eclipse.cdt.make.core.enableAutoBuild - false + true org.eclipse.cdt.make.core.enableCleanBuild diff --git a/plugin/jsbindings/auto/jsb_pluginx_protocols_auto.cpp b/plugin/jsbindings/auto/jsb_pluginx_protocols_auto.cpp index aa6f3e2fe5..9ad4624a55 100644 --- a/plugin/jsbindings/auto/jsb_pluginx_protocols_auto.cpp +++ b/plugin/jsbindings/auto/jsb_pluginx_protocols_auto.cpp @@ -742,10 +742,18 @@ JSBool js_pluginx_protocols_ProtocolAds_showAds(JSContext *cx, uint32_t argc, js js_proxy_t *proxy = jsb_get_js_proxy(obj); cocos2d::plugin::ProtocolAds* cobj = (cocos2d::plugin::ProtocolAds *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object"); + if (argc == 1) { + TAdsInfo arg0; + ok &= jsval_to_TAdsInfo(cx, argv[0], &arg0); + JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments"); + cobj->showAds(arg0); + JS_SET_RVAL(cx, vp, JSVAL_VOID); + return JS_TRUE; + } if (argc == 2) { TAdsInfo arg0; cocos2d::plugin::ProtocolAds::AdsPos arg1; - #pragma warning NO CONVERSION TO NATIVE FOR TAdsInfo; + ok &= jsval_to_TAdsInfo(cx, argv[0], &arg0); ok &= jsval_to_int32(cx, argv[1], (int32_t *)&arg1); JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments"); cobj->showAds(arg0, arg1); @@ -753,7 +761,7 @@ JSBool js_pluginx_protocols_ProtocolAds_showAds(JSContext *cx, uint32_t argc, js return JS_TRUE; } - JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2); + JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1); return JS_FALSE; } JSBool js_pluginx_protocols_ProtocolAds_hideAds(JSContext *cx, uint32_t argc, jsval *vp) @@ -766,7 +774,7 @@ JSBool js_pluginx_protocols_ProtocolAds_hideAds(JSContext *cx, uint32_t argc, js JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object"); if (argc == 1) { TAdsInfo arg0; - #pragma warning NO CONVERSION TO NATIVE FOR TAdsInfo; + ok &= jsval_to_TAdsInfo(cx, argv[0], &arg0); JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments"); cobj->hideAds(arg0); JS_SET_RVAL(cx, vp, JSVAL_VOID); @@ -893,7 +901,7 @@ void js_register_pluginx_protocols_ProtocolAds(JSContext *cx, JSObject *global) }; static JSFunctionSpec funcs[] = { - JS_FN("showAds", js_pluginx_protocols_ProtocolAds_showAds, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("showAds", js_pluginx_protocols_ProtocolAds_showAds, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("hideAds", js_pluginx_protocols_ProtocolAds_hideAds, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("queryPoints", js_pluginx_protocols_ProtocolAds_queryPoints, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("spendPoints", js_pluginx_protocols_ProtocolAds_spendPoints, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), @@ -1143,7 +1151,7 @@ JSBool js_pluginx_protocols_ProtocolSocial_configDeveloperInfo(JSContext *cx, ui JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object"); if (argc == 1) { TSocialDeveloperInfo arg0; - #pragma warning NO CONVERSION TO NATIVE FOR TSocialDeveloperInfo; + ok &= jsval_to_TSocialDeveloperInfo(cx, argv[0], &arg0); JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments"); cobj->configDeveloperInfo(arg0); JS_SET_RVAL(cx, vp, JSVAL_VOID); @@ -1163,7 +1171,7 @@ JSBool js_pluginx_protocols_ProtocolSocial_unlockAchievement(JSContext *cx, uint JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object"); if (argc == 1) { TAchievementInfo arg0; - #pragma warning NO CONVERSION TO NATIVE FOR TAchievementInfo; + ok &= jsval_to_TAchievementInfo(cx, argv[0], &arg0); JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments"); cobj->unlockAchievement(arg0); JS_SET_RVAL(cx, vp, JSVAL_VOID); @@ -1295,7 +1303,7 @@ JSBool js_pluginx_protocols_ProtocolUser_configDeveloperInfo(JSContext *cx, uint JSB_PRECONDITION2( cobj, cx, JS_FALSE, "Invalid Native Object"); if (argc == 1) { TUserDeveloperInfo arg0; - #pragma warning NO CONVERSION TO NATIVE FOR TUserDeveloperInfo; + ok &= jsval_to_TUserDeveloperInfo(cx, argv[0], &arg0); JSB_PRECONDITION2(ok, cx, JS_FALSE, "Error processing arguments"); cobj->configDeveloperInfo(arg0); JS_SET_RVAL(cx, vp, JSVAL_VOID); diff --git a/plugin/samples/HelloAnalytics-JS/Classes/AppDelegate.cpp b/plugin/samples/HelloAnalytics-JS/Classes/AppDelegate.cpp index 51cb166184..2e5330a1b8 100644 --- a/plugin/samples/HelloAnalytics-JS/Classes/AppDelegate.cpp +++ b/plugin/samples/HelloAnalytics-JS/Classes/AppDelegate.cpp @@ -61,8 +61,8 @@ bool AppDelegate::applicationDidFinishLaunching() void AppDelegate::applicationDidEnterBackground() { Director::getInstance()->stopAnimation(); - SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); - SimpleAudioEngine::sharedEngine()->pauseAllEffects(); + SimpleAudioEngine::getInstance()->pauseBackgroundMusic(); + SimpleAudioEngine::getInstance()->pauseAllEffects(); ScriptingCore* sc = ScriptingCore::getInstance(); jsval nsval; @@ -76,8 +76,8 @@ void AppDelegate::applicationDidEnterBackground() void AppDelegate::applicationWillEnterForeground() { Director::getInstance()->startAnimation(); - SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); - SimpleAudioEngine::sharedEngine()->resumeAllEffects(); + SimpleAudioEngine::getInstance()->resumeBackgroundMusic(); + SimpleAudioEngine::getInstance()->resumeAllEffects(); ScriptingCore* sc = ScriptingCore::getInstance(); jsval nsval; diff --git a/plugin/samples/HelloAnalytics-JS/proj.android/build_native.sh b/plugin/samples/HelloAnalytics-JS/proj.android/build_native.sh index 62e0ebf499..fe1ce83858 100755 --- a/plugin/samples/HelloAnalytics-JS/proj.android/build_native.sh +++ b/plugin/samples/HelloAnalytics-JS/proj.android/build_native.sh @@ -35,6 +35,20 @@ echo "please define NDK_ROOT" exit 1 fi +# For compatibility of android-ndk-r9, 4.7 was removed from r9 +if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then + export NDK_TOOLCHAIN_VERSION=4.7 + echo "The Selected NDK toolchain version was 4.7 !" +else + if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then + export NDK_TOOLCHAIN_VERSION=4.8 + echo "The Selected NDK toolchain version was 4.8 !" + else + echo "Couldn't find the gcc toolchain." + exit 1 + fi +fi + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # ... use paths relative to current directory PLUGIN_ROOT="$DIR/../../.." diff --git a/plugin/samples/HelloAnalytics-JS/proj.android/jni/Application.mk b/plugin/samples/HelloAnalytics-JS/proj.android/jni/Application.mk index 8e3c31147c..ee9712a9d8 100644 --- a/plugin/samples/HelloAnalytics-JS/proj.android/jni/Application.mk +++ b/plugin/samples/HelloAnalytics-JS/proj.android/jni/Application.mk @@ -1,4 +1,4 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11 APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -NDK_TOOLCHAIN_VERSION=4.7 + diff --git a/plugin/samples/HelloIAP-JS/proj.android/build_native.sh b/plugin/samples/HelloIAP-JS/proj.android/build_native.sh index 2cdd8693a5..65fa2e8c22 100755 --- a/plugin/samples/HelloIAP-JS/proj.android/build_native.sh +++ b/plugin/samples/HelloIAP-JS/proj.android/build_native.sh @@ -35,6 +35,20 @@ echo "please define NDK_ROOT" exit 1 fi +# For compatibility of android-ndk-r9, 4.7 was removed from r9 +if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then + export NDK_TOOLCHAIN_VERSION=4.7 + echo "The Selected NDK toolchain version was 4.7 !" +else + if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then + export NDK_TOOLCHAIN_VERSION=4.8 + echo "The Selected NDK toolchain version was 4.8 !" + else + echo "Couldn't find the gcc toolchain." + exit 1 + fi +fi + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # ... use paths relative to current directory PLUGIN_ROOT="$DIR/../../.." diff --git a/plugin/samples/HelloIAP-JS/proj.android/jni/Application.mk b/plugin/samples/HelloIAP-JS/proj.android/jni/Application.mk index 8e3c31147c..ee9712a9d8 100755 --- a/plugin/samples/HelloIAP-JS/proj.android/jni/Application.mk +++ b/plugin/samples/HelloIAP-JS/proj.android/jni/Application.mk @@ -1,4 +1,4 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11 APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -NDK_TOOLCHAIN_VERSION=4.7 + diff --git a/plugin/samples/HelloPlugins/Classes/AppDelegate.cpp b/plugin/samples/HelloPlugins/Classes/AppDelegate.cpp index e77c27e7ef..458f96c4e1 100644 --- a/plugin/samples/HelloPlugins/Classes/AppDelegate.cpp +++ b/plugin/samples/HelloPlugins/Classes/AppDelegate.cpp @@ -40,7 +40,7 @@ void AppDelegate::applicationDidEnterBackground() { Director::getInstance()->stopAnimation(); // if you use SimpleAudioEngine, it must be pause - // SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic(); + // SimpleAudioEngine::getInstance()->pauseBackgroundMusic(); } // this function will be called when the app is active again @@ -48,5 +48,5 @@ void AppDelegate::applicationWillEnterForeground() { Director::getInstance()->startAnimation(); // if you use SimpleAudioEngine, it must resume here - // SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic(); + // SimpleAudioEngine::getInstance()->resumeBackgroundMusic(); } diff --git a/plugin/samples/HelloPlugins/Classes/TestAnalytics/TestAnalyticsScene.cpp b/plugin/samples/HelloPlugins/Classes/TestAnalytics/TestAnalyticsScene.cpp index a49d39051b..27cfe1750d 100644 --- a/plugin/samples/HelloPlugins/Classes/TestAnalytics/TestAnalyticsScene.cpp +++ b/plugin/samples/HelloPlugins/Classes/TestAnalytics/TestAnalyticsScene.cpp @@ -118,7 +118,7 @@ bool TestAnalytics::init() std::string strVer = _pluginAnalytics->getSDKVersion(); char ret[256] = { 0 }; sprintf(ret, "Plugin : %s, Ver : %s", strName.c_str(), strVer.c_str()); - LabelTTF* pLabel = LabelTTF::create(ret, "Arial", 18, Point(visibleSize.width, 0), kTextAlignmentCenter); + LabelTTF* pLabel = LabelTTF::create(ret, "Arial", 18, Point(visibleSize.width, 0), Label::HAlignment::CENTER); pLabel->setPosition(Point(visibleSize.width / 2, yPos - 80)); addChild(pLabel); diff --git a/plugin/samples/HelloPlugins/proj.android/build_native.sh b/plugin/samples/HelloPlugins/proj.android/build_native.sh index a76848a0e4..ba5e6b061d 100755 --- a/plugin/samples/HelloPlugins/proj.android/build_native.sh +++ b/plugin/samples/HelloPlugins/proj.android/build_native.sh @@ -35,6 +35,20 @@ echo "please define NDK_ROOT" exit 1 fi +# For compatibility of android-ndk-r9, 4.7 was removed from r9 +if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then + export NDK_TOOLCHAIN_VERSION=4.7 + echo "The Selected NDK toolchain version was 4.7 !" +else + if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then + export NDK_TOOLCHAIN_VERSION=4.8 + echo "The Selected NDK toolchain version was 4.8 !" + else + echo "Couldn't find the gcc toolchain." + exit 1 + fi +fi + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # ... use paths relative to current directory PLUGIN_ROOT="$DIR/../../.." diff --git a/plugin/samples/HelloPlugins/proj.android/jni/Application.mk b/plugin/samples/HelloPlugins/proj.android/jni/Application.mk index 43499d7113..9caa13be80 100644 --- a/plugin/samples/HelloPlugins/proj.android/jni/Application.mk +++ b/plugin/samples/HelloPlugins/proj.android/jni/Application.mk @@ -1,3 +1,3 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11 -NDK_TOOLCHAIN_VERSION=4.7 + diff --git a/plugin/tools/tojs/conversions.yaml b/plugin/tools/tojs/conversions.yaml index 992588048b..13f00a8389 100644 --- a/plugin/tools/tojs/conversions.yaml +++ b/plugin/tools/tojs/conversions.yaml @@ -40,8 +40,12 @@ conversions: TIAPDeveloperInfo: "ok &= jsval_to_TIAPDeveloperInfo(cx, ${in_value}, &${out_value})" TPaymentInfo: "ok &= jsval_to_TPaymentInfo(cx, ${in_value}, &${out_value})" TAdsDeveloperInfo: "ok &= jsval_to_TAdsDeveloperInfo(cx, ${in_value}, &${out_value})" + TAdsInfo: "ok &= jsval_to_TAdsInfo(cx, ${in_value}, &${out_value})" TShareDeveloperInfo: "ok &= jsval_to_TShareDeveloperInfo(cx, ${in_value}, &${out_value})" TShareInfo: "ok &= jsval_to_TShareInfo(cx, ${in_value}, &${out_value})" + TUserDeveloperInfo: "ok &= jsval_to_TUserDeveloperInfo(cx, ${in_value}, &${out_value})" + TSocialDeveloperInfo: "ok &= jsval_to_TSocialDeveloperInfo(cx, ${in_value}, &${out_value})" + TAchievementInfo: "ok &= jsval_to_TAchievementInfo(cx, ${in_value}, &${out_value})" LogEventParamMap*: | LogEventParamMap ${out_value}_tmp; ${($level + 0) * '\t'}do { @@ -62,11 +66,6 @@ conversions: float: "${out_value} = DOUBLE_TO_JSVAL(${in_value})" double: "${out_value} = DOUBLE_TO_JSVAL(${in_value})" TProductInfo: "${out_value} = TProductInfo_to_jsval(cx, ${in_value})" - TIAPDeveloperInfo: "${out_value} = TIAPDeveloperInfo_to_jsval(cx, ${in_value})" - TPaymentInfo: "${out_value} = TPaymentInfo_to_jsval(cx, ${in_value})" - TAdsDeveloperInfo: "${out_value} = TAdsDeveloperInfo_to_jsval(cx, ${in_value})" - TShareDeveloperInfo: "${out_value} = TShareDeveloperInfo_to_jsval(cx, ${in_value})" - TShareInfo: "${out_value} = TShareInfo_to_jsval(cx, ${in_value})" LogEventParamMap*: "${out_value} = LogEventParamMap_to_jsval(cx, ${in_value})" long: "${out_value} = long_to_jsval(cx, ${in_value})" diff --git a/samples/Cpp/AssetsManagerTest/proj.android/build_native.sh b/samples/Cpp/AssetsManagerTest/proj.android/build_native.sh index 12e6564c5b..cbf74a57d7 100755 --- a/samples/Cpp/AssetsManagerTest/proj.android/build_native.sh +++ b/samples/Cpp/AssetsManagerTest/proj.android/build_native.sh @@ -49,6 +49,20 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc exit 1 fi +# For compatibility of android-ndk-r9, 4.7 was removed from r9 +if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then + export NDK_TOOLCHAIN_VERSION=4.7 + echo "The Selected NDK toolchain version was 4.7 !" +else + if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then + export NDK_TOOLCHAIN_VERSION=4.8 + echo "The Selected NDK toolchain version was 4.8 !" + else + echo "Couldn't find the gcc toolchain." + exit 1 + fi +fi + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # ... use paths relative to current directory COCOS2DX_ROOT="$DIR/../../../.." diff --git a/samples/Cpp/AssetsManagerTest/proj.android/jni/Application.mk b/samples/Cpp/AssetsManagerTest/proj.android/jni/Application.mk index 83aeced7b6..7d9d576f0c 100644 --- a/samples/Cpp/AssetsManagerTest/proj.android/jni/Application.mk +++ b/samples/Cpp/AssetsManagerTest/proj.android/jni/Application.mk @@ -1,4 +1,3 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11 APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -NDK_TOOLCHAIN_VERSION=4.7 \ No newline at end of file diff --git a/samples/Cpp/HelloCpp/proj.android/build_native.sh b/samples/Cpp/HelloCpp/proj.android/build_native.sh index 5a91b70245..684f0d9886 100755 --- a/samples/Cpp/HelloCpp/proj.android/build_native.sh +++ b/samples/Cpp/HelloCpp/proj.android/build_native.sh @@ -49,6 +49,20 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc exit 1 fi +# For compatibility of android-ndk-r9, 4.7 was removed from r9 +if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then + export NDK_TOOLCHAIN_VERSION=4.7 + echo "The Selected NDK toolchain version was 4.7 !" +else + if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then + export NDK_TOOLCHAIN_VERSION=4.8 + echo "The Selected NDK toolchain version was 4.8 !" + else + echo "Couldn't find the gcc toolchain." + exit 1 + fi +fi + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # ... use paths relative to current directory COCOS2DX_ROOT="$DIR/../../../.." diff --git a/samples/Cpp/HelloCpp/proj.android/jni/Application.mk b/samples/Cpp/HelloCpp/proj.android/jni/Application.mk index d06f06e718..988bf2fadc 100644 --- a/samples/Cpp/HelloCpp/proj.android/jni/Application.mk +++ b/samples/Cpp/HelloCpp/proj.android/jni/Application.mk @@ -1,3 +1,2 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11 -NDK_TOOLCHAIN_VERSION=4.7 \ No newline at end of file diff --git a/samples/Cpp/SimpleGame/proj.android/build_native.sh b/samples/Cpp/SimpleGame/proj.android/build_native.sh index 29be776c45..25feecb480 100755 --- a/samples/Cpp/SimpleGame/proj.android/build_native.sh +++ b/samples/Cpp/SimpleGame/proj.android/build_native.sh @@ -49,6 +49,20 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc exit 1 fi +# For compatibility of android-ndk-r9, 4.7 was removed from r9 +if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then + export NDK_TOOLCHAIN_VERSION=4.7 + echo "The Selected NDK toolchain version was 4.7 !" +else + if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then + export NDK_TOOLCHAIN_VERSION=4.8 + echo "The Selected NDK toolchain version was 4.8 !" + else + echo "Couldn't find the gcc toolchain." + exit 1 + fi +fi + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # ... use paths relative to current directory COCOS2DX_ROOT="$DIR/../../../.." diff --git a/samples/Cpp/SimpleGame/proj.android/jni/Application.mk b/samples/Cpp/SimpleGame/proj.android/jni/Application.mk index d06f06e718..988bf2fadc 100644 --- a/samples/Cpp/SimpleGame/proj.android/jni/Application.mk +++ b/samples/Cpp/SimpleGame/proj.android/jni/Application.mk @@ -1,3 +1,2 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11 -NDK_TOOLCHAIN_VERSION=4.7 \ No newline at end of file diff --git a/samples/Cpp/TestCpp/Classes/RenderTextureTest/RenderTextureTest.cpp b/samples/Cpp/TestCpp/Classes/RenderTextureTest/RenderTextureTest.cpp index 8c93958856..4ba33e79b1 100644 --- a/samples/Cpp/TestCpp/Classes/RenderTextureTest/RenderTextureTest.cpp +++ b/samples/Cpp/TestCpp/Classes/RenderTextureTest/RenderTextureTest.cpp @@ -448,15 +448,13 @@ RenderTextureTestDepthStencil::RenderTextureTestDepthStencil() //! mark sprite quad into stencil buffer glEnable(GL_STENCIL_TEST); - glStencilFunc(GL_ALWAYS, 1, 0xFF); - glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); - glColorMask(0, 0, 0, 1); + glStencilFunc(GL_NEVER, 1, 0xFF); + glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); sprite->visit(); //! move sprite half width and height, and draw only where not marked - sprite->setPosition(sprite->getPosition() + Point(sprite->getContentSize().width * sprite->getScale(), sprite->getContentSize().height * sprite->getScale() * 0.5)); + sprite->setPosition(sprite->getPosition() + Point(sprite->getContentSize().width * sprite->getScale() * 0.5, sprite->getContentSize().height * sprite->getScale() * 0.5)); glStencilFunc(GL_NOTEQUAL, 1, 0xFF); - glColorMask(1, 1, 1, 1); sprite->visit(); rend->end(); diff --git a/samples/Cpp/TestCpp/proj.android/build_native.sh b/samples/Cpp/TestCpp/proj.android/build_native.sh index 9172deb176..dba0c405ec 100755 --- a/samples/Cpp/TestCpp/proj.android/build_native.sh +++ b/samples/Cpp/TestCpp/proj.android/build_native.sh @@ -49,6 +49,21 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc exit 1 fi +# For compatibility of android-ndk-r9, 4.7 was removed from r9 +if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then + export NDK_TOOLCHAIN_VERSION=4.7 + echo "The Selected NDK toolchain version was 4.7 !" +else + if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then + export NDK_TOOLCHAIN_VERSION=4.8 + echo "The Selected NDK toolchain version was 4.8 !" + else + echo "Couldn't find the gcc toolchain." + exit 1 + fi +fi + + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # ... use paths relative to current directory COCOS2DX_ROOT="$DIR/../../../.." diff --git a/samples/Cpp/TestCpp/proj.android/jni/Application.mk b/samples/Cpp/TestCpp/proj.android/jni/Application.mk index 43499d7113..9caa13be80 100644 --- a/samples/Cpp/TestCpp/proj.android/jni/Application.mk +++ b/samples/Cpp/TestCpp/proj.android/jni/Application.mk @@ -1,3 +1,3 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11 -NDK_TOOLCHAIN_VERSION=4.7 + diff --git a/samples/Javascript/CocosDragonJS/proj.android/build_native.sh b/samples/Javascript/CocosDragonJS/proj.android/build_native.sh index a897fde8c3..5d50201a71 100755 --- a/samples/Javascript/CocosDragonJS/proj.android/build_native.sh +++ b/samples/Javascript/CocosDragonJS/proj.android/build_native.sh @@ -58,6 +58,20 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc exit 1 fi +# For compatibility of android-ndk-r9, 4.7 was removed from r9 +if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then + export NDK_TOOLCHAIN_VERSION=4.7 + echo "The Selected NDK toolchain version was 4.7 !" +else + if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then + export NDK_TOOLCHAIN_VERSION=4.8 + echo "The Selected NDK toolchain version was 4.8 !" + else + echo "Couldn't find the gcc toolchain." + exit 1 + fi +fi + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # ... use paths relative to current directory COCOS2DX_ROOT="$DIR/../../../.." diff --git a/samples/Javascript/CocosDragonJS/proj.android/jni/Application.mk b/samples/Javascript/CocosDragonJS/proj.android/jni/Application.mk index 8e3c31147c..ee9712a9d8 100644 --- a/samples/Javascript/CocosDragonJS/proj.android/jni/Application.mk +++ b/samples/Javascript/CocosDragonJS/proj.android/jni/Application.mk @@ -1,4 +1,4 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11 APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -NDK_TOOLCHAIN_VERSION=4.7 + diff --git a/samples/Javascript/CrystalCraze/proj.android/build_native.sh b/samples/Javascript/CrystalCraze/proj.android/build_native.sh index 11415396fa..379ec6da8c 100755 --- a/samples/Javascript/CrystalCraze/proj.android/build_native.sh +++ b/samples/Javascript/CrystalCraze/proj.android/build_native.sh @@ -58,6 +58,20 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc exit 1 fi +# For compatibility of android-ndk-r9, 4.7 was removed from r9 +if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then + export NDK_TOOLCHAIN_VERSION=4.7 + echo "The Selected NDK toolchain version was 4.7 !" +else + if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then + export NDK_TOOLCHAIN_VERSION=4.8 + echo "The Selected NDK toolchain version was 4.8 !" + else + echo "Couldn't find the gcc toolchain." + exit 1 + fi +fi + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # ... use paths relative to current directory COCOS2DX_ROOT="$DIR/../../../.." diff --git a/samples/Javascript/CrystalCraze/proj.android/jni/Application.mk b/samples/Javascript/CrystalCraze/proj.android/jni/Application.mk index 8e3c31147c..ee9712a9d8 100644 --- a/samples/Javascript/CrystalCraze/proj.android/jni/Application.mk +++ b/samples/Javascript/CrystalCraze/proj.android/jni/Application.mk @@ -1,4 +1,4 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11 APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -NDK_TOOLCHAIN_VERSION=4.7 + diff --git a/samples/Javascript/MoonWarriors/proj.android/build_native.sh b/samples/Javascript/MoonWarriors/proj.android/build_native.sh index 92128a413e..42484a8394 100755 --- a/samples/Javascript/MoonWarriors/proj.android/build_native.sh +++ b/samples/Javascript/MoonWarriors/proj.android/build_native.sh @@ -57,6 +57,20 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc exit 1 fi +# For compatibility of android-ndk-r9, 4.7 was removed from r9 +if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then + export NDK_TOOLCHAIN_VERSION=4.7 + echo "The Selected NDK toolchain version was 4.7 !" +else + if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then + export NDK_TOOLCHAIN_VERSION=4.8 + echo "The Selected NDK toolchain version was 4.8 !" + else + echo "Couldn't find the gcc toolchain." + exit 1 + fi +fi + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # ... use paths relative to current directory COCOS2DX_ROOT="$DIR/../../../.." diff --git a/samples/Javascript/MoonWarriors/proj.android/jni/Application.mk b/samples/Javascript/MoonWarriors/proj.android/jni/Application.mk index 9fa21e684e..4014245067 100644 --- a/samples/Javascript/MoonWarriors/proj.android/jni/Application.mk +++ b/samples/Javascript/MoonWarriors/proj.android/jni/Application.mk @@ -1,4 +1,4 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT= -std=c++11 APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -NDK_TOOLCHAIN_VERSION=4.7 + diff --git a/samples/Javascript/Shared b/samples/Javascript/Shared index 57366f0fa0..714ea94824 160000 --- a/samples/Javascript/Shared +++ b/samples/Javascript/Shared @@ -1 +1 @@ -Subproject commit 57366f0fa067f548de15bc2b417985a115e8d10e +Subproject commit 714ea9482432a94a2d58ca265c97c61b5b369919 diff --git a/samples/Javascript/TestJavascript/proj.android/build_native.sh b/samples/Javascript/TestJavascript/proj.android/build_native.sh index 3bae11c304..4bbde54d56 100755 --- a/samples/Javascript/TestJavascript/proj.android/build_native.sh +++ b/samples/Javascript/TestJavascript/proj.android/build_native.sh @@ -57,6 +57,20 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc exit 1 fi +# For compatibility of android-ndk-r9, 4.7 was removed from r9 +if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then + export NDK_TOOLCHAIN_VERSION=4.7 + echo "The Selected NDK toolchain version was 4.7 !" +else + if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then + export NDK_TOOLCHAIN_VERSION=4.8 + echo "The Selected NDK toolchain version was 4.8 !" + else + echo "Couldn't find the gcc toolchain." + exit 1 + fi +fi + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # ... use paths relative to current directory COCOS2DX_ROOT="$DIR/../../../.." diff --git a/samples/Javascript/TestJavascript/proj.android/jni/Application.mk b/samples/Javascript/TestJavascript/proj.android/jni/Application.mk index 8e3c31147c..ee9712a9d8 100644 --- a/samples/Javascript/TestJavascript/proj.android/jni/Application.mk +++ b/samples/Javascript/TestJavascript/proj.android/jni/Application.mk @@ -1,4 +1,4 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11 APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -NDK_TOOLCHAIN_VERSION=4.7 + diff --git a/samples/Javascript/WatermelonWithMe/proj.android/build_native.sh b/samples/Javascript/WatermelonWithMe/proj.android/build_native.sh index 8545f0a954..71d135c9c6 100755 --- a/samples/Javascript/WatermelonWithMe/proj.android/build_native.sh +++ b/samples/Javascript/WatermelonWithMe/proj.android/build_native.sh @@ -57,6 +57,20 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc exit 1 fi +# For compatibility of android-ndk-r9, 4.7 was removed from r9 +if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then + export NDK_TOOLCHAIN_VERSION=4.7 + echo "The Selected NDK toolchain version was 4.7 !" +else + if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then + export NDK_TOOLCHAIN_VERSION=4.8 + echo "The Selected NDK toolchain version was 4.8 !" + else + echo "Couldn't find the gcc toolchain." + exit 1 + fi +fi + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # ... use paths relative to current directory COCOS2DX_ROOT="$DIR/../../../.." diff --git a/samples/Javascript/WatermelonWithMe/proj.android/jni/Application.mk b/samples/Javascript/WatermelonWithMe/proj.android/jni/Application.mk index 8e3c31147c..ee9712a9d8 100644 --- a/samples/Javascript/WatermelonWithMe/proj.android/jni/Application.mk +++ b/samples/Javascript/WatermelonWithMe/proj.android/jni/Application.mk @@ -1,4 +1,4 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 -std=c++11 APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -NDK_TOOLCHAIN_VERSION=4.7 + diff --git a/samples/Lua/HelloLua/proj.android/build_native.sh b/samples/Lua/HelloLua/proj.android/build_native.sh index ffbe9e564f..7a7144497f 100755 --- a/samples/Lua/HelloLua/proj.android/build_native.sh +++ b/samples/Lua/HelloLua/proj.android/build_native.sh @@ -49,6 +49,20 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc exit 1 fi +# For compatibility of android-ndk-r9, 4.7 was removed from r9 +if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then + export NDK_TOOLCHAIN_VERSION=4.7 + echo "The Selected NDK toolchain version was 4.7 !" +else + if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then + export NDK_TOOLCHAIN_VERSION=4.8 + echo "The Selected NDK toolchain version was 4.8 !" + else + echo "Couldn't find the gcc toolchain." + exit 1 + fi +fi + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # ... use paths relative to current directory COCOS2DX_ROOT="$DIR/../../../.." diff --git a/samples/Lua/HelloLua/proj.android/jni/Application.mk b/samples/Lua/HelloLua/proj.android/jni/Application.mk index 60500cd560..daad673c2b 100644 --- a/samples/Lua/HelloLua/proj.android/jni/Application.mk +++ b/samples/Lua/HelloLua/proj.android/jni/Application.mk @@ -1,4 +1,4 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11 APP_CPPFLAGS += -fexceptions -NDK_TOOLCHAIN_VERSION=4.7 + diff --git a/samples/Lua/TestLua/proj.android/build_native.sh b/samples/Lua/TestLua/proj.android/build_native.sh index 8ac23114e7..661dde8e12 100755 --- a/samples/Lua/TestLua/proj.android/build_native.sh +++ b/samples/Lua/TestLua/proj.android/build_native.sh @@ -49,6 +49,21 @@ echo "NDK_ROOT not defined. Please define NDK_ROOT in your environment or in loc exit 1 fi +# For compatibility of android-ndk-r9, 4.7 was removed from r9 +if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then + export NDK_TOOLCHAIN_VERSION=4.7 + echo "The Selected NDK toolchain version was 4.7 !" +else + if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then + export NDK_TOOLCHAIN_VERSION=4.8 + echo "The Selected NDK toolchain version was 4.8 !" + else + echo "Couldn't find the gcc toolchain." + exit 1 + fi +fi + + if [ -z "${COCOS2DX_ROOT+aaa}" ]; then # ... if COCOS2DX_ROOT is not set # ... find current working directory diff --git a/samples/Lua/TestLua/proj.android/jni/Application.mk b/samples/Lua/TestLua/proj.android/jni/Application.mk index 60500cd560..daad673c2b 100644 --- a/samples/Lua/TestLua/proj.android/jni/Application.mk +++ b/samples/Lua/TestLua/proj.android/jni/Application.mk @@ -1,4 +1,4 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11 APP_CPPFLAGS += -fexceptions -NDK_TOOLCHAIN_VERSION=4.7 + diff --git a/template/multi-platform-cpp/proj.android/build_native.sh b/template/multi-platform-cpp/proj.android/build_native.sh index 53cbb80e4b..62f24ecb8c 100755 --- a/template/multi-platform-cpp/proj.android/build_native.sh +++ b/template/multi-platform-cpp/proj.android/build_native.sh @@ -35,6 +35,20 @@ echo "please define NDK_ROOT" exit 1 fi +# For compatibility of android-ndk-r9, 4.7 was removed from r9 +if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then + export NDK_TOOLCHAIN_VERSION=4.7 + echo "The Selected NDK toolchain version was 4.7 !" +else + if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then + export NDK_TOOLCHAIN_VERSION=4.8 + echo "The Selected NDK toolchain version was 4.8 !" + else + echo "Couldn't find the gcc toolchain." + exit 1 + fi +fi + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # ... use paths relative to current directory COCOS2DX_ROOT="$DIR/../../.." diff --git a/template/multi-platform-cpp/proj.android/jni/Application.mk b/template/multi-platform-cpp/proj.android/jni/Application.mk index 43499d7113..b20df4f373 100644 --- a/template/multi-platform-cpp/proj.android/jni/Application.mk +++ b/template/multi-platform-cpp/proj.android/jni/Application.mk @@ -1,3 +1,2 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++11 -NDK_TOOLCHAIN_VERSION=4.7 diff --git a/template/multi-platform-js/proj.android/build_native.sh b/template/multi-platform-js/proj.android/build_native.sh index 6388af5a7a..149635b305 100755 --- a/template/multi-platform-js/proj.android/build_native.sh +++ b/template/multi-platform-js/proj.android/build_native.sh @@ -43,6 +43,20 @@ echo "please define NDK_ROOT" exit 1 fi +# For compatibility of android-ndk-r9, 4.7 was removed from r9 +if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then + export NDK_TOOLCHAIN_VERSION=4.7 + echo "The Selected NDK toolchain version was 4.7 !" +else + if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then + export NDK_TOOLCHAIN_VERSION=4.8 + echo "The Selected NDK toolchain version was 4.8 !" + else + echo "Couldn't find the gcc toolchain." + exit 1 + fi +fi + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # ... use paths relative to current directory COCOS2DX_ROOT="$DIR/../../.." diff --git a/template/multi-platform-js/proj.android/jni/Application.mk b/template/multi-platform-js/proj.android/jni/Application.mk index 4e46d23deb..ee36f34b40 100644 --- a/template/multi-platform-js/proj.android/jni/Application.mk +++ b/template/multi-platform-js/proj.android/jni/Application.mk @@ -1,4 +1,4 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1 APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -NDK_TOOLCHAIN_VERSION=4.7 + diff --git a/template/multi-platform-lua/proj.android/build_native.sh b/template/multi-platform-lua/proj.android/build_native.sh index bca05d0902..6728b60a2e 100755 --- a/template/multi-platform-lua/proj.android/build_native.sh +++ b/template/multi-platform-lua/proj.android/build_native.sh @@ -35,6 +35,20 @@ echo "please define NDK_ROOT" exit 1 fi +# For compatibility of android-ndk-r9, 4.7 was removed from r9 +if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.7" ]; then + export NDK_TOOLCHAIN_VERSION=4.7 + echo "The Selected NDK toolchain version was 4.7 !" +else + if [ -d "${NDK_ROOT}/toolchains/arm-linux-androideabi-4.8" ]; then + export NDK_TOOLCHAIN_VERSION=4.8 + echo "The Selected NDK toolchain version was 4.8 !" + else + echo "Couldn't find the gcc toolchain." + exit 1 + fi +fi + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # ... use paths relative to current directory COCOS2DX_ROOT="$DIR/../../.." diff --git a/template/multi-platform-lua/proj.android/jni/Application.mk b/template/multi-platform-lua/proj.android/jni/Application.mk index edebaebf65..95acd5331a 100644 --- a/template/multi-platform-lua/proj.android/jni/Application.mk +++ b/template/multi-platform-lua/proj.android/jni/Application.mk @@ -1,4 +1,4 @@ APP_STL := gnustl_static APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 APP_CPPFLAGS += -fexceptions -NDK_TOOLCHAIN_VERSION=4.7 +