diff options
author | Dominick Allen <djallen@librehumanitas.org> | 2024-09-23 23:53:01 -0500 |
---|---|---|
committer | Dominick Allen <djallen@librehumanitas.org> | 2024-09-23 23:53:01 -0500 |
commit | b4a17e3a28f31217c79faa160f5e6abd720da054 (patch) | |
tree | 9e95862b192aa6c14b86a820ef77f290e46969c8 /src/sdl_main_window.hpp | |
parent | cae8b633fc8723bcc35944298335ad48844d2bf0 (diff) |
Applying RAII types
Diffstat (limited to 'src/sdl_main_window.hpp')
-rw-r--r-- | src/sdl_main_window.hpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/sdl_main_window.hpp b/src/sdl_main_window.hpp new file mode 100644 index 0000000..fbb9dd4 --- /dev/null +++ b/src/sdl_main_window.hpp @@ -0,0 +1,31 @@ +#ifndef SDL_MAIN_WINDOW_HPP +#define SDL_MAIN_WINDOW_HPP + +#include "sdl_context.hpp" + +#include <SDL.h> + +namespace bookmouse { + +class SdlMainWindow { + public: + explicit SdlMainWindow(const SdlContext& sdlContext) noexcept(false); + SdlMainWindow(const SdlMainWindow&) = delete; + SdlMainWindow(SdlMainWindow&&) = delete; + ~SdlMainWindow(); + + SdlMainWindow& operator=(const SdlMainWindow&) = delete; + SdlMainWindow& operator=(SdlMainWindow&&) = delete; + + constexpr SDL_Window* window() + { + return m_window; + } + + private: + SDL_Window* m_window{nullptr}; +}; + +} // namespace bookmouse + +#endif |