collab/PineapplePad

git clone https://git.julia.blue/collab/PineapplePad

Joseph RyanFinishing touchesca230b6

master
1012 B61 linesraw
1#ifndef _GRAPHICS_H
2#define _GRAPHICS_H
3#include "ST7735.h"
4
5#define SCREEN_WIDTH    160
6#define SCREEN_HEIGHT   128
7// precompute tangents of view angles
8#define VIEW_Y_MULT     5773
9#define VIEW_Y_DIV      10000
10#define VIEW_X_MULT     5773
11#define VIEW_X_DIV      10000
12#define SELF_OCCLUDE    true
13
14struct Vec2 {
15    int x, y;
16    Vec2(){
17        x = 0; y = 0;
18    }
19
20    Vec2(int x, int y) : x(x), y(y){
21    }
22};
23
24struct Vec3 {
25    int x, y, z;
26    Vec3(){
27        x = 0; y = 0; z = 0;
28    }
29
30    Vec3(int x, int y, int z) : x(x), y(y), z(z) {
31    }
32
33    Vec2 project();
34};
35
36struct Cube {
37    Vec3 pos; // bottom front left vertex is origin
38    int size;
39    int color;
40    Cube(){
41        size = 0;
42    }
43
44    Cube(Vec3 pos, int size, int color = ST7735_WHITE) :
45        pos(pos), size(size), color(color) {
46    }
47
48    void draw();
49};
50
51void drawLine(Vec2 a, Vec2 b, int color = ST7735_WHITE);
52
53void drawPlayer();
54
55void drawGround(int width, int depth);
56
57void printScore(int x);
58
59int randomColor();
60
61#endif