libSDL2pp
C++ bindings/wrapper for SDL2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL2pp::SDL Class Reference

Helper class taking care of SDL library initialization and deinitialization. More...

#include <SDL2pp/SDL.hh>

Public Member Functions

 SDL (Uint32 flags)
 Initializes SDL2 library.
 
virtual ~SDL ()
 Destructor, deinitializes SDL2 library.
 
 SDL (const SDL &other)=delete
 Deleted copy constructor.
 
SDLoperator= (const SDL &other)=delete
 Deleted assignment operator.
 
 SDL (SDL &&other)=delete
 Deleted move constructor.
 
SDLoperator= (SDL &&other)=delete
 Deleted move assignment operator.
 
Uint32 WasInit (Uint32 flags)
 Checks which SDL2 subsystems were initialized.
 
void InitSubSystem (Uint32 flags)
 Initializes additional SDL2 subsystems.
 
void QuitSubSystem (Uint32 flags)
 Deinitializes specific SDL2 subsystems.
 

Detailed Description

Helper class taking care of SDL library initialization and deinitialization.

Before using any SDL2 functions, the library must be initialized. Likewise, it should be deinitialized before application exits. SDL2pp::SDL object takes care of this in a RAII way by initializing the library in constructor and deinitializing in destructor, with an ability to init/quit specific subsystems in between

Usage example:

int main() {
SDL2pp::SDL sdl(SDL_INIT_VIDEO);
// ...use SDL functions...
// SDL library is automatically deinitialized before exit
return 0;
}
Helper class taking care of SDL library initialization and deinitialization.
Definition: SDL.hh:59

Constructor & Destructor Documentation

◆ SDL() [1/3]

SDL2pp::SDL::SDL ( Uint32  flags)

Initializes SDL2 library.

Parameters
[in]flagsFlags to pass to SDL_Init()
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_Init

◆ ~SDL()

SDL2pp::SDL::~SDL ( )
virtual

Destructor, deinitializes SDL2 library.

See also
http://wiki.libsdl.org/SDL_Quit

◆ SDL() [2/3]

SDL2pp::SDL::SDL ( const SDL other)
delete

Deleted copy constructor.

This class is not copyable

◆ SDL() [3/3]

SDL2pp::SDL::SDL ( SDL &&  other)
delete

Deleted move constructor.

This class is not movable

Member Function Documentation

◆ InitSubSystem()

void SDL2pp::SDL::InitSubSystem ( Uint32  flags)

Initializes additional SDL2 subsystems.

Parameters
[in]flagsSet of flags which determines which subsystems to initialize
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_InitSubSystem

◆ operator=() [1/2]

SDL & SDL2pp::SDL::operator= ( const SDL other)
delete

Deleted assignment operator.

This class is not copyable

◆ operator=() [2/2]

SDL & SDL2pp::SDL::operator= ( SDL &&  other)
delete

Deleted move assignment operator.

This class is not movable

◆ QuitSubSystem()

void SDL2pp::SDL::QuitSubSystem ( Uint32  flags)

Deinitializes specific SDL2 subsystems.

Parameters
[in]flagsSet of flags which determines which subsystems to deinitialize
See also
http://wiki.libsdl.org/SDL_QuitSubSystem

◆ WasInit()

Uint32 SDL2pp::SDL::WasInit ( Uint32  flags)

Checks which SDL2 subsystems were initialized.

Parameters
[in]flags0 to return mask of initialized subsystems or any combination of flags to return initialization status of the specified subsystems
Returns
Mask of initialized subsystems or the initialization status of the specified subsystems
See also
http://wiki.libsdl.org/SDL_WasInit

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