mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 13:35:12 +00:00
fixed non dev compile
This commit is contained in:
parent
a81d8fde26
commit
fd99cee674
2 changed files with 17 additions and 13 deletions
|
@ -59,6 +59,7 @@ bool debug_context_within(enum DebugContext ctx) {
|
||||||
return sCtxDepth[ctx] > 0;
|
return sCtxDepth[ctx] > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEVELOPMENT
|
||||||
void debug_context_set_time(enum DebugContext ctx, f64 time) {
|
void debug_context_set_time(enum DebugContext ctx, f64 time) {
|
||||||
if (ctx >= CTX_MAX) { return; }
|
if (ctx >= CTX_MAX) { return; }
|
||||||
sCtxTime[ctx] = time;
|
sCtxTime[ctx] = time;
|
||||||
|
@ -67,4 +68,5 @@ void debug_context_set_time(enum DebugContext ctx, f64 time) {
|
||||||
f64 debug_context_get_time(enum DebugContext ctx) {
|
f64 debug_context_get_time(enum DebugContext ctx) {
|
||||||
if (ctx >= CTX_MAX) { return 0.0; }
|
if (ctx >= CTX_MAX) { return 0.0; }
|
||||||
return sCtxTime[ctx];
|
return sCtxTime[ctx];
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -38,15 +38,15 @@ struct DjuiCtxDisplay {
|
||||||
struct DjuiCtxDisplay *sCtxDisplay = NULL;
|
struct DjuiCtxDisplay *sCtxDisplay = NULL;
|
||||||
|
|
||||||
void djui_ctx_display_update(void) {
|
void djui_ctx_display_update(void) {
|
||||||
if (!configCtxProfiler || sCtxDisplay == NULL) { return; }
|
|
||||||
|
|
||||||
#ifdef DEVELOPMENT
|
#ifdef DEVELOPMENT
|
||||||
|
if (!configCtxProfiler || sCtxDisplay == NULL) { return; }
|
||||||
|
|
||||||
// Time we have for a indivdual frame. If we exceed it. We are in the red.
|
// Time we have for a indivdual frame. If we exceed it. We are in the red.
|
||||||
f64 frameTime = 1.0 / 30.0;
|
f64 frameTime = 1.0 / 30.0;
|
||||||
s32 frameTimeMs = (s32)(frameTime * 1000000.0);
|
s32 frameTimeMs = (s32)(frameTime * 1000000.0);
|
||||||
|
|
||||||
struct DjuiCtxEntry *topEntry = &sCtxDisplay->topEntry;
|
struct DjuiCtxEntry *topEntry = &sCtxDisplay->topEntry;
|
||||||
|
|
||||||
// If we've exceeded our available frame time. Make the top entry timing red - For dramatic effect.
|
// If we've exceeded our available frame time. Make the top entry timing red - For dramatic effect.
|
||||||
// Otherwise. It's green!
|
// Otherwise. It's green!
|
||||||
if (debug_context_get_time(CTX_TOTAL) > frameTime) {
|
if (debug_context_get_time(CTX_TOTAL) > frameTime) {
|
||||||
|
@ -54,19 +54,19 @@ void djui_ctx_display_update(void) {
|
||||||
} else {
|
} else {
|
||||||
djui_base_set_color(&topEntry->timing->base, 124, 252, 0, 240);
|
djui_base_set_color(&topEntry->timing->base, 124, 252, 0, 240);
|
||||||
}
|
}
|
||||||
|
|
||||||
djui_text_set_text(topEntry->name, "FRAME");
|
djui_text_set_text(topEntry->name, "FRAME");
|
||||||
char timing[32];
|
char timing[32];
|
||||||
snprintf(timing, 32, "%05d", frameTimeMs);
|
snprintf(timing, 32, "%05d", frameTimeMs);
|
||||||
djui_text_set_text(topEntry->timing, timing);
|
djui_text_set_text(topEntry->timing, timing);
|
||||||
|
|
||||||
// Draw the counters.
|
// Draw the counters.
|
||||||
for (s32 i = CTX_TOTAL; i < CTX_MAX; i++) {
|
for (s32 i = CTX_TOTAL; i < CTX_MAX; i++) {
|
||||||
struct DjuiCtxEntry *entry = &sCtxDisplay->entries[i];
|
struct DjuiCtxEntry *entry = &sCtxDisplay->entries[i];
|
||||||
|
|
||||||
const char *name = sDebugContextNames[i];
|
const char *name = sDebugContextNames[i];
|
||||||
djui_text_set_text(entry->name, name);
|
djui_text_set_text(entry->name, name);
|
||||||
|
|
||||||
// The timing is in microseconds.
|
// The timing is in microseconds.
|
||||||
s32 counterMs = (s32)(debug_context_get_time(i) * 1000000.0);
|
s32 counterMs = (s32)(debug_context_get_time(i) * 1000000.0);
|
||||||
char timing[32];
|
char timing[32];
|
||||||
|
@ -77,10 +77,12 @@ void djui_ctx_display_update(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void djui_ctx_display_render(void) {
|
void djui_ctx_display_render(void) {
|
||||||
|
#ifdef DEVELOPMENT
|
||||||
if (!configCtxProfiler || sCtxDisplay == NULL) { return; }
|
if (!configCtxProfiler || sCtxDisplay == NULL) { return; }
|
||||||
|
|
||||||
djui_rect_render(&sCtxDisplay->base);
|
djui_rect_render(&sCtxDisplay->base);
|
||||||
djui_base_render(&sCtxDisplay->base);
|
djui_base_render(&sCtxDisplay->base);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void djui_ctx_display_on_destroy(UNUSED struct DjuiBase* base) {
|
void djui_ctx_display_on_destroy(UNUSED struct DjuiBase* base) {
|
||||||
|
@ -94,7 +96,7 @@ void djui_ctx_display_initialize_entry(struct DjuiBase *base, struct DjuiCtxEntr
|
||||||
djui_base_set_size(&name->base, 1.0f, name->fontScale * 2);
|
djui_base_set_size(&name->base, 1.0f, name->fontScale * 2);
|
||||||
djui_base_set_location(&name->base, 0, -name->fontScale / 3.0f + offset);
|
djui_base_set_location(&name->base, 0, -name->fontScale / 3.0f + offset);
|
||||||
djui_base_set_color(&name->base, 255, 255, 255, 240);
|
djui_base_set_color(&name->base, 255, 255, 255, 240);
|
||||||
|
|
||||||
struct DjuiText *timing = djui_text_create(base, "");
|
struct DjuiText *timing = djui_text_create(base, "");
|
||||||
djui_text_set_alignment(timing, DJUI_HALIGN_RIGHT, DJUI_VALIGN_TOP);
|
djui_text_set_alignment(timing, DJUI_HALIGN_RIGHT, DJUI_VALIGN_TOP);
|
||||||
djui_base_set_size_type(&timing->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
djui_base_set_size_type(&timing->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE);
|
||||||
|
@ -119,10 +121,10 @@ void djui_ctx_display_create(void) {
|
||||||
|
|
||||||
{
|
{
|
||||||
f64 offset = 4.0;
|
f64 offset = 4.0;
|
||||||
|
|
||||||
djui_ctx_display_initialize_entry(base, &ctxDisplay->topEntry, offset);
|
djui_ctx_display_initialize_entry(base, &ctxDisplay->topEntry, offset);
|
||||||
offset += 35.0;
|
offset += 35.0;
|
||||||
|
|
||||||
for (s32 i = CTX_TOTAL; i < CTX_MAX; i++) {
|
for (s32 i = CTX_TOTAL; i < CTX_MAX; i++) {
|
||||||
djui_ctx_display_initialize_entry(base, &ctxDisplay->entries[i], offset);
|
djui_ctx_display_initialize_entry(base, &ctxDisplay->entries[i], offset);
|
||||||
offset += 22.0;
|
offset += 22.0;
|
||||||
|
|
Loading…
Reference in a new issue