37 lines
725 B
Text
37 lines
725 B
Text
|
|
module;
|
||
|
|
|
||
|
|
#include <cassert>
|
||
|
|
#include <memory>
|
||
|
|
#include <SDL3/SDL.h>
|
||
|
|
|
||
|
|
export module wrappers.sdl.video;
|
||
|
|
|
||
|
|
import utils.memory;
|
||
|
|
|
||
|
|
export namespace sdl
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Wrapper around SDL_Window that manages its lifecycle with a unique_ptr.
|
||
|
|
*/
|
||
|
|
class Window
|
||
|
|
{
|
||
|
|
std::unique_ptr<
|
||
|
|
SDL_Window,
|
||
|
|
utils::FuncDeleter<SDL_DestroyWindow>
|
||
|
|
> raw_window_ = nullptr;
|
||
|
|
|
||
|
|
public:
|
||
|
|
Window() = default;
|
||
|
|
|
||
|
|
explicit Window(SDL_Window* raw_window)
|
||
|
|
: raw_window_{raw_window}
|
||
|
|
{}
|
||
|
|
|
||
|
|
constexpr SDL_Window* get_raw() const
|
||
|
|
{
|
||
|
|
assert(raw_window_);
|
||
|
|
return raw_window_.get();
|
||
|
|
}
|
||
|
|
};
|
||
|
|
}
|