rework random shape selection

This commit is contained in:
2025-02-03 14:05:53 +01:00
parent c21419480c
commit df93300798
4 changed files with 54 additions and 36 deletions

View File

@@ -9,22 +9,18 @@
#define COLUMNS ((int8_t)10)
#define ROWS ((int8_t)(COLUMNS * 2))
typedef struct {
ShapeId id;
int8_t x;
int8_t y;
} SelectedShape;
typedef const Colour* CRow;
typedef Colour* Row;
typedef struct {
Row rows[ROWS];
SelectedShape selected;
ShapeId next_shape;
ShapeId nxt[7]; // the order of the shape ids that they should appear in
uint8_t curr_idx; // current shape index
int8_t sel_x; // selected shape x position
int8_t sel_y; // selected shape y position
} GameData;
void set_next_shape(GameData* game_data);
void next_shape(GameData* game_data);
void game_init(GameData* game_data); // initializes the game
void game_update(GameData* game_data, const uint8_t* keys); // updates the game's state
void game_free(GameData* game_data); // free all data stored with the game