Files

60 lines
1.0 KiB
C
Raw Permalink Normal View History

#pragma once
#include "core.h"
#include "ui.h"
typedef enum MoveDir {
MOVE_DIR_UP,
MOVE_DIR_DOWN,
MOVE_DIR_LEFT,
MOVE_DIR_RIGHT,
} MoveDir;
2023-12-27 22:42:35 +02:00
typedef enum IconTexture {
HELP_ICON,
SETTINGS_ICON,
2023-12-29 15:12:43 +02:00
CLOSE_ICON,
2023-12-27 22:42:35 +02:00
ICON_TEXTURE_COUNT,
} IconTexture;
2024-01-05 22:19:31 +02:00
typedef struct ColorPalette {
Color bg_color;
Color board_bg_color;
Color tile_colors[11];
} ColorPalette;
typedef struct Tile {
u16 value;
u16 new_value;
2023-12-15 08:41:07 +02:00
bool merged;
f64 anim_x_offset_relative;
f64 anim_y_offset_relative;
u8 tiles_to_move;
} Tile;
typedef struct Game {
Tile board[4][4];
u32 score;
MoveDir last_move_dir;
bool animating;
2023-12-15 08:41:07 +02:00
bool spawning_new_tile;
2023-12-29 21:18:13 +02:00
bool has_lost;
float game_over_bg_opacity;
float game_over_opacity;
2023-12-29 23:09:30 +02:00
float spawning_tile_scale;
Vec2 spawning_tile_coords;
u16 spawning_tile_value;
2023-12-27 22:42:35 +02:00
bool quit_dialog;
2023-12-29 15:12:43 +02:00
bool help_dialog;
2024-01-05 22:19:31 +02:00
bool settings_dialog;
TextureId icon_textures[ICON_TEXTURE_COUNT];
ColorPalette palette;
} Game;
void draw_board(void);
void game_loop(void);