Project

General

Profile

Statistics
| Revision:

root / proj / include / proj_structures.h @ 320

History | View | Annotate | Download (1.49 KB)

1
#ifndef PROJ_STRUCTURES_H_INCLUDED
2
#define PROJ_STRUCTURES_H_INCLUDED
3

    
4
#include <stdint.h>
5
#include "ent.h"
6

    
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
typedef struct __attribute__((packed)) {
19
    // host
20
    double  host_x;
21
    double  host_y;
22
    double  host_angle;
23
    double  host_health;
24
    double  host_current_health;
25

    
26
    // remote
27
    double  remote_x;
28
    double  remote_y;
29
    double  remote_angle;
30
    double  remote_health;
31
    double  remote_current_health;
32

    
33
    // bullets
34
    size_t  no_bullets;
35
    double *bullets_x;
36
    double *bullets_y;
37
    double *bullets_vx;
38
    double *bullets_vy;
39
    bool   *bullets_shooter; // false for host, true for remote
40
} host_info_t;
41

    
42
typedef struct __attribute__((packed)) {
43
    keys_t  remote_keys_pressed;
44
    double  remote_angle;
45
} remote_info_t;
46

    
47
typedef struct __attribute__((packed)) {
48
    bool   new_bullet;
49
} bullet_info_t;
50

    
51
host_info_t* host_info_ctor(gunner_t *host, gunner_t *remote);
52

    
53
void host_info_dtor(host_info_t *p);
54

    
55
remote_info_t* remote_info_ctor();
56

    
57
void remote_info_dtor(remote_info_t *p);
58

    
59
bullet_info_t* bullet_info_ctor();
60

    
61
void bullet_info_dtor(bullet_info_t *p);
62

    
63
#endif /* end of include guard: PROJ_STRUCTURES_H_INCLUDED */