nolibgs_demo/OVL/hello_light/hello_light.c
2021-11-14 18:27:50 +01:00

58 lines
1.6 KiB
C

#include "../common.h"
DISPENV disp[2];
DRAWENV draw[2];
u_long ot[2][OTLEN];
char primbuff[2][32768];
char * nextpri = primbuff[0];
uint8_t db = 0;
CVECTOR BGcolor = { 40, 120, 168 };
// Prototypes
void init()
{
// Reset the GPU before doing anything and the controller
PadInit(0);
ResetGraph(0);
// Initialize and setup the GTE
InitGeom();
SetGeomOffset(CENTERX, CENTERY); // x, y offset
SetGeomScreen(CENTERX); // Distance between eye and screen
// Set the display and draw environments
SetDefDispEnv(&disp[0], 0, 0 , SCREENXRES, SCREENYRES);
SetDefDispEnv(&disp[1], 0, SCREENYRES, SCREENXRES, SCREENYRES);
SetDefDrawEnv(&draw[0], 0, SCREENYRES, SCREENXRES, SCREENYRES);
SetDefDrawEnv(&draw[1], 0, 0, SCREENXRES, SCREENYRES);
if (VMODE)
{
SetVideoMode(MODE_PAL);
disp[0].screen.y += 8;
disp[1].screen.y += 8;
}
SetDispMask(1);
setRGB0(&draw[0], BGcolor.r, BGcolor.g, BGcolor.b);
setRGB0(&draw[1], BGcolor.r, BGcolor.g, BGcolor.b);
draw[0].isbg = 1;
draw[1].isbg = 1;
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
// Init font system
FntLoad(960, 0);
FntOpen(16, 16, 196, 64, 0, 256);
}
void display(void)
{
DrawSync(0);
VSync(0);
PutDispEnv(&disp[db]);
PutDrawEnv(&draw[db]);
DrawOTag(&ot[db][OTLEN - 1]);
db = !db;
nextpri = primbuff[db];
}
#include "hello_ovl_light.c"
int main()
{
ovl_main_light();
}