Subversion Repositories Code-Repo

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
241 Kevin 1
#ifndef TRON_H
2
#define	TRON_H
3
 
4
#include "CUBE.h"
5
 
6
#define TRON_PLAYER_1_COLOR    GREEN
7
#define TRON_PLAYER_2_COLOR    PURPLE
8
#define TRON_PLAYER_1_HEAD     BLUE
9
#define TRON_PLAYER_2_HEAD     RED
10
#define TRON_COLLISION         ORANGE
11
 
12
typedef struct {
13
    unsigned x  :8;
14
    unsigned y  :8;
15
    unsigned z  :8;
16
    unsigned    :8;
17
} TRON_POINT;
18
 
19
typedef union {
20
    struct {
21
        unsigned up         :1;
22
        unsigned down       :1;
23
        unsigned right      :1;
24
        unsigned forward    :1;
25
        unsigned left       :1;
26
        unsigned backward   :1;
27
        unsigned            :2;
28
    };
29
    uint8_t value;
30
} TRON_P1_DIRECTION;
31
 
32
typedef union {
33
    struct {
34
        unsigned up         :1;
35
        unsigned down       :1;
36
        unsigned left       :1;
37
        unsigned backward   :1;
38
        unsigned right      :1;
39
        unsigned forward    :1;
40
        unsigned            :2;
41
    };
42
    uint8_t value;
43
} TRON_P2_DIRECTION;
44
 
45
typedef struct {
46
    TRON_POINT p1_body[CUBE_PIXELS];
47
    TRON_POINT p1_direction;
48
    uint8_t p1_last_direction;
49
 
50
    TRON_POINT p2_body[CUBE_PIXELS];
51
    TRON_POINT p2_direction;
52
    uint8_t p2_last_direction;
53
 
54
    uint32_t length;
55
    uint32_t delay;
56
} TRON_DATA;
57
 
58
void Tron_Init(TRON_DATA *data);
59
void Tron_Main(void);
60
void Tron_Update_Direction(uint8_t p1, uint8_t p2);
61
void Tron_Update_Frame(void);
62
 
63
#endif	/* TRON_H */
64