Thin Windows runtime globals and legacy GLFW hooks
This commit is contained in:
@@ -71,24 +71,24 @@ public:
|
||||
return state;
|
||||
}
|
||||
|
||||
[[nodiscard]] RetainedLegacyGlfwWindowHooks& active_legacy_glfw_window_hooks()
|
||||
{
|
||||
return active_legacy_glfw_window_state().hooks;
|
||||
}
|
||||
|
||||
void set_legacy_glfw_window(GLFWwindow* window)
|
||||
{
|
||||
auto& retained = active_legacy_glfw_window_state();
|
||||
retained.window = window;
|
||||
retained.hooks.acquire_render_context = [window] {
|
||||
glfwMakeContextCurrent(window);
|
||||
};
|
||||
retained.hooks.present_render_context = [window] {
|
||||
glfwSwapBuffers(window);
|
||||
};
|
||||
retained.hooks.request_app_close = [window] {
|
||||
glfwSetWindowShouldClose(window, GLFW_TRUE);
|
||||
};
|
||||
active_legacy_glfw_window_state().window = window;
|
||||
}
|
||||
|
||||
void acquire_legacy_glfw_render_context()
|
||||
{
|
||||
glfwMakeContextCurrent(active_legacy_glfw_window_state().window);
|
||||
}
|
||||
|
||||
void present_legacy_glfw_render_context()
|
||||
{
|
||||
glfwSwapBuffers(active_legacy_glfw_window_state().window);
|
||||
}
|
||||
|
||||
void request_legacy_glfw_app_close()
|
||||
{
|
||||
glfwSetWindowShouldClose(active_legacy_glfw_window_state().window, GLFW_TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user