aboutsummaryrefslogtreecommitdiff
path: root/src/player/inc/human_player.h
blob: 9cfd49837539ea32d041e69098a44dd12e99b817 (plain) (blame)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef HUMAN_PLAYER_H
#define HUMAN_PLAYER_H

#include <camera.h>
#include <keyboard.h>
#include <instance.h>
#include <input.h>
#include <mouse.h>
#include <pad.h>
#include <peripheral.h>
#include <player.h>
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>

#ifdef __cplusplus
extern "C"
{
#endif

enum {MAX_SELECTED_INSTANCES = 4};

struct human_player_cfg
{
    struct player_cfg pl;
    union peripheral *p;
    struct camera_dim dim;
};

struct human_player
{
    struct player pl;
    struct camera cam;
    union peripheral *periph;
    struct input in;

    struct sel_instance
    {
        enum sel_type
        {
            INSTANCE_TYPE_UNIT,
            INSTANCE_TYPE_BUILDING
        } type;

        union sel_data
        {
            const struct unit *u;
            const struct building *b;
            const struct resource *r;
            const struct instance *i;
            struct unit *rw_u;
        } d;
    } sel[MAX_SELECTED_INSTANCES];

    struct human_player_target
    {
        const struct instance *ins;
        unsigned char t, n;
        bool render;
    } target;

    size_t n_sel;
};

int human_player_init(const struct human_player_cfg *cfg, struct human_player *h);
void human_player_update(struct human_player *h, struct player_others *o);
int human_player_render(const struct human_player *h, const struct player_others *o);

#ifdef __cplusplus
}
#endif

#endif /* HUMAN_PLAYER_H */