cpp-sdl2
C++ header-only SDL2 wrapper
sdl.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <SDL.h>
4 
5 #include "color.hpp"
6 #include "event.hpp"
7 #include "exception.hpp"
8 #include "game_controller.hpp"
9 #include "haptic.hpp"
10 #include "joystick.hpp"
11 #include "mouse.hpp"
12 #include "rect.hpp"
13 #include "renderer.hpp"
14 #include "shared_object.hpp"
15 #include "simd.hpp"
16 #include "surface.hpp"
17 #include "texture.hpp"
18 #include "timer.hpp"
19 #include "utils.hpp"
20 #include "vec2.hpp"
21 #include "window.hpp"
22 
72 namespace sdl
73 {
80 
81 // clang-format off
82 struct [[nodiscard]] Root
83 {
88  Root(Uint32 flags = SDL_INIT_EVERYTHING)
89  {
90  if (SDL_Init(flags) != 0)
91  throw Exception{"SDL_Init"};
92  }
93 
96  {
97  SDL_Quit();
98  }
99 };
100 // clang-format on
101 
102 } // namespace sdl
Root(Uint32 flags=SDL_INIT_EVERYTHING)
Construct a root object.
Definition: sdl.hpp:88
~Root()
Automatically quit SDL for you!
Definition: sdl.hpp:95
Define to deactivate exception support.
Definition: color.hpp:7
This class represent the "library entry point".
Definition: sdl.hpp:82
Define to deactivate exception support.
Definition: exception.hpp:21