Project

General

Profile

Statistics
| Revision:

root / proj / include / proj_structures.h @ 334

History | View | Annotate | Download (1.47 KB)

1 312 up20180655
#ifndef PROJ_STRUCTURES_H_INCLUDED
2
#define PROJ_STRUCTURES_H_INCLUDED
3
4
#include <stdint.h>
5 320 up20180655
#include "ent.h"
6 312 up20180655
7
typedef struct keys {
8
    uint8_t w_pressed       : 1;
9
    uint8_t a_pressed       : 1;
10
    uint8_t s_pressed       : 1;
11
    uint8_t d_pressed       : 1;
12
    uint8_t ctrl_pressed    : 1;
13
    uint8_t plus_pressed    : 1;
14
    uint8_t minus_pressed   : 1;
15
    uint8_t lb_pressed      : 1;
16
} keys_t;
17
18 321 up20180642
typedef struct {
19 312 up20180655
    // host
20 329 up20180655
    int16_t    host_x;
21
    int16_t    host_y;
22
    int16_t    host_angle;
23
    int16_t    host_health;
24
    int16_t    host_current_health;
25 312 up20180655
26
    // remote
27 329 up20180655
    int16_t    remote_x;
28
    int16_t    remote_y;
29
    int16_t    remote_angle;
30
    int16_t    remote_health;
31
    int16_t    remote_current_health;
32 312 up20180655
33
    // bullets
34 329 up20180655
    uint8_t    no_bullets;
35
    int16_t   *bullets_x;
36
    int16_t   *bullets_y;
37
    int16_t   *bullets_vx;
38
    int16_t   *bullets_vy;
39
    bool      *bullets_shooter; // false for host, true for remote
40 312 up20180655
} host_info_t;
41
42 321 up20180642
typedef struct {
43 312 up20180655
    keys_t  remote_keys_pressed;
44 320 up20180655
    double  remote_angle;
45 312 up20180655
} remote_info_t;
46
47 321 up20180642
typedef struct {
48 320 up20180655
    bool   new_bullet;
49
} bullet_info_t;
50
51
host_info_t* host_info_ctor(gunner_t *host, gunner_t *remote);
52
53 312 up20180655
void host_info_dtor(host_info_t *p);
54
55 324 up20180642
remote_info_t* remote_info_ctor(void);
56 320 up20180655
57 312 up20180655
void remote_info_dtor(remote_info_t *p);
58
59 324 up20180642
bullet_info_t* bullet_info_ctor(void);
60 320 up20180655
61
void bullet_info_dtor(bullet_info_t *p);
62
63 312 up20180655
#endif /* end of include guard: PROJ_STRUCTURES_H_INCLUDED */