game_launcher 1.1.0
Modern Linux game launcher with Steam / Proton / Wine integration
Loading...
Searching...
No Matches
platform.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2#pragma once
3
4// Platform detection macros
5#if defined(_WIN32) || defined(_WIN64)
6#define PLATFORM_WINDOWS 1
7#define PLATFORM_NAME "Windows"
8#elif defined(__linux__)
9#define PLATFORM_LINUX 1
10#define PLATFORM_NAME "Linux"
11#elif defined(__APPLE__)
12#define PLATFORM_MACOS 1
13#define PLATFORM_NAME "macOS"
14#else
15#error "Unsupported platform"
16#endif
17
18// Common platform utilities
19namespace platform
20{
21
22inline const char* getPlatformName()
23{
24 return PLATFORM_NAME;
25}
26
27inline bool isWindows()
28{
29#ifdef PLATFORM_WINDOWS
30 return true;
31#else
32 return false;
33#endif
34}
35
36inline bool isLinux()
37{
38#ifdef PLATFORM_LINUX
39 return true;
40#else
41 return false;
42#endif
43}
44
45} // namespace platform
const char * getPlatformName()
Definition platform.h:22
bool isLinux()
Definition platform.h:36
bool isWindows()
Definition platform.h:27