29#ifndef NOMLIB_SDL2_RENDERER_HPP
30#define NOMLIB_SDL2_RENDERER_HPP
38#include "nomlib/config.hpp"
39#include "nomlib/math/Color4.hpp"
40#include "nomlib/math/Rect.hpp"
41#include "nomlib/graphics/RendererInfo.hpp"
42#include "nomlib/system/SDL_helpers.hpp"
64 static const uint32 DEFAULT_RENDERER_FLAGS =
65 SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE;
78 bool create( SDL_WINDOW::RawPtr window,
80 uint32 renderer_flags = DEFAULT_RENDERER_FLAGS );
151 bool fill (
const Color4i& color );
183 bool set_color (
const Color4i& color );
213 std::unique_ptr<SDL_Renderer, void(*)(SDL_Renderer*)>
renderer_;
const Point2f scale() const
Get the drawing scale for the rendering context.
bool reset_render_target() const
Set the current rendering target back to the default renderer.
bool set_logical_size(int width, int height)
SDL_Renderer * renderer(void) const
Get a raw pointer to the SDL_Renderer in use.
bool set_render_target(const Texture *texture) const
Set a texture as the current rendering target.
bool set_blend_mode(const SDL_BlendMode mode)
bool create(SDL_WINDOW::RawPtr window, int rendering_driver=DEFAULT_RENDERING_DRIVER, uint32 renderer_flags=DEFAULT_RENDERER_FLAGS)
bool renderer_valid(void) const
Is this object initialized? Valid when NOT nullptr.
bool set_viewport(const IntRect &bounds)
bool fill(const Color4i &color)
bool set_scale(const Point2f &scale_factor)
Set the drawing scale for this rendering context.
Size2i output_size(void) const
Get the renderer's output size dimensions.
bool set_logical_size(const Size2i &size)
IntRect clip_bounds() const
Obtain the renderer's clipping rectangle bounds (in pixels).
std::unique_ptr< SDL_Renderer, void(*)(SDL_Renderer *)> renderer_
static const int DEFAULT_RENDERING_DRIVER
The index of the default rendering driver to use.
const SDL_BlendMode blend_mode(void) const
Obtain the blending mode used for drawing.
void * pixels() const
Obtain pixels buffer of the entire rendering target.
static const RendererInfo caps(SDL_Renderer *target)
Obtain information specific to your rendering hardware capabilities.
bool set_clip_bounds(const IntRect &bounds)
Set new clipping rectangle bounds for the rendering target.
virtual ~Renderer(void)
Lazy destructor with nothing to do.
Renderer(void)
Default constructor; initializes instance to sane defaults.
const IntRect viewport(void) const
Get the current viewport dimensions.
void update(void) const
Update the renderer surface on the attached window.
Size2i logical_size() const
Get the current logical resolution size.
const RendererInfo caps(void) const
Obtain information specific to your rendering hardware capabilities.
Container class for the current renderer driver capabilities.