Fix inverted up and down (#18)

This commit is contained in:
Shadowtrance
2026-01-04 09:31:17 +10:00
committed by GitHub
parent 6cb52d826d
commit 3bc1e7a373
+4 -4
View File
@@ -154,10 +154,10 @@ static void game_play_event(lv_event_t * e)
lv_dir_t dir = lv_indev_get_gesture_dir(lv_indev_active()); lv_dir_t dir = lv_indev_get_gesture_dir(lv_indev_active());
switch (dir) { switch (dir) {
case LV_DIR_TOP: case LV_DIR_TOP:
success = move_left(&(game_2048->score), game_2048->matrix_size, game_2048->matrix); success = move_right(&(game_2048->score), game_2048->matrix_size, game_2048->matrix);
break; break;
case LV_DIR_BOTTOM: case LV_DIR_BOTTOM:
success = move_right(&(game_2048->score), game_2048->matrix_size, game_2048->matrix); success = move_left(&(game_2048->score), game_2048->matrix_size, game_2048->matrix);
break; break;
case LV_DIR_LEFT: case LV_DIR_LEFT:
success = move_up(&(game_2048->score), game_2048->matrix_size, game_2048->matrix); success = move_up(&(game_2048->score), game_2048->matrix_size, game_2048->matrix);
@@ -177,10 +177,10 @@ static void game_play_event(lv_event_t * e)
if (!game_2048->game_over) { if (!game_2048->game_over) {
switch (*((const uint8_t *) lv_event_get_param(e))) { switch (*((const uint8_t *) lv_event_get_param(e))) {
case LV_KEY_UP: case LV_KEY_UP:
success = move_left(&(game_2048->score), game_2048->matrix_size, game_2048->matrix); success = move_right(&(game_2048->score), game_2048->matrix_size, game_2048->matrix);
break; break;
case LV_KEY_DOWN: case LV_KEY_DOWN:
success = move_right(&(game_2048->score), game_2048->matrix_size, game_2048->matrix); success = move_left(&(game_2048->score), game_2048->matrix_size, game_2048->matrix);
break; break;
case LV_KEY_LEFT: case LV_KEY_LEFT:
success = move_up(&(game_2048->score), game_2048->matrix_size, game_2048->matrix); success = move_up(&(game_2048->score), game_2048->matrix_size, game_2048->matrix);