家用機 - Play Station - C/C++ (PsyQ) - Fill Color



參考資訊:
https://psx.arthus.net/starting.html
https://github.com/ABelliqueux/nolibgs_hello_worlds#installation

main.c

#include <sys/types.h>
#include <stdio.h>
#include <libgte.h>
#include <libetc.h>
#include <libgpu.h>

int main(int argc, char *argv[])
{
    const int w = 320;
    const int h = 240;
    u_long ot = 0;
    TILE t = { 0 };
    DISPENV disp = { 0 };
    DRAWENV draw = { 0 };

    ResetGraph(0);

    SetDefDispEnv(&disp, 0, 0, w, h);
    SetDefDrawEnv(&draw, 0, 0, w, h);
    SetDispMask(1);
    setRGB0(&draw, 0xff, 0, 0);
    draw.isbg = 1;

    PutDispEnv(&disp);
    PutDrawEnv(&draw);

    FntLoad(640, 0);
    FntOpen(100, 100, w, h, 0, 255);

    while (1) {
        setTile(&t);
        setXY0(&t, 50, 50);
        setWH(&t, 30, 30);
        setRGB0(&t, 0, 0xff, 0);
        addPrim(&ot, &t);
        DrawOTag(&ot);

        setTile(&t);
        setXY0(&t, 100, 100);
        setWH(&t, 50, 100);
        setRGB0(&t, 0, 0, 0xff);
        addPrim(&ot, &t);
        DrawOTag(&ot);

        FntFlush(-1);
        DrawSync(0);
        VSync(0);
    }

    return 0;
}