123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #pragma once
- #ifndef SNAKE_SDL_HXX
- #define SNAKE_SDL_HXX
- #include <SDL.h>
- #include <cstdint>
- #include <source_location>
- #include <stdexcept>
- #include <string_view>
- class SDLError final : public std::runtime_error {
- public:
- explicit SDLError(
- std::string_view message,
- std::source_location location = std::source_location::current()
- );
- };
- class SDL final {
- public:
- explicit SDL(std::uint32_t flags = SDL_INIT_EVERYTHING);
- ~SDL() noexcept;
- SDL(SDL const&) = delete;
- SDL& operator=(SDL const&) = delete;
- static SDL& instance() noexcept;
- static SDL& require(std::uint32_t flags) noexcept;
- private:
- static SDL* instance_;
- };
- #endif
|