Tidy platform macros/consts value

This commit is contained in:
halx99 2023-09-11 19:37:49 +08:00
parent 6856c2d073
commit 8b96ff7f1b
9 changed files with 45 additions and 35 deletions

View File

@ -66,3 +66,5 @@ IndentPPDirectives: AfterHash
IncludeBlocks: Preserve IncludeBlocks: Preserve
UseTab: Never UseTab: Never
BreakConstructorInitializers: BeforeComma BreakConstructorInitializers: BeforeComma
AlignConsecutiveMacros: AcrossEmptyLines

View File

@ -46,21 +46,19 @@ public:
*/ */
enum class Platform enum class Platform
{ {
Windows, /**< Windows */ Unknown,
UWP, Win32, /**< Win32 Apps */
UWP_Phone, WinUWP, /**< WinUWP */
Linux, /**< Linux */ Linux, /**< Linux */
macOS, /**< macOS */ OSX, /**< macOS */
Android, /**< Android */ Android, /**< Android */
Emscripten, /**< Emscripten */ iOS, /**< Apple iOS */
iOS, /**< Apple iOS */ tvOS, /**< Apple tvOS */
}; Wasm, /**< aka WebAssembly/Emscripten */
/* alias */
enum class SubPlatform { Windows = Win32,
Null, macOS = OSX,
Win32, Emscripten = Wasm
WinRT,
tvOS,
}; };
/** /**

View File

@ -45,14 +45,19 @@ THE SOFTWARE.
// define supported target platform macro which CC uses. // define supported target platform macro which CC uses.
#define AX_PLATFORM_UNKNOWN 0 #define AX_PLATFORM_UNKNOWN 0
#define AX_PLATFORM_IOS 1 #define AX_PLATFORM_WIN32 1
#define AX_PLATFORM_ANDROID 2 #define AX_PLATFORM_WINUWP 2
#define AX_PLATFORM_WIN32 3 #define AX_PLATFORM_LINUX 3
#define AX_PLATFORM_LINUX 5 #define AX_PLATFORM_OSX 4
#define AX_PLATFORM_MAC 8 #define AX_PLATFORM_ANDROID 5
#define AX_PLATFORM_WASM 10 #define AX_PLATFORM_IOS 6
#define AX_PLATFORM_TVOS 7
#define AX_PLATFORM_WASM 8
// alias platform macros
#define AX_PLATFORM_WINRT AX_PLATFORM_WINUWP
#define AX_PLATFORM_MAC AX_PLATFORM_OSX
#define AX_PLATFORM_EMSCRIPTEN AX_PLATFORM_WASM #define AX_PLATFORM_EMSCRIPTEN AX_PLATFORM_WASM
#define AX_PLATFORM_WINRT 13
// Determine target platform by compile environment macro. // Determine target platform by compile environment macro.
#define AX_TARGET_PLATFORM AX_PLATFORM_UNKNOWN #define AX_TARGET_PLATFORM AX_PLATFORM_UNKNOWN

View File

@ -102,7 +102,11 @@ LanguageType Application::getCurrentLanguage()
Application::Platform Application::getTargetPlatform() Application::Platform Application::getTargetPlatform()
{ {
#if TARGET_OS_IOS
return Platform::iOS; return Platform::iOS;
#else /*elif TARGET_OS_TV*/
return Platform::tvOS;
#endif
} }
std::string Application::getVersion() std::string Application::getVersion()

View File

@ -108,7 +108,7 @@ void Application::setAnimationInterval(float interval)
Application::Platform Application::getTargetPlatform() Application::Platform Application::getTargetPlatform()
{ {
return Platform::macOS; return Platform::OSX;
} }
std::string Application::getVersion() std::string Application::getVersion()

View File

@ -130,7 +130,7 @@ const std::string& Application::getResourceRootPath()
Application::Platform Application::getTargetPlatform() Application::Platform Application::getTargetPlatform()
{ {
return Platform::Emscripten; return Platform::Wasm;
} }
std::string Application::getVersion() std::string Application::getVersion()

View File

@ -245,7 +245,7 @@ const char* Application::getCurrentLanguageCode()
Application::Platform Application::getTargetPlatform() Application::Platform Application::getTargetPlatform()
{ {
return Platform::Windows; return Platform::Win32;
} }
std::string Application::getVersion() std::string Application::getVersion()

View File

@ -147,14 +147,7 @@ LanguageType Application::getCurrentLanguage()
Application::Platform Application::getTargetPlatform() Application::Platform Application::getTargetPlatform()
{ {
if (isWindowsPhone()) return Platform::WinUWP;
{
return Platform::UWP;
}
else
{
return Platform::UWP_Phone;
}
} }
std::string Application::getVersion() std::string Application::getVersion()

View File

@ -190,15 +190,23 @@ cc.UNIFORM_SAMPLER_S = 'AX_Texture0'
cc.UNIFORM_SIN_TIME_S = 'AX_SinTime' cc.UNIFORM_SIN_TIME_S = 'AX_SinTime'
cc.UNIFORM_TIME_S = 'AX_Time' cc.UNIFORM_TIME_S = 'AX_Time'
cc.PLATFORM_WINDOWS = 0 -- refer to: ApplicationProtocol.h: enum class Platform
cc.PLATFORM_UWP = 1 cc.PLATFORM_UNKNOWN = 0
cc.PLATFORM_UWP_PHONE = 2 cc.PLATFORM_WIN32 = 1
cc.PLATFORM_WINUWP = 2
cc.PLATFORM_LINUX = 3 cc.PLATFORM_LINUX = 3
cc.PLATFORM_MACOS = 4 cc.PLATFORM_OSX = 4
cc.PLATFORM_ANDROID = 5 cc.PLATFORM_ANDROID = 5
cc.PLATFORM_IOS = 6 cc.PLATFORM_IOS = 6
cc.PLATFORM_TVOS = 7
cc.PLATFORM_WASM = 8
-- iPAD device of iOS, TODO: provide API: isIPad() -- iPAD device of iOS, TODO: provide API: isIPad()
-- platform alias
cc.PLATFORM_WINDOWS = cc.PLATFORM_WIN32
cc.PLATFORM_MACOS = cc.PLATFORM_OSX
cc.PLATFORM_EMSCRIPTEN = cc.PLATFORM_WASM
cc.LANGUAGE_ENGLISH = 0 cc.LANGUAGE_ENGLISH = 0
cc.LANGUAGE_CHINESE = 1 cc.LANGUAGE_CHINESE = 1
cc.LANGUAGE_FRENCH = 2 cc.LANGUAGE_FRENCH = 2