Add wrappers for SDL functions and structs
This commit is contained in:
parent
4277f4c818
commit
d180b8a5b4
18 changed files with 410 additions and 206 deletions
36
src/wrappers/sdl/video.cppm
Normal file
36
src/wrappers/sdl/video.cppm
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
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();
|
||||
}
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue