collab/PineapplePad
git clone https://git.julia.blue/collab/PineapplePad
ca230b6
master
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 { 15int x ,y ; 16Vec2 (){ 17x = 0 ;y = 0 ; 18 } 19 20Vec2 (int x ,int y ) :x (x ),y (y ){ 21 } 22}; 23 24struct Vec3 { 25int x ,y ,z ; 26Vec3 (){ 27x = 0 ;y = 0 ;z = 0 ; 28 } 29 30Vec3 (int x ,int y ,int z ) :x (x ),y (y ),z (z ) { 31 } 32 33Vec2 project (); 34}; 35 36struct Cube { 37Vec3 pos ;// bottom front left vertex is origin 38int size ; 39int color ; 40Cube (){ 41size = 0 ; 42 } 43 44Cube (Vec3 pos ,int size ,int color = ST7735_WHITE ) : 45pos (pos ),size (size ),color (color ) { 46 } 47 48void 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