2048: Use the arrow keys and the Home key as input
All checks were successful
Build and test / build (push) Successful in 1m53s
All checks were successful
Build and test / build (push) Successful in 1m53s
This commit is contained in:
parent
fc37634a18
commit
70c63572b2
@ -50,9 +50,9 @@ class GameWidget final : public ui::Widget
|
||||
|
||||
bool should_add_tile = false;
|
||||
|
||||
switch (request.key)
|
||||
switch (request.code)
|
||||
{
|
||||
case 'w': {
|
||||
case moon::K_UpArrow: {
|
||||
bool changed;
|
||||
changed = move_up();
|
||||
if (changed) should_add_tile = true;
|
||||
@ -61,7 +61,7 @@ class GameWidget final : public ui::Widget
|
||||
if (changed) should_add_tile = true;
|
||||
}
|
||||
break;
|
||||
case 'a': {
|
||||
case moon::K_LeftArrow: {
|
||||
bool changed;
|
||||
changed = move_left();
|
||||
if (changed) should_add_tile = true;
|
||||
@ -70,7 +70,7 @@ class GameWidget final : public ui::Widget
|
||||
if (changed) should_add_tile = true;
|
||||
}
|
||||
break;
|
||||
case 's': {
|
||||
case moon::K_DownArrow: {
|
||||
bool changed;
|
||||
changed = move_down();
|
||||
if (changed) should_add_tile = true;
|
||||
@ -79,7 +79,7 @@ class GameWidget final : public ui::Widget
|
||||
if (changed) should_add_tile = true;
|
||||
}
|
||||
break;
|
||||
case 'd': {
|
||||
case moon::K_RightArrow: {
|
||||
bool changed;
|
||||
changed = move_right();
|
||||
if (changed) should_add_tile = true;
|
||||
@ -88,7 +88,7 @@ class GameWidget final : public ui::Widget
|
||||
if (changed) should_add_tile = true;
|
||||
}
|
||||
break;
|
||||
case 'r': {
|
||||
case moon::K_Home: {
|
||||
reset();
|
||||
return ui::EventResult::DidHandle;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user