SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Macros | Functions

SDL provides a means to identify the app's platform, both at compile time and runtime. More...

Macros

#define SDL_PLATFORM_AIX   1
 A preprocessor macro that is only defined if compiling for AIX.
 
#define SDL_PLATFORM_BSDI   1
 A preprocessor macro that is only defined if compiling for BSDi.
 
#define SDL_PLATFORM_FREEBSD   1
 A preprocessor macro that is only defined if compiling for FreeBSD.
 
#define SDL_PLATFORM_HPUX   1
 A preprocessor macro that is only defined if compiling for HP-UX.
 
#define SDL_PLATFORM_IRIX   1
 A preprocessor macro that is only defined if compiling for IRIX.
 
#define SDL_PLATFORM_LINUX   1
 A preprocessor macro that is only defined if compiling for Linux.
 
#define SDL_PLATFORM_ANDROID   1
 A preprocessor macro that is only defined if compiling for Android.
 
#define SDL_PLATFORM_UNIX   1
 A preprocessor macro that is only defined if compiling for a Unix-like system.
 
#define SDL_PLATFORM_APPLE   1
 A preprocessor macro that is only defined if compiling for Apple platforms.
 
#define SDL_PLATFORM_TVOS   1
 A preprocessor macro that is only defined if compiling for tvOS.
 
#define SDL_PLATFORM_VISIONOS   1
 A preprocessor macro that is only defined if compiling for VisionOS.
 
#define SDL_PLATFORM_IOS   1
 A preprocessor macro that is only defined if compiling for iOS.
 
#define SDL_PLATFORM_MACOS   1
 A preprocessor macro that is only defined if compiling for macOS.
 
#define SDL_PLATFORM_EMSCRIPTEN   1
 A preprocessor macro that is only defined if compiling for Emscripten.
 
#define SDL_PLATFORM_NETBSD   1
 A preprocessor macro that is only defined if compiling for NetBSD.
 
#define SDL_PLATFORM_OPENBSD   1
 A preprocessor macro that is only defined if compiling for OpenBSD.
 
#define SDL_PLATFORM_OS2   1
 A preprocessor macro that is only defined if compiling for OS/2.
 
#define SDL_PLATFORM_OSF   1
 A preprocessor macro that is only defined if compiling for Tru64 (OSF/1).
 
#define SDL_PLATFORM_QNXNTO   1
 A preprocessor macro that is only defined if compiling for QNX Neutrino.
 
#define SDL_PLATFORM_RISCOS   1
 A preprocessor macro that is only defined if compiling for RISC OS.
 
#define SDL_PLATFORM_SOLARIS   1
 A preprocessor macro that is only defined if compiling for SunOS/Solaris.
 
#define SDL_PLATFORM_CYGWIN   1
 A preprocessor macro that is only defined if compiling for Cygwin.
 
#define SDL_PLATFORM_WINDOWS   1
 A preprocessor macro that is only defined if compiling for Windows.
 
#define SDL_WINAPI_FAMILY_PHONE   1
 A preprocessor macro that defined to 1 if compiling for Windows Phone.
 
#define SDL_PLATFORM_WINGDK   1
 A preprocessor macro that is only defined if compiling for Microsoft GDK for Windows.
 
#define SDL_PLATFORM_XBOXSERIES   1
 A preprocessor macro that is only defined if compiling for Xbox Series.
 
#define SDL_PLATFORM_WIN32   1
 A preprocessor macro that is only defined if compiling for desktop Windows.
 
#define SDL_PLATFORM_GDK   1
 A preprocessor macro that is only defined if compiling for Microsoft GDK on any platform.
 
#define SDL_PLATFORM_PSP   1
 A preprocessor macro that is only defined if compiling for Sony PSP.
 
#define SDL_PLATFORM_PS2   1
 A preprocessor macro that is only defined if compiling for Sony PlayStation 2.
 
#define SDL_PLATFORM_VITA   1
 A preprocessor macro that is only defined if compiling for Sony Vita.
 
#define SDL_PLATFORM_3DS   1
 A preprocessor macro that is only defined if compiling for Nintendo 3DS.
 

Functions

const char * SDL::GetPlatform ()
 Get the name of the platform.
 

Detailed Description

For sanity, we don't wrap the macros, so use the regular SDL_* macros as documented.

Macro Definition Documentation

◆ SDL_PLATFORM_3DS

#define SDL_PLATFORM_3DS   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_AIX

#define SDL_PLATFORM_AIX   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_ANDROID

#define SDL_PLATFORM_ANDROID   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_APPLE

#define SDL_PLATFORM_APPLE   1

iOS, macOS, etc will additionally define a more specific platform macro.

Since
This macro is available since SDL 3.2.0.
See also
SDL_PLATFORM_MACOS
SDL_PLATFORM_IOS
SDL_PLATFORM_TVOS
SDL_PLATFORM_VISIONOS

◆ SDL_PLATFORM_BSDI

#define SDL_PLATFORM_BSDI   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_CYGWIN

#define SDL_PLATFORM_CYGWIN   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_EMSCRIPTEN

#define SDL_PLATFORM_EMSCRIPTEN   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_FREEBSD

#define SDL_PLATFORM_FREEBSD   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_GDK

#define SDL_PLATFORM_GDK   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_HPUX

#define SDL_PLATFORM_HPUX   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_IOS

#define SDL_PLATFORM_IOS   1
Since
This macro is available since SDL 3.2.0.
See also
SDL_PLATFORM_APPLE

◆ SDL_PLATFORM_IRIX

#define SDL_PLATFORM_IRIX   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_LINUX

#define SDL_PLATFORM_LINUX   1

Note that Android, although ostensibly a Linux-based system, will not define this. It defines SDL_PLATFORM_ANDROID instead.

Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_MACOS

#define SDL_PLATFORM_MACOS   1
Since
This macro is available since SDL 3.2.0.
See also
SDL_PLATFORM_APPLE

◆ SDL_PLATFORM_NETBSD

#define SDL_PLATFORM_NETBSD   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_OPENBSD

#define SDL_PLATFORM_OPENBSD   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_OS2

#define SDL_PLATFORM_OS2   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_OSF

#define SDL_PLATFORM_OSF   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_PS2

#define SDL_PLATFORM_PS2   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_PSP

#define SDL_PLATFORM_PSP   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_QNXNTO

#define SDL_PLATFORM_QNXNTO   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_RISCOS

#define SDL_PLATFORM_RISCOS   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_SOLARIS

#define SDL_PLATFORM_SOLARIS   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_TVOS

#define SDL_PLATFORM_TVOS   1
Since
This macro is available since SDL 3.2.0.
See also
SDL_PLATFORM_APPLE

◆ SDL_PLATFORM_UNIX

#define SDL_PLATFORM_UNIX   1

Other platforms, like Linux, might define this in addition to their primary define.

Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_VISIONOS

#define SDL_PLATFORM_VISIONOS   1
Since
This macro is available since SDL 3.2.0.
See also
SDL_PLATFORM_APPLE

◆ SDL_PLATFORM_VITA

#define SDL_PLATFORM_VITA   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_WIN32

#define SDL_PLATFORM_WIN32   1

Despite the "32", this also covers 64-bit Windows; as an informal convention, its system layer tends to still be referred to as "the Win32 API."

Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_WINDOWS

#define SDL_PLATFORM_WINDOWS   1

This also covers several other platforms, like Microsoft GDK, Xbox, WinRT, etc. Each will have their own more-specific platform macros, too.

Since
This macro is available since SDL 3.2.0.
See also
SDL_PLATFORM_WIN32
SDL_PLATFORM_XBOXONE
SDL_PLATFORM_XBOXSERIES
SDL_PLATFORM_WINGDK
SDL_PLATFORM_GDK

◆ SDL_PLATFORM_WINGDK

#define SDL_PLATFORM_WINGDK   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_PLATFORM_XBOXSERIES

#define SDL_PLATFORM_XBOXSERIES   1
Since
This macro is available since SDL 3.2.0.

◆ SDL_WINAPI_FAMILY_PHONE

#define SDL_WINAPI_FAMILY_PHONE   1
Since
This macro is available since SDL 3.2.0.

Function Documentation

◆ GetPlatform()

const char * SDL::GetPlatform ( )
inline

Here are the names returned for some (but not all) supported platforms:

  • "Windows"
  • "macOS"
  • "Linux"
  • "iOS"
  • "Android"
Returns
the name of the platform. If the correct platform name is not available, returns a string beginning with the text "Unknown".
Since
This function is available since SDL 3.2.0.