Files
C2048/game.h
T
Illusion e543b5f882 zephr/game: various fixes and improvements
- zephr: handle newlines in text
- fix(zephr): don't overflow color channels bytes when multiplying
  colors
- fix(zephr): don't fallback to UI_CONSTRAINT_FIXED when setting the x
  or y constraint to UI_CONSTRAINT_RELATIVE_PIXELS
- game: added how to play dialog
- game: ability to start a new game
2023-12-29 15:12:43 +02:00

46 lines
748 B
C

#pragma once
#include "core.h"
#include "ui.h"
typedef enum MoveDir {
MOVE_DIR_UP,
MOVE_DIR_DOWN,
MOVE_DIR_LEFT,
MOVE_DIR_RIGHT,
} MoveDir;
typedef enum IconTexture {
HELP_ICON,
SETTINGS_ICON,
CLOSE_ICON,
ICON_TEXTURE_COUNT,
} IconTexture;
typedef struct Tile {
u16 value;
u16 new_value;
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;
bool spawning_new_tile;
bool game_over;
TextureId icon_textures[ICON_TEXTURE_COUNT];
bool quit_dialog;
bool help_dialog;
} Game;
void draw_board(void);
void game_loop(void);