Revision 336
even more docs
proj/include/ent.h | ||
---|---|---|
16 | 16 |
#define GUNNER_PLAYER BIT(2) |
17 | 17 |
#define GUNNER_FOLLOW BIT(3) |
18 | 18 |
|
19 |
struct gunner; |
|
20 | 19 |
typedef struct gunner gunner_t; |
21 | 20 |
gunner_t* (gunner_ctor)(basic_sprite_t *dude, basic_sprite_t *weapon, uint16_t type, int team); |
22 | 21 |
void (gunner_dtor)(gunner_t *p); |
... | ... | |
41 | 40 |
|
42 | 41 |
double (gunner_distance)(const gunner_t *p1, const gunner_t *p2); |
43 | 42 |
|
44 |
struct bullet; |
|
45 | 43 |
typedef struct bullet bullet_t; |
46 | 44 |
bullet_t* (bullet_ctor)(const gunner_t *shooter, const basic_sprite_t *b, double x, double y, double vx, double vy); |
47 | 45 |
void (bullet_dtor)(bullet_t *p); |
... | ... | |
62 | 60 |
void (bullet_draw_list)(list_t *bullet_list); |
63 | 61 |
void (gunner_draw_health)(const gunner_t *p); |
64 | 62 |
|
65 |
struct map; |
|
66 | 63 |
typedef struct map map_t; |
67 | 64 |
map_t* (map_ctor)(const char *const *background, const char *const *collide); |
68 | 65 |
void (map_dtor)(map_t *p); |
proj/include/proj_structures.h | ||
---|---|---|
5 | 5 |
#include "ent.h" |
6 | 6 |
|
7 | 7 |
typedef struct keys { |
8 |
/// @brief W is pressed when 1 |
|
8 | 9 |
uint8_t w_pressed : 1; |
10 |
/// @brief A is pressed when 1 |
|
9 | 11 |
uint8_t a_pressed : 1; |
12 |
/// @brief S is pressed when 1 |
|
10 | 13 |
uint8_t s_pressed : 1; |
14 |
/// @brief D is pressed when 1 |
|
11 | 15 |
uint8_t d_pressed : 1; |
16 |
/// @brief Ctrl is pressed when 1 |
|
12 | 17 |
uint8_t ctrl_pressed : 1; |
18 |
/// @brief Plus (+) is pressed when 1 |
|
13 | 19 |
uint8_t plus_pressed : 1; |
20 |
/// @brief Minus (-) is pressed when 1 |
|
14 | 21 |
uint8_t minus_pressed : 1; |
22 |
/// @brief Mouse left button is pressed when 1 |
|
15 | 23 |
uint8_t lb_pressed : 1; |
16 | 24 |
} keys_t; |
17 | 25 |
|
18 | 26 |
typedef struct { |
19 | 27 |
// host |
28 |
/// @brief Host player X-position |
|
20 | 29 |
int16_t host_x; |
30 |
/// @brief Host player Y-postition |
|
21 | 31 |
int16_t host_y; |
32 |
/// @brief Host player angle |
|
22 | 33 |
int16_t host_angle; |
34 |
/// @brief Host player health |
|
23 | 35 |
int16_t host_health; |
36 |
/// @brief Host player current health |
|
24 | 37 |
int16_t host_current_health; |
25 | 38 |
|
26 | 39 |
// remote |
40 |
/// @brief Remote player X-position |
|
27 | 41 |
int16_t remote_x; |
42 |
/// @brief Remote player Y-postition |
|
28 | 43 |
int16_t remote_y; |
44 |
/// @brief Remote player angle |
|
29 | 45 |
int16_t remote_angle; |
46 |
/// @brief Remote player health |
|
30 | 47 |
int16_t remote_health; |
48 |
/// @brief Remote player current health |
|
31 | 49 |
int16_t remote_current_health; |
32 | 50 |
|
33 | 51 |
// bullets |
... | ... | |
40 | 58 |
} host_info_t; |
41 | 59 |
|
42 | 60 |
typedef struct { |
61 |
/// @brief Remote keys that are pressed |
|
43 | 62 |
keys_t remote_keys_pressed; |
63 |
/// @brief Remote player angle |
|
44 | 64 |
double remote_angle; |
45 | 65 |
} remote_info_t; |
46 | 66 |
|
47 | 67 |
typedef struct { |
68 |
/// @brief New bullet signal from remote |
|
48 | 69 |
bool new_bullet; |
49 | 70 |
} bullet_info_t; |
50 | 71 |
|
proj/libs/classes/include/list.h | ||
---|---|---|
23 | 23 |
* @{ |
24 | 24 |
*/ |
25 | 25 |
|
26 |
struct list_node; |
|
26 |
/** |
|
27 |
* @brief List node. |
|
28 |
*/ |
|
27 | 29 |
typedef struct list_node list_node_t; |
28 | 30 |
|
29 | 31 |
/** |
... | ... | |
62 | 64 |
* @} |
63 | 65 |
*/ |
64 | 66 |
|
65 |
struct list; |
|
66 |
|
|
67 |
/** |
|
68 |
* @brief List. |
|
69 |
*/ |
|
67 | 70 |
typedef struct list list_t; |
68 | 71 |
|
69 | 72 |
/** |
proj/libs/classes/include/queue.h | ||
---|---|---|
12 | 12 |
* @{ |
13 | 13 |
*/ |
14 | 14 |
|
15 |
struct queue; |
|
16 | 15 |
typedef struct queue queue_t; |
17 | 16 |
|
18 | 17 |
/** |
proj/libs/graph/include/graph.h | ||
---|---|---|
11 | 11 |
*/ |
12 | 12 |
|
13 | 13 |
// Graphics modes |
14 |
/// @brief Indexed graphic mode, 1024x768 px |
|
14 | 15 |
#define INDEXED_1024_768 0x105 |
16 |
/// @brief Direct graphic mode, 640x480 px, RGB = 888 bits |
|
15 | 17 |
#define DIRECT_640_480_888 0x110 |
18 |
/// @brief Direct graphic mode, 800x600 px, RGB = 888 bits |
|
16 | 19 |
#define DIRECT_800_600_888 0x115 |
20 |
/// @brief Direct graphic mode, 1024x768 px, RGB = 888 bits |
|
17 | 21 |
#define DIRECT_1024_768_888 0x118 |
22 |
/// @brief Direct graphic mode, 1280x1024 px, RGB = 565 bits |
|
18 | 23 |
#define DIRECT_1280_1024_565 0x11A |
24 |
/// @brief Direct graphic mode, 1280x1024 px, RGB = 888 bits |
|
19 | 25 |
#define DIRECT_1280_1024_888 0x11B |
20 | 26 |
|
21 | 27 |
// Colors in RBG (8 bit) |
28 |
/// @brief Black color |
|
22 | 29 |
#define GRAPH_BLACK 0x000000 |
30 |
/// @brief White color |
|
23 | 31 |
#define GRAPH_WHITE 0xFFFFFF |
32 |
/// @brief Transparent |
|
24 | 33 |
#define GRAPH_TRANSPARENT 0x00 |
34 |
/// @brief Red color |
|
25 | 35 |
#define GRAPH_RED 0xFF0000 |
26 | 36 |
|
27 |
// Alpha
|
|
37 |
/// @brief Alpha threshold, from which it is either considered transparent or opaque
|
|
28 | 38 |
#define ALPHA_THRESHOLD 0x7F |
29 | 39 |
|
30 | 40 |
/** |
proj/libs/kbc/include/keyboard.h | ||
---|---|---|
39 | 39 |
#define MINUS_MAKE_CODE 0x35 |
40 | 40 |
/** @brief Minus (-) Break Code */ |
41 | 41 |
#define MINUS_BREAK_CODE 0xB5 |
42 |
/** @brief Enter Make Code */ |
|
42 | 43 |
#define ENTER_MAKE_CODE 0x1C |
44 |
/** @brief Enter Break Code */ |
|
43 | 45 |
#define ENTER_BREAK_CODE 0x9C |
46 |
/** @brief Backspace Make Code */ |
|
44 | 47 |
#define BACKSPACE_MAKE_CODE 0x0E |
48 |
/** @brief Backspace Break Code */ |
|
45 | 49 |
#define BACKSPACE_BREAK_CODE 0x8E |
50 |
/** @brief ESC Make Code */ |
|
51 |
#define ESC_MAKE_CODE 0x01 |
|
52 |
/** @brief ESC Break Code */ |
|
53 |
#define ESC_BREAK_CODE 0x81 |
|
46 | 54 |
|
47 |
#define ESC_MAKE_CODE 0x01 /** @brief ESC Make Code */ |
|
48 |
#define ESC_BREAK_CODE 0x81 /** @brief ESC Break Code */ |
|
49 |
|
|
50 | 55 |
/** |
51 | 56 |
* @brief Subscribes Keyboard Interrupts and disables Minix Default IH. |
52 | 57 |
* @param interrupt_bit Bit of Interrupt Vector that will be set when Keyboard Interrupt is pending |
... | ... | |
56 | 61 |
*/ |
57 | 62 |
int (subscribe_kbc_interrupt)(uint8_t interrupt_bit, int *interrupt_id); |
58 | 63 |
|
64 |
/** |
|
65 |
* @brief Get scancode read from keyboard. |
|
66 |
* @return Pointer to begin of scancode array (array with size 2) |
|
67 |
*/ |
|
59 | 68 |
const uint8_t* keyboard_get_scancode(void); |
69 |
/** |
|
70 |
* @brief Get state of reading (done). |
|
71 |
* @return 1 if done, 0 otherwise |
|
72 |
*/ |
|
60 | 73 |
int keyboard_get_done(void); |
74 |
/** |
|
75 |
* @brief Get size of read scancode (1 or 2). |
|
76 |
* @return Size of scancode |
|
77 |
*/ |
|
61 | 78 |
int keyboard_get_size(void); |
79 |
/** |
|
80 |
* @brief Get error code of previous run of kbc_ih, if an error occured. |
|
81 |
* @return Error code, or 0 if successful |
|
82 |
*/ |
|
62 | 83 |
int keyboard_get_error(void); |
63 |
|
|
84 |
/** |
|
85 |
* @brief KBC interrupt handler. Reads scancodes. |
|
86 |
*/ |
|
64 | 87 |
void (kbc_ih)(void); |
65 |
|
|
88 |
/** |
|
89 |
* @brief Poll keyboard for scancodes. |
|
90 |
* @param bytes Array to put read bytes (up to 2) |
|
91 |
* @param size Number of ready bytes (1 or 2) |
|
92 |
* @return SUCCESS if operation was successful, other value otherwise |
|
93 |
*/ |
|
66 | 94 |
int (keyboard_poll)(uint8_t bytes[], uint8_t *size); |
67 | 95 |
|
68 | 96 |
/** |
proj/libs/uart/include/hltp.h | ||
---|---|---|
12 | 12 |
#include "uart.h" |
13 | 13 |
#include "proj_structures.h" |
14 | 14 |
|
15 |
/** |
|
16 |
* @brief Data types that HLTP is familiar with (i.e., can send and intepret). |
|
17 |
*/ |
|
15 | 18 |
typedef enum{ |
16 | 19 |
hltp_type_invalid = 0x00, |
17 | 20 |
hltp_type_string = 0x53, |
proj/src/proj.c | ||
---|---|---|
12 | 12 |
#include "mouse.h" |
13 | 13 |
#include "graph.h" |
14 | 14 |
#include "menu.h" |
15 |
#include "text_timer.h" |
|
15 | 16 |
#include "rtc.h" |
16 | 17 |
#include "hltp.h" |
17 | 18 |
#include "interrupts_func.h" |
Also available in: Unified diff