cpp-sdl2
C++ header-only SDL2 wrapper
|
Class that represent a SDL2 2D renderer. More...
#include <renderer.hpp>
Public Member Functions | |
Renderer (SDL_Renderer *renderer) | |
Construct a renderer from the SDL_Renderer C object. More... | |
Renderer () | |
Default ctor, create an empty renderer object. More... | |
Renderer (Renderer &&other) noexcept | |
Default move ctor. More... | |
Renderer & | operator= (Renderer &&other) noexcept |
Move a renderer to this one. More... | |
~Renderer () | |
Destroy the renderer automaticlally when object goes out of scope. More... | |
Renderer (Renderer const &)=delete | |
This is a managed RAII resource. this object is not copyable. More... | |
Renderer & | operator= (Renderer const &)=delete |
This is a managed RAII resource. this object is not copyable. More... | |
SDL_Renderer * | ptr () const |
Return a pointer to the wrapped C SDL_Renderer. More... | |
void | get_info (SDL_RendererInfo &info) const |
Populate renderinfo structure. More... | |
SDL_RendererInfo | info () const |
Get renderer infos. More... | |
Color | drawcolor () const |
void | set_drawcolor (Uint8 r, Uint8 g, Uint8 b, Uint8 a=SDL_ALPHA_OPAQUE) const |
Set the drawcolor from color values as bytes. More... | |
void | set_drawcolor (Color const &c) const |
Set the drawcolor from color struct. More... | |
Rect | cliprect () const |
Get the clipping rectangle. More... | |
void | set_cliprect (Rect const &r) const |
Set the clipping rectangle. More... | |
bool | clip_enabled () const |
Return true if clipping is enable. More... | |
void | disable_clip () const |
Disable the clipping rectangle. More... | |
bool | intscale () const |
Get the current integer scale. More... | |
void | set_intscale (bool intscale) const |
Set the integer scale. More... | |
Texture | make_texture (Uint32 format, SDL_TextureAccess access, int w, int h) const |
Make a new texture. More... | |
Texture | make_texture (Uint32 format, SDL_TextureAccess access, Vec2i size) const |
Make a new texture. More... | |
Texture | make_texture (Surface const &surface) const |
Make a texture from a surface. More... | |
Texture | make_texture (std::string const &filename) const |
Make a texture from a file. More... | |
void | render_copy (Texture const &tex, Rect const &source_rect, Rect const &dest_rect) const |
void | present () const |
Present renderer. More... | |
void | clear () const |
Clear renderer. More... | |
void | clear (Color const &c) const |
Clear with specified color. More... | |
void | draw_line (Vec2i const &pos1, Vec2i const &pos2) const |
Draw line between two points. More... | |
void | draw_line (Vec2i const &pos1, Vec2i const &pos2, Color const &c) const |
Draw line between two points with specified color. More... | |
void | draw_lines (std::vector< Vec2i > const &points) const |
Draw array of lines. More... | |
void | draw_lines (std::vector< Vec2i > const &points, Color const &c) const |
Draw array of lines with specified color. More... | |
void | draw_point (Vec2i const &point) const |
Draw point. More... | |
void | draw_point (Vec2i const &point, Color const &c) const |
Draw point with specified color. More... | |
void | draw_points (std::vector< Vec2i > const &points) const |
Draw array of points. More... | |
void | draw_points (std::vector< Vec2i > const &points, Color const &c) const |
Draw array of points with specified color. More... | |
void | draw_ray (Vec2i const &orig, Vec2i const &ray) const |
void | draw_ray (Vec2i const &orig, Vec2i const &ray, Color const &c) const |
void | draw_rect (Rect const &rect) const |
Draw rectangle. More... | |
void | draw_rect (Rect const &rect, Color const &c) const |
Draw rectangle with specified color. More... | |
void | draw_rects (std::vector< Rect > const &rects) const |
Draw array of rectangles. More... | |
void | draw_rects (std::vector< Rect > const &rects, const Color &c) const |
Draw array of rectangles with specified colors. More... | |
void | fill_rect (Rect const &rect) const |
Fill rectangle. More... | |
void | fill_rect (Rect const &rect, Color const &c) const |
Fill rectangle with specified color. More... | |
void | fill_rects (std::vector< Rect > const &rects) const |
Fill array of rectangles. More... | |
void | fill_rects (std::vector< Rect > const &rects, Color const &c) |
Fill array of rectangles with specified colors. More... | |
Private Attributes | |
SDL_Renderer * | renderer_ = nullptr |
Pointer to raw SDL_Renderer. More... | |
Class that represent a SDL2 2D renderer.
Definition at line 18 of file renderer.hpp.
|
inlineexplicit |
Construct a renderer from the SDL_Renderer C object.
Definition at line 22 of file renderer.hpp.
|
inline |
Default ctor, create an empty renderer object.
Definition at line 25 of file renderer.hpp.
Referenced by ~Renderer().
|
inlinenoexcept |
Default move ctor.
Definition at line 28 of file renderer.hpp.
|
inline |
Destroy the renderer automaticlally when object goes out of scope.
Definition at line 43 of file renderer.hpp.
References operator=(), Renderer(), and renderer_.
|
delete |
This is a managed RAII resource. this object is not copyable.
|
inline |
Clear renderer.
Definition at line 152 of file renderer.hpp.
References renderer_.
Referenced by clear().
|
inline |
Clear with specified color.
Definition at line 158 of file renderer.hpp.
References clear(), and set_drawcolor().
|
inline |
Return true if clipping is enable.
Definition at line 102 of file renderer.hpp.
References renderer_.
|
inline |
|
inline |
Draw line between two points.
Definition at line 165 of file renderer.hpp.
References renderer_.
Referenced by draw_line(), and draw_ray().
|
inline |
Draw line between two points with specified color.
Definition at line 172 of file renderer.hpp.
References draw_line(), and set_drawcolor().
|
inline |
Draw array of lines.
Definition at line 179 of file renderer.hpp.
References renderer_.
Referenced by draw_lines().
|
inline |
Draw array of lines with specified color.
Definition at line 186 of file renderer.hpp.
References draw_lines(), and set_drawcolor().
|
inline |
Draw point.
Definition at line 193 of file renderer.hpp.
References renderer_.
Referenced by draw_point().
Draw point with specified color.
Definition at line 200 of file renderer.hpp.
References draw_point(), and set_drawcolor().
|
inline |
Draw array of points.
Definition at line 207 of file renderer.hpp.
References renderer_.
Referenced by draw_points().
|
inline |
Draw array of points with specified color.
Definition at line 214 of file renderer.hpp.
References draw_points(), and set_drawcolor().
Definition at line 220 of file renderer.hpp.
References draw_line().
|
inline |
Definition at line 221 of file renderer.hpp.
References draw_line().
|
inline |
Draw rectangle.
Definition at line 227 of file renderer.hpp.
References renderer_.
Referenced by draw_rect().
Draw rectangle with specified color.
Definition at line 233 of file renderer.hpp.
References draw_rect(), and set_drawcolor().
|
inline |
Draw array of rectangles.
Definition at line 240 of file renderer.hpp.
References renderer_.
Referenced by draw_rects().
Draw array of rectangles with specified colors.
Definition at line 246 of file renderer.hpp.
References draw_rects(), and set_drawcolor().
|
inline |
Definition at line 69 of file renderer.hpp.
References renderer_.
|
inline |
Fill rectangle.
Definition at line 253 of file renderer.hpp.
References renderer_.
Referenced by fill_rect().
Fill rectangle with specified color.
Definition at line 258 of file renderer.hpp.
References fill_rect(), and set_drawcolor().
|
inline |
Fill array of rectangles.
Definition at line 265 of file renderer.hpp.
References renderer_.
Referenced by fill_rects().
Fill array of rectangles with specified colors.
Definition at line 271 of file renderer.hpp.
References fill_rects(), and set_drawcolor().
|
inline |
Populate renderinfo structure.
Definition at line 55 of file renderer.hpp.
References renderer_.
Referenced by info().
|
inline |
|
inline |
|
inline |
|
inline |
Make a texture from a file.
filename | file path |
Definition at line 138 of file renderer.hpp.
References renderer_.
Move a renderer to this one.
Definition at line 31 of file renderer.hpp.
References renderer_.
Referenced by ~Renderer().
This is a managed RAII resource. this object is not copyable.
|
inline |
|
inline |
Return a pointer to the wrapped C SDL_Renderer.
Definition at line 52 of file renderer.hpp.
References renderer_.
Referenced by render_copy().
|
inline |
Definition at line 140 of file renderer.hpp.
|
inline |
|
inline |
Set the drawcolor from color values as bytes.
Definition at line 78 of file renderer.hpp.
References sdl::simd::a, and renderer_.
Referenced by clear(), draw_line(), draw_lines(), draw_point(), draw_points(), draw_rect(), draw_rects(), fill_rect(), and fill_rects().
|
inline |
Set the drawcolor from color struct.
Definition at line 85 of file renderer.hpp.
References set_drawcolor().
Referenced by set_drawcolor().
|
inline |
|
private |
Pointer to raw SDL_Renderer.
Definition at line 279 of file renderer.hpp.
Referenced by clear(), clip_enabled(), cliprect(), disable_clip(), draw_line(), draw_lines(), draw_point(), draw_points(), draw_rect(), draw_rects(), drawcolor(), fill_rect(), fill_rects(), get_info(), intscale(), make_texture(), operator=(), present(), ptr(), render_copy(), set_cliprect(), set_drawcolor(), set_intscale(), and ~Renderer().