TK2048/src/game_logic.c
2025-07-15 22:20:28 +02:00

29 lines
574 B
C

#include "game_logic.h"
static uint8_t game_grid_alpha[GRID_WIDTH * GRID_HEIGHT];
static uint8_t game_grid_beta[GRID_WIDTH * GRID_HEIGHT];
static uint8_t *front_grid = game_grid_alpha;
static uint8_t *back_grid = game_grid_beta;
void swap_grids(void);
void swap_grids(void) {
uint8_t *temp = front_grid;
front_grid = back_grid;
back_grid = temp;
}
uint8_t *get_current_grid(void) {
return front_grid;
}
uint8_t *step_game(step_direction dir) {
// TODO: Update the grid state calculating the new state in the back grid
swap_grids();
return front_grid;
}