new render function

This commit is contained in:
Cuptain 2024-08-30 10:17:52 +10:00
parent 6ab95bff58
commit 3b95d24e5e

View File

@ -1,5 +1,33 @@
#include <genesis.h> #include <genesis.h>
Line l;
void render(){
//Clear the bitmap
BMP_clear();
//Draw the line defined above (in the background, hidden)
BMP_drawLine(&l);
//Flip the data to the screen - i.e. actually draw the complete image on screen
BMP_flip(1);
//Increment the destination y coordinate
l.pt2.y = l.pt2.y + 2;
//Reset the destination y coordinate if it hits 160
if (l.pt2.y == 160)
{
l.pt2.y = 0;
}
}
void update(){
}
int main() int main()
{ {
@ -14,7 +42,6 @@ int main()
VDP_setBackgroundColor(13); VDP_setBackgroundColor(13);
//A line needs a source coordinate x,y and a destination coordinate x,y along with a pallete colour. //A line needs a source coordinate x,y and a destination coordinate x,y along with a pallete colour.
Line l;
l.pt1.x = 0; l.pt1.x = 0;
l.pt1.y = 0; l.pt1.y = 0;
l.pt2.x = 255; l.pt2.x = 255;
@ -24,23 +51,7 @@ int main()
while(TRUE) while(TRUE)
{ {
//Clear the bitmap render();
BMP_clear();
//Draw the line defined above (in the background, hidden)
BMP_drawLine(&l);
//Flip the data to the screen - i.e. actually draw the complete image on screen
BMP_flip(1);
//Increment the destination y coordinate
l.pt2.y = l.pt2.y + 2;
//Reset the destination y coordinate if it hits 160
if (l.pt2.y == 160)
{
l.pt2.y = 0;
}
} }
return 0; return 0;
} }