Hubris Engine
Dev
A Project to learn and get into Game Engine developement.
Loading...
Searching...
No Matches
Platform.h
Go to the documentation of this file.
1
// File: Hubris/include/Platform.h
2
#pragma once
3
4
enum class
Hbr_Platform
:
unsigned
short
{
5
Windows
,
Linux
,
MacOS
,
IOS
,
Android
,
Unknown
6
};
7
8
[[nodiscard]]
consteval
inline
Hbr_Platform
GetPlatform
() noexcept{
9
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
10
#define HBR_WINDOWS
11
#define WIN32_LEAN_AND_MEAN
12
//#include "Windows.h"
13
return
Hbr_Platform::Windows
;
14
#elif __APPLE__
15
#include <TargetConditionals.h>
16
#define HBR_APPLE
17
#if TARGET_IPHONE_SIMULATOR
18
#define HBR_IOS
19
return
Hbr_Platform::IOS
;
// iOS Simulator
20
#elif TARGET_OS_MACCATALYST
21
#define HBR_MACOS
22
return
Hbr_Platform::MacOS
;
// Mac Catalyst
23
#elif TARGET_OS_IPHONE
24
#define HBR_IOS
25
return
Hbr_Platform::IOS
;
// iOS device
26
#elif TARGET_OS_MAC
27
#define HBR_MACOS
28
return
Hbr_Platform::MacOS
;
// macOS
29
#else
30
#error "Unknown Apple platform"
31
#endif
32
#elif __ANDROID__
33
#define HBR_ANDROID
34
return
Hbr_Platform::Android
;
35
#elif __linux__
36
#define HBR_LINUX
37
return
Hbr_Platform::Linux
;
38
#elif __unix__
// all unices not caught above
39
#define HBR_LINUX
40
return
Hbr_Platform::Linux
;
// Assuming Unix-like systems are similar to Linux
41
#elif defined(_POSIX_VERSION)
42
return
Hbr_Platform::Linux
;
// POSIX systems
43
#else
44
return
Hbr_Platform::Unknown
;
45
#endif
46
}
47
48
constinit
const
Hbr_Platform
Platform
=
GetPlatform
();
Hbr_Platform
Hbr_Platform
Definition
Platform.h:4
Hbr_Platform::MacOS
@ MacOS
Definition
Platform.h:5
Hbr_Platform::Unknown
@ Unknown
Definition
Platform.h:5
Hbr_Platform::Windows
@ Windows
Definition
Platform.h:5
Hbr_Platform::IOS
@ IOS
Definition
Platform.h:5
Hbr_Platform::Android
@ Android
Definition
Platform.h:5
Hbr_Platform::Linux
@ Linux
Definition
Platform.h:5
GetPlatform
consteval Hbr_Platform GetPlatform() noexcept
Definition
Platform.h:8
Platform
constinit const Hbr_Platform Platform
Definition
Platform.h:48
include
Platform.h
Generated by
1.13.2