Wii: Improve menu rendering
Jeffrey Pfau jeffrey@endrift.com
Fri, 28 Aug 2015 21:29:38 -0700
2 files changed,
10 insertions(+),
3 deletions(-)
M
src/platform/wii/gui-font.c
→
src/platform/wii/gui-font.c
@@ -53,6 +53,7 @@ return defaultFontMetrics[glyph].width;
} void GUIFontDrawGlyph(const struct GUIFont* font, int x, int y, uint32_t color, uint32_t glyph) { + color = (color >> 24) | (color << 8); GXTexObj tex; // Grumble grumble, libogc is bad about const-correctness struct GUIFont* ncfont = font;@@ -61,6 +62,7 @@ GX_LoadTexObj(&tex, GX_TEXMAP0);
GX_SetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_NOOP); GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0); + GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0); if (glyph > 0x7F) { glyph = 0;@@ -70,15 +72,19 @@ s16 tx = (glyph & 15) * CELL_WIDTH + metric.padding.left;
s16 ty = (glyph >> 4) * CELL_HEIGHT + metric.padding.top; GX_Begin(GX_QUADS, GX_VTXFMT0, 4); GX_Position2s16(x, y - GLYPH_HEIGHT + metric.padding.top); + GX_Color1u32(color); GX_TexCoord2f32(tx / 256.f, ty / 128.f); GX_Position2s16(x + CELL_WIDTH - (metric.padding.left + metric.padding.right), y - GLYPH_HEIGHT + metric.padding.top); + GX_Color1u32(color); GX_TexCoord2f32((tx + CELL_WIDTH - (metric.padding.left + metric.padding.right)) / 256.f, ty / 128.f); GX_Position2s16(x + CELL_WIDTH - (metric.padding.left + metric.padding.right), y - GLYPH_HEIGHT + CELL_HEIGHT - metric.padding.bottom); + GX_Color1u32(color); GX_TexCoord2f32((tx + CELL_WIDTH - (metric.padding.left + metric.padding.right)) / 256.f, (ty + CELL_HEIGHT - (metric.padding.top + metric.padding.bottom)) / 128.f); GX_Position2s16(x, y - GLYPH_HEIGHT + CELL_HEIGHT - metric.padding.bottom); + GX_Color1u32(color); GX_TexCoord2f32(tx / 256.f, (ty + CELL_HEIGHT - (metric.padding.top + metric.padding.bottom)) / 128.f); GX_End(); }
M
src/platform/wii/main.c
→
src/platform/wii/main.c
@@ -108,7 +108,7 @@
GX_SetNumChans(1); GX_SetNumTexGens(1); GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0); - GX_SetTevOp(GX_TEVSTAGE0, GX_REPLACE); + GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE); GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY); GX_InvVtxCache();@@ -170,6 +170,7 @@ while (true) {
char path[256]; guOrtho(proj, -20, 240, 0, 352, 0, 300); GX_LoadProjectionMtx(proj, GX_ORTHOGRAPHIC); + GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT); struct GUIParams params = { 352, 230,@@ -182,6 +183,7 @@ GBAContextStart(&context);
guOrtho(proj, -10, VIDEO_VERTICAL_PIXELS + 10, 0, VIDEO_HORIZONTAL_PIXELS, 0, 300); GX_LoadProjectionMtx(proj, GX_ORTHOGRAPHIC); + GX_SetVtxDesc(GX_VA_CLR0, GX_NONE); while (true) { #if RESAMPLE_LIBRARY == RESAMPLE_BLIP_BUF@@ -283,8 +285,6 @@ return 0;
} static void GBAWiiFrame(void) { - VIDEO_WaitVSync(); - size_t x, y; uint64_t* texdest = (uint64_t*) texmem; uint64_t* texsrc = (uint64_t*) renderer.outputBuffer;@@ -355,6 +355,7 @@ audioBufferSize = 0;
} static void _drawStart(void) { + VIDEO_WaitVSync(); GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE); GX_SetColorUpdate(GX_TRUE);