-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbouncer.h
More file actions
122 lines (107 loc) · 2.89 KB
/
Copy pathbouncer.h
File metadata and controls
122 lines (107 loc) · 2.89 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#define BSIZE 127
#define XSIZE 127
#define YSIZE 120
#define ZSIZE 100
#define VEXPRITES 16
#define SCALE 200
#define SPEED 1
/*
* vectorlist class
*
* A class to keep track of the boundaries of a vector symbol. The constructor calculates the
* boundaries when created by the 'new' operator and passed a Vectrex vectorlist. It only adds
* a RAM usage of 6 bytes per unique vectorlist, NOT per animated object!
*/
class vectorlist {
public:
vectorlist(int8_t *sym);
int8_t *vec; /* Vectrex vector list */
int8_t bleft; /* Left boundary */
int8_t bright; /* Right boundary */
int8_t bup; /* Up boundary */
int8_t bdown; /* Down boundary */
private:
void init(int8_t *sym);
};
/*
* Vexprites class
*
* A class to keep track of the position, direction and speed of an object. Each object requires
* only 6 bytes of RAM.
*/
class vexprite
{
public:
vectorlist *sym; /* vectorlist */
int8_t ox, oy; /* Centerpoint of vexprite */
int8_t xdir, ydir; /* Speed and direction of vexprite */
// methods
vexprite();
void draw();
void move();
};
/*
* Vexprite3D adds scale for Z dimension for simulated depth. The class is duplicated and not
* inherited to avoid complexity for the compiler
*/
class vexprite3D
{
public:
vectorlist *sym; /* vectorlist */
int8_t ox, oy; /* Centerpoint of vexprite */
int8_t xdir, ydir; /* Speed and direction of vexprite */
// 3D extensions
int8_t zdir;
int8_t oz;
// methods
vexprite3D();
void draw();
void move();
};
/*
* The following vectorlists ends up readonly in flash memory and take NO RAM space
*/
/*
* Simple square
* Profile ROM: 11 RAM: 0 Bouncer5.box_line_list: On init
*/
#define BX_SIZE 5
int8_t box_line_list[] =
{ 4,
BX_SIZE / 2, BX_SIZE / 2,
-BX_SIZE, 0,
0, -BX_SIZE,
BX_SIZE, 0,
0, BX_SIZE
};
/* Turtle outline ripped from the line2 tutorial
* Profile ROM: 47 RAM: 0 Bouncer5.turtle_line_list: On init
*/
#define TU_SIZE 1
int8_t turtle_line_list[] =
{ 23,
2 * TU_SIZE, 2 * TU_SIZE,
-1 * TU_SIZE, 2 * TU_SIZE,
2 * TU_SIZE, 1 * TU_SIZE,
2 * TU_SIZE, -2 * TU_SIZE,
0 * TU_SIZE, 2 * TU_SIZE,
-1 * TU_SIZE, 1 * TU_SIZE,
1 * TU_SIZE, 3 * TU_SIZE,
-1 * TU_SIZE, 4 * TU_SIZE,
1 * TU_SIZE, 0 * TU_SIZE,
-1 * TU_SIZE, 1 * TU_SIZE,
-1 * TU_SIZE, 0 * TU_SIZE,
-3 * TU_SIZE, 2 * TU_SIZE,
-3 * TU_SIZE, -2 * TU_SIZE,
-1 * TU_SIZE, 0 * TU_SIZE,
-1 * TU_SIZE, -1 * TU_SIZE,
1 * TU_SIZE, 0 * TU_SIZE,
-1 * TU_SIZE, -4 * TU_SIZE,
1 * TU_SIZE, -3 * TU_SIZE,
-1 * TU_SIZE, -1 * TU_SIZE,
0 * TU_SIZE, -2 * TU_SIZE,
2 * TU_SIZE, 2 * TU_SIZE,
2 * TU_SIZE, -1 * TU_SIZE,
-1 * TU_SIZE, -2 * TU_SIZE,
2 * TU_SIZE, -2 * TU_SIZE
};