enum class for LanguageType, Application::Platform

This commit is contained in:
James Chen 2013-07-26 17:29:06 +08:00
parent 54ab99bf74
commit ad1d8b667d
24 changed files with 254 additions and 195 deletions

View File

@ -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,33 @@ 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::WINDOWS;
const Application::Platform kTargetLinux = Application::Platform::LINUX;
const Application::Platform kTargetMacOS = Application::Platform::MACOS;
const Application::Platform kTargetAndroid = Application::Platform::ANDROID;
const Application::Platform kTargetIphone = Application::Platform::IPHONE;
const Application::Platform kTargetIpad = Application::Platform::IPAD;
const Application::Platform kTargetBlackBerry = Application::Platform::BLACKBERRY;
const Application::Platform kTargetNaCl = Application::Platform::NACL;
const Application::Platform kTargetEmscripten = Application::Platform::EMSCRIPTEN;
const Application::Platform kTargetTizen = Application::Platform::TIZEN;
void ccDrawInit()
{
@ -262,4 +289,4 @@ void ccPointSize( GLfloat pointSize )
DrawPrimitives::setPointSize(pointSize);
}
NS_CC_END
NS_CC_END

View File

@ -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,36 @@ 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;
#define kCCTMXTileHorizontalFlag kTMXTileHorizontalFlag
#define kCCTMXTileVerticalFlag kTMXTileVerticalFlag
#define kCCTMXTileDiagonalFlag kTMXTileDiagonalFlag

View File

@ -3,20 +3,6 @@
NS_CC_BEGIN
enum TargetPlatform
{
kTargetWindows,
kTargetLinux,
kTargetMacOS,
kTargetAndroid,
kTargetIphone,
kTargetIpad,
kTargetBlackBerry,
kTargetNaCl,
kTargetEmscripten,
kTargetTizen
};
/**
* @addtogroup platform
* @{
@ -26,6 +12,21 @@ class CC_DLL ApplicationProtocol
{
public:
enum class Platform
{
WINDOWS,
LINUX,
MACOS,
ANDROID,
IPHONE,
IPAD,
BLACKBERRY,
NACL,
EMSCRIPTEN,
TIZEN
};
virtual ~ApplicationProtocol() {}
/**
@ -57,12 +58,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

View File

@ -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

View File

@ -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::ANDROID;
}
NS_CC_END

View File

@ -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;

View File

@ -85,9 +85,9 @@ const std::string& Application::getResourceRootPath(void)
return _resourceRootPath;
}
TargetPlatform Application::getTargetPlatform()
Application::Platform Application::getTargetPlatform()
{
return kTargetEmscripten;
return Platform::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;

View File

@ -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();
/**

View File

@ -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;

View File

@ -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::IPAD;
}
else
{
return kTargetIphone;
return Platform::IPHONE;
}
}

View File

@ -84,9 +84,9 @@ const std::string& Application::getResourceRootPath(void)
return _resourceRootPath;
}
TargetPlatform Application::getTargetPlatform()
Application::Platform Application::getTargetPlatform()
{
return kTargetLinux;
return Platform::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;

View File

@ -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;

View File

@ -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.

View File

@ -60,9 +60,9 @@ void Application::setAnimationInterval(double interval)
[[CCDirectorCaller sharedDirectorCaller] setAnimationInterval: interval ];
}
TargetPlatform Application::getTargetPlatform()
Application::Platform Application::getTargetPlatform()
{
return kTargetMacOS;
return Platform::MACOS;
}
/////////////////////////////////////////////////////////////////////////////////////////////////
@ -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;
}

View File

@ -90,9 +90,9 @@ void Application::setAnimationInterval(double interval)
_animationInterval = interval * 1000.0f;
}
TargetPlatform Application::getTargetPlatform()
Application::Platform Application::getTargetPlatform()
{
return kTargetNaCl;
return Platform::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;
}

View File

@ -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:

View File

@ -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::TIZEN;
}
NS_CC_END

View File

@ -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;

View File

@ -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::WINDOWS;
}
void Application::setResourceRootPath(const std::string& rootResDir)

View File

@ -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.

View File

@ -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;

View File

@ -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;
}

View File

@ -1 +1 @@
c9c987cbc9ac6856565577936bcc7f23d097ecf9
5cfa022d431fe35f1546ac01341c2c3226635ac0

View File

@ -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)")