Fix graphical issues that stem from text drawing

This commit is contained in:
MysterD 2022-02-19 22:03:25 -08:00
parent e7e94a5155
commit 1f61f2f632
3 changed files with 7 additions and 12 deletions

View File

@ -92,8 +92,7 @@ TOOLS_DIR := tools
ifeq ($(WINDOWS_AUTO_BUILDER),1)
export SHELL=sh.exe
RM ?= rm.exe
EXTRA_INCLUDES := -I ../include/1 -I ../include/2 -I ../include/3 -I ../include/4 -fno-use-linker-plugin
EXTRA_INCLUDES := -I ../include/1 -I ../include/2 -I ../include/3 -I ../include/4
EXTRA_CFLAGS := -Wno-expansion-to-defined
else
EXTRA_INCLUDES :=

View File

@ -12,18 +12,13 @@ static Vtx djui_font_normal_vertices[] = {
{{{ 0, 0, 0}, 0, { 512, 256}, { 0xff, 0xff, 0xff, 0xff }}},
};
static const Gfx djui_font_normal_text_begin[] = {
const Gfx dl_font_normal_display_list[] = {
gsDPPipeSync(),
gsSPClearGeometryMode(G_LIGHTING),
gsDPSetCombineMode(G_CC_FADEA, G_CC_FADEA),
//gsDPSetEnvColor(255, 255, 255, 255),
gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_XLU_SURF2),
gsDPSetTextureFilter(G_TF_POINT),
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
gsSPEndDisplayList(),
};
static const Gfx djui_font_normal_text_settings[] = {
gsDPSetTile(G_IM_FMT_IA, G_IM_SIZ_16b, 0, 0, G_TX_LOADTILE, 0, G_TX_WRAP | G_TX_NOMIRROR, 3, G_TX_NOLOD, G_TX_WRAP | G_TX_NOMIRROR, 4, G_TX_NOLOD),
gsDPLoadSync(),
gsDPLoadBlock(G_TX_LOADTILE, 0, 0, ((16 * 8 + G_IM_SIZ_4b_INCR) >> G_IM_SIZ_4b_SHIFT) - 1, CALC_DXT(16, G_IM_SIZ_4b_BYTES)),
@ -43,9 +38,8 @@ static void djui_font_normal_render_char(char c) {
void* fontChar = (void*)font_normal_chars[c - '!'];
if (fontChar == NULL) { fontChar = (void*)font_normal_chars[94]; }
gDPPipeSync(gDisplayListHead++);
gDPSetTextureImage(gDisplayListHead++, G_IM_FMT_IA, G_IM_SIZ_16b, 1, (void*)fontChar);
gSPDisplayList(gDisplayListHead++, djui_font_normal_text_settings);
gSPDisplayList(gDisplayListHead++, dl_font_normal_display_list);
}
static f32 djui_font_normal_char_width(char c) {
@ -60,7 +54,7 @@ static const struct DjuiFont sDjuiFontNormal = {
.lineHeight = 0.8125f,
.defaultFontScale = 32.0f,
.rotatedUV = true,
.textBeginDisplayList = djui_font_normal_text_begin,
.textBeginDisplayList = NULL,
.render_char = djui_font_normal_render_char,
.char_width = djui_font_normal_char_width,
};

View File

@ -479,7 +479,9 @@ static bool djui_inputbox_render(struct DjuiBase* base) {
djui_inputbox_render_selection(inputbox);
// begin font
gSPDisplayList(gDisplayListHead++, font->textBeginDisplayList);
if (font->textBeginDisplayList != NULL) {
gSPDisplayList(gDisplayListHead++, font->textBeginDisplayList);
}
// set color
gDPSetEnvColor(gDisplayListHead++, inputbox->textColor.r, inputbox->textColor.g, inputbox->textColor.b, inputbox->textColor.a);