Own Web platform services directly

This commit is contained in:
2026-06-17 16:02:26 +02:00
parent d80289665d
commit b5d3bc131d
9 changed files with 461 additions and 19 deletions

View File

@@ -5,7 +5,6 @@
#include <thread>
#include <chrono>
#include <app.h>
#include <platform_legacy/legacy_platform_services.h>
#include <platform_web/web_platform_services.h>
#include <fstream>
#include <keymap.h>
@@ -16,7 +15,6 @@ App app;
GLFWwindow* wnd;
float theta = 0;
glm::vec2 g_cursor_pos;
std::unique_ptr<pp::platform::WebPlatformServices> g_web_platform_services;
std::unique_ptr<pp::platform::PlatformServices> g_platform_services;
template<typename F>
@@ -201,14 +199,12 @@ int main()
if (glfwInit() != GL_TRUE)
printf("Failed to init GLFW");
wnd = glfwCreateWindow(1024, 768, "PanoPainter", nullptr, nullptr);
g_web_platform_services = pp::platform::web::create_web_platform_services();
g_platform_services = pp::platform::legacy::create_platform_services({
.glfw_shell = {
g_platform_services = pp::platform::web::create_platform_services({
.shell = {
.acquire_render_context = [wnd] { glfwMakeContextCurrent(wnd); },
.present_render_context = [wnd] { glfwSwapBuffers(wnd); },
.request_app_close = [wnd] { glfwSetWindowShouldClose(wnd, GLFW_TRUE); },
},
.web_platform_services = g_web_platform_services.get(),
});
glfwMakeContextCurrent(wnd);