new render function

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

View File

@ -1,29 +1,8 @@
#include <genesis.h> #include <genesis.h>
int main() Line l;
{
//Initialise the bitmap engine void render(){
BMP_init(TRUE, BG_A, PAL0, FALSE);
//Set the colour of the line. We are using pallete 0 for the bitmap, so we have 0->15. 15 is used for white text, so we set an unused pallet colour, 14 to blue - RGB 0000FF.
u16 colour_blue = RGB24_TO_VDPCOLOR(0x0000ff);
u16 colour_red = RGB24_TO_VDPCOLOR(0xff0000);
PAL_setColor(14, colour_blue);
PAL_setColor(13, colour_red);
VDP_setBackgroundColor(13);
//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.y = 0;
l.pt2.x = 255;
l.pt2.y = 0;
l.col = 14;
l.col |= l.col << 4; // if we do not left shift the colour, we get gaps in the line
while(TRUE)
{
//Clear the bitmap //Clear the bitmap
BMP_clear(); BMP_clear();
@ -41,6 +20,38 @@ int main()
{ {
l.pt2.y = 0; l.pt2.y = 0;
} }
}
void update(){
}
int main()
{
//Initialise the bitmap engine
BMP_init(TRUE, BG_A, PAL0, FALSE);
//Set the colour of the line. We are using pallete 0 for the bitmap, so we have 0->15. 15 is used for white text, so we set an unused pallet colour, 14 to blue - RGB 0000FF.
u16 colour_blue = RGB24_TO_VDPCOLOR(0x0000ff);
u16 colour_red = RGB24_TO_VDPCOLOR(0xff0000);
PAL_setColor(14, colour_blue);
PAL_setColor(13, colour_red);
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.pt2.x = 255;
l.pt2.y = 0;
l.col = 14;
l.col |= l.col << 4; // if we do not left shift the colour, we get gaps in the line
while(TRUE)
{
render();
} }
return 0; return 0;
} }