2022-07-27 11:25:25 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <aurora/aurora.h>
|
|
|
|
|
#include <aurora/event.h>
|
|
|
|
|
|
|
|
|
|
struct SDL_Window;
|
|
|
|
|
struct SDL_Renderer;
|
|
|
|
|
|
|
|
|
|
namespace aurora::window {
|
2026-05-08 16:55:12 -06:00
|
|
|
|
|
|
|
|
enum class CustomEvent {
|
|
|
|
|
FutureResize,
|
|
|
|
|
RefreshSurface,
|
|
|
|
|
End,
|
|
|
|
|
};
|
|
|
|
|
static Uint32 operator+(Uint32 lhs, CustomEvent rhs) { return lhs + static_cast<Uint32>(rhs); }
|
|
|
|
|
|
2026-05-09 15:02:38 -06:00
|
|
|
// On Android in particular, we need to hold a mutex around critical areas like surface creation
|
|
|
|
|
// and presentation, so that the SDLActivity doesn't destroy the surface out from underneath us.
|
|
|
|
|
class SurfaceLock {
|
|
|
|
|
public:
|
|
|
|
|
SurfaceLock() noexcept;
|
|
|
|
|
~SurfaceLock();
|
|
|
|
|
|
|
|
|
|
SurfaceLock(const SurfaceLock&) = delete;
|
|
|
|
|
SurfaceLock& operator=(const SurfaceLock&) = delete;
|
|
|
|
|
};
|
|
|
|
|
|
2022-07-27 11:25:25 -04:00
|
|
|
bool initialize();
|
2026-05-08 16:55:12 -06:00
|
|
|
bool initialize_event_watch();
|
|
|
|
|
bool push_custom_event(CustomEvent eventType);
|
2022-07-27 11:25:25 -04:00
|
|
|
void shutdown();
|
|
|
|
|
bool create_window(AuroraBackend backend);
|
|
|
|
|
bool create_renderer();
|
|
|
|
|
void destroy_window();
|
|
|
|
|
void show_window();
|
|
|
|
|
AuroraWindowSize get_window_size();
|
|
|
|
|
const AuroraEvent* poll_events();
|
|
|
|
|
SDL_Window* get_sdl_window();
|
|
|
|
|
SDL_Renderer* get_sdl_renderer();
|
2026-05-08 16:55:12 -06:00
|
|
|
bool is_paused() noexcept;
|
|
|
|
|
bool is_presentable() noexcept;
|
2026-05-09 15:02:38 -06:00
|
|
|
void set_surface_ready(bool ready) noexcept;
|
2022-07-29 16:46:03 -04:00
|
|
|
void set_title(const char* title);
|
|
|
|
|
void set_fullscreen(bool fullscreen);
|
|
|
|
|
bool get_fullscreen();
|
2026-04-05 11:38:31 -06:00
|
|
|
void set_window_size(uint32_t width, uint32_t height);
|
|
|
|
|
void set_window_position(uint32_t x, uint32_t y);
|
|
|
|
|
void center_window();
|
2026-05-05 23:13:31 -06:00
|
|
|
void request_frame_buffer_resize();
|
2026-04-18 14:10:32 -06:00
|
|
|
void set_frame_buffer_scale(float scale);
|
2026-05-05 23:13:31 -06:00
|
|
|
void set_frame_buffer_aspect_fit(bool fit);
|
2026-05-08 16:55:12 -06:00
|
|
|
void set_background_input(bool value);
|
2022-07-27 11:25:25 -04:00
|
|
|
}; // namespace aurora::window
|