Skip to content

Commit

Permalink
Input works
Browse files Browse the repository at this point in the history
  • Loading branch information
ferris committed May 17, 2013
1 parent cca8158 commit b058d65
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,34 @@ int Main(const List<String>& arguments)
auto running = true;

auto window = Window::Create("Vip8");
window->KeyDown += [&] (Key key) { if (key == Key::Escape) running = false; };
Key keys[] =
{
Key::Number1, Key::Number2, Key::Number3, Key::Number4,
Key::Q, Key::W, Key::E, Key::R,
Key::A, Key::S, Key::D, Key::F,
Key::Z, Key::X, Key::C, Key::V
};
window->KeyDown += [&] (Key key)
{
if (key == Key::Escape)
{
running = false;
}
else
{
for (int i = 0; i < 16; i++)
{
if (key == keys[i]) chip8.SetInput(i, true);
}
}
};
window->KeyUp += [&] (Key key)
{
for (int i = 0; i < 16; i++)
{
if (key == keys[i]) chip8.SetInput(i, false);
}
};
window->Closing += [&] { running = false; };

auto loadAndStartRomImage = [&] (const String& fileName)
Expand Down

0 comments on commit b058d65

Please sign in to comment.