Remove embedded default font

This commit is contained in:
Lucas Vieira 2025-04-25 00:40:58 -03:00
parent 9599852258
commit 3cb8cda422
6 changed files with 33 additions and 50 deletions

View file

@ -66,10 +66,6 @@ void draw_quad(int16_t vx, int16_t vy,
uint8_t semitrans,
uint16_t otz);
void draw_text(int x, int y, int z, const char *text);
void render_loading_text();
RECT *render_get_buffer_clip(void);
#endif

View file

@ -8,11 +8,8 @@ RenderContext ctx;
void
setup_context()
{
// Initialize the GPU and load the default font texture provided by
// PSn00bSDK at (960, 0) in VRAM.
// Initialize the GPU
ResetGraph(0);
FntLoad(960, 0);
FntOpen(4, 12, 312, 16, 2, 256);
// Place the two framebuffers vertically in VRAM.
SetDefDrawEnv(&ctx.buffers[0].draw_env, 0, 0, SCREEN_XRES, SCREEN_YRES);
@ -128,16 +125,6 @@ sort_prim(void *prim, uint32_t otz)
assert(ctx.next_packet <= &ctx.buffers[ctx.active_buffer].buffer[BUFFER_LENGTH]);
}
// A simple helper for drawing text using PSn00bSDK's debug font API. Note that
// FntSort() requires the debug font texture to be uploaded to VRAM beforehand
// by calling FntLoad().
void
draw_text(int x, int y, int z, const char *text)
{
ctx.next_packet = FntSort(get_ot_at(z), get_next_prim(), x, y, text);
assert(ctx.next_packet <= &ctx.buffers[ctx.active_buffer].buffer[BUFFER_LENGTH]);
}
uint32_t *
get_ot_at(uint32_t otz)
{
@ -145,15 +132,6 @@ get_ot_at(uint32_t otz)
return &buffer->ot[otz];
}
void
render_loading_text()
{
swap_buffers();
draw_text(CENTERX - 52, CENTERY - 4, 0, "Now Loading...");
swap_buffers();
swap_buffers();
}
RECT *
render_get_buffer_clip(void)
{

View file

@ -261,17 +261,6 @@ screen_credits_draw(void *d)
{
screen_credits_data *data = (screen_credits_data *)d;
if(debug_mode) {
uint32_t elapsed_sectors;
sound_xa_get_elapsed_sectors(&elapsed_sectors);
FntPrint(-1, "%-29s %4s %3d\n",
GIT_COMMIT,
GetVideoMode() == MODE_PAL ? "PAL" : "NTSC",
get_frame_rate());
FntPrint(-1, " %08u\n", elapsed_sectors);
FntFlush(-1);
}
// Get current text
const char **window = &creditstxt[data->entry];
if(*window != NULL) {

View file

@ -264,13 +264,24 @@ screen_levelselect_draw(void *d)
if(debug_mode) {
uint32_t elapsed_sectors;
char buffer[80];
sound_xa_get_elapsed_sectors(&elapsed_sectors);
FntPrint(-1, "%-29s %4s %3d\n",
snprintf(buffer, 120,
"DBG %1u\n"
"%-29s\n"
"%4s %3d Hz\n"
"Build Date %11s %8s\n"
"BGM SECTORS %08u",
debug_mode,
GIT_COMMIT,
GetVideoMode() == MODE_PAL ? "PAL" : "NTSC",
get_frame_rate());
FntPrint(-1, " %08u\n", elapsed_sectors);
FntFlush(-1);
get_frame_rate(),
__DATE__, __TIME__,
elapsed_sectors);
font_draw_sm(buffer, 8, 12);
draw_quad(0, 0, SCREEN_XRES, 75,
0, 0, 0, 1,
OTZ_LAYER_LEVEL_FG_FRONT);
}
// Draw background

View file

@ -6,6 +6,7 @@
#include "screen.h"
#include "input.h"
#include "render.h"
#include "basic_font.h"
typedef struct {
char buffer[255];
@ -98,6 +99,6 @@ screen_modeltest_draw(void *d)
data->ring->scl.vx,
data->ring->scl.vy,
data->ring->scl.vz);
draw_text(8, 12, 0, data->buffer);
font_draw_sm(data->buffer, 8, 12);
render_model(data->ring);
}

View file

@ -418,17 +418,25 @@ screen_title_draw(void *d)
if(debug_mode) {
uint32_t elapsed_sectors;
char buffer[80];
sound_xa_get_elapsed_sectors(&elapsed_sectors);
FntPrint(-1, "%-29s %4s %3d\n",
snprintf(buffer, 120,
"DBG %1u\n"
"%-29s\n"
"%4s %3d Hz\n"
"Build Date %11s %8s\n"
"BGM SECTORS %08u",
debug_mode,
GIT_COMMIT,
GetVideoMode() == MODE_PAL ? "PAL" : "NTSC",
get_frame_rate());
FntPrint(-1, "%11s %8s %08u\n",
__DATE__, __TIME__, elapsed_sectors);
FntFlush(-1);
get_frame_rate(),
__DATE__, __TIME__,
elapsed_sectors);
font_draw_sm(buffer, 8, 12);
draw_quad(0, 0, SCREEN_XRES, 75,
0, 0, 0, 1,
OTZ_LAYER_LEVEL_FG_FRONT);
}
screen_title_drawtitle(data);
screen_title_drawprl(data);