mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-24 21:15:12 +00:00
Review fixes
This commit is contained in:
parent
e3d57c01cc
commit
839d040cf9
5 changed files with 98 additions and 96 deletions
|
@ -28,10 +28,10 @@ void djui_gfx_displaylist_end(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const Vtx vertex_djui_simple_rect[] = {
|
static const Vtx vertex_djui_simple_rect[] = {
|
||||||
{{{ 0, -1, 0 }, 0, { 0, 0 }, { 0xff, 0xff, 0xff, 0xff }}},
|
{ { { 0, -1, 0 }, 0, { 0, 0 }, { 0xff, 0xff, 0xff, 0xff } } },
|
||||||
{{{ 1, -1, 0 }, 0, { 0, 0 }, { 0xff, 0xff, 0xff, 0xff }}},
|
{ { { 1, -1, 0 }, 0, { 0, 0 }, { 0xff, 0xff, 0xff, 0xff } } },
|
||||||
{{{ 1, 0, 0 }, 0, { 0, 0 }, { 0xff, 0xff, 0xff, 0xff }}},
|
{ { { 1, 0, 0 }, 0, { 0, 0 }, { 0xff, 0xff, 0xff, 0xff } } },
|
||||||
{{{ 0, 0, 0 }, 0, { 0, 0 }, { 0xff, 0xff, 0xff, 0xff }}},
|
{ { { 0, 0, 0 }, 0, { 0, 0 }, { 0xff, 0xff, 0xff, 0xff } } },
|
||||||
};
|
};
|
||||||
|
|
||||||
const Gfx dl_djui_simple_rect[] = {
|
const Gfx dl_djui_simple_rect[] = {
|
||||||
|
@ -40,39 +40,34 @@ const Gfx dl_djui_simple_rect[] = {
|
||||||
gsDPSetCombineMode(G_CC_FADE, G_CC_FADE),
|
gsDPSetCombineMode(G_CC_FADE, G_CC_FADE),
|
||||||
gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_XLU_SURF2),
|
gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_XLU_SURF2),
|
||||||
gsSPVertexNonGlobal(vertex_djui_simple_rect, 4, 0),
|
gsSPVertexNonGlobal(vertex_djui_simple_rect, 4, 0),
|
||||||
gsSP2Triangles(0, 1, 2, 0x0, 0, 2, 3, 0x0),
|
gsSP2Triangles(0, 1, 2, 0x0, 0, 2, 3, 0x0),
|
||||||
gsSPEndDisplayList(),
|
gsSPEndDisplayList(),
|
||||||
};
|
};
|
||||||
|
|
||||||
f32 djui_gfx_get_scale(void) {
|
f32 djui_gfx_get_scale(void) {
|
||||||
u32 windowWidth, windowHeight;
|
u32 windowWidth, windowHeight;
|
||||||
wm_api->get_dimensions(&windowWidth, &windowHeight);
|
wm_api->get_dimensions(&windowWidth, &windowHeight);
|
||||||
switch (gDjuiScale)
|
switch (configDjuiScale) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
return 0.85f;
|
return 0.85f;
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
return 1.5f;
|
return 1.5f;
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
wm_api->get_dimensions(&windowWidth, &windowHeight);
|
return 1.0f;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
|
|
||||||
static const Vtx vertex_djui_image[] = {
|
static const Vtx vertex_djui_image[] = {
|
||||||
{{{ 0, -1, 0 }, 0, { 0, 2048 }, { 0xff, 0xff, 0xff, 0xff }}},
|
{ { { 0, -1, 0 }, 0, { 0, 2048 }, { 0xff, 0xff, 0xff, 0xff } } },
|
||||||
{{{ 1, -1, 0 }, 0, { 2048, 2048 }, { 0xff, 0xff, 0xff, 0xff }}},
|
{ { { 1, -1, 0 }, 0, { 2048, 2048 }, { 0xff, 0xff, 0xff, 0xff } } },
|
||||||
{{{ 1, 0, 0 }, 0, { 2048, 0 }, { 0xff, 0xff, 0xff, 0xff }}},
|
{ { { 1, 0, 0 }, 0, { 2048, 0 }, { 0xff, 0xff, 0xff, 0xff } } },
|
||||||
{{{ 0, 0, 0 }, 0, { 0, 0 }, { 0xff, 0xff, 0xff, 0xff }}},
|
{ { { 0, 0, 0 }, 0, { 0, 0 }, { 0xff, 0xff, 0xff, 0xff } } },
|
||||||
};
|
};
|
||||||
|
|
||||||
const Gfx dl_djui_image[] = {
|
const Gfx dl_djui_image[] = {
|
||||||
|
@ -81,11 +76,12 @@ const Gfx dl_djui_image[] = {
|
||||||
gsDPSetCombineMode(G_CC_FADEA, G_CC_FADEA),
|
gsDPSetCombineMode(G_CC_FADEA, G_CC_FADEA),
|
||||||
gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_XLU_SURF2),
|
gsDPSetRenderMode(G_RM_XLU_SURF, G_RM_XLU_SURF2),
|
||||||
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
|
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON),
|
||||||
gsDPLoadTextureBlock(NULL, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 0, 0, 0, 0),
|
gsDPLoadTextureBlock(NULL, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 0, 0, 0,
|
||||||
|
0),
|
||||||
gsSPExecuteDjui(G_TEXOVERRIDE_DJUI),
|
gsSPExecuteDjui(G_TEXOVERRIDE_DJUI),
|
||||||
gsSPVertexNonGlobal(vertex_djui_image, 4, 0),
|
gsSPVertexNonGlobal(vertex_djui_image, 4, 0),
|
||||||
// gsSPExecuteDjui(G_TEXCLIP_DJUI),
|
// gsSPExecuteDjui(G_TEXCLIP_DJUI),
|
||||||
gsSP2Triangles(0, 1, 2, 0x0, 0, 2, 3, 0x0),
|
gsSP2Triangles(0, 1, 2, 0x0, 0, 2, 3, 0x0),
|
||||||
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF),
|
gsSPTexture(0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF),
|
||||||
gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
|
gsDPSetCombineMode(G_CC_SHADE, G_CC_SHADE),
|
||||||
gsSPEndDisplayList(),
|
gsSPEndDisplayList(),
|
||||||
|
@ -93,27 +89,40 @@ const Gfx dl_djui_image[] = {
|
||||||
|
|
||||||
static u8 djui_gfx_power_of_two(u32 value) {
|
static u8 djui_gfx_power_of_two(u32 value) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case 2: return 1;
|
case 2:
|
||||||
case 4: return 2;
|
return 1;
|
||||||
case 8: return 3;
|
case 4:
|
||||||
case 16: return 4;
|
return 2;
|
||||||
case 32: return 5;
|
case 8:
|
||||||
case 64: return 6;
|
return 3;
|
||||||
case 128: return 7;
|
case 16:
|
||||||
case 256: return 8;
|
return 4;
|
||||||
case 512: return 9;
|
case 32:
|
||||||
case 1024: return 10;
|
return 5;
|
||||||
default: return 11;
|
case 64:
|
||||||
|
return 6;
|
||||||
|
case 128:
|
||||||
|
return 7;
|
||||||
|
case 256:
|
||||||
|
return 8;
|
||||||
|
case 512:
|
||||||
|
return 9;
|
||||||
|
case 1024:
|
||||||
|
return 10;
|
||||||
|
default:
|
||||||
|
return 11;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void djui_gfx_render_texture(const u8* texture, u32 w, u32 h, u32 bitSize, bool filter) {
|
void djui_gfx_render_texture(const u8 *texture, u32 w, u32 h, u32 bitSize, bool filter) {
|
||||||
gDPSetTextureFilter(gDisplayListHead++, filter ? G_TF_BILERP : G_TF_POINT);
|
gDPSetTextureFilter(gDisplayListHead++, filter ? G_TF_BILERP : G_TF_POINT);
|
||||||
gDPSetTextureOverrideDjui(gDisplayListHead++, texture, djui_gfx_power_of_two(w), djui_gfx_power_of_two(h), bitSize);
|
gDPSetTextureOverrideDjui(gDisplayListHead++, texture, djui_gfx_power_of_two(w),
|
||||||
|
djui_gfx_power_of_two(h), bitSize);
|
||||||
gSPDisplayList(gDisplayListHead++, dl_djui_image);
|
gSPDisplayList(gDisplayListHead++, dl_djui_image);
|
||||||
}
|
}
|
||||||
|
|
||||||
void djui_gfx_render_texture_tile(const u8* texture, u32 w, u32 h, u32 bitSize, u32 tileX, u32 tileY, u32 tileW, u32 tileH, bool filter) {
|
void djui_gfx_render_texture_tile(const u8 *texture, u32 w, u32 h, u32 bitSize, u32 tileX, u32 tileY,
|
||||||
|
u32 tileW, u32 tileH, bool filter) {
|
||||||
if (!gDisplayListHead) {
|
if (!gDisplayListHead) {
|
||||||
LOG_ERROR("Retrieved a null displaylist head");
|
LOG_ERROR("Retrieved a null displaylist head");
|
||||||
return;
|
return;
|
||||||
|
@ -130,12 +139,24 @@ void djui_gfx_render_texture_tile(const u8* texture, u32 w, u32 h, u32 bitSize,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
f32 aspect = tileH ? ((f32)tileW / (f32)tileH) : 1;
|
f32 aspect = tileH ? ((f32) tileW / (f32) tileH) : 1;
|
||||||
// I don't know why adding 1 to all of the UVs seems to fix rendering, but it does...
|
// I don't know why adding 1 to all of the UVs seems to fix rendering, but it does...
|
||||||
vtx[0] = (Vtx) {{{ 0, -1, 0 }, 0, { ( tileX * 2048.0f) / (f32)w, ((tileY + tileH) * 2048.0f) / (f32)h }, { 0xff, 0xff, 0xff, 0xff }}};
|
vtx[0] = (Vtx){ { { 0, -1, 0 },
|
||||||
vtx[1] = (Vtx) {{{ 1 * aspect, -1, 0 }, 0, { ((tileX + tileW) * 2048.0f) / (f32)w, ((tileY + tileH) * 2048.0f) / (f32)h }, { 0xff, 0xff, 0xff, 0xff }}};
|
0,
|
||||||
vtx[2] = (Vtx) {{{ 1 * aspect, 0, 0 }, 0, { ((tileX + tileW) * 2048.0f) / (f32)w, ( tileY * 2048.0f) / (f32)h }, { 0xff, 0xff, 0xff, 0xff }}};
|
{ (tileX * 2048.0f) / (f32) w, ((tileY + tileH) * 2048.0f) / (f32) h },
|
||||||
vtx[3] = (Vtx) {{{ 0, 0, 0 }, 0, { ( tileX * 2048.0f) / (f32)w, ( tileY * 2048.0f) / (f32)h }, { 0xff, 0xff, 0xff, 0xff }}};
|
{ 0xff, 0xff, 0xff, 0xff } } };
|
||||||
|
vtx[1] = (Vtx){ { { 1 * aspect, -1, 0 },
|
||||||
|
0,
|
||||||
|
{ ((tileX + tileW) * 2048.0f) / (f32) w, ((tileY + tileH) * 2048.0f) / (f32) h },
|
||||||
|
{ 0xff, 0xff, 0xff, 0xff } } };
|
||||||
|
vtx[2] = (Vtx){ { { 1 * aspect, 0, 0 },
|
||||||
|
0,
|
||||||
|
{ ((tileX + tileW) * 2048.0f) / (f32) w, (tileY * 2048.0f) / (f32) h },
|
||||||
|
{ 0xff, 0xff, 0xff, 0xff } } };
|
||||||
|
vtx[3] = (Vtx){ { { 0, 0, 0 },
|
||||||
|
0,
|
||||||
|
{ (tileX * 2048.0f) / (f32) w, (tileY * 2048.0f) / (f32) h },
|
||||||
|
{ 0xff, 0xff, 0xff, 0xff } } };
|
||||||
|
|
||||||
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
|
gSPClearGeometryMode(gDisplayListHead++, G_LIGHTING);
|
||||||
gDPSetCombineMode(gDisplayListHead++, G_CC_FADEA, G_CC_FADEA);
|
gDPSetCombineMode(gDisplayListHead++, G_CC_FADEA, G_CC_FADEA);
|
||||||
|
@ -144,14 +165,16 @@ void djui_gfx_render_texture_tile(const u8* texture, u32 w, u32 h, u32 bitSize,
|
||||||
|
|
||||||
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
|
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON);
|
||||||
|
|
||||||
gDPSetTextureOverrideDjui(gDisplayListHead++, texture, djui_gfx_power_of_two(w), djui_gfx_power_of_two(h), bitSize);
|
gDPSetTextureOverrideDjui(gDisplayListHead++, texture, djui_gfx_power_of_two(w),
|
||||||
gDPLoadTextureBlockWithoutTexture(gDisplayListHead++, NULL, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 64, 0, G_TX_CLAMP, G_TX_CLAMP, 0, 0, 0, 0);
|
djui_gfx_power_of_two(h), bitSize);
|
||||||
|
gDPLoadTextureBlockWithoutTexture(gDisplayListHead++, NULL, G_IM_FMT_RGBA, G_IM_SIZ_16b, 64, 64, 0,
|
||||||
|
G_TX_CLAMP, G_TX_CLAMP, 0, 0, 0, 0);
|
||||||
|
|
||||||
*(gDisplayListHead++) = (Gfx) gsSPExecuteDjui(G_TEXOVERRIDE_DJUI);
|
*(gDisplayListHead++) = (Gfx) gsSPExecuteDjui(G_TEXOVERRIDE_DJUI);
|
||||||
|
|
||||||
gSPVertexNonGlobal(gDisplayListHead++, vtx, 4, 0);
|
gSPVertexNonGlobal(gDisplayListHead++, vtx, 4, 0);
|
||||||
*(gDisplayListHead++) = (Gfx) gsSPExecuteDjui(G_TEXCLIP_DJUI);
|
*(gDisplayListHead++) = (Gfx) gsSPExecuteDjui(G_TEXCLIP_DJUI);
|
||||||
gSP2TrianglesDjui(gDisplayListHead++, 0, 1, 2, 0x0, 0, 2, 3, 0x0);
|
gSP2TrianglesDjui(gDisplayListHead++, 0, 1, 2, 0x0, 0, 2, 3, 0x0);
|
||||||
|
|
||||||
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF);
|
gSPTexture(gDisplayListHead++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_OFF);
|
||||||
gDPSetCombineMode(gDisplayListHead++, G_CC_SHADE, G_CC_SHADE);
|
gDPSetCombineMode(gDisplayListHead++, G_CC_SHADE, G_CC_SHADE);
|
||||||
|
@ -159,30 +182,31 @@ void djui_gfx_render_texture_tile(const u8* texture, u32 w, u32 h, u32 bitSize,
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
|
|
||||||
void djui_gfx_position_translate(f32* x, f32* y) {
|
void djui_gfx_position_translate(f32 *x, f32 *y) {
|
||||||
u32 windowWidth, windowHeight;
|
u32 windowWidth, windowHeight;
|
||||||
wm_api->get_dimensions(&windowWidth, &windowHeight);
|
wm_api->get_dimensions(&windowWidth, &windowHeight);
|
||||||
*x = GFX_DIMENSIONS_FROM_LEFT_EDGE(0) + *x * ((f32)SCREEN_HEIGHT / (f32)windowHeight) * djui_gfx_get_scale();
|
*x = GFX_DIMENSIONS_FROM_LEFT_EDGE(0)
|
||||||
*y = SCREEN_HEIGHT - *y * ((f32)SCREEN_HEIGHT / (f32)windowHeight) * djui_gfx_get_scale();
|
+ *x * ((f32) SCREEN_HEIGHT / (f32) windowHeight) * djui_gfx_get_scale();
|
||||||
|
*y = SCREEN_HEIGHT - *y * ((f32) SCREEN_HEIGHT / (f32) windowHeight) * djui_gfx_get_scale();
|
||||||
}
|
}
|
||||||
|
|
||||||
void djui_gfx_scale_translate(f32* width, f32* height) {
|
void djui_gfx_scale_translate(f32 *width, f32 *height) {
|
||||||
u32 windowWidth, windowHeight;
|
u32 windowWidth, windowHeight;
|
||||||
wm_api->get_dimensions(&windowWidth, &windowHeight);
|
wm_api->get_dimensions(&windowWidth, &windowHeight);
|
||||||
|
|
||||||
*width = *width * ((f32)SCREEN_HEIGHT / (f32)windowHeight) * djui_gfx_get_scale();
|
*width = *width * ((f32) SCREEN_HEIGHT / (f32) windowHeight) * djui_gfx_get_scale();
|
||||||
*height = *height * ((f32)SCREEN_HEIGHT / (f32)windowHeight) * djui_gfx_get_scale();
|
*height = *height * ((f32) SCREEN_HEIGHT / (f32) windowHeight) * djui_gfx_get_scale();
|
||||||
}
|
}
|
||||||
|
|
||||||
void djui_gfx_size_translate(f32* size) {
|
void djui_gfx_size_translate(f32 *size) {
|
||||||
u32 windowWidth, windowHeight;
|
u32 windowWidth, windowHeight;
|
||||||
wm_api->get_dimensions(&windowWidth, &windowHeight);
|
wm_api->get_dimensions(&windowWidth, &windowHeight);
|
||||||
|
|
||||||
*size = *size * ((f32)SCREEN_HEIGHT / (f32)windowHeight) * djui_gfx_get_scale();
|
*size = *size * ((f32) SCREEN_HEIGHT / (f32) windowHeight) * djui_gfx_get_scale();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool djui_gfx_add_clipping_specific(struct DjuiBase* base, f32 dX, f32 dY, f32 dW, f32 dH) {
|
bool djui_gfx_add_clipping_specific(struct DjuiBase *base, f32 dX, f32 dY, f32 dW, f32 dH) {
|
||||||
struct DjuiBaseRect* clip = &base->clip;
|
struct DjuiBaseRect *clip = &base->clip;
|
||||||
|
|
||||||
f32 clipX2 = clip->x + clip->width;
|
f32 clipX2 = clip->x + clip->width;
|
||||||
f32 clipY2 = clip->y + clip->height;
|
f32 clipY2 = clip->y + clip->height;
|
||||||
|
@ -191,10 +215,18 @@ bool djui_gfx_add_clipping_specific(struct DjuiBase* base, f32 dX, f32 dY, f32 d
|
||||||
f32 dY2 = dY + dH;
|
f32 dY2 = dY + dH;
|
||||||
|
|
||||||
// completely clipped
|
// completely clipped
|
||||||
if (dX2 < clip->x) { return true; }
|
if (dX2 < clip->x) {
|
||||||
if (dX > clipX2) { return true; }
|
return true;
|
||||||
if (dY2 < clip->y) { return true; }
|
}
|
||||||
if (dY > clipY2) { return true; }
|
if (dX > clipX2) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (dY2 < clip->y) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (dY > clipY2) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
f32 dClipX1 = fmax((clip->x - dX) / dW, 0);
|
f32 dClipX1 = fmax((clip->x - dX) / dW, 0);
|
||||||
f32 dClipY1 = fmax((clip->y - dY) / dH, 0);
|
f32 dClipY1 = fmax((clip->y - dY) / dH, 0);
|
||||||
|
@ -202,13 +234,14 @@ bool djui_gfx_add_clipping_specific(struct DjuiBase* base, f32 dX, f32 dY, f32 d
|
||||||
f32 dClipY2 = fmax((dY - (clipY2 - dH)) / dH, 0);
|
f32 dClipY2 = fmax((dY - (clipY2 - dH)) / dH, 0);
|
||||||
|
|
||||||
if ((dClipX1 != 0) || (dClipY1 != 0) || (dClipX2 != 0) || (dClipY2 != 0)) {
|
if ((dClipX1 != 0) || (dClipY1 != 0) || (dClipX2 != 0) || (dClipY2 != 0)) {
|
||||||
gDPSetTextureClippingDjui(gDisplayListHead++, (u8)(dClipX1 * 255), (u8)(dClipY1 * 255), (u8)(dClipX2 * 255), (u8)(dClipY2 * 255));
|
gDPSetTextureClippingDjui(gDisplayListHead++, (u8) (dClipX1 * 255), (u8) (dClipY1 * 255),
|
||||||
|
(u8) (dClipX2 * 255), (u8) (dClipY2 * 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool djui_gfx_add_clipping(struct DjuiBase* base) {
|
bool djui_gfx_add_clipping(struct DjuiBase *base) {
|
||||||
struct DjuiBaseRect* comp = &base->comp;
|
struct DjuiBaseRect *comp = &base->comp;
|
||||||
return djui_gfx_add_clipping_specific(base, comp->x, comp->y, comp->width, comp->height);
|
return djui_gfx_add_clipping_specific(base, comp->x, comp->y, comp->width, comp->height);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,7 @@
|
||||||
#include "src/pc/configfile.h"
|
#include "src/pc/configfile.h"
|
||||||
#include "src/game/level_update.h"
|
#include "src/game/level_update.h"
|
||||||
|
|
||||||
static struct DjuiText* sRestartText = NULL;
|
static bool sChangedScale = false;
|
||||||
|
|
||||||
bool changedScale = false;
|
|
||||||
|
|
||||||
static struct DjuiSelectionbox* sLevelBox = NULL;
|
static struct DjuiSelectionbox* sLevelBox = NULL;
|
||||||
|
|
||||||
|
@ -17,7 +15,7 @@ static void djui_panel_random_menu(UNUSED struct DjuiBase* caller) {
|
||||||
djui_base_set_enabled(&sLevelBox->base, !configMenuRandom);
|
djui_base_set_enabled(&sLevelBox->base, !configMenuRandom);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void djui_panel_misc_djui_theme_change(UNUSED struct DjuiBase* caller) {
|
static void djui_panel_misc_djui_setting_change(UNUSED struct DjuiBase* caller) {
|
||||||
// god this is so hacky and terrible - djoslin0, 2023
|
// god this is so hacky and terrible - djoslin0, 2023
|
||||||
if (gDjuiInMainMenu) {
|
if (gDjuiInMainMenu) {
|
||||||
djui_panel_shutdown();
|
djui_panel_shutdown();
|
||||||
|
@ -36,14 +34,6 @@ static void djui_panel_misc_djui_theme_change(UNUSED struct DjuiBase* caller) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void djui_panel_misc_djui_scale_change(UNUSED struct DjuiBase* caller) {
|
|
||||||
if (changedScale) {
|
|
||||||
djui_text_set_text(sRestartText, DLANG(DISPLAY, MUST_RESTART));
|
|
||||||
} else {
|
|
||||||
changedScale = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void djui_panel_main_menu_create(struct DjuiBase* caller) {
|
void djui_panel_main_menu_create(struct DjuiBase* caller) {
|
||||||
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(MENU_OPTIONS, MAIN_MENU));
|
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(MENU_OPTIONS, MAIN_MENU));
|
||||||
struct DjuiBase* body = djui_three_panel_get_body(panel);
|
struct DjuiBase* body = djui_three_panel_get_body(panel);
|
||||||
|
@ -84,27 +74,13 @@ void djui_panel_main_menu_create(struct DjuiBase* caller) {
|
||||||
for (int i = 0; i < DJUI_THEME_MAX; i++) {
|
for (int i = 0; i < DJUI_THEME_MAX; i++) {
|
||||||
themeChoices[i] = (char*)gDjuiThemes[i]->name;
|
themeChoices[i] = (char*)gDjuiThemes[i]->name;
|
||||||
}
|
}
|
||||||
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_THEME), themeChoices, DJUI_THEME_MAX, &configDjuiTheme, djui_panel_misc_djui_theme_change);
|
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_THEME), themeChoices, DJUI_THEME_MAX, &configDjuiTheme, djui_panel_misc_djui_setting_change);
|
||||||
|
|
||||||
djui_checkbox_create(body, DLANG(DJUI_THEMES, CENTER), &configDjuiThemeCenter, djui_panel_misc_djui_theme_change);
|
djui_checkbox_create(body, DLANG(DJUI_THEMES, CENTER), &configDjuiThemeCenter, djui_panel_misc_djui_setting_change);
|
||||||
|
|
||||||
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_SCALE), djuiScaleChoices, 3, &configDjuiScale, djui_panel_misc_djui_scale_change);
|
djui_selectionbox_create(body, DLANG(DJUI_THEMES, DJUI_SCALE), djuiScaleChoices, 3, &configDjuiScale, djui_panel_misc_djui_setting_change);
|
||||||
|
|
||||||
djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
|
djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
|
||||||
|
|
||||||
// Must restart text
|
|
||||||
sRestartText = djui_text_create(body, "");
|
|
||||||
djui_text_set_alignment(sRestartText, DJUI_HALIGN_CENTER, DJUI_VALIGN_TOP);
|
|
||||||
djui_base_set_color(&sRestartText->base, 255, 100, 100, 255);
|
|
||||||
djui_base_set_size_type(&sRestartText->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
|
||||||
djui_base_set_size(&sRestartText->base, 1.0f, 64);
|
|
||||||
|
|
||||||
// force the restart text to update
|
|
||||||
if (changedScale) {
|
|
||||||
djui_text_set_text(sRestartText, DLANG(DISPLAY, MUST_RESTART));
|
|
||||||
} else {
|
|
||||||
djui_text_set_text(sRestartText, "");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
djui_panel_add(caller, panel, NULL);
|
djui_panel_add(caller, panel, NULL);
|
||||||
|
|
|
@ -73,7 +73,6 @@ u8 gRenderingInterpolated = 0;
|
||||||
f32 gRenderingDelta = 0;
|
f32 gRenderingDelta = 0;
|
||||||
|
|
||||||
f64 gGameSpeed = 1.0f; // TODO: should probably remove
|
f64 gGameSpeed = 1.0f; // TODO: should probably remove
|
||||||
u32 gDjuiScale = 1; //0 = 0.85, 1 = 1.0, 2 = 1.5
|
|
||||||
|
|
||||||
#define FRAMERATE 30
|
#define FRAMERATE 30
|
||||||
static const f64 sFrameTime = (1.0 / ((double)FRAMERATE));
|
static const f64 sFrameTime = (1.0 / ((double)FRAMERATE));
|
||||||
|
@ -264,11 +263,6 @@ void game_exit(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void* main_game_init(UNUSED void* arg) {
|
void* main_game_init(UNUSED void* arg) {
|
||||||
if (gDjuiScale != 0 || gDjuiScale != 1 || gDjuiScale != 2) {
|
|
||||||
gDjuiScale = 1;
|
|
||||||
configDjuiScale = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *gamedir = gCLIOpts.GameDir[0] ? gCLIOpts.GameDir : FS_BASEDIR;
|
const char *gamedir = gCLIOpts.GameDir[0] ? gCLIOpts.GameDir : FS_BASEDIR;
|
||||||
const char *userpath = gCLIOpts.SavePath[0] ? gCLIOpts.SavePath : sys_user_path();
|
const char *userpath = gCLIOpts.SavePath[0] ? gCLIOpts.SavePath : sys_user_path();
|
||||||
fs_init(sys_ropaths, gamedir, userpath);
|
fs_init(sys_ropaths, gamedir, userpath);
|
||||||
|
|
|
@ -16,7 +16,6 @@ extern "C" {
|
||||||
#include "gfx/gfx_dummy.h"
|
#include "gfx/gfx_dummy.h"
|
||||||
|
|
||||||
extern bool gCoopCompatibility;
|
extern bool gCoopCompatibility;
|
||||||
extern u32 gDjuiScale;
|
|
||||||
|
|
||||||
#if defined(WAPI_SDL1) || defined(WAPI_SDL2)
|
#if defined(WAPI_SDL1) || defined(WAPI_SDL2)
|
||||||
# define WAPI gfx_sdl
|
# define WAPI gfx_sdl
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue