From 7d82923aa4b08823d69a44c8d883b67d2b9e754c Mon Sep 17 00:00:00 2001 From: Isaac <62234577+Isaac0-dev@users.noreply.github.com> Date: Tue, 3 May 2022 12:45:32 +1000 Subject: [PATCH] Fix headless server compile (3) (#78) --- src/pc/djui/djui_hud_utils.c | 4 ++++ src/pc/utils/profile.c | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/pc/djui/djui_hud_utils.c b/src/pc/djui/djui_hud_utils.c index ef1ce1a4..871728fb 100644 --- a/src/pc/djui/djui_hud_utils.c +++ b/src/pc/djui/djui_hud_utils.c @@ -86,12 +86,16 @@ u32 djui_hud_get_screen_height(void) { } f32 djui_hud_get_mouse_x(void) { +#ifdef HAVE_SDL2 controller_sdl_read_mouse_window(); +#endif return mouse_window_x / djui_gfx_get_scale(); } f32 djui_hud_get_mouse_y(void) { +#ifdef HAVE_SDL2 controller_sdl_read_mouse_window(); +#endif return mouse_window_y / djui_gfx_get_scale(); } diff --git a/src/pc/utils/profile.c b/src/pc/utils/profile.c index 6aeaa6df..0697ac7f 100644 --- a/src/pc/utils/profile.c +++ b/src/pc/utils/profile.c @@ -2,7 +2,9 @@ #include "PR/gbi.h" #include "pc/utils/stb_ds.h" #include "pc/debuglog.h" +#ifdef HAVE_SDL2 #include +#endif struct ProfileCounters { const char* key; @@ -44,8 +46,12 @@ void profiler_start_counter(const char* keyName) { } counters = counters; - f64 freq = SDL_GetPerformanceFrequency(); - f64 curr = SDL_GetPerformanceCounter(); + f64 freq; + f64 curr; +#ifdef HAVE_SDL2 + freq = SDL_GetPerformanceFrequency(); + curr = SDL_GetPerformanceCounter(); +#endif v->key = keyName; v->start = curr / freq; v->indent = sProfileIndent++; @@ -57,8 +63,12 @@ void profiler_stop_counter(const char* keyName) { return; } - f64 freq = SDL_GetPerformanceFrequency(); - f64 curr = SDL_GetPerformanceCounter(); + f64 freq; + f64 curr; +#ifdef HAVE_SDL2 + freq = SDL_GetPerformanceFrequency(); + curr = SDL_GetPerformanceCounter(); +#endif v->end = curr / freq; v->sum += v->end - v->start; sProfileIndent--;