Add scancode and virtual key and fix some sdl stuff on Windows

This commit is contained in:
Lynix
2019-05-19 16:34:29 +02:00
parent 848f05a420
commit ab5188c57d
33 changed files with 920 additions and 382 deletions

View File

@@ -19,9 +19,9 @@ void MenuState::Enter(Ndk::StateMachine& fsm)
Nz::EventHandler& eventHandler = m_context.window.GetEventHandler();
m_keyPressedSlot.Connect(eventHandler.OnKeyPressed, [this] (const Nz::EventHandler*, const Nz::WindowEvent::KeyEvent& key)
{
if (key.code >= Nz::Keyboard::Key::A && key.code < (Nz::Keyboard::Key::A + static_cast<int>(EventStatus::Max) - 1))
if (key.virtualKey >= Nz::Keyboard::VKey::A && key.virtualKey < static_cast<Nz::Keyboard::VKey>(static_cast<int>(Nz::Keyboard::VKey::A) + static_cast<int>(EventStatus::Max) - 1))
{
m_selectedNextState = key.code - static_cast<int>(Nz::Keyboard::Key::A);
m_selectedNextState = static_cast<int>(key.virtualKey) - static_cast<int>(Nz::Keyboard::VKey::A);
}
});
}
@@ -44,4 +44,4 @@ bool MenuState::Update(Ndk::StateMachine& fsm, float /*elapsedTime*/)
void MenuState::DrawMenu()
{
m_text.SetContent("a. Event\nb. Focus\nc. Key\nd. Mouse click\ne. Mouse enter\nf. Mouse move\ng. Text enter\nh. Window modification");
}
}