diff --git a/cocos2dx/CCDeprecated.cpp b/cocos2dx/CCDeprecated.cpp index 5edddf915b..5daeecff64 100644 --- a/cocos2dx/CCDeprecated.cpp +++ b/cocos2dx/CCDeprecated.cpp @@ -93,8 +93,8 @@ const int kCCVertexAttribFlag_Color = GL::VERTEX_ATTRIB_FLAG_COLOR; const int kCCVertexAttribFlag_TexCoords = GL::VERTEX_ATTRIB_FLAG_TEX_COORDS; const int kCCVertexAttribFlag_PosColorTex = GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX; -const int kCCProgressTimerTypeRadial = ProgressTimer::RADIAL; -const int kCCProgressTimerTypeBar = ProgressTimer::BAR; +const ProgressTimer::Type kCCProgressTimerTypeRadial = ProgressTimer::Type::RADIAL; +const ProgressTimer::Type kCCProgressTimerTypeBar = ProgressTimer::Type::BAR; const Director::Projection kCCDirectorProjection2D = Director::Projection::_2D; const Director::Projection kCCDirectorProjection3D = Director::Projection::_3D; @@ -161,6 +161,40 @@ const int kCCNodeOnEnterTransitionDidFinish = kNodeOnEnterTransitionDidFinish; const int kCCNodeOnExitTransitionDidStart = kNodeOnExitTransitionDidStart; const int kCCNodeOnCleanup = kNodeOnCleanup; +const LanguageType kLanguageEnglish = LanguageType::ENGLISH; +const LanguageType kLanguageChinese = LanguageType::CHINESE; +const LanguageType kLanguageFrench = LanguageType::FRENCH; +const LanguageType kLanguageItalian = LanguageType::ITALIAN; +const LanguageType kLanguageGerman = LanguageType::GERMAN; +const LanguageType kLanguageSpanish = LanguageType::SPANISH; +const LanguageType kLanguageRussian = LanguageType::RUSSIAN; +const LanguageType kLanguageKorean = LanguageType::KOREAN; +const LanguageType kLanguageJapanese = LanguageType::JAPANESE; +const LanguageType kLanguageHungarian = LanguageType::HUNGARIAN; +const LanguageType kLanguagePortuguese = LanguageType::PORTUGUESE; +const LanguageType kLanguageArabic = LanguageType::ARABIC; +const LanguageType kLanguageNorwegian = LanguageType::NORWEGIAN; +const LanguageType kLanguagePolish = LanguageType::POLISH; + + + +const Application::Platform kTargetWindows = Application::Platform::OS_WINDOWS; +const Application::Platform kTargetLinux = Application::Platform::OS_LINUX; +const Application::Platform kTargetMacOS = Application::Platform::OS_MAC; +const Application::Platform kTargetAndroid = Application::Platform::OS_ANDROID; +const Application::Platform kTargetIphone = Application::Platform::OS_IPHONE; +const Application::Platform kTargetIpad = Application::Platform::OS_IPAD; +const Application::Platform kTargetBlackBerry = Application::Platform::OS_BLACKBERRY; +const Application::Platform kTargetNaCl = Application::Platform::OS_NACL; +const Application::Platform kTargetEmscripten = Application::Platform::OS_EMSCRIPTEN; +const Application::Platform kTargetTizen = Application::Platform::OS_TIZEN; + +const ResolutionPolicy kResolutionExactFit = ResolutionPolicy::EXACT_FIT; +const ResolutionPolicy kResolutionNoBorder = ResolutionPolicy::NO_BORDER; +const ResolutionPolicy kResolutionShowAll = ResolutionPolicy::SHOW_ALL; +const ResolutionPolicy kResolutionFixedHeight = ResolutionPolicy::FIXED_HEIGHT; +const ResolutionPolicy kResolutionFixedWidth = ResolutionPolicy::FIXED_WIDTH; +const ResolutionPolicy kResolutionUnKnown = ResolutionPolicy::UNKNOWN; void ccDrawInit() { @@ -262,4 +296,4 @@ void ccPointSize( GLfloat pointSize ) DrawPrimitives::setPointSize(pointSize); } -NS_CC_END \ No newline at end of file +NS_CC_END diff --git a/cocos2dx/include/CCDeprecated.h b/cocos2dx/include/CCDeprecated.h index 24b781ae0b..2a1317de76 100644 --- a/cocos2dx/include/CCDeprecated.h +++ b/cocos2dx/include/CCDeprecated.h @@ -856,9 +856,9 @@ CC_DEPRECATED_ATTRIBUTE extern const int kCCVertexAttribFlag_Color; CC_DEPRECATED_ATTRIBUTE extern const int kCCVertexAttribFlag_TexCoords; CC_DEPRECATED_ATTRIBUTE extern const int kCCVertexAttribFlag_PosColorTex; -CC_DEPRECATED_ATTRIBUTE extern const int kCCProgressTimerTypeRadial; -CC_DEPRECATED_ATTRIBUTE extern const int kCCProgressTimerTypeBar; -CC_DEPRECATED_ATTRIBUTE typedef enum ProgressTimer::Type ProgressTimerType; +CC_DEPRECATED_ATTRIBUTE extern const ProgressTimer::Type kCCProgressTimerTypeRadial; +CC_DEPRECATED_ATTRIBUTE extern const ProgressTimer::Type kCCProgressTimerTypeBar; +CC_DEPRECATED_ATTRIBUTE typedef ProgressTimer::Type ProgressTimerType; CC_DEPRECATED_ATTRIBUTE extern const Director::Projection kCCDirectorProjection2D; CC_DEPRECATED_ATTRIBUTE extern const Director::Projection kCCDirectorProjection3D; @@ -937,6 +937,43 @@ CC_DEPRECATED_ATTRIBUTE extern const int kCCNodeOnExitTransitionDidStart; CC_DEPRECATED_ATTRIBUTE extern const int kCCNodeOnCleanup; +CC_DEPRECATED_ATTRIBUTE extern const LanguageType kLanguageEnglish; +CC_DEPRECATED_ATTRIBUTE extern const LanguageType kLanguageChinese; +CC_DEPRECATED_ATTRIBUTE extern const LanguageType kLanguageFrench; +CC_DEPRECATED_ATTRIBUTE extern const LanguageType kLanguageItalian; +CC_DEPRECATED_ATTRIBUTE extern const LanguageType kLanguageGerman; +CC_DEPRECATED_ATTRIBUTE extern const LanguageType kLanguageSpanish; +CC_DEPRECATED_ATTRIBUTE extern const LanguageType kLanguageRussian; +CC_DEPRECATED_ATTRIBUTE extern const LanguageType kLanguageKorean; +CC_DEPRECATED_ATTRIBUTE extern const LanguageType kLanguageJapanese; +CC_DEPRECATED_ATTRIBUTE extern const LanguageType kLanguageHungarian; +CC_DEPRECATED_ATTRIBUTE extern const LanguageType kLanguagePortuguese; +CC_DEPRECATED_ATTRIBUTE extern const LanguageType kLanguageArabic; +CC_DEPRECATED_ATTRIBUTE extern const LanguageType kLanguageNorwegian; +CC_DEPRECATED_ATTRIBUTE extern const LanguageType kLanguagePolish; + +CC_DEPRECATED_ATTRIBUTE typedef LanguageType ccLanguageType; + + +CC_DEPRECATED_ATTRIBUTE extern const Application::Platform kTargetWindows; +CC_DEPRECATED_ATTRIBUTE extern const Application::Platform kTargetLinux; +CC_DEPRECATED_ATTRIBUTE extern const Application::Platform kTargetMacOS; +CC_DEPRECATED_ATTRIBUTE extern const Application::Platform kTargetAndroid; +CC_DEPRECATED_ATTRIBUTE extern const Application::Platform kTargetIphone; +CC_DEPRECATED_ATTRIBUTE extern const Application::Platform kTargetIpad; +CC_DEPRECATED_ATTRIBUTE extern const Application::Platform kTargetBlackBerry; +CC_DEPRECATED_ATTRIBUTE extern const Application::Platform kTargetNaCl; +CC_DEPRECATED_ATTRIBUTE extern const Application::Platform kTargetEmscripten; +CC_DEPRECATED_ATTRIBUTE extern const Application::Platform kTargetTizen; +CC_DEPRECATED_ATTRIBUTE typedef Application::Platform TargetPlatform; + +CC_DEPRECATED_ATTRIBUTE extern const ResolutionPolicy kResolutionExactFit; +CC_DEPRECATED_ATTRIBUTE extern const ResolutionPolicy kResolutionNoBorder; +CC_DEPRECATED_ATTRIBUTE extern const ResolutionPolicy kResolutionShowAll; +CC_DEPRECATED_ATTRIBUTE extern const ResolutionPolicy kResolutionFixedHeight; +CC_DEPRECATED_ATTRIBUTE extern const ResolutionPolicy kResolutionFixedWidth; +CC_DEPRECATED_ATTRIBUTE extern const ResolutionPolicy kResolutionUnKnown; + #define kCCTMXTileHorizontalFlag kTMXTileHorizontalFlag #define kCCTMXTileVerticalFlag kTMXTileVerticalFlag #define kCCTMXTileDiagonalFlag kTMXTileDiagonalFlag diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.cpp index ca4d745d5d..a2c5772848 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCTransitionProgress.cpp @@ -140,7 +140,7 @@ ProgressTimer* TransitionProgressRadialCCW::progressTimerNodeWithRenderTexture(R // but it is flipped upside down so we flip the sprite pNode->getSprite()->setFlipY(true); - pNode->setType(ProgressTimer::RADIAL); + pNode->setType(ProgressTimer::Type::RADIAL); // Return the radial type that we want to use pNode->setReverseDirection(false); @@ -184,7 +184,7 @@ ProgressTimer* TransitionProgressRadialCW::progressTimerNodeWithRenderTexture(Re // but it is flipped upside down so we flip the sprite pNode->getSprite()->setFlipY(true); - pNode->setType( ProgressTimer::RADIAL ); + pNode->setType( ProgressTimer::Type::RADIAL ); // Return the radial type that we want to use pNode->setReverseDirection(true); @@ -216,7 +216,7 @@ ProgressTimer* TransitionProgressHorizontal::progressTimerNodeWithRenderTexture( // but it is flipped upside down so we flip the sprite pNode->getSprite()->setFlipY(true); - pNode->setType( ProgressTimer::BAR); + pNode->setType( ProgressTimer::Type::BAR); pNode->setMidpoint(Point(1, 0)); pNode->setBarChangeRate(Point(1,0)); @@ -249,7 +249,7 @@ ProgressTimer* TransitionProgressVertical::progressTimerNodeWithRenderTexture(Re // but it is flipped upside down so we flip the sprite pNode->getSprite()->setFlipY(true); - pNode->setType(ProgressTimer::BAR); + pNode->setType(ProgressTimer::Type::BAR); pNode->setMidpoint(Point(0, 0)); pNode->setBarChangeRate(Point(0,1)); @@ -295,7 +295,7 @@ ProgressTimer* TransitionProgressInOut::progressTimerNodeWithRenderTexture(Rende // but it is flipped upside down so we flip the sprite pNode->getSprite()->setFlipY(true); - pNode->setType( ProgressTimer::BAR); + pNode->setType( ProgressTimer::Type::BAR); pNode->setMidpoint(Point(0.5f, 0.5f)); pNode->setBarChangeRate(Point(1, 1)); @@ -329,7 +329,7 @@ ProgressTimer* TransitionProgressOutIn::progressTimerNodeWithRenderTexture(Rende // but it is flipped upside down so we flip the sprite pNode->getSprite()->setFlipY(true); - pNode->setType( ProgressTimer::BAR ); + pNode->setType( ProgressTimer::Type::BAR ); pNode->setMidpoint(Point(0.5f, 0.5f)); pNode->setBarChangeRate(Point(1, 1)); diff --git a/cocos2dx/misc_nodes/CCProgressTimer.cpp b/cocos2dx/misc_nodes/CCProgressTimer.cpp index 3166227b93..dbc09d05c4 100644 --- a/cocos2dx/misc_nodes/CCProgressTimer.cpp +++ b/cocos2dx/misc_nodes/CCProgressTimer.cpp @@ -45,7 +45,7 @@ const char kProgressTextureCoords = 0x4b; ProgressTimer::ProgressTimer() -:_type(RADIAL) +:_type(Type::RADIAL) ,_percentage(0.0f) ,_sprite(NULL) ,_vertexDataCount(0) @@ -78,7 +78,7 @@ bool ProgressTimer::initWithSprite(Sprite* sp) _vertexDataCount = 0; setAnchorPoint(Point(0.5f,0.5f)); - _type = RADIAL; + _type = Type::RADIAL; _reverseDirection = false; setMidpoint(Point(0.5f, 0.5f)); setBarChangeRate(Point(1,1)); @@ -225,10 +225,10 @@ void ProgressTimer::updateProgress(void) { switch (_type) { - case RADIAL: + case Type::RADIAL: updateRadial(); break; - case BAR: + case Type::BAR: updateBar(); break; default: @@ -527,11 +527,11 @@ void ProgressTimer::draw(void) glVertexAttribPointer( GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(_vertexData[0]), &_vertexData[0].colors); #endif // EMSCRIPTEN - if(_type == RADIAL) + if(_type == Type::RADIAL) { glDrawArrays(GL_TRIANGLE_FAN, 0, _vertexDataCount); } - else if (_type == BAR) + else if (_type == Type::BAR) { if (!_reverseDirection) { diff --git a/cocos2dx/misc_nodes/CCProgressTimer.h b/cocos2dx/misc_nodes/CCProgressTimer.h index 2725964477..f8fea4ca68 100644 --- a/cocos2dx/misc_nodes/CCProgressTimer.h +++ b/cocos2dx/misc_nodes/CCProgressTimer.h @@ -52,7 +52,7 @@ public: /** Types of progress @since v0.99.1 */ - enum Type + enum class Type { /// Radial Counter-Clockwise RADIAL, diff --git a/cocos2dx/platform/CCApplicationProtocol.h b/cocos2dx/platform/CCApplicationProtocol.h index 317fbb5c15..b567072279 100644 --- a/cocos2dx/platform/CCApplicationProtocol.h +++ b/cocos2dx/platform/CCApplicationProtocol.h @@ -3,20 +3,6 @@ NS_CC_BEGIN -enum TargetPlatform -{ - kTargetWindows, - kTargetLinux, - kTargetMacOS, - kTargetAndroid, - kTargetIphone, - kTargetIpad, - kTargetBlackBerry, - kTargetNaCl, - kTargetEmscripten, - kTargetTizen -}; - /** * @addtogroup platform * @{ @@ -26,6 +12,23 @@ class CC_DLL ApplicationProtocol { public: + // Since WINDOWS and ANDROID are defined as macros, we could not just use these keywords in enumeration(Platform). + // Therefore, 'OS_' prefix is added to avoid conflicts with the definitions of system macros. + enum class Platform + { + OS_WINDOWS, + OS_LINUX, + OS_MAC, + OS_ANDROID, + OS_IPHONE, + OS_IPAD, + OS_BLACKBERRY, + OS_NACL, + OS_EMSCRIPTEN, + OS_TIZEN + }; + + virtual ~ApplicationProtocol() {} /** @@ -57,12 +60,12 @@ public: @brief Get current language config @return Current language config */ - virtual ccLanguageType getCurrentLanguage() = 0; + virtual LanguageType getCurrentLanguage() = 0; /** @brief Get target platform */ - virtual TargetPlatform getTargetPlatform() = 0; + virtual Platform getTargetPlatform() = 0; }; // end of platform group diff --git a/cocos2dx/platform/CCCommon.h b/cocos2dx/platform/CCCommon.h index ff98158a14..b83b83efb2 100644 --- a/cocos2dx/platform/CCCommon.h +++ b/cocos2dx/platform/CCCommon.h @@ -55,25 +55,25 @@ void CC_DLL MessageBox(const char * pszMsg, const char * pszTitle); /** @brief Enum the language type supported now */ -typedef enum LanguageType +enum class LanguageType { - kLanguageEnglish = 0, - kLanguageChinese, - kLanguageFrench, - kLanguageItalian, - kLanguageGerman, - kLanguageSpanish, - kLanguageRussian, - kLanguageKorean, - kLanguageJapanese, - kLanguageHungarian, - kLanguagePortuguese, - kLanguageArabic, - kLanguageNorwegian, - kLanguagePolish -} ccLanguageType; + ENGLISH = 0, + CHINESE, + FRENCH, + ITALIAN, + GERMAN, + SPANISH, + RUSSIAN, + KOREAN, + JAPANESE, + HUNGARIAN, + PORTUGUESE, + ARABIC, + NORWEGIAN, + POLISH +}; -// end of platform group +// END of platform group /// @} NS_CC_END diff --git a/cocos2dx/platform/CCEGLViewProtocol.cpp b/cocos2dx/platform/CCEGLViewProtocol.cpp index fbd0049419..17448f9871 100644 --- a/cocos2dx/platform/CCEGLViewProtocol.cpp +++ b/cocos2dx/platform/CCEGLViewProtocol.cpp @@ -46,7 +46,7 @@ EGLViewProtocol::EGLViewProtocol() : _delegate(NULL) , _scaleX(1.0f) , _scaleY(1.0f) -, _resolutionPolicy(kResolutionUnKnown) +, _resolutionPolicy(ResolutionPolicy::UNKNOWN) { } @@ -57,7 +57,7 @@ EGLViewProtocol::~EGLViewProtocol() void EGLViewProtocol::setDesignResolutionSize(float width, float height, ResolutionPolicy resolutionPolicy) { - CCASSERT(resolutionPolicy != kResolutionUnKnown, "should set resolutionPolicy"); + CCASSERT(resolutionPolicy != ResolutionPolicy::UNKNOWN, "should set resolutionPolicy"); if (width == 0.0f || height == 0.0f) { @@ -69,22 +69,22 @@ void EGLViewProtocol::setDesignResolutionSize(float width, float height, Resolut _scaleX = (float)_screenSize.width / _designResolutionSize.width; _scaleY = (float)_screenSize.height / _designResolutionSize.height; - if (resolutionPolicy == kResolutionNoBorder) + if (resolutionPolicy == ResolutionPolicy::NO_BORDER) { _scaleX = _scaleY = MAX(_scaleX, _scaleY); } - if (resolutionPolicy == kResolutionShowAll) + if (resolutionPolicy == ResolutionPolicy::SHOW_ALL) { _scaleX = _scaleY = MIN(_scaleX, _scaleY); } - if ( resolutionPolicy == kResolutionFixedHeight) { + if ( resolutionPolicy == ResolutionPolicy::FIXED_HEIGHT) { _scaleX = _scaleY; _designResolutionSize.width = ceilf(_screenSize.width/_scaleX); } - if ( resolutionPolicy == kResolutionFixedWidth) { + if ( resolutionPolicy == ResolutionPolicy::FIXED_WIDTH) { _scaleY = _scaleX; _designResolutionSize.height = ceilf(_screenSize.height/_scaleY); } @@ -120,7 +120,7 @@ void EGLViewProtocol::setFrameSize(float width, float height) Size EGLViewProtocol::getVisibleSize() const { - if (_resolutionPolicy == kResolutionNoBorder) + if (_resolutionPolicy == ResolutionPolicy::NO_BORDER) { return Size(_screenSize.width/_scaleX, _screenSize.height/_scaleY); } @@ -132,7 +132,7 @@ Size EGLViewProtocol::getVisibleSize() const Point EGLViewProtocol::getVisibleOrigin() const { - if (_resolutionPolicy == kResolutionNoBorder) + if (_resolutionPolicy == ResolutionPolicy::NO_BORDER) { return Point((_designResolutionSize.width - _screenSize.width/_scaleX)/2, (_designResolutionSize.height - _screenSize.height/_scaleY)/2); diff --git a/cocos2dx/platform/CCEGLViewProtocol.h b/cocos2dx/platform/CCEGLViewProtocol.h index c5aad7f507..5cfb959032 100644 --- a/cocos2dx/platform/CCEGLViewProtocol.h +++ b/cocos2dx/platform/CCEGLViewProtocol.h @@ -3,29 +3,29 @@ #include "ccTypes.h" -enum ResolutionPolicy +enum class ResolutionPolicy { // The entire application is visible in the specified area without trying to preserve the original aspect ratio. // Distortion can occur, and the application may appear stretched or compressed. - kResolutionExactFit, + EXACT_FIT, // The entire application fills the specified area, without distortion but possibly with some cropping, // while maintaining the original aspect ratio of the application. - kResolutionNoBorder, + NO_BORDER, // The entire application is visible in the specified area without distortion while maintaining the original // aspect ratio of the application. Borders can appear on two sides of the application. - kResolutionShowAll, + SHOW_ALL, // The application takes the height of the design resolution size and modifies the width of the internal // canvas so that it fits the aspect ratio of the device // no distortion will occur however you must make sure your application works on different // aspect ratios - kResolutionFixedHeight, + FIXED_HEIGHT, // The application takes the width of the design resolution size and modifies the height of the internal // canvas so that it fits the aspect ratio of the device // no distortion will occur however you must make sure your application works on different // aspect ratios - kResolutionFixedWidth, + FIXED_WIDTH, - kResolutionUnKnown, + UNKNOWN, }; NS_CC_BEGIN @@ -84,9 +84,9 @@ public: * @param width Design resolution width. * @param height Design resolution height. * @param resolutionPolicy The resolution policy desired, you may choose: - * [1] kResolutionExactFit Fill screen by stretch-to-fit: if the design resolution ratio of width to height is different from the screen resolution ratio, your game view will be stretched. - * [2] kResolutionNoBorder Full screen without black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two areas of your game view will be cut. - * [3] kResolutionShowAll Full screen with black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two black borders will be shown. + * [1] EXACT_FIT Fill screen by stretch-to-fit: if the design resolution ratio of width to height is different from the screen resolution ratio, your game view will be stretched. + * [2] NO_BORDER Full screen without black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two areas of your game view will be cut. + * [3] SHOW_ALL Full screen with black border: if the design resolution ratio of width to height is different from the screen resolution ratio, two black borders will be shown. */ virtual void setDesignResolutionSize(float width, float height, ResolutionPolicy resolutionPolicy); diff --git a/cocos2dx/platform/android/CCApplication.cpp b/cocos2dx/platform/android/CCApplication.cpp index 215af4c8f8..abb5f54044 100644 --- a/cocos2dx/platform/android/CCApplication.cpp +++ b/cocos2dx/platform/android/CCApplication.cpp @@ -67,74 +67,74 @@ Application* Application::sharedApplication() return Application::getInstance(); } -ccLanguageType Application::getCurrentLanguage() +LanguageType Application::getCurrentLanguage() { std::string languageName = getCurrentLanguageJNI(); const char* pLanguageName = languageName.c_str(); - ccLanguageType ret = kLanguageEnglish; + LanguageType ret = LanguageType::ENGLISH; if (0 == strcmp("zh", pLanguageName)) { - ret = kLanguageChinese; + ret = LanguageType::CHINESE; } else if (0 == strcmp("en", pLanguageName)) { - ret = kLanguageEnglish; + ret = LanguageType::ENGLISH; } else if (0 == strcmp("fr", pLanguageName)) { - ret = kLanguageFrench; + ret = LanguageType::FRENCH; } else if (0 == strcmp("it", pLanguageName)) { - ret = kLanguageItalian; + ret = LanguageType::ITALIAN; } else if (0 == strcmp("de", pLanguageName)) { - ret = kLanguageGerman; + ret = LanguageType::GERMAN; } else if (0 == strcmp("es", pLanguageName)) { - ret = kLanguageSpanish; + ret = LanguageType::SPANISH; } else if (0 == strcmp("ru", pLanguageName)) { - ret = kLanguageRussian; + ret = LanguageType::RUSSIAN; } else if (0 == strcmp("ko", pLanguageName)) { - ret = kLanguageKorean; + ret = LanguageType::KOREAN; } else if (0 == strcmp("ja", pLanguageName)) { - ret = kLanguageJapanese; + ret = LanguageType::JAPANESE; } else if (0 == strcmp("hu", pLanguageName)) { - ret = kLanguageHungarian; + ret = LanguageType::HUNGARIAN; } else if (0 == strcmp("pt", pLanguageName)) { - ret = kLanguagePortuguese; + ret = LanguageType::PORTUGUESE; } else if (0 == strcmp("ar", pLanguageName)) { - ret = kLanguageArabic; + ret = LanguageType::ARABIC; } - else if (0 == strcmp("nb", pLanguageName)) + else if (0 == strcmp("nb", pLanguageName)) { - ret = kLanguageNorwegian; + ret = LanguageType::NORWEGIAN; } else if (0 == strcmp("pl", pLanguageName)) { - ret = kLanguagePolish; + ret = LanguageType::POLISH; } return ret; } -TargetPlatform Application::getTargetPlatform() +Application::Platform Application::getTargetPlatform() { - return kTargetAndroid; + return Platform::OS_ANDROID; } NS_CC_END diff --git a/cocos2dx/platform/android/CCApplication.h b/cocos2dx/platform/android/CCApplication.h index a2a431e220..d3225516f2 100644 --- a/cocos2dx/platform/android/CCApplication.h +++ b/cocos2dx/platform/android/CCApplication.h @@ -38,12 +38,12 @@ public: @brief Get current language config @return Current language config */ - virtual ccLanguageType getCurrentLanguage(); + virtual LanguageType getCurrentLanguage(); /** @brief Get target platform */ - virtual TargetPlatform getTargetPlatform(); + virtual Platform getTargetPlatform(); protected: static Application * sm_pSharedApplication; diff --git a/cocos2dx/platform/emscripten/CCApplication.cpp b/cocos2dx/platform/emscripten/CCApplication.cpp index 2c3b98b54d..cf78ff625b 100644 --- a/cocos2dx/platform/emscripten/CCApplication.cpp +++ b/cocos2dx/platform/emscripten/CCApplication.cpp @@ -85,9 +85,9 @@ const std::string& Application::getResourceRootPath(void) return _resourceRootPath; } -TargetPlatform Application::getTargetPlatform() +Application::Platform Application::getTargetPlatform() { - return kTargetEmscripten; + return Platform::OS_EMSCRIPTEN; } ////////////////////////////////////////////////////////////////////////// @@ -105,9 +105,9 @@ Application* Application::sharedApplication() return Application::getInstance(); } -ccLanguageType Application::getCurrentLanguage() +LanguageType Application::getCurrentLanguage() { - return kLanguageEnglish; + return LanguageType::ENGLISH; } NS_CC_END; diff --git a/cocos2dx/platform/emscripten/CCApplication.h b/cocos2dx/platform/emscripten/CCApplication.h index 396b6046ae..634238606f 100644 --- a/cocos2dx/platform/emscripten/CCApplication.h +++ b/cocos2dx/platform/emscripten/CCApplication.h @@ -38,12 +38,12 @@ public: @brief Get current language config @return Current language config */ - virtual ccLanguageType getCurrentLanguage(); + virtual LanguageType getCurrentLanguage(); /** @brief Get target platform */ - virtual TargetPlatform getTargetPlatform(); + virtual Platform getTargetPlatform(); /** diff --git a/cocos2dx/platform/ios/CCApplication.h b/cocos2dx/platform/ios/CCApplication.h index 8a7451dff2..297ddbd8c3 100644 --- a/cocos2dx/platform/ios/CCApplication.h +++ b/cocos2dx/platform/ios/CCApplication.h @@ -49,7 +49,7 @@ public: */ static Application* getInstance(); - /** @deprecated Use getInstance() instead */ + /** @deprecated Use getInstance() instead */ CC_DEPRECATED_ATTRIBUTE static Application* sharedApplication(); /** @@ -62,12 +62,12 @@ public: @brief Get current language config @return Current language config */ - virtual ccLanguageType getCurrentLanguage(); + virtual LanguageType getCurrentLanguage(); /** @brief Get target platform */ - virtual TargetPlatform getTargetPlatform(); + virtual Platform getTargetPlatform(); protected: static Application * sm_pSharedApplication; diff --git a/cocos2dx/platform/ios/CCApplication.mm b/cocos2dx/platform/ios/CCApplication.mm index 1f118009ed..8c8d543c2e 100644 --- a/cocos2dx/platform/ios/CCApplication.mm +++ b/cocos2dx/platform/ios/CCApplication.mm @@ -75,7 +75,7 @@ Application* Application::sharedApplication() return Application::getInstance(); } -ccLanguageType Application::getCurrentLanguage() +LanguageType Application::getCurrentLanguage() { // get the current language and country config NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; @@ -86,63 +86,63 @@ ccLanguageType Application::getCurrentLanguage() NSDictionary* temp = [NSLocale componentsFromLocaleIdentifier:currentLanguage]; NSString * languageCode = [temp objectForKey:NSLocaleLanguageCode]; - ccLanguageType ret = kLanguageEnglish; + LanguageType ret = LanguageType::ENGLISH; if ([languageCode isEqualToString:@"zh"]) { - ret = kLanguageChinese; + ret = LanguageType::CHINESE; } else if ([languageCode isEqualToString:@"en"]) { - ret = kLanguageEnglish; + ret = LanguageType::ENGLISH; } else if ([languageCode isEqualToString:@"fr"]){ - ret = kLanguageFrench; + ret = LanguageType::FRENCH; } else if ([languageCode isEqualToString:@"it"]){ - ret = kLanguageItalian; + ret = LanguageType::ITALIAN; } else if ([languageCode isEqualToString:@"de"]){ - ret = kLanguageGerman; + ret = LanguageType::GERMAN; } else if ([languageCode isEqualToString:@"es"]){ - ret = kLanguageSpanish; + ret = LanguageType::SPANISH; } else if ([languageCode isEqualToString:@"ru"]){ - ret = kLanguageRussian; + ret = LanguageType::RUSSIAN; } else if ([languageCode isEqualToString:@"ko"]){ - ret = kLanguageKorean; + ret = LanguageType::KOREAN; } else if ([languageCode isEqualToString:@"ja"]){ - ret = kLanguageJapanese; + ret = LanguageType::JAPANESE; } else if ([languageCode isEqualToString:@"hu"]){ - ret = kLanguageHungarian; + ret = LanguageType::HUNGARIAN; } else if ([languageCode isEqualToString:@"pt"]){ - ret = kLanguagePortuguese; + ret = LanguageType::PORTUGUESE; } else if ([languageCode isEqualToString:@"ar"]){ - ret = kLanguageArabic; + ret = LanguageType::ARABIC; } else if ([languageCode isEqualToString:@"nb"]){ - ret = kLanguageNorwegian; + ret = LanguageType::NORWEGIAN; } else if ([languageCode isEqualToString:@"pl"]){ - ret = kLanguagePolish; + ret = LanguageType::POLISH; } return ret; } -TargetPlatform Application::getTargetPlatform() +Application::Platform Application::getTargetPlatform() { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) // idiom for iOS <= 3.2, otherwise: [UIDevice userInterfaceIdiom] is faster. { - return kTargetIpad; + return Platform::OS_IPAD; } else { - return kTargetIphone; + return Platform::OS_IPHONE; } } diff --git a/cocos2dx/platform/ios/CCEGLView.mm b/cocos2dx/platform/ios/CCEGLView.mm index e9e0eec5ad..c302bdf149 100644 --- a/cocos2dx/platform/ios/CCEGLView.mm +++ b/cocos2dx/platform/ios/CCEGLView.mm @@ -48,7 +48,7 @@ bool EGLView::isOpenGLReady() bool EGLView::setContentScaleFactor(float contentScaleFactor) { - assert(_resolutionPolicy == kResolutionUnKnown); // cannot enable retina mode + assert(_resolutionPolicy == ResolutionPolicy::UNKNOWN); // cannot enable retina mode _scaleX = _scaleY = contentScaleFactor; [[CCEAGLView sharedEGLView] setNeedsLayout]; diff --git a/cocos2dx/platform/linux/CCApplication.cpp b/cocos2dx/platform/linux/CCApplication.cpp index 8b3f6f6f32..93232a7643 100644 --- a/cocos2dx/platform/linux/CCApplication.cpp +++ b/cocos2dx/platform/linux/CCApplication.cpp @@ -84,9 +84,9 @@ const std::string& Application::getResourceRootPath(void) return _resourceRootPath; } -TargetPlatform Application::getTargetPlatform() +Application::Platform Application::getTargetPlatform() { - return kTargetLinux; + return Platform::OS_LINUX; } ////////////////////////////////////////////////////////////////////////// @@ -104,75 +104,75 @@ Application* Application::sharedApplication() return Application::getInstance(); } -ccLanguageType Application::getCurrentLanguage() +LanguageType Application::getCurrentLanguage() { char *pLanguageName = getenv("LANG"); - ccLanguageType ret = kLanguageEnglish; + LanguageType ret = LanguageType::ENGLISH; if (!pLanguageName) { - return kLanguageEnglish; + return LanguageType::ENGLISH; } strtok(pLanguageName, "_"); if (!pLanguageName) { - return kLanguageEnglish; + return LanguageType::ENGLISH; } if (0 == strcmp("zh", pLanguageName)) { - ret = kLanguageChinese; + ret = LanguageType::CHINESE; } else if (0 == strcmp("en", pLanguageName)) { - ret = kLanguageEnglish; + ret = LanguageType::ENGLISH; } else if (0 == strcmp("fr", pLanguageName)) { - ret = kLanguageFrench; + ret = LanguageType::FRENCH; } else if (0 == strcmp("it", pLanguageName)) { - ret = kLanguageItalian; + ret = LanguageType::ITALIAN; } else if (0 == strcmp("de", pLanguageName)) { - ret = kLanguageGerman; + ret = LanguageType::GERMAN; } else if (0 == strcmp("es", pLanguageName)) { - ret = kLanguageSpanish; + ret = LanguageType::SPANISH; } else if (0 == strcmp("ru", pLanguageName)) { - ret = kLanguageRussian; + ret = LanguageType::RUSSIAN; } else if (0 == strcmp("ko", pLanguageName)) { - ret = kLanguageKorean; + ret = LanguageType::KOREAN; } else if (0 == strcmp("ja", pLanguageName)) { - ret = kLanguageJapanese; + ret = LanguageType::JAPANESE; } else if (0 == strcmp("hu", pLanguageName)) { - ret = kLanguageHungarian; + ret = LanguageType::HUNGARIAN; } else if (0 == strcmp("pt", pLanguageName)) { - ret = kLanguagePortuguese; + ret = LanguageType::PORTUGUESE; } else if (0 == strcmp("ar", pLanguageName)) { - ret = kLanguageArabic; + ret = LanguageType::ARABIC; } else if (0 == strcmp("nb", pLanguageName)) { - ret = kLanguageNorwegian; + ret = LanguageType::NORWEGIAN; } else if (0 == strcmp("pl", pLanguageName)) { - ret = kLanguagePolish; + ret = LanguageType::POLISH; } return ret; diff --git a/cocos2dx/platform/linux/CCApplication.h b/cocos2dx/platform/linux/CCApplication.h index 2d5c92c750..1320a50ce8 100644 --- a/cocos2dx/platform/linux/CCApplication.h +++ b/cocos2dx/platform/linux/CCApplication.h @@ -42,7 +42,7 @@ public: CC_DEPRECATED_ATTRIBUTE static Application* sharedApplication(); /* override functions */ - virtual ccLanguageType getCurrentLanguage(); + virtual LanguageType getCurrentLanguage(); /** * Sets the Resource root path. @@ -59,7 +59,7 @@ public: /** @brief Get target platform */ - virtual TargetPlatform getTargetPlatform(); + virtual Platform getTargetPlatform(); protected: long _animationInterval; //micro second std::string _resourceRootPath; diff --git a/cocos2dx/platform/mac/CCApplication.h b/cocos2dx/platform/mac/CCApplication.h index ad31dcb097..ada3d28c0f 100644 --- a/cocos2dx/platform/mac/CCApplication.h +++ b/cocos2dx/platform/mac/CCApplication.h @@ -65,12 +65,12 @@ public: @brief Get current language config @return Current language config */ - virtual ccLanguageType getCurrentLanguage(); + virtual LanguageType getCurrentLanguage(); /** @brief Get target platform */ - virtual TargetPlatform getTargetPlatform(); + virtual Platform getTargetPlatform(); /** * Sets the Resource root path. diff --git a/cocos2dx/platform/mac/CCApplication.mm b/cocos2dx/platform/mac/CCApplication.mm index 226665d3dd..62047a3d4f 100644 --- a/cocos2dx/platform/mac/CCApplication.mm +++ b/cocos2dx/platform/mac/CCApplication.mm @@ -60,9 +60,9 @@ void Application::setAnimationInterval(double interval) [[CCDirectorCaller sharedDirectorCaller] setAnimationInterval: interval ]; } -TargetPlatform Application::getTargetPlatform() +Application::Platform Application::getTargetPlatform() { - return kTargetMacOS; + return Platform::OS_MAC; } ///////////////////////////////////////////////////////////////////////////////////////////////// @@ -81,7 +81,7 @@ Application* Application::sharedApplication() return Application::getInstance(); } -ccLanguageType Application::getCurrentLanguage() +LanguageType Application::getCurrentLanguage() { // get the current language and country config NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; @@ -92,52 +92,52 @@ ccLanguageType Application::getCurrentLanguage() NSDictionary* temp = [NSLocale componentsFromLocaleIdentifier:currentLanguage]; NSString * languageCode = [temp objectForKey:NSLocaleLanguageCode]; - ccLanguageType ret = kLanguageEnglish; + LanguageType ret = LanguageType::ENGLISH; if ([languageCode isEqualToString:@"zh"]) { - ret = kLanguageChinese; + ret = LanguageType::CHINESE; } else if ([languageCode isEqualToString:@"en"]) { - ret = kLanguageEnglish; + ret = LanguageType::ENGLISH;; } else if ([languageCode isEqualToString:@"fr"]){ - ret = kLanguageFrench; + ret = LanguageType::FRENCH; } else if ([languageCode isEqualToString:@"it"]){ - ret = kLanguageItalian; + ret = LanguageType::ITALIAN; } else if ([languageCode isEqualToString:@"de"]){ - ret = kLanguageGerman; + ret = LanguageType::GERMAN; } else if ([languageCode isEqualToString:@"es"]){ - ret = kLanguageSpanish; + ret = LanguageType::SPANISH; } else if ([languageCode isEqualToString:@"ru"]){ - ret = kLanguageRussian; + ret = LanguageType::RUSSIAN; } else if ([languageCode isEqualToString:@"ko"]){ - ret = kLanguageKorean; + ret = LanguageType::KOREAN; } else if ([languageCode isEqualToString:@"ja"]){ - ret = kLanguageJapanese; + ret = LanguageType::JAPANESE; } else if ([languageCode isEqualToString:@"hu"]){ - ret = kLanguageHungarian; + ret = LanguageType::HUNGARIAN; } else if ([languageCode isEqualToString:@"pt"]) { - ret = kLanguagePortuguese; + ret = LanguageType::PORTUGUESE; } else if ([languageCode isEqualToString:@"ar"]) { - ret = kLanguageArabic; + ret = LanguageType::ARABIC; } else if ([languageCode isEqualToString:@"nb"]){ - ret = kLanguageNorwegian; + ret = LanguageType::NORWEGIAN; } else if ([languageCode isEqualToString:@"pl"]){ - ret = kLanguagePolish; + ret = LanguageType::POLISH; } return ret; } diff --git a/cocos2dx/platform/nacl/CCApplication.cpp b/cocos2dx/platform/nacl/CCApplication.cpp index 918d37240a..4b335dac8d 100644 --- a/cocos2dx/platform/nacl/CCApplication.cpp +++ b/cocos2dx/platform/nacl/CCApplication.cpp @@ -90,9 +90,9 @@ void Application::setAnimationInterval(double interval) _animationInterval = interval * 1000.0f; } -TargetPlatform Application::getTargetPlatform() +Application::Platform Application::getTargetPlatform() { - return kTargetNaCl; + return Platform::OS_NACL; } Application* Application::getInstance() @@ -107,9 +107,9 @@ Application* Application::sharedApplication() return Application::getInstance(); } -ccLanguageType Application::getCurrentLanguage() +LanguageType Application::getCurrentLanguage() { - ccLanguageType ret = kLanguageEnglish; + LanguageType ret = LanguageType::ENGLISH; return ret; } diff --git a/cocos2dx/platform/nacl/CCApplication.h b/cocos2dx/platform/nacl/CCApplication.h index 5be4d12325..5b970623cb 100644 --- a/cocos2dx/platform/nacl/CCApplication.h +++ b/cocos2dx/platform/nacl/CCApplication.h @@ -58,12 +58,12 @@ public: CC_DEPRECATED_ATTRIBUTE static Application* sharedApplication(); /* override functions */ - virtual ccLanguageType getCurrentLanguage(); + virtual LanguageType getCurrentLanguage(); /** @brief Get target platform */ - virtual TargetPlatform getTargetPlatform(); + virtual Platform getTargetPlatform(); static bool isRunning() { return s_running; } protected: diff --git a/cocos2dx/platform/tizen/CCApplication.cpp b/cocos2dx/platform/tizen/CCApplication.cpp index 211be5391c..d8d535d374 100644 --- a/cocos2dx/platform/tizen/CCApplication.cpp +++ b/cocos2dx/platform/tizen/CCApplication.cpp @@ -84,12 +84,12 @@ Application* Application::sharedApplication() return Application::getInstance(); } -ccLanguageType Application::getCurrentLanguage() +LanguageType Application::getCurrentLanguage() { result r = E_SUCCESS; int index = 0; Tizen::Base::String localelanguageCode, languageCode; - ccLanguageType ret = kLanguageEnglish; + LanguageType ret = LanguageType::ENGLISH; r = SettingInfo::GetValue(L"http://tizen.org/setting/locale.language", localelanguageCode); TryLog(!IsFailed(r), "[%s] Cannot get the current language setting", GetErrorMessage(r)); @@ -98,66 +98,66 @@ ccLanguageType Application::getCurrentLanguage() if (0 == languageCode.CompareTo(L"zho")) { - ret = kLanguageChinese; + ret = LanguageType::CHINESE; } else if (0 == languageCode.CompareTo(L"eng")) { - ret = kLanguageEnglish; + ret = LanguageType::ENGLISH; } else if (0 == languageCode.CompareTo(L"fre")) { - ret = kLanguageFrench; + ret = LanguageType::FRENCH; } else if (0 == languageCode.CompareTo(L"ita")) { - ret = kLanguageItalian; + ret = LanguageType::ITALIAN; } else if (0 == languageCode.CompareTo(L"deu")) { - ret = kLanguageGerman; + ret = LanguageType::GERMAN; } else if (0 == languageCode.CompareTo(L"spa")) { - ret = kLanguageSpanish; + ret = LanguageType::SPANISH; } else if (0 == languageCode.CompareTo(L"rus")) { - ret = kLanguageRussian; + ret = LanguageType::RUSSIAN; } else if (0 == languageCode.CompareTo(L"kor")) { - ret = kLanguageKorean; + ret = LanguageType::KOREAN; } else if (0 == languageCode.CompareTo(L"jpn")) { - ret = kLanguageJapanese; + ret = LanguageType::JAPANESE; } else if (0 == languageCode.CompareTo(L"hun")) { - ret = kLanguageHungarian; + ret = LanguageType::HUNGARIAN; } else if (0 == languageCode.CompareTo(L"por")) { - ret = kLanguagePortuguese; + ret = LanguageType::PORTUGUESE; } else if (0 == languageCode.CompareTo(L"ara")) { - ret = kLanguageArabic; + ret = LanguageType::ARABIC; } else if (0 == languageCode.CompareTo(L"nor")) { - ret = kLanguageNorwegian; + ret = LanguageType::NORWEGIAN; } else if (0 == languageCode.CompareTo(L"pol")) { - ret = kLanguagePolish; + ret = LanguageType::POLISH; } return ret; } -TargetPlatform Application::getTargetPlatform() +Application::Platform Application::getTargetPlatform() { - return kTargetTizen; + return Platform::OS_TIZEN; } NS_CC_END diff --git a/cocos2dx/platform/tizen/CCApplication.h b/cocos2dx/platform/tizen/CCApplication.h index 2614a90481..53f8dc5cc9 100644 --- a/cocos2dx/platform/tizen/CCApplication.h +++ b/cocos2dx/platform/tizen/CCApplication.h @@ -66,12 +66,12 @@ public: @brief Get current language config @return Current language config */ - virtual ccLanguageType getCurrentLanguage(); + virtual LanguageType getCurrentLanguage(); /** @brief Get target platform */ - virtual TargetPlatform getTargetPlatform(); + virtual Platform getTargetPlatform(); protected: static Application * sm_pSharedApplication; diff --git a/cocos2dx/platform/win32/CCApplication.cpp b/cocos2dx/platform/win32/CCApplication.cpp index 04cd15c75d..742ae62275 100644 --- a/cocos2dx/platform/win32/CCApplication.cpp +++ b/cocos2dx/platform/win32/CCApplication.cpp @@ -112,9 +112,9 @@ Application* Application::sharedApplication() return Application::getInstance(); } -ccLanguageType Application::getCurrentLanguage() +LanguageType Application::getCurrentLanguage() { - ccLanguageType ret = kLanguageEnglish; + LanguageType ret = LanguageType::ENGLISH; LCID localeID = GetUserDefaultLCID(); unsigned short primaryLanguageID = localeID & 0xFF; @@ -122,55 +122,55 @@ ccLanguageType Application::getCurrentLanguage() switch (primaryLanguageID) { case LANG_CHINESE: - ret = kLanguageChinese; + ret = LanguageType::CHINESE; break; case LANG_ENGLISH: - ret = kLanguageEnglish; + ret = LanguageType::ENGLISH; break; case LANG_FRENCH: - ret = kLanguageFrench; + ret = LanguageType::FRENCH; break; case LANG_ITALIAN: - ret = kLanguageItalian; + ret = LanguageType::ITALIAN; break; case LANG_GERMAN: - ret = kLanguageGerman; + ret = LanguageType::GERMAN; break; case LANG_SPANISH: - ret = kLanguageSpanish; + ret = LanguageType::SPANISH; break; case LANG_RUSSIAN: - ret = kLanguageRussian; + ret = LanguageType::RUSSIAN; break; case LANG_KOREAN: - ret = kLanguageKorean; + ret = LanguageType::KOREAN; break; case LANG_JAPANESE: - ret = kLanguageJapanese; + ret = LanguageType::JAPANESE; break; case LANG_HUNGARIAN: - ret = kLanguageHungarian; + ret = LanguageType::HUNGARIAN; break; case LANG_PORTUGUESE: - ret = kLanguagePortuguese; + ret = LanguageType::PORTUGUESE; break; case LANG_ARABIC: - ret = kLanguageArabic; + ret = LanguageType::ARABIC; break; case LANG_NORWEGIAN: - ret = kLanguageNorwegian; + ret = LanguageType::NORWEGIAN; break; case LANG_POLISH: - ret = kLanguagePolish; + ret = LanguageType::POLISH; break; } return ret; } -TargetPlatform Application::getTargetPlatform() +Application::Platform Application::getTargetPlatform() { - return kTargetWindows; + return Platform::OS_WINDOWS; } void Application::setResourceRootPath(const std::string& rootResDir) diff --git a/cocos2dx/platform/win32/CCApplication.h b/cocos2dx/platform/win32/CCApplication.h index bd86206482..d8e56fc0da 100644 --- a/cocos2dx/platform/win32/CCApplication.h +++ b/cocos2dx/platform/win32/CCApplication.h @@ -32,12 +32,12 @@ public: /* override functions */ virtual void setAnimationInterval(double interval); - virtual ccLanguageType getCurrentLanguage(); + virtual LanguageType getCurrentLanguage(); /** @brief Get target platform */ - virtual TargetPlatform getTargetPlatform(); + virtual Platform getTargetPlatform(); /** * Sets the Resource root path. diff --git a/plugin/samples/HelloPlugins/Classes/AppDelegate.cpp b/plugin/samples/HelloPlugins/Classes/AppDelegate.cpp index 467d2a3eed..e77c27e7ef 100644 --- a/plugin/samples/HelloPlugins/Classes/AppDelegate.cpp +++ b/plugin/samples/HelloPlugins/Classes/AppDelegate.cpp @@ -18,7 +18,7 @@ bool AppDelegate::applicationDidFinishLaunching() { pDirector->setOpenGLView(pEGLView); - pEGLView->setDesignResolutionSize(960.0f, 640.0f, kResolutionNoBorder); + pEGLView->setDesignResolutionSize(960.0f, 640.0f, ResolutionPolicy::NO_BORDER); // turn on display FPS pDirector->setDisplayStats(true); diff --git a/plugin/samples/HelloPlugins/Classes/TestAnalytics/TestAnalyticsScene.cpp b/plugin/samples/HelloPlugins/Classes/TestAnalytics/TestAnalyticsScene.cpp index a0f110307b..a49d39051b 100644 --- a/plugin/samples/HelloPlugins/Classes/TestAnalytics/TestAnalyticsScene.cpp +++ b/plugin/samples/HelloPlugins/Classes/TestAnalytics/TestAnalyticsScene.cpp @@ -225,7 +225,7 @@ void TestAnalytics::eventMenuCallback(Object* pSender) void TestAnalytics::loadPlugins() { - ccLanguageType langType = Application::getInstance()->getCurrentLanguage(); + LanguageType langType = Application::getInstance()->getCurrentLanguage(); std::string umengKey = ""; std::string flurryKey = ""; @@ -240,7 +240,7 @@ void TestAnalytics::loadPlugins() flurryKey = FLURRY_KEY_ANDROID; #endif - if (kLanguageChinese == langType) + if (LanguageType::CHINESE == langType) { pluginName = "AnalyticsUmeng"; strAppKey = umengKey; diff --git a/samples/Cpp/HelloCpp/Classes/AppDelegate.cpp b/samples/Cpp/HelloCpp/Classes/AppDelegate.cpp index b22c7e8a6e..0be3f40794 100644 --- a/samples/Cpp/HelloCpp/Classes/AppDelegate.cpp +++ b/samples/Cpp/HelloCpp/Classes/AppDelegate.cpp @@ -27,7 +27,7 @@ bool AppDelegate::applicationDidFinishLaunching() { Size size = director->getWinSize(); // Set the design resolution - glView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder); + glView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER); Size frameSize = glView->getFrameSize(); diff --git a/samples/Cpp/SimpleGame/Classes/AppDelegate.cpp b/samples/Cpp/SimpleGame/Classes/AppDelegate.cpp index 961f517e43..c1f7b09f90 100644 --- a/samples/Cpp/SimpleGame/Classes/AppDelegate.cpp +++ b/samples/Cpp/SimpleGame/Classes/AppDelegate.cpp @@ -36,7 +36,7 @@ bool AppDelegate::applicationDidFinishLaunching() { FileUtils::getInstance()->setSearchPaths(searchPaths); - EGLView::getInstance()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionNoBorder); + EGLView::getInstance()->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::NO_BORDER); // turn on display FPS director->setDisplayStats(true); diff --git a/samples/Cpp/TestCpp/Classes/ActionsProgressTest/ActionsProgressTest.cpp b/samples/Cpp/TestCpp/Classes/ActionsProgressTest/ActionsProgressTest.cpp index 00fb18e3ed..5f904e8f7b 100644 --- a/samples/Cpp/TestCpp/Classes/ActionsProgressTest/ActionsProgressTest.cpp +++ b/samples/Cpp/TestCpp/Classes/ActionsProgressTest/ActionsProgressTest.cpp @@ -136,13 +136,13 @@ void SpriteProgressToRadial::onEnter() ProgressTo *to2 = ProgressTo::create(2, 100); ProgressTimer *left = ProgressTimer::create(Sprite::create(s_pathSister1)); - left->setType( ProgressTimer::RADIAL ); + left->setType( ProgressTimer::Type::RADIAL ); addChild(left); left->setPosition(Point(100, s.height/2)); left->runAction( RepeatForever::create(to1)); ProgressTimer *right = ProgressTimer::create(Sprite::create(s_pathBlock)); - right->setType(ProgressTimer::RADIAL); + right->setType(ProgressTimer::Type::RADIAL); // Makes the ridial CCW right->setReverseProgress(true); addChild(right); @@ -171,7 +171,7 @@ void SpriteProgressToHorizontal::onEnter() ProgressTo *to2 = ProgressTo::create(2, 100); ProgressTimer *left = ProgressTimer::create(Sprite::create(s_pathSister1)); - left->setType(ProgressTimer::BAR); + left->setType(ProgressTimer::Type::BAR); // Setup for a bar starting from the left since the midpoint is 0 for the x left->setMidpoint(Point(0,0)); // Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change @@ -181,7 +181,7 @@ void SpriteProgressToHorizontal::onEnter() left->runAction( RepeatForever::create(to1)); ProgressTimer *right = ProgressTimer::create(Sprite::create(s_pathSister2)); - right->setType(ProgressTimer::BAR); + right->setType(ProgressTimer::Type::BAR); // Setup for a bar starting from the left since the midpoint is 1 for the x right->setMidpoint(Point(1, 0)); // Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change @@ -211,7 +211,7 @@ void SpriteProgressToVertical::onEnter() ProgressTo *to2 = ProgressTo::create(2, 100); ProgressTimer *left = ProgressTimer::create(Sprite::create(s_pathSister1)); - left->setType(ProgressTimer::BAR); + left->setType(ProgressTimer::Type::BAR); // Setup for a bar starting from the bottom since the midpoint is 0 for the y left->setMidpoint(Point(0,0)); @@ -222,7 +222,7 @@ void SpriteProgressToVertical::onEnter() left->runAction( RepeatForever::create(to1)); ProgressTimer *right = ProgressTimer::create(Sprite::create(s_pathSister2)); - right->setType(ProgressTimer::BAR); + right->setType(ProgressTimer::Type::BAR); // Setup for a bar starting from the bottom since the midpoint is 0 for the y right->setMidpoint(Point(0, 1)); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change @@ -254,7 +254,7 @@ void SpriteProgressToRadialMidpointChanged::onEnter() * Our image on the left should be a radial progress indicator, clockwise */ ProgressTimer *left = ProgressTimer::create(Sprite::create(s_pathBlock)); - left->setType(ProgressTimer::RADIAL); + left->setType(ProgressTimer::Type::RADIAL); addChild(left); left->setMidpoint(Point(0.25f, 0.75f)); left->setPosition(Point(100, s.height/2)); @@ -264,7 +264,7 @@ void SpriteProgressToRadialMidpointChanged::onEnter() * Our image on the left should be a radial progress indicator, counter clockwise */ ProgressTimer *right = ProgressTimer::create(Sprite::create(s_pathBlock)); - right->setType(ProgressTimer::RADIAL); + right->setType(ProgressTimer::Type::RADIAL); right->setMidpoint(Point(0.75f, 0.25f)); /** @@ -295,7 +295,7 @@ void SpriteProgressBarVarious::onEnter() ProgressTo *to = ProgressTo::create(2, 100); ProgressTimer *left = ProgressTimer::create(Sprite::create(s_pathSister1)); - left->setType(ProgressTimer::BAR); + left->setType(ProgressTimer::Type::BAR); // Setup for a bar starting from the bottom since the midpoint is 0 for the y left->setMidpoint(Point(0.5f, 0.5f)); @@ -306,7 +306,7 @@ void SpriteProgressBarVarious::onEnter() left->runAction(RepeatForever::create(to->clone())); ProgressTimer *middle = ProgressTimer::create(Sprite::create(s_pathSister2)); - middle->setType(ProgressTimer::BAR); + middle->setType(ProgressTimer::Type::BAR); // Setup for a bar starting from the bottom since the midpoint is 0 for the y middle->setMidpoint(Point(0.5f, 0.5f)); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change @@ -316,7 +316,7 @@ void SpriteProgressBarVarious::onEnter() middle->runAction(RepeatForever::create(to->clone())); ProgressTimer *right = ProgressTimer::create(Sprite::create(s_pathSister2)); - right->setType(ProgressTimer::BAR); + right->setType(ProgressTimer::Type::BAR); // Setup for a bar starting from the bottom since the midpoint is 0 for the y right->setMidpoint(Point(0.5f, 0.5f)); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change @@ -352,7 +352,7 @@ void SpriteProgressBarTintAndFade::onEnter() NULL); ProgressTimer *left = ProgressTimer::create(Sprite::create(s_pathSister1)); - left->setType(ProgressTimer::BAR); + left->setType(ProgressTimer::Type::BAR); // Setup for a bar starting from the bottom since the midpoint is 0 for the y left->setMidpoint(Point(0.5f, 0.5f)); @@ -366,7 +366,7 @@ void SpriteProgressBarTintAndFade::onEnter() left->addChild(LabelTTF::create("Tint", "Marker Felt", 20.0f)); ProgressTimer *middle = ProgressTimer::create(Sprite::create(s_pathSister2)); - middle->setType(ProgressTimer::BAR); + middle->setType(ProgressTimer::Type::BAR); // Setup for a bar starting from the bottom since the midpoint is 0 for the y middle->setMidpoint(Point(0.5f, 0.5f)); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change @@ -379,7 +379,7 @@ void SpriteProgressBarTintAndFade::onEnter() middle->addChild(LabelTTF::create("Fade", "Marker Felt", 20.0f)); ProgressTimer *right = ProgressTimer::create(Sprite::create(s_pathSister2)); - right->setType(ProgressTimer::BAR); + right->setType(ProgressTimer::Type::BAR); // Setup for a bar starting from the bottom since the midpoint is 0 for the y right->setMidpoint(Point(0.5f, 0.5f)); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change @@ -414,7 +414,7 @@ void SpriteProgressWithSpriteFrame::onEnter() SpriteFrameCache::getInstance()->addSpriteFramesWithFile("zwoptex/grossini.plist"); ProgressTimer *left = ProgressTimer::create(Sprite::createWithSpriteFrameName("grossini_dance_01.png")); - left->setType(ProgressTimer::BAR); + left->setType(ProgressTimer::Type::BAR); // Setup for a bar starting from the bottom since the midpoint is 0 for the y left->setMidpoint(Point(0.5f, 0.5f)); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change @@ -424,7 +424,7 @@ void SpriteProgressWithSpriteFrame::onEnter() left->runAction(RepeatForever::create(to->clone())); ProgressTimer *middle = ProgressTimer::create(Sprite::createWithSpriteFrameName("grossini_dance_02.png")); - middle->setType(ProgressTimer::BAR); + middle->setType(ProgressTimer::Type::BAR); // Setup for a bar starting from the bottom since the midpoint is 0 for the y middle->setMidpoint(Point(0.5f, 0.5f)); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change @@ -434,7 +434,7 @@ void SpriteProgressWithSpriteFrame::onEnter() middle->runAction(RepeatForever::create(to->clone())); ProgressTimer *right = ProgressTimer::create(Sprite::createWithSpriteFrameName("grossini_dance_03.png")); - right->setType(ProgressTimer::RADIAL); + right->setType(ProgressTimer::Type::RADIAL); // Setup for a bar starting from the bottom since the midpoint is 0 for the y right->setMidpoint(Point(0.5f, 0.5f)); // Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change diff --git a/samples/Cpp/TestCpp/Classes/AppDelegate.cpp b/samples/Cpp/TestCpp/Classes/AppDelegate.cpp index 32536a540e..6755e7af84 100644 --- a/samples/Cpp/TestCpp/Classes/AppDelegate.cpp +++ b/samples/Cpp/TestCpp/Classes/AppDelegate.cpp @@ -48,7 +48,7 @@ bool AppDelegate::applicationDidFinishLaunching() director->setContentScaleFactor(resourceSize.height/designSize.height); } - EGLView::getInstance()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionNoBorder); + EGLView::getInstance()->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::NO_BORDER); auto scene = Scene::create(); auto layer = new TestController(); diff --git a/samples/Cpp/TestCpp/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp b/samples/Cpp/TestCpp/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp index 4fca603e08..6cb43bfb67 100644 --- a/samples/Cpp/TestCpp/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp +++ b/samples/Cpp/TestCpp/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp @@ -9,49 +9,49 @@ CurrentLanguageTest::CurrentLanguageTest() LabelTTF *labelLanguage = LabelTTF::create("", "Arial", 20); labelLanguage->setPosition(VisibleRect::center()); - ccLanguageType currentLanguageType = Application::getInstance()->getCurrentLanguage(); + LanguageType currentLanguageType = Application::getInstance()->getCurrentLanguage(); switch (currentLanguageType) { - case kLanguageEnglish: + case LanguageType::ENGLISH: labelLanguage->setString("current language is English"); break; - case kLanguageChinese: + case LanguageType::CHINESE: labelLanguage->setString("current language is Chinese"); break; - case kLanguageFrench: + case LanguageType::FRENCH: labelLanguage->setString("current language is French"); break; - case kLanguageGerman: + case LanguageType::GERMAN: labelLanguage->setString("current language is German"); break; - case kLanguageItalian: + case LanguageType::ITALIAN: labelLanguage->setString("current language is Italian"); break; - case kLanguageRussian: + case LanguageType::RUSSIAN: labelLanguage->setString("current language is Russian"); break; - case kLanguageSpanish: + case LanguageType::SPANISH: labelLanguage->setString("current language is Spanish"); break; - case kLanguageKorean: + case LanguageType::KOREAN: labelLanguage->setString("current language is Korean"); break; - case kLanguageJapanese: + case LanguageType::JAPANESE: labelLanguage->setString("current language is Japanese"); break; - case kLanguageHungarian: + case LanguageType::HUNGARIAN: labelLanguage->setString("current language is Hungarian"); break; - case kLanguagePortuguese: + case LanguageType::PORTUGUESE: labelLanguage->setString("current language is Portuguese"); break; - case kLanguageArabic: + case LanguageType::ARABIC: labelLanguage->setString("current language is Arabic"); break; - case kLanguageNorwegian: + case LanguageType::NORWEGIAN: labelLanguage->setString("current language is Norwegian"); break; - case kLanguagePolish: + case LanguageType::POLISH: labelLanguage->setString("current language is Polish"); break; } diff --git a/samples/Javascript/CocosDragonJS/Classes/AppDelegate.cpp b/samples/Javascript/CocosDragonJS/Classes/AppDelegate.cpp index 3abcf87655..54248f8c7a 100644 --- a/samples/Javascript/CocosDragonJS/Classes/AppDelegate.cpp +++ b/samples/Javascript/CocosDragonJS/Classes/AppDelegate.cpp @@ -109,7 +109,7 @@ bool AppDelegate::applicationDidFinishLaunching() pDirector->setContentScaleFactor(resourceSize.width/designSize.width); - EGLView::getInstance()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionNoBorder); + EGLView::getInstance()->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::NO_BORDER); // turn on display FPS pDirector->setDisplayStats(true); diff --git a/samples/Javascript/CrystalCraze/Classes/AppDelegate.cpp b/samples/Javascript/CrystalCraze/Classes/AppDelegate.cpp index 9135775b89..5c96cee8e8 100644 --- a/samples/Javascript/CrystalCraze/Classes/AppDelegate.cpp +++ b/samples/Javascript/CrystalCraze/Classes/AppDelegate.cpp @@ -91,7 +91,7 @@ bool AppDelegate::applicationDidFinishLaunching() } pDirector->setContentScaleFactor(resourceSize.width/designSize.width); - EGLView::getInstance()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionShowAll); + EGLView::getInstance()->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::SHOW_ALL); // turn on display FPS pDirector->setDisplayStats(true); diff --git a/samples/Javascript/MoonWarriors/Classes/AppDelegate.cpp b/samples/Javascript/MoonWarriors/Classes/AppDelegate.cpp index 43d3d9b860..f186a261fb 100644 --- a/samples/Javascript/MoonWarriors/Classes/AppDelegate.cpp +++ b/samples/Javascript/MoonWarriors/Classes/AppDelegate.cpp @@ -32,7 +32,7 @@ bool AppDelegate::applicationDidFinishLaunching() pDirector->setProjection(Director::Projection::_2D); // Set the design resolution - EGLView::getInstance()->setDesignResolutionSize(320, 480, kResolutionShowAll); + EGLView::getInstance()->setDesignResolutionSize(320, 480, ResolutionPolicy::SHOW_ALL); // turn on display FPS pDirector->setDisplayStats(true); diff --git a/samples/Javascript/TestJavascript/Classes/AppDelegate.cpp b/samples/Javascript/TestJavascript/Classes/AppDelegate.cpp index 66d43c205c..efb7ba7e43 100644 --- a/samples/Javascript/TestJavascript/Classes/AppDelegate.cpp +++ b/samples/Javascript/TestJavascript/Classes/AppDelegate.cpp @@ -33,7 +33,7 @@ bool AppDelegate::applicationDidFinishLaunching() pDirector->setOpenGLView(EGLView::getInstance()); // JS-Test in Html5 uses 800x450 as design resolution - EGLView::getInstance()->setDesignResolutionSize(800, 450, kResolutionFixedHeight); + EGLView::getInstance()->setDesignResolutionSize(800, 450, ResolutionPolicy::FIXED_HEIGHT); // turn on display FPS pDirector->setDisplayStats(true); diff --git a/samples/Javascript/WatermelonWithMe/Classes/AppDelegate.cpp b/samples/Javascript/WatermelonWithMe/Classes/AppDelegate.cpp index 12225bddb9..7ea95f5ebf 100644 --- a/samples/Javascript/WatermelonWithMe/Classes/AppDelegate.cpp +++ b/samples/Javascript/WatermelonWithMe/Classes/AppDelegate.cpp @@ -36,7 +36,7 @@ bool AppDelegate::applicationDidFinishLaunching() // set FPS. the default value is 1.0/60 if you don't call this pDirector->setAnimationInterval(1.0 / 60); - EGLView::getInstance()->setDesignResolutionSize(480, 320, kResolutionFixedHeight); + EGLView::getInstance()->setDesignResolutionSize(480, 320, ResolutionPolicy::FIXED_HEIGHT); ScriptingCore* sc = ScriptingCore::getInstance(); sc->addRegisterCallback(register_all_cocos2dx); diff --git a/samples/Lua/HelloLua/Classes/AppDelegate.cpp b/samples/Lua/HelloLua/Classes/AppDelegate.cpp index 5a3b770341..3116264745 100644 --- a/samples/Lua/HelloLua/Classes/AppDelegate.cpp +++ b/samples/Lua/HelloLua/Classes/AppDelegate.cpp @@ -26,7 +26,7 @@ bool AppDelegate::applicationDidFinishLaunching() Director *pDirector = Director::getInstance(); pDirector->setOpenGLView(EGLView::getInstance()); - EGLView::getInstance()->setDesignResolutionSize(480, 320, kResolutionNoBorder); + EGLView::getInstance()->setDesignResolutionSize(480, 320, ResolutionPolicy::NO_BORDER); // turn on display FPS pDirector->setDisplayStats(true); diff --git a/samples/Lua/TestLua/Classes/AppDelegate.cpp b/samples/Lua/TestLua/Classes/AppDelegate.cpp index 59e6af9b68..8b763a80bd 100644 --- a/samples/Lua/TestLua/Classes/AppDelegate.cpp +++ b/samples/Lua/TestLua/Classes/AppDelegate.cpp @@ -44,7 +44,7 @@ bool AppDelegate::applicationDidFinishLaunching() pDirector->setContentScaleFactor(resourceSize.height/designSize.height); } - EGLView::getInstance()->setDesignResolutionSize(designSize.width, designSize.height, kResolutionFixedHeight); + EGLView::getInstance()->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::FIXED_HEIGHT); // register lua engine LuaEngine* pEngine = LuaEngine::getInstance(); diff --git a/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id b/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id index e35e224c8f..7e708e27c6 100644 --- a/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id +++ b/scripting/lua/cocos2dx_support/LuaCocos2d.cpp.REMOVED.git-id @@ -1 +1 @@ -d2e1fc14f4c663f31bc92cb89e099efdbfc986a2 \ No newline at end of file +fa9c4583d202c4fd4af5f97259eb3cac2bfbdec1 \ No newline at end of file diff --git a/tools/tolua++/basic.lua b/tools/tolua++/basic.lua index d18e2f4bdb..2aa38bd3a7 100644 --- a/tools/tolua++/basic.lua +++ b/tools/tolua++/basic.lua @@ -341,7 +341,8 @@ TOLUA_API int tolua_Cocos2d_open (lua_State* tolua_S);]], [[]]) remove_prefix() - result = string.gsub(result, "(tolua_tonumber%(tolua_S,%d,)(kCC)", "%1(int)%2") + result = string.gsub(result, '(tolua_tonumber%(tolua_S,%d,)(kCC)', '%1(int)%2') + result = string.gsub(result, '(tolua_constant%(tolua_S,"k%w*",)(k)', '%1(int)%2') result = string.gsub(result, "(self%->setEmitterMode%()", "%1(ParticleSystem::Mode)")