Extract node lifecycle, preview runtime, and Win32 input state
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user