diff --git a/src/main.c b/src/main.c index 2115d1c..cee3d77 100644 --- a/src/main.c +++ b/src/main.c @@ -15,9 +15,23 @@ const u8 map[10][10] = {{1,1,1,1,1,1,1,1,1,1}, {1,0,0,0,0,0,1,0,0,1}, {1,1,1,1,1,1,1,1,1,1}}; +void castRay(s16 angle){ + u8 r,mx,my,mp,dof; + float rx,ry,ra,xo,yo; + s16 ind = (int)((float)angle/360.0f*1024.0f); + fix16 dx = sinFix16(ind); + fix16 dy = cosFix16(ind); + fix16 tan = fix16Div(dy, dx); + fix16 aTan = fix16Div(-1, tan); + s16 tanInt = fix16ToInt(fix16Mul(dx, 100)); + char str[10]; + sprintf(str, "%d", 10); + BMP_drawText(str, 20, 0); +} + void mapscan(){ - u8 mapcolor = 14; + u8 mapcolor = 12; mapcolor |= mapcolor << 4; int mapscale = 10; @@ -42,6 +56,7 @@ void render(){ BMP_drawLine(&l); mapscan(); + castRay(10); //Flip the data to the screen - i.e. actually draw the complete image on screen BMP_flip(1); @@ -93,11 +108,13 @@ int main() u16 colour_red = RGB24_TO_VDPCOLOR(0x756a4a); PAL_setColor(14, colour_blue); PAL_setColor(13, colour_red); + PAL_setColor(12, RGB24_TO_VDPCOLOR(0x00ff00)); + PAL_setColor(15, RGB24_TO_VDPCOLOR(0xff0000)); VDP_setBackgroundColor(13); //A line needs a source coordinate x,y and a destination coordinate x,y along with a pallete colour. - l.pt1.x = 0; - l.pt1.y = 0; + l.pt1.x = 15; + l.pt1.y = 15; l.pt2.x = 255; l.pt2.y = 0; l.col = 14;