forked from eugene-kirzhanov/flipper-zero-2048-game
-
Notifications
You must be signed in to change notification settings - Fork 0
/
game_controller.h
35 lines (30 loc) · 920 Bytes
/
game_controller.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once
#include <gui/gui.h>
#include "game_state.h"
typedef enum {
UIStateMenu,
UIStateInProgress,
UIStateGameOver,
} UIState;
typedef struct {
UIState ui_state;
GameState state;
int8_t selected_menu_item;
} GameController;
typedef struct {
bool is_handled;
bool should_exit;
} GameControllerInputHandlerResult;
void game_controlller_init(GameController* gamectrl);
void game_controller_save_state(GameController* gamectrl);
bool game_controller_restore_state(GameController* gamectrl);
void game_controller_draw(const GameController* gamectrl, Canvas* const canvas);
void game_controller_handle_input(
GameController* gamectrl,
InputEvent input,
GameControllerInputHandlerResult* out);
#ifdef __game_controller_c
#define MENU_ITEMS_COUNT 2
void game_controller_show_menu(GameController* gamectrl);
void game_controller_close_menu(GameController* gamectrl);
#endif