Extract node lifecycle, preview runtime, and Win32 input state

This commit is contained in:
2026-06-16 22:18:30 +02:00
parent 24d9d5b6e2
commit 2a2f0c7dd6
12 changed files with 420 additions and 245 deletions

View File

@@ -13,6 +13,31 @@ void destroy_window();
namespace pp::platform::windows {
void initialize_retained_input_state()
{
auto& state = retained_state();
memset(&state.keys, 0, sizeof(state.keys));
for (int k = 1; k < 256; ++k) // ignore kKey::Unknown = 0
{
for (int vk = 0; vk < 256; ++vk)
{
if (k != (int)convert_key(vk))
continue;
auto key = (kKey)k;
if (state.vkey_map.find(key) == state.vkey_map.end())
{
state.vkey_map.insert({ key, vk });
}
else
{
LOG("KEY MAP COLLISION %d and %d maps to %d",
vk, state.vkey_map[key], k);
}
}
}
}
RetainedState& retained_state()
{
static RetainedState state;

View File

@@ -19,6 +19,7 @@ struct RetainedState
namespace pp::platform::windows {
void initialize_retained_input_state();
RetainedState& retained_state();
LRESULT CALLBACK main_window_proc(HWND hWnd, UINT msg, WPARAM wp, LPARAM lp);