Thin node loader, Win32 wrappers, and canvas mode shells

This commit is contained in:
2026-06-17 00:10:39 +02:00
parent acee4db356
commit 371095770d
9 changed files with 302 additions and 289 deletions

View File

@@ -1,6 +1,9 @@
#include "pch.h"
#include "platform_windows/windows_bootstrap_helpers.h"
#include "platform_windows/windows_lifecycle_shell.h"
#include "platform_windows/windows_platform_services.h"
#include "platform_windows/windows_stylus_input.h"
#include "platform_windows/windows_window_shell.h"
#include "log.h"
#include "legacy_gl_runtime_dispatch.h"
@@ -12,6 +15,15 @@
#include <deque>
#include <map>
namespace pp::platform::windows {
void set_async_render_context(HDC hdc, HGLRC hrc);
void lock_async_render_context();
bool try_lock_async_render_context();
void unlock_async_render_context();
void swap_async_render_context();
RetainedState& retained_state();
}
void destroy_window();
void async_lock();
void async_unlock();
@@ -23,6 +35,67 @@ bool win32_vr_start();
void win32_vr_stop();
HWND pp_windows_main_window_handle();
HWND pp_windows_main_window_handle()
{
return pp::platform::windows::retained_state().hWnd;
}
void destroy_window()
{
pp::platform::windows::enqueue_main_thread_task(std::packaged_task<void()>([hWnd = pp::platform::windows::retained_state().hWnd] {
pp::platform::windows::request_window_close(hWnd);
}));
}
void async_lock()
{
pp::platform::windows::lock_async_render_context();
}
bool async_lock_try()
{
return pp::platform::windows::try_lock_async_render_context();
}
void win32_async_swap()
{
pp::platform::windows::swap_async_render_context();
}
void async_unlock()
{
pp::platform::windows::unlock_async_render_context();
}
void win32_update_stylus(float dt)
{
pp::platform::windows::update_stylus_frame(dt);
}
void win32_update_fps(int frames)
{
auto& state = pp::platform::windows::retained_state();
pp::platform::windows::enqueue_main_thread_task(std::packaged_task<void()>([hWnd = state.hWnd, window_title = state.window_title, &vr = state.vr, frames] {
pp::platform::windows::update_window_fps(hWnd, window_title, vr, frames);
}));
}
bool win32_vr_start()
{
auto& state = pp::platform::windows::retained_state();
return pp::platform::windows::start_window_vr(state.vr, state.sandboxed);
}
void win32_vr_stop()
{
pp::platform::windows::stop_window_vr(pp::platform::windows::retained_state().vr);
}
void win32_save_window_state()
{
pp::platform::windows::save_window_preferences(pp::platform::windows::retained_state().hWnd);
}
namespace pp::platform::windows {
namespace {