- nom
- Renderer
Video subsystem responsible for managing high-level graphics display (think: very fancy back-buffer). More...
#include <Renderer.hpp>
Public Member Functions | |
| Renderer (void) | |
| Default constructor; initializes instance to sane defaults. | |
| virtual | ~Renderer (void) |
| Lazy destructor with nothing to do. | |
| bool | initialize (SDL_WINDOW::RawPtr window, int32 rendering_driver=-1, uint32 context_flags=SDL_RENDERER_ACCELERATED) |
| SDL_RENDERER::RawPtr | renderer (void) const |
| Get a raw pointer to the SDL_Renderer in use. | |
| bool | renderer_valid (void) const |
| Is this object initialized? Valid when NOT nullptr. | |
| const Point2i | logical_resolution (void) const |
| const Coords | viewport (void) const |
| const Point2i | scale_factor (void) const |
| Obtain the current scale factor. | |
| const SDL_BlendMode | blend_mode (void) const |
| Obtain the blending mode used for drawing. | |
| const Point2i | size (void) const |
| const Coords | bounds (void) const |
| void | update (void) const |
| Update the renderer surface on the attached window. | |
| bool | update (SDL_TEXTURE::RawPtr input_texture) |
| bool | clear (void) const |
| bool | fill (const Color &color=Color::Blue) |
| bool | set_logical_resolution (int width, int height) |
| bool | set_viewport (const Coords &rect) |
| bool | set_color (const Color &color) |
| bool | set_blend_mode (const SDL_BlendMode mode) |
| bool | set_bounds (const Coords &clip_bounds) |
| void * | pixels (void) const |
Protected Attributes | |
| SDL_RENDERER::UniquePtr | renderer_ |
Video subsystem responsible for managing high-level graphics display (think: very fancy back-buffer).
A nom::Window is lifeless without its attached Renderer buddy!
Definition at line 49 of file Renderer.hpp.
| const Coords nom::Renderer::bounds | ( | void | ) | const |
Obtain the renderer's clipping rectangle bounds (X, Y, width & height) in pixels
Definition at line 135 of file Renderer.cpp.
| bool nom::Renderer::clear | ( | void | ) | const |
Clear the whole rendering object; ignoring the viewport.
(to a rendering color, if set?)
This method is usually called after setting the rendering draw color.
Definition at line 159 of file Renderer.cpp.
| bool nom::Renderer::fill | ( | const Color & | color = Color::Blue | ) |
Fill the rendering target video display with a new color.
This combines two methods into one: set_color() and clear().
Default color fill is "BSOD (TM) Blue".
Definition at line 170 of file Renderer.cpp.
| bool nom::Renderer::initialize | ( | SDL_WINDOW::RawPtr | window, |
| int32 | rendering_driver = -1, |
||
| uint32 | context_flags = SDL_RENDERER_ACCELERATED |
||
| ) |
Initialize a Renderer instance with an existing, initialized SDL_Window
Initializes with the first rendering driver supporting our request flags Enables video acceleration when able
Definition at line 47 of file Renderer.cpp.
| const Point2i nom::Renderer::logical_resolution | ( | void | ) | const |
Get the current logical resolution size
Definition at line 84 of file Renderer.cpp.
| void * nom::Renderer::pixels | ( | void | ) | const |
Obtain pixels buffer of the entire rendering target
Pixels pitch calculation
Definition at line 262 of file Renderer.cpp.
| bool nom::Renderer::set_blend_mode | ( | const SDL_BlendMode | mode | ) |
Set the color blending mode (fill and line).
SDL_BLENDMODE_NONE SDL_BLENDMODE_BLEND SDL_BLENDMODE_ADD SDL_BLENDMODE_MOD
Definition at line 229 of file Renderer.cpp.
| bool nom::Renderer::set_bounds | ( | const Coords & | clip_bounds | ) |
Set new clipping rectangle bounds for the rendering target.
| clip_bounds | Passing nom::Coords::null will disable clipping on the target |
Definition at line 239 of file Renderer.cpp.
| bool nom::Renderer::set_logical_resolution | ( | int | width, |
| int | height | ||
| ) |
Set device independent resolution for rendering
| width | Width of the new logical resolution |
| height | Height of the new logical resolution |
Sets both a new view port and any necessary rescaling to fit within a fixed, logical resolution for rendering.
Definition at line 185 of file Renderer.cpp.
| bool nom::Renderer::set_viewport | ( | const Coords & | rect | ) |
Set a new drawing area for rendering
| rect | Represents the drawing area to update; passing Coords::null to set the viewport to the entire target |
Definition at line 195 of file Renderer.cpp.
| const Point2i nom::Renderer::size | ( | void | ) | const |
Obtain the renderer's output size (width & height) in pixels
Definition at line 121 of file Renderer.cpp.
| bool nom::Renderer::update | ( | SDL_TEXTURE::RawPtr | input_texture | ) |
Set an input texture source as the new rendering target.
| input_texture | The targeted texture |
Definition at line 149 of file Renderer.cpp.
| const Coords nom::Renderer::viewport | ( | void | ) | const |
Get the current viewport dimensions
Definition at line 93 of file Renderer.cpp.
|
protected |
This is automatically released after the attached nom::Window has been destroyed.
Definition at line 165 of file Renderer.hpp.