-
Notifications
You must be signed in to change notification settings - Fork 2
/
moving_cube.c
48 lines (38 loc) · 898 Bytes
/
moving_cube.c
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
//
// File: moving_cube.c
// Author: Roger Boesch
// Info: Shows basic uasge of joystick
//
// Created for Classics Coder and CMOC by Roger Boesch
//
#include <vectrex.h>
#pragma vx_copyright "2020"
#pragma vx_title_pos 0,-80
#pragma vx_title_size -8, 80
#pragma vx_title "g CLASSICS CODER"
#pragma vx_music vx_music_1
#define MAX_BRIGHTNESS (0x7f)
int8_t rectangle[8] = {
40, 0,
0, 40,
-40, 0,
0, -40
};
int main() {
int8_t x = -20;
int8_t y = -20;
while(1) {
wait_recal();
controller_enable_1_x();
controller_enable_1_y();
controller_check_joysticks();
if (controller_joystick_1_x() < 0) y -= 1;
if (controller_joystick_1_x() > 0) y += 1;
if (controller_joystick_1_y() < 0) x -= 1;
if (controller_joystick_1_y() > 0) x += 1;
intensity_a(MAX_BRIGHTNESS);
moveto_d(x, y);
draw_vl_a(4, rectangle);
}
return 0;
}