cpp-sdl2
C++ header-only SDL2 wrapper
|
This class represent the "library entry point". More...
#include <sdl.hpp>
Public Member Functions | |
Root (Uint32 flags=SDL_INIT_EVERYTHING) | |
Construct a root object. More... | |
~Root () | |
Automatically quit SDL for you! More... | |
This class represent the "library entry point".
Create and keep an instance of this object before creating any other sdl object (e.g. sdl::Window)
Create an sdl::Root object on the stack, and SDL is initialized. When your instance of Root goes out of scope, SDL will be deinitialized for you. This pattern (idiom) is called RAII. If you aren't familiar with it, I suggest reading https://en.cppreference.com/w/cpp/language/raii
|
inline |
Construct a root object.
This object initialize SDL for you. SDL is de-initialized when object quit scope
flags | The intialization flags that you want to pass to SDL_Init. Default value is SDL_INIT_EVERYTHING |
This constructor will throw an sdl::Exception if SDL_Init fails.