mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-04-21 17:41:42 +00:00
use prim color for text color
This commit is contained in:
parent
2cd747199b
commit
65afb3b809
5 changed files with 24 additions and 26 deletions
|
|
@ -217,12 +217,12 @@ static void crash_handler_produce_one_frame_callback(void) {
|
|||
if (font->textBeginDisplayList != NULL) {
|
||||
gSPDisplayList(gDisplayListHead++, font->textBeginDisplayList);
|
||||
}
|
||||
gDPSetPrimColor(gDisplayListHead++, 0, 0, 255, 255, 255, 255);
|
||||
|
||||
for (CrashHandlerText* text = sCrashHandlerText; text->s[0] != 0; ++text) {
|
||||
s32 x = GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(text->x * aspectScale);
|
||||
s32 y = SCREEN_HEIGHT - 8 - text->y * aspectScale;
|
||||
gDPPipeSync(gDisplayListHead++);
|
||||
gDPSetEnvColor(gDisplayListHead++, text->r, text->g, text->b, 0xFF);
|
||||
create_dl_translation_matrix(DJUI_MTX_PUSH, x, y, 0);
|
||||
|
||||
// translate scale
|
||||
|
|
|
|||
|
|
@ -166,7 +166,8 @@ void djui_gfx_render_texture_tile(const Texture* texture, u32 w, u32 h, u8 fmt,
|
|||
|
||||
void djui_gfx_render_texture_font_begin() {
|
||||
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING | G_CULL_BOTH);
|
||||
gDPSetCombineMode(gDisplayListHead++, G_CC_FADEA, G_CC_FADEA);
|
||||
gDPSetCombineMode(gDisplayListHead++, G_CC_FADEA, G_CC_MODULATERGBA_PRIM2);
|
||||
gDPSetCycleType(gDisplayListHead++, G_CYC_2CYCLE);
|
||||
gDPSetRenderMode(gDisplayListHead++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
|
||||
gDPSetTextureFilter(gDisplayListHead++, djui_hud_get_filter() ? G_TF_BILERP : G_TF_POINT);
|
||||
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
|
||||
|
|
@ -193,12 +194,14 @@ void djui_gfx_render_texture_font(const Texture* texture, u32 w, u32 h, u8 fmt,
|
|||
void djui_gfx_render_texture_font_end() {
|
||||
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF);
|
||||
gDPSetCombineMode(gDisplayListHead++, G_CC_SHADE, G_CC_SHADE);
|
||||
gDPSetCycleType(gDisplayListHead++, G_CYC_1CYCLE);
|
||||
gSPSetGeometryMode(gDisplayListHead++, G_LIGHTING | G_CULL_BACK);
|
||||
}
|
||||
|
||||
void djui_gfx_render_texture_tile_font_begin() {
|
||||
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING | G_CULL_BOTH);
|
||||
gDPSetCombineMode(gDisplayListHead++, G_CC_FADEA, G_CC_FADEA);
|
||||
gDPSetCombineMode(gDisplayListHead++, G_CC_FADEA, G_CC_MODULATERGBA_PRIM2);
|
||||
gDPSetCycleType(gDisplayListHead++, G_CYC_2CYCLE);
|
||||
gDPSetRenderMode(gDisplayListHead++, G_RM_XLU_SURF, G_RM_XLU_SURF2);
|
||||
gDPSetTextureFilter(gDisplayListHead++, G_TF_POINT);
|
||||
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
|
||||
|
|
@ -243,6 +246,7 @@ void djui_gfx_render_texture_tile_font(const Texture* texture, u32 w, u32 h, u8
|
|||
void djui_gfx_render_texture_tile_font_end() {
|
||||
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF);
|
||||
gDPSetCombineMode(gDisplayListHead++, G_CC_SHADE, G_CC_SHADE);
|
||||
gDPSetCycleType(gDisplayListHead++, G_CYC_1CYCLE);
|
||||
gSPSetGeometryMode(gDisplayListHead++, G_LIGHTING | G_CULL_BACK);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -173,7 +173,6 @@ struct InterpHud {
|
|||
|
||||
static struct GrowingArray *sInterpHuds = NULL;
|
||||
static u32 sInterpHudCount = 0;
|
||||
static bool sColorAltered = false;
|
||||
|
||||
static void interp_hud_free(void *ptr) {
|
||||
struct InterpHud *interp = ptr;
|
||||
|
|
@ -348,19 +347,15 @@ void djui_hud_set_color(u8 r, u8 g, u8 b, u8 a) {
|
|||
sHudUtilsState.color.g = g;
|
||||
sHudUtilsState.color.b = b;
|
||||
sHudUtilsState.color.a = a;
|
||||
sColorAltered = true;
|
||||
gDPSetEnvColor(gDisplayListHead++, r, g, b, a);
|
||||
}
|
||||
|
||||
void djui_hud_reset_color(void) {
|
||||
if (sColorAltered) {
|
||||
sHudUtilsState.color.r = 255;
|
||||
sHudUtilsState.color.g = 255;
|
||||
sHudUtilsState.color.b = 255;
|
||||
sHudUtilsState.color.a = 255;
|
||||
sColorAltered = false;
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 255);
|
||||
}
|
||||
sHudUtilsState.color.r = 255;
|
||||
sHudUtilsState.color.g = 255;
|
||||
sHudUtilsState.color.b = 255;
|
||||
sHudUtilsState.color.a = 255;
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, 255);
|
||||
}
|
||||
|
||||
struct DjuiColor* djui_hud_get_text_color(void) {
|
||||
|
|
@ -625,11 +620,11 @@ static void djui_hud_print_text_internal(const char* message, f32 x, f32 y, f32
|
|||
f32 textHeight = font->lineHeight;
|
||||
|
||||
// apply text color
|
||||
gDPSetEnvColor(gDisplayListHead++,
|
||||
(sHudUtilsState.color.r * sHudUtilsState.textColor.r) / 255,
|
||||
(sHudUtilsState.color.g * sHudUtilsState.textColor.g) / 255,
|
||||
(sHudUtilsState.color.b * sHudUtilsState.textColor.b) / 255,
|
||||
(sHudUtilsState.color.a * sHudUtilsState.textColor.a) / 255
|
||||
gDPSetPrimColor(gDisplayListHead++, 0, 0,
|
||||
sHudUtilsState.textColor.r,
|
||||
sHudUtilsState.textColor.g,
|
||||
sHudUtilsState.textColor.b,
|
||||
sHudUtilsState.textColor.a
|
||||
);
|
||||
|
||||
font->render_begin();
|
||||
|
|
@ -638,11 +633,11 @@ static void djui_hud_print_text_internal(const char* message, f32 x, f32 y, f32
|
|||
// check color code
|
||||
struct DjuiColor parsedColor;
|
||||
if (djui_text_parse_color(c, end, false, &sHudUtilsState.textColor, &c, &parsedColor)) {
|
||||
gDPSetEnvColor(gDisplayListHead++,
|
||||
(sHudUtilsState.color.r * parsedColor.r) / 255,
|
||||
(sHudUtilsState.color.g * parsedColor.g) / 255,
|
||||
(sHudUtilsState.color.b * parsedColor.b) / 255,
|
||||
(sHudUtilsState.color.a * parsedColor.a) / 255
|
||||
gDPSetPrimColor(gDisplayListHead++, 0, 0,
|
||||
parsedColor.r,
|
||||
parsedColor.g,
|
||||
parsedColor.b,
|
||||
parsedColor.a
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
|
@ -706,9 +701,6 @@ static void djui_hud_print_text_internal(const char* message, f32 x, f32 y, f32
|
|||
|
||||
// pop
|
||||
gSPPopMatrix(gDisplayListHead++, G_MTX_MODELVIEW);
|
||||
|
||||
// reset color
|
||||
gDPSetEnvColor(gDisplayListHead++, sHudUtilsState.color.r, sHudUtilsState.color.g, sHudUtilsState.color.b, sHudUtilsState.color.a);
|
||||
}
|
||||
|
||||
void djui_hud_print_text(const char* message, f32 x, f32 y, f32 scale) {
|
||||
|
|
|
|||
|
|
@ -577,6 +577,7 @@ static bool djui_inputbox_render(struct DjuiBase* base) {
|
|||
}
|
||||
|
||||
// set color
|
||||
gDPSetPrimColor(gDisplayListHead++, 0, 0, 255, 255, 255, 255);
|
||||
gDPSetEnvColor(gDisplayListHead++, inputbox->textColor.r, inputbox->textColor.g, inputbox->textColor.b, inputbox->textColor.a);
|
||||
|
||||
// make selection well formed
|
||||
|
|
|
|||
|
|
@ -452,6 +452,7 @@ static bool djui_text_render(struct DjuiBase* base) {
|
|||
create_dl_scale_matrix(DJUI_MTX_NOPUSH, translatedFontSize, translatedFontSize, 1.0f);
|
||||
|
||||
// set color
|
||||
gDPSetPrimColor(gDisplayListHead++, 0, 0, 255, 255, 255, 255);
|
||||
gDPSetEnvColor(gDisplayListHead++, base->color.r, base->color.g, base->color.b, base->color.a);
|
||||
sDjuiTextCurrentColor = base->color;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue