-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path2048.h
56 lines (46 loc) · 1.32 KB
/
2048.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
Application template for Amazfit Bip BipOS
(C) Maxim Volkov 2019 <Maxim.N.Volkov@ya.ru>
Game 2048 for Amazfit Bip BipOS
(C) Claudio Benvenuti 2019 <claudio.benvenuti@gmail.com>
*/
#ifndef __APP_2048_H__
#define __APP_2048_H__
#define SIZE 4
struct game {
short tiles[SIZE][SIZE];
short undo[SIZE][SIZE];
short moves;
unsigned int score;
unsigned int record;
};
struct app_data_ {
void* ret_f;
struct game game;
short screen;
Elf_proc_* proc;
};
short random_spot();
short random_value();
void print(struct game* g);
void twist(struct game* g);
void flip(struct game* g);
void begin(struct game* g, int index_listed);
void fall(struct game* g);
unsigned int fall_column(short* a, short* b);
int same(struct game* a, struct game* b);
int tryfalling(struct game* g);
void popup(struct game* g);
void move(struct game* g, short way);
int read_move(void);
unsigned short randint( short max );
void draw_button(int from_x, int from_y, int to_x, int to_y);
void ask_confirmation();
void show_screen (void *return_screen);
void key_press_screen();
int dispatch_screen (void *param);
void screen_job();
void draw_board(struct game* g);
void draw_screen(struct game* g);
void draw_score_screen(short moves, unsigned int score, unsigned int record);
#endif