diff --git a/include/dolphin/vi.h b/include/dolphin/vi.h index 7ac0a13..e78e509 100644 --- a/include/dolphin/vi.h +++ b/include/dolphin/vi.h @@ -16,6 +16,12 @@ void VISetNextFrameBuffer(void *fb); void VIWaitForRetrace(void); void VISetBlack(BOOL black); +#ifdef TARGET_PC +void VISetWindowTitle(const char* title); +void VISetWindowFullscreen(bool fullscreen); +bool VIGetWindowFullscreen(); +#endif + #ifdef __cplusplus } #endif diff --git a/lib/dolphin/vi.cpp b/lib/dolphin/vi.cpp index 8c08241..c700c06 100644 --- a/lib/dolphin/vi.cpp +++ b/lib/dolphin/vi.cpp @@ -1,7 +1,11 @@ -extern "C" { #include -} + +#include "../window.hpp" void VIInit() {} u32 VIGetTvFormat() { return 0; } void VIFlush() {} + +void VISetWindowTitle(const char* title) { aurora::window::set_title(title); } +void VISetWindowFullscreen(bool fullscreen) { aurora::window::set_fullscreen(fullscreen); } +bool VIGetWindowFullscreen() { return aurora::window::get_fullscreen(); } diff --git a/lib/window.cpp b/lib/window.cpp index 7891684..7993389 100644 --- a/lib/window.cpp +++ b/lib/window.cpp @@ -91,6 +91,11 @@ const AuroraEvent* poll_events() { .type = AURORA_EXIT, }); } + + g_events.push_back(AuroraEvent{ + .type = AURORA_SDL_EVENT, + .sdl = event, + }); } g_events.push_back(AuroraEvent{ .type = AURORA_NONE, @@ -247,4 +252,10 @@ SDL_Window* get_sdl_window() { return g_window; } SDL_Renderer* get_sdl_renderer() { return g_renderer; } +void set_title(const char* title) { SDL_SetWindowTitle(g_window, title); } + +void set_fullscreen(bool fullscreen) { SDL_SetWindowFullscreen(g_window, fullscreen ? SDL_WINDOW_FULLSCREEN : 0); } + +bool get_fullscreen() { return (SDL_GetWindowFlags(g_window) & SDL_WINDOW_FULLSCREEN) != 0u; } + } // namespace aurora::window diff --git a/lib/window.hpp b/lib/window.hpp index 553405d..8cd48c8 100644 --- a/lib/window.hpp +++ b/lib/window.hpp @@ -17,4 +17,7 @@ AuroraWindowSize get_window_size(); const AuroraEvent* poll_events(); SDL_Window* get_sdl_window(); SDL_Renderer* get_sdl_renderer(); +void set_title(const char* title); +void set_fullscreen(bool fullscreen); +bool get_fullscreen(); }; // namespace aurora::window