You've already forked ultrasm64-2
mirror of
https://github.com/HackerN64/ultrasm64-2.git
synced 2026-01-21 10:38:08 -08:00
RGFX5 setters
This commit is contained in:
@@ -1,30 +1,138 @@
|
||||
#include <ultra64.h>
|
||||
#include "rgfx_hud.h"
|
||||
|
||||
static RgfxHud sRgfxHudBuffer[RGFX_HUD_BUFFER_SIZE][RGFX_HUD_LAYERS];
|
||||
#ifdef ULTRASM64_2
|
||||
#define RGFX_PRINTF n64_printf
|
||||
#else
|
||||
#define RGFX_PRINTF osSyncPrintf
|
||||
#endif
|
||||
|
||||
static RgfxHud sRgfxHudBuffer[RGFX_HUD_LAYERS][RGFX_HUD_BUFFER_SIZE];
|
||||
static RgfxHud *sRgfxHudHead[RGFX_HUD_LAYERS] = { &sRgfxHudBuffer[0][0], &sRgfxHudBuffer[1][0], &sRgfxHudBuffer[2][0] };
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
|
||||
RgfxHud *rgfx_hud_create_box(RgfxHud *parent, s16 x, s16 y, s16 z, s16 sX, s16 sY) {
|
||||
return NULL;
|
||||
// platform independent assert
|
||||
|
||||
static void debug_crash(char *s) {
|
||||
RGFX_PRINTF(s);
|
||||
while (TRUE) {}
|
||||
}
|
||||
|
||||
RgfxHud *rgfx_hud_create_txt(RgfxHud *parent, s16 x, s16 y, s16 z, u8 font, char *c) {
|
||||
return NULL;
|
||||
static RgfxHud *alloc_hud(u8 layer) {
|
||||
if ((u32)sRgfxHudHead[layer] >= (u32)&sRgfxHudBuffer[layer] + RGFX_HUD_BUFFER_SIZE) {
|
||||
debug_crash("RGFX: Buffer too large.\n");
|
||||
}
|
||||
return sRgfxHudHead[0]++;
|
||||
}
|
||||
|
||||
RgfxHud *rgfx_hud_create_sprite(RgfxHud *parent, s16 x, s16 y, s16 z, s16 sX, s16 sY, u8 fmt, Texture *sprite) {
|
||||
return NULL;
|
||||
/*
|
||||
* if z == 0 && rotation == 0:
|
||||
* texture rect
|
||||
* else:
|
||||
* ortho
|
||||
*
|
||||
* if alpha == 255:
|
||||
* opaque rendermode
|
||||
* else:
|
||||
* transparent rendermode (no coverage)
|
||||
*/
|
||||
|
||||
static inline void set_default_color(u8 *color) {
|
||||
for (u8 i = 0; i < 4; i++) {
|
||||
color[i] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
RgfxHud *rgfx_hud_create_scissor(RgfxHud *parent, s16 x, s16 y, s16 sX, s16 sY) {
|
||||
return NULL;
|
||||
static inline void set_default_3d_settings(RgfxHud *c) {
|
||||
c->z = 0;
|
||||
c->pitch = 0;
|
||||
c->yaw = 0;
|
||||
c->roll = 0;
|
||||
c->scale = 1.0f;
|
||||
}
|
||||
|
||||
RgfxHud *rgfx_hud_create_gfx(RgfxHud *parent, s16 x, s16 y, s16 z, Gfx *gfx) {
|
||||
return NULL;
|
||||
RgfxHud *rgfx_hud_create_box(RgfxHud *parent, u8 layer, s16 x, s16 y, s16 z, s16 sX, s16 sY) {
|
||||
RgfxHud *c = alloc_hud(layer);
|
||||
c->type = RGFX_BOX;
|
||||
c->parent = parent;
|
||||
c->x = x;
|
||||
c->y = y;
|
||||
c->z = z;
|
||||
set_default_3d_settings(c);
|
||||
set_default_color(&c->d.box.color[0]);
|
||||
c->d.box.sX = sX;
|
||||
c->d.box.sY = sY;
|
||||
return c;
|
||||
}
|
||||
|
||||
RgfxHud *rgfx_hud_create_txt(RgfxHud *parent, u8 layer, s16 x, s16 y, s16 z, u8 font, char *s) {
|
||||
RgfxHud *c = alloc_hud(layer);
|
||||
c->type = RGFX_TEXT;
|
||||
c->parent = parent;
|
||||
c->x = x;
|
||||
c->y = y;
|
||||
c->z = z;
|
||||
set_default_3d_settings(c);
|
||||
set_default_color(&c->d.txt.color[0]);
|
||||
return c;
|
||||
}
|
||||
|
||||
RgfxHud *rgfx_hud_create_sprite(RgfxHud *parent, u8 layer, s16 x, s16 y, s16 z, s16 sX, s16 sY, u8 fmt, Texture *sprite) {
|
||||
RgfxHud *c = alloc_hud(layer);
|
||||
c->type = RGFX_SPRITE;
|
||||
c->parent = parent;
|
||||
c->x = x;
|
||||
c->y = y;
|
||||
c->z = z;
|
||||
set_default_3d_settings(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
RgfxHud *rgfx_hud_create_scissor(RgfxHud *parent, u8 layer, s16 x, s16 y, s16 sX, s16 sY) {
|
||||
RgfxHud *c = alloc_hud(layer);
|
||||
c->type = RGFX_SCISSOR;
|
||||
c->parent = parent;
|
||||
c->x = x;
|
||||
c->y = y;
|
||||
c->d.box.sX = sX;
|
||||
c->d.box.sY = sY;
|
||||
return c;
|
||||
}
|
||||
|
||||
RgfxHud *rgfx_hud_create_gfx(RgfxHud *parent, u8 layer, s16 x, s16 y, s16 z, Gfx *gfx) {
|
||||
RgfxHud *c = alloc_hud(layer);
|
||||
c->type = RGFX_GFX;
|
||||
c->parent = parent;
|
||||
c->x = x;
|
||||
c->y = y;
|
||||
c->z = z;
|
||||
set_default_3d_settings(c);
|
||||
c->d.gfx.d = gfx;
|
||||
return c;
|
||||
}
|
||||
|
||||
s16 get_true_x(RgfxHud *c) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
s16 get_true_y(RgfxHud *c) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void rgfx_hud_draw() {
|
||||
return;
|
||||
for (u8 i = 0; i < RGFX_HUD_LAYERS; i++) {
|
||||
sRgfxHudHead[i]->type = RGFX_END;
|
||||
RgfxHud *c = &sRgfxHudBuffer[i][0];
|
||||
while (c->type != RGFX_END) {
|
||||
switch (c->type) {
|
||||
case RGFX_BOX: break;
|
||||
case RGFX_TEXT: break;
|
||||
case RGFX_SPRITE: break;
|
||||
case RGFX_SCISSOR: break;
|
||||
case RGFX_GFX: break;
|
||||
case RGFX_END: break; // avoids gcc warning
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,10 +57,9 @@ typedef struct {
|
||||
RgfxHudData d;
|
||||
} RgfxHud;
|
||||
|
||||
RgfxHud *rgfx_hud_create_box(RgfxHud *parent, s16 x, s16 y, s16 z, s16 sX, s16 sY);
|
||||
RgfxHud *rgfx_hud_create_txt(RgfxHud *parent, s16 x, s16 y, s16 z, u8 font, char *c);
|
||||
RgfxHud *rgfx_hud_create_sprite(RgfxHud *parent, s16 x, s16 y, s16 z, s16 sX, s16 sY, u8 fmt, Texture *sprite);
|
||||
RgfxHud *rgfx_hud_create_scissor(RgfxHud *parent, s16 x, s16 y, s16 sX, s16 sY);
|
||||
RgfxHud *rgfx_hud_create_gfx(RgfxHud *parent, s16 x, s16 y, s16 z, Gfx *gfx);
|
||||
|
||||
RgfxHud *rgfx_hud_create_box(RgfxHud *parent, u8 layer, s16 x, s16 y, s16 z, s16 sX, s16 sY);
|
||||
RgfxHud *rgfx_hud_create_txt(RgfxHud *parent, u8 layer, s16 x, s16 y, s16 z, u8 font, char *s);
|
||||
RgfxHud *rgfx_hud_create_sprite(RgfxHud *parent, u8 layer, s16 x, s16 y, s16 z, s16 sX, s16 sY, u8 fmt, Texture *sprite);
|
||||
RgfxHud *rgfx_hud_create_scissor(RgfxHud *parent, u8 layer, s16 x, s16 y, s16 sX, s16 sY);
|
||||
RgfxHud *rgfx_hud_create_gfx(RgfxHud *parent, u8 layer, s16 x, s16 y, s16 z, Gfx *gfx);
|
||||
void rgfx_hud_draw();
|
||||
|
||||
Reference in New Issue
Block a user