Move Win32 VR state behind platform services
This commit is contained in:
@@ -20,10 +20,6 @@
|
||||
#include <deque>
|
||||
#include <map>
|
||||
|
||||
namespace pp::platform::windows {
|
||||
[[nodiscard]] VrShellState& platform_vr_state() noexcept;
|
||||
}
|
||||
|
||||
void destroy_window();
|
||||
void async_lock();
|
||||
void async_unlock();
|
||||
@@ -134,7 +130,8 @@ void initialize_retained_input_state()
|
||||
|
||||
VrShellState& platform_vr_state() noexcept
|
||||
{
|
||||
return retained_vr_shell_state();
|
||||
static VrShellState state;
|
||||
return state;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,10 +5,12 @@
|
||||
#include <future>
|
||||
|
||||
struct VrSessionSnapshot;
|
||||
struct VrShellState;
|
||||
|
||||
namespace pp::platform::windows {
|
||||
|
||||
[[nodiscard]] PlatformServices& platform_services();
|
||||
[[nodiscard]] VrShellState& platform_vr_state() noexcept;
|
||||
[[nodiscard]] VrSessionSnapshot read_platform_vr_session_snapshot() noexcept;
|
||||
void enqueue_main_thread_task(std::packaged_task<void()> task);
|
||||
void drain_main_thread_tasks();
|
||||
|
||||
@@ -60,12 +60,6 @@ void synchronize_app_key_state_from_keyboard(App& app)
|
||||
|
||||
}
|
||||
|
||||
pp::platform::windows::VrShellState& pp::platform::windows::retained_vr_shell_state() noexcept
|
||||
{
|
||||
static pp::platform::windows::VrShellState state;
|
||||
return state;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
||||
{
|
||||
auto* app = bound_app();
|
||||
@@ -75,7 +69,7 @@ LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp)
|
||||
switch (msg)
|
||||
{
|
||||
case kUserCloseMessage:
|
||||
handle_window_close_message(retained_vr_shell_state());
|
||||
handle_window_close_message(pp::platform::windows::platform_vr_state());
|
||||
return 0;
|
||||
case WM_PAINT:
|
||||
app->redraw = true;
|
||||
|
||||
@@ -3,12 +3,10 @@
|
||||
#include <Windows.h>
|
||||
|
||||
#include "event.h"
|
||||
#include "platform_windows/windows_vr_shell.h"
|
||||
|
||||
namespace pp::platform::windows {
|
||||
|
||||
void initialize_retained_input_state();
|
||||
pp::platform::windows::VrShellState& retained_vr_shell_state() noexcept;
|
||||
LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user