MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ get_platform()

std::string MayaFlux::Core::GLFWSingleton::get_platform ( )
static

Gets the current GLFW platform (Wayland, X11, etc.)

Returns
Platform identifier, or empty string if GLFW < 3.4

Definition at line 140 of file GlfwSingleton.cpp.

141{
142 if (!s_initialized)
143 return "";
144
145#if GLFW_VERSION_MAJOR >= 3 && GLFW_VERSION_MINOR >= 4
146 int platform = glfwGetPlatform();
147 switch (platform) {
148 case GLFW_PLATFORM_WAYLAND:
149 return "wayland";
150 case GLFW_PLATFORM_X11:
151 return "x11";
152 case GLFW_PLATFORM_WIN32:
153 return "win32";
154 case GLFW_PLATFORM_COCOA:
155 return "cocoa";
156 default:
157 return "unknown";
158 }
159#else
160 const char* platform = glfwGetPlatformName();
161 if (platform)
162 return platform;
163
164#ifdef MAYAFLUX_PLATFORM_LINUX
165#ifdef GLFW_USE_WAYLAND
166 return "wayland";
167#else
168 return "x11";
169#endif
170#elif MAYAFLUX_PLATFORM_WINDOWS
171 return "win32";
172#elif MAYAFLUX_PLATFORM_MACOS
173 return "cocoa";
174#else
175 return "unknown";
176#endif
177#endif
178}
static bool s_initialized
Tracks whether GLFW has been initialized.

References s_initialized.

Referenced by MayaFlux::Core::WindowManager::create_window(), and is_wayland().

+ Here is the caller graph for this function: