mirror of https://github.com/axmolengine/axmol.git
Tidy platform macros/consts value
This commit is contained in:
parent
6856c2d073
commit
8b96ff7f1b
|
@ -66,3 +66,5 @@ IndentPPDirectives: AfterHash
|
|||
IncludeBlocks: Preserve
|
||||
UseTab: Never
|
||||
BreakConstructorInitializers: BeforeComma
|
||||
|
||||
AlignConsecutiveMacros: AcrossEmptyLines
|
||||
|
|
|
@ -46,21 +46,19 @@ public:
|
|||
*/
|
||||
enum class Platform
|
||||
{
|
||||
Windows, /**< Windows */
|
||||
UWP,
|
||||
UWP_Phone,
|
||||
Unknown,
|
||||
Win32, /**< Win32 Apps */
|
||||
WinUWP, /**< WinUWP */
|
||||
Linux, /**< Linux */
|
||||
macOS, /**< macOS */
|
||||
OSX, /**< macOS */
|
||||
Android, /**< Android */
|
||||
Emscripten, /**< Emscripten */
|
||||
iOS, /**< Apple iOS */
|
||||
};
|
||||
|
||||
enum class SubPlatform {
|
||||
Null,
|
||||
Win32,
|
||||
WinRT,
|
||||
tvOS,
|
||||
tvOS, /**< Apple tvOS */
|
||||
Wasm, /**< aka WebAssembly/Emscripten */
|
||||
/* alias */
|
||||
Windows = Win32,
|
||||
macOS = OSX,
|
||||
Emscripten = Wasm
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -45,14 +45,19 @@ THE SOFTWARE.
|
|||
|
||||
// define supported target platform macro which CC uses.
|
||||
#define AX_PLATFORM_UNKNOWN 0
|
||||
#define AX_PLATFORM_IOS 1
|
||||
#define AX_PLATFORM_ANDROID 2
|
||||
#define AX_PLATFORM_WIN32 3
|
||||
#define AX_PLATFORM_LINUX 5
|
||||
#define AX_PLATFORM_MAC 8
|
||||
#define AX_PLATFORM_WASM 10
|
||||
#define AX_PLATFORM_WIN32 1
|
||||
#define AX_PLATFORM_WINUWP 2
|
||||
#define AX_PLATFORM_LINUX 3
|
||||
#define AX_PLATFORM_OSX 4
|
||||
#define AX_PLATFORM_ANDROID 5
|
||||
#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_WINRT 13
|
||||
|
||||
// Determine target platform by compile environment macro.
|
||||
#define AX_TARGET_PLATFORM AX_PLATFORM_UNKNOWN
|
||||
|
|
|
@ -102,7 +102,11 @@ LanguageType Application::getCurrentLanguage()
|
|||
|
||||
Application::Platform Application::getTargetPlatform()
|
||||
{
|
||||
#if TARGET_OS_IOS
|
||||
return Platform::iOS;
|
||||
#else /*elif TARGET_OS_TV*/
|
||||
return Platform::tvOS;
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string Application::getVersion()
|
||||
|
|
|
@ -108,7 +108,7 @@ void Application::setAnimationInterval(float interval)
|
|||
|
||||
Application::Platform Application::getTargetPlatform()
|
||||
{
|
||||
return Platform::macOS;
|
||||
return Platform::OSX;
|
||||
}
|
||||
|
||||
std::string Application::getVersion()
|
||||
|
|
|
@ -130,7 +130,7 @@ const std::string& Application::getResourceRootPath()
|
|||
|
||||
Application::Platform Application::getTargetPlatform()
|
||||
{
|
||||
return Platform::Emscripten;
|
||||
return Platform::Wasm;
|
||||
}
|
||||
|
||||
std::string Application::getVersion()
|
||||
|
|
|
@ -245,7 +245,7 @@ const char* Application::getCurrentLanguageCode()
|
|||
|
||||
Application::Platform Application::getTargetPlatform()
|
||||
{
|
||||
return Platform::Windows;
|
||||
return Platform::Win32;
|
||||
}
|
||||
|
||||
std::string Application::getVersion()
|
||||
|
|
|
@ -147,14 +147,7 @@ LanguageType Application::getCurrentLanguage()
|
|||
|
||||
Application::Platform Application::getTargetPlatform()
|
||||
{
|
||||
if (isWindowsPhone())
|
||||
{
|
||||
return Platform::UWP;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Platform::UWP_Phone;
|
||||
}
|
||||
return Platform::WinUWP;
|
||||
}
|
||||
|
||||
std::string Application::getVersion()
|
||||
|
|
|
@ -190,15 +190,23 @@ cc.UNIFORM_SAMPLER_S = 'AX_Texture0'
|
|||
cc.UNIFORM_SIN_TIME_S = 'AX_SinTime'
|
||||
cc.UNIFORM_TIME_S = 'AX_Time'
|
||||
|
||||
cc.PLATFORM_WINDOWS = 0
|
||||
cc.PLATFORM_UWP = 1
|
||||
cc.PLATFORM_UWP_PHONE = 2
|
||||
-- refer to: ApplicationProtocol.h: enum class Platform
|
||||
cc.PLATFORM_UNKNOWN = 0
|
||||
cc.PLATFORM_WIN32 = 1
|
||||
cc.PLATFORM_WINUWP = 2
|
||||
cc.PLATFORM_LINUX = 3
|
||||
cc.PLATFORM_MACOS = 4
|
||||
cc.PLATFORM_OSX = 4
|
||||
cc.PLATFORM_ANDROID = 5
|
||||
cc.PLATFORM_IOS = 6
|
||||
cc.PLATFORM_TVOS = 7
|
||||
cc.PLATFORM_WASM = 8
|
||||
-- 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_CHINESE = 1
|
||||
cc.LANGUAGE_FRENCH = 2
|
||||
|
|
Loading…
Reference in New Issue