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

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

#include <SDL2pp/SDLImage.hh>

Public Member Functions

 SDLImage (int flags=0)
 Initializes SDL_image library.
 
virtual ~SDLImage ()
 Destructor, deinitializes SDL_image library.
 
int InitMore (int flags)
 Try to init more SDL_image formats.
 
int GetInitFlags ()
 Get mask of initialized SDL_image formats.
 
 SDLImage (const SDLImage &other)=delete
 Deleted copy constructor.
 
SDLImageoperator= (const SDLImage &other)=delete
 Deleted assignment operator.
 
 SDLImage (SDLImage &&other)=delete
 Deleted move constructor.
 
SDLImageoperator= (SDLImage &&other)=delete
 Deleted move assignment operator.
 

Detailed Description

Helper class taking care of SDL_image library initialization and deinitialization.

Though it's possible to use SDL_image without initializing it, library provides initialization/deinitialization functions to be able to preload libraries for specific file format support (png, jpeg or tiff) beforehand. In SDL2pp, this is handled by this class.

Usage example:

int main() {
SDL2pp::SDL sdl(SDL_INIT_VIDEO);
SDL2pp::SDLImage image(IMG_INIT_PNG);
// use SDL_image functions
SDL2pp::Texture t("/path/to/file.png");
// SDL_image library is automatically deinitialized before exit
return 0;
}
Helper class taking care of SDL_image library initialization and deinitialization.
Definition: SDLImage.hh:58
Helper class taking care of SDL library initialization and deinitialization.
Definition: SDL.hh:59
Image stored in the graphics card memory that can be used for fast drawing.
Definition: Texture.hh:53

Constructor & Destructor Documentation

◆ SDLImage() [1/3]

SDL2pp::SDLImage::SDLImage ( int  flags = 0)
explicit

Initializes SDL_image library.

Parameters
[in]flagsFlags to pass to IMG_Init()
Exceptions
SDL2pp::Exception
See also
https://www.libsdl.org/projects/SDL_image/docs/SDL_image.html#SEC8

◆ ~SDLImage()

SDL2pp::SDLImage::~SDLImage ( )
virtual

Destructor, deinitializes SDL_image library.

See also
https://www.libsdl.org/projects/SDL_image/docs/SDL_image.html#SEC9

◆ SDLImage() [2/3]

SDL2pp::SDLImage::SDLImage ( const SDLImage other)
delete

Deleted copy constructor.

This class is not copyable

◆ SDLImage() [3/3]

SDL2pp::SDLImage::SDLImage ( SDLImage &&  other)
delete

Deleted move constructor.

This class is not movable

Member Function Documentation

◆ GetInitFlags()

int SDL2pp::SDLImage::GetInitFlags ( )

Get mask of initialized SDL_image formats.

See also
https://www.libsdl.org/projects/SDL_image/docs/SDL_image.html#SEC8

◆ InitMore()

int SDL2pp::SDLImage::InitMore ( int  flags)

Try to init more SDL_image formats.

Parameters
[in]flagsFlags to pass to IMG_Init()
Exceptions
SDL2pp::Exception
See also
https://www.libsdl.org/projects/SDL_image/docs/SDL_image.html#SEC8

◆ operator=() [1/2]

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

Deleted assignment operator.

This class is not copyable

◆ operator=() [2/2]

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

Deleted move assignment operator.

This class is not movable


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