Split Linux platform target and move runtime/platform state

This commit is contained in:
2026-06-17 01:20:11 +02:00
parent 90a55b86fe
commit 3ce365fc15
16 changed files with 169 additions and 94 deletions

View File

@@ -3,6 +3,7 @@
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#include <app.h>
#include <platform_legacy/legacy_platform_state.h>
#include <libgen.h>
#include <pwd.h>
#include <unistd.h>
@@ -41,7 +42,9 @@ void linux_update_fps(int frames)
{
static char title_fps[512];
sprintf(title_fps, "PanoPainter - %d fps", frames);
glfwSetWindowTitle(app.glfw_window, title_fps);
auto* const window = pp::platform::legacy::active_legacy_glfw_window_state().window;
if (window)
glfwSetWindowTitle(window, title_fps);
}
void error_log(int code, const char * s)
@@ -90,9 +93,9 @@ int main(int argc, char** args)
});
});
glfwSetWindowCloseCallback(wnd, [](GLFWwindow* wnd){
app.ui_task([] {
app.ui_task([wnd] {
if (!app.request_close())
glfwSetWindowShouldClose(app.glfw_window, GLFW_FALSE);
glfwSetWindowShouldClose(wnd, GLFW_FALSE);
});
});
glfwSetWindowRefreshCallback(wnd, [](GLFWwindow* wnd){
@@ -116,11 +119,11 @@ int main(int argc, char** args)
umask(0);
App::I = &app;
pp::platform::legacy::set_legacy_glfw_window(wnd);
app.initLog();
app.create();
app.width = 800;
app.height = 600;
app.glfw_window = wnd;
app.render_thread_start();
app.ui_thread_start();