lxgui
Public Member Functions | Static Public Member Functions | List of all members
lxgui::gui::sdl::render_target Class Referencefinal

A place to render things (the screen, a texture, ...) More...

#include <gui_sdl_render_target.hpp>

Inheritance diagram for lxgui::gui::sdl::render_target:
lxgui::gui::render_target

Public Member Functions

 render_target (SDL_Renderer *rdr, const vector2ui &dimensions, material::filter filt=material::filter::none)
 Constructor. More...
 
void begin () override
 Begins rendering on this target. More...
 
void end () override
 Ends rendering on this target. More...
 
void clear (const color &c) override
 Clears the content of this render_target. More...
 
bounds2f get_rect () const override
 Returns this render target's pixel rect. More...
 
bool set_dimensions (const vector2ui &dimensions) override
 Sets this render target's dimensions. More...
 
vector2ui get_canvas_dimensions () const override
 Returns this render target's canvas dimension. More...
 
void save_to_file (std::string filename) const override
 Saves the content of this render target into a file. More...
 
std::weak_ptr< sdl::materialget_material ()
 Returns the associated texture for rendering. More...
 
const matrix4fget_view_matrix () const
 Returns the view matrix of this render target. More...
 
SDL_Texture * get_render_texture ()
 Returns the underlying SDL render texture object. return The underlying SDL render texture object. More...
 

Static Public Member Functions

static void check_availability (SDL_Renderer *rdr)
 Checks if the machine is capable of using render targets. More...
 

Detailed Description

A place to render things (the screen, a texture, ...)

Definition at line 17 of file gui_sdl_render_target.hpp.

Constructor & Destructor Documentation

◆ render_target()

lxgui::gui::sdl::render_target::render_target ( SDL_Renderer *  rdr,
const vector2ui dimensions,
material::filter  filt = material::filter::none 
)

Constructor.

Parameters
rdrThe SDL render to create the render_target for
dimensionsThe dimensions of the render_target
filtThe filtering to apply to the target texture when displayed

Member Function Documentation

◆ begin()

void lxgui::gui::sdl::render_target::begin ( )
overridevirtual

Begins rendering on this target.

Implements lxgui::gui::render_target.

◆ check_availability()

static void lxgui::gui::sdl::render_target::check_availability ( SDL_Renderer *  rdr)
static

Checks if the machine is capable of using render targets.

Parameters
rdrThe renderer to check for availability
Note
If not, this function throws a gui::exception.

◆ clear()

void lxgui::gui::sdl::render_target::clear ( const color c)
overridevirtual

Clears the content of this render_target.

Parameters
cThe color to use as background

Implements lxgui::gui::render_target.

◆ end()

void lxgui::gui::sdl::render_target::end ( )
overridevirtual

Ends rendering on this target.

Implements lxgui::gui::render_target.

◆ get_canvas_dimensions()

vector2ui lxgui::gui::sdl::render_target::get_canvas_dimensions ( ) const
overridevirtual

Returns this render target's canvas dimension.

Returns
This render target's canvas dimension
Note
This is the physical size of the render target. On some systems, abitrary dimensions are not supported: they can be promoted to the nearest power of two from for example.

Implements lxgui::gui::render_target.

◆ get_material()

std::weak_ptr<sdl::material> lxgui::gui::sdl::render_target::get_material ( )

Returns the associated texture for rendering.

Returns
The underlying pixel buffer, that you can use to render its content

◆ get_rect()

bounds2f lxgui::gui::sdl::render_target::get_rect ( ) const
overridevirtual

Returns this render target's pixel rect.

Returns
This render target's pixel rect

Implements lxgui::gui::render_target.

◆ get_render_texture()

SDL_Texture* lxgui::gui::sdl::render_target::get_render_texture ( )

Returns the underlying SDL render texture object. return The underlying SDL render texture object.

◆ get_view_matrix()

const matrix4f& lxgui::gui::sdl::render_target::get_view_matrix ( ) const

Returns the view matrix of this render target.

Returns
The view matrix of this render target

◆ save_to_file()

void lxgui::gui::sdl::render_target::save_to_file ( std::string  filename) const
overridevirtual

Saves the content of this render target into a file.

Parameters
filenameThe path of the file to save to
Note
The file format will be detected based on the extension. Not all renderer backends support all extensions.

Implements lxgui::gui::render_target.

◆ set_dimensions()

bool lxgui::gui::sdl::render_target::set_dimensions ( const vector2ui dimensions)
overridevirtual

Sets this render target's dimensions.

Parameters
dimensionsThe new dimensions (in pixels)
Returns
'true' if the function had to re-create a new render target

Implements lxgui::gui::render_target.


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