-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame.h
51 lines (42 loc) · 1.05 KB
/
game.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
#ifndef GAME_H
#define GAME_H
#include <avr/eeprom.h>
#include <stdbool.h>
#include <stdint.h>
#define MAX_GAME_LENGTH 50
#define RED 0
#define GREEN 1
#define YELLOW 2
#define BLUE 3
#define MODE_NORMAL 0
#define MODE_SILENT 1
#define MODE_HARD 2
#define MODE_FREE_PLAY 3
#define MODE_NONE
#define FREQ_1 TONE_C6
#define FREQ_2 TONE_E6
#define FREQ_3 TONE_G6
#define FREQ_4 TONE_A6
typedef struct {
uint16_t length;
uint16_t speed;
uint8_t mode;
uint8_t pattern[MAX_GAME_LENGTH];
} game_t;
void game_start(uint8_t starting_length);
void game_free_play(void);
void game_over(void);
void game_victory(void);
void game_start_melody(void);
void game_power_up_melody(void);
void game_surprise_melody(void);
void game_display_pattern(void);
void game_display_segment(uint8_t color);
void game_button_segment(uint8_t color);
uint8_t game_get_input(void);
bool game_input_correct(uint8_t index, uint8_t input);
void game_generate_pattern(void);
void game_set_speed(void);
void game_set_mode(uint8_t mode);
void game_rand_setup(void);
#endif //GAME_H