SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL::SDL Class Reference

Initialize the SDL library. More...

Public Member Functions

template<class... FLAGS>
 SDL (FLAGS... flags)
 Init given subsystems.
 
constexpr SDL ()=default
 Default ctor.
 
 SDL (const SDL &other)=delete
 
constexpr SDL (SDL &&other)
 Move ctor.
 
SDLoperator= (SDL rhs)
 Assignment operator.
 
bool release ()
 release locking such as reset() does, but never calls SDL_Quit() or SDL_QuitSubSystem()
 
bool reset ()
 reset the value of this instance, acts like it was destroyed and then newly instantiated with empty ctor
 
 operator bool () const
 returns true if active and has no errors
 

Detailed Description

Also init any subsystem passed as InitFlags

This might be called multiple times, it keeps a ref count and calls SDL_Quit only on the last one.

The SubSystems are out of the refCount, as SDL itself already keep track internally.

Constructor & Destructor Documentation

◆ SDL() [1/2]

template<class... FLAGS>
SDL::SDL::SDL ( FLAGS...  flags)
inline
Parameters
flagssubsystem initialization flags.
Postcondition
convertible to true on success or to false on failure; call GetError() for more information.

This class must have only a single initialized instance at any given time, as it will call Quit() when goes out of scope.

◆ SDL() [2/2]

constexpr SDL::SDL::SDL ( )
constexprdefault

Useful if you plan to create it afterwards

Member Function Documentation

◆ release()

bool SDL::SDL::release ( )
inline
Returns
false if there are still other locks, true if this was last one

When this returns true it is safe to call Quit() directly

◆ reset()

bool SDL::SDL::reset ( )
inline
Returns
true if Quit() was called.

The documentation for this class was generated from the following file: