mirror of https://github.com/mgba-emu/mgba.git
Wii: Improve menu rendering
This commit is contained in:
parent
a88613abbe
commit
c0d19a1ad5
|
@ -53,6 +53,7 @@ unsigned GUIFontGlyphWidth(const struct GUIFont* font, uint32_t glyph) {
|
|||
}
|
||||
|
||||
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 @@ void GUIFontDrawGlyph(const struct GUIFont* font, int x, int y, uint32_t color,
|
|||
|
||||
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 @@ void GUIFontDrawGlyph(const struct GUIFont* font, int x, int y, uint32_t color,
|
|||
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();
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ int main() {
|
|||
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 @@ int main() {
|
|||
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 @@ int main() {
|
|||
|
||||
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 @@ int main() {
|
|||
}
|
||||
|
||||
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 @@ static void _audioDMA(void) {
|
|||
}
|
||||
|
||||
static void _drawStart(void) {
|
||||
VIDEO_WaitVSync();
|
||||
GX_SetZMode(GX_TRUE, GX_LEQUAL, GX_TRUE);
|
||||
GX_SetColorUpdate(GX_TRUE);
|
||||
|
||||
|
|
Loading…
Reference in New Issue