SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL::Renderer Struct Reference

Handle to an owned renderer. More...

Inheritance diagram for SDL::Renderer:
Inheritance graph
[legend]

Public Member Functions

constexpr Renderer (SDL_Renderer *resource={})
 Constructs from the underlying resource.
 
constexpr Renderer (const Renderer &other)=delete
 
constexpr Renderer (Renderer &&other)=default
 Move constructor.
 
 ~Renderer ()
 Frees up resource when object goes out of scope.
 
Rendereroperator= (Renderer other)
 Assignment operator.
 
constexpr RendererRef (const RendererRef &other)
 Copy constructor.
 
constexpr RendererRef (RendererRef &&other)
 Move constructor.
 
- Public Member Functions inherited from SDL::RendererRef
constexpr RendererRef (const RendererRef &other)
 Copy constructor.
 
constexpr RendererRef (RendererRef &&other)
 Move constructor.
 
constexpr ~RendererRef ()=default
 Default constructor.
 
RendererRefoperator= (RendererRef other)
 Assignment operator.
 
void reset (SDL_Renderer *newResource={})
 Destroy the rendering context for a window and free all associated textures.
 
 RendererBase (WindowRef window)
 Create a 2D rendering context for a window.
 
 RendererBase (WindowBase &window, StringParam name)
 Create a 2D rendering context for a window.
 
 RendererBase (PropertiesBase &props)
 Create a 2D rendering context for a window, with the specified properties.
 
 RendererBase (SurfaceBase &surface)
 Create a 2D software rendering context for a surface.
 
- Public Member Functions inherited from SDL::RendererBase
 RendererBase (WindowRef window)
 Create a 2D rendering context for a window.
 
 RendererBase (WindowBase &window, StringParam name)
 Create a 2D rendering context for a window.
 
 RendererBase (PropertiesBase &props)
 Create a 2D rendering context for a window, with the specified properties.
 
 RendererBase (SurfaceBase &surface)
 Create a 2D software rendering context for a surface.
 
WindowRef GetWindow ()
 Get the window associated with a renderer.
 
const char * GetName () const
 Get the name of a renderer.
 
Point GetOutputSize () const
 Get the output size in pixels of a rendering context.
 
void GetOutputSize (int *w, int *h) const
 Get the output size in pixels of a rendering context.
 
Point GetCurrentOutputSize () const
 Get the current output size in pixels of a rendering context.
 
void GetCurrentOutputSize (int *w, int *h) const
 Get the current output size in pixels of a rendering context.
 
PropertiesRef GetProperties () const
 Get the properties associated with a renderer.
 
void ResetTarget ()
 Set target texture back to window.
 
void SetTarget (OptionalTexture texture)
 Set a texture as the current rendering target.
 
TextureRef GetTarget () const
 Get the current render target.
 
void SetLogicalPresentation (SDL_Point size, RendererLogicalPresentation mode)
 Set a device-independent resolution and presentation mode for rendering.
 
void GetLogicalPresentation (SDL_Point *size, RendererLogicalPresentation *mode)
 Get device independent resolution and presentation mode for rendering.
 
void GetLogicalPresentation (int *w, int *h, RendererLogicalPresentation *mode) const
 Get device independent resolution and presentation mode for rendering.
 
FRect GetLogicalPresentationRect () const
 Get the final presentation rectangle for rendering.
 
FPoint RenderCoordinatesFromWindow (const SDL_FPoint &window_coord) const
 Get a point in render coordinates when given a point in window coordinates.
 
FPoint RenderCoordinatesToWindow (const SDL_FPoint &coord) const
 Get a point in window coordinates when given a point in render coordinates.
 
void ConvertEventToRenderCoordinates (Event *event) const
 Convert the coordinates in an event to render coordinates.
 
void ResetViewport ()
 Reset the drawing area for rendering to the entire target.
 
void SetViewport (OptionalRef< const SDL_Rect > rect)
 Set the drawing area for rendering on the current target.
 
Rect GetViewport () const
 Get the drawing area for the current target.
 
bool IsViewportSet () const
 Return whether an explicit rectangle was set as the viewport.
 
Rect GetSafeArea () const
 Get the safe area for rendering within the current viewport.
 
void ResetClipRect ()
 Reset the clip rectangle for rendering to the entire render target.
 
void SetClipRect (OptionalRef< const SDL_Rect > rect)
 Set the clip rectangle for rendering on the specified target.
 
Rect GetClipRect () const
 Get the clip rectangle for the current target.
 
bool IsClipEnabled () const
 Get whether clipping is enabled on the given render target.
 
void SetScale (SDL_FPoint scale)
 Set the drawing scale for rendering on the current target.
 
FPoint GetScale () const
 Get the drawing scale for the current target.
 
void GetScale (float *scaleX, float *scaleY) const
 Get the drawing scale for the current target.
 
void SetDrawColor (SDL_Color c)
 Set the color used for drawing operations.
 
void SetDrawColor (SDL_FColor c)
 Set the color used for drawing operations (Rect, Line and Clear).
 
FColor GetDrawColor () const
 Get the color used for drawing operations (Rect, Line and Clear).
 
void GetDrawColor (SDL_Color *c) const
 Get the color used for drawing operations (Rect, Line and Clear).
 
void GetDrawColor (SDL_FColor *c) const
 Get the color used for drawing operations (Rect, Line and Clear).
 
void GetDrawColor (Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a) const
 Get the color used for drawing operations (Rect, Line and Clear).
 
void GetDrawColor (float *r, float *g, float *b, float *a) const
 Get the color used for drawing operations (Rect, Line and Clear).
 
void SetColorScale (float scale)
 Set the color scale used for render operations.
 
float GetColorScale () const
 Get the color scale used for render operations.
 
void SetDrawBlendMode (BlendMode blendMode)
 Set the blend mode used for drawing operations (Fill and Line).
 
BlendMode GetDrawBlendMode () const
 Get the blend mode used for drawing operations.
 
void RenderClear ()
 Clear the current rendering target with the drawing color.
 
void RenderPoint (SDL_FPoint p)
 Draw a point on the current rendering target at subpixel precision.
 
void RenderPoints (SpanRef< const SDL_FPoint > points)
 Draw multiple points on the current rendering target at subpixel precision.
 
void RenderLine (SDL_FPoint p1, SDL_FPoint p2)
 Draw a line on the current rendering target at subpixel precision.
 
void RenderLines (SpanRef< const SDL_FPoint > points)
 Draw a series of connected lines on the current rendering target at subpixel precision.
 
void RenderRect (OptionalRef< const SDL_FRect > rect)
 Draw a rectangle on the current rendering target at subpixel precision.
 
void RenderRects (SpanRef< const SDL_FRect > rects)
 Draw some number of rectangles on the current rendering target at subpixel precision.
 
void RenderFillRect (OptionalRef< const SDL_FRect > rect)
 Fill a rectangle on the current rendering target with the drawing color at subpixel precision.
 
void RenderFillRects (SpanRef< const SDL_FRect > rects)
 Fill some number of rectangles on the current rendering target with the drawing color at subpixel precision.
 
void RenderTexture (TextureBase &texture, OptionalRef< const SDL_FRect > srcrect, OptionalRef< const SDL_FRect > dstrect)
 Copy a portion of the texture to the current rendering target at subpixel precision.
 
void RenderTextureRotated (TextureBase &texture, OptionalRef< const SDL_FRect > srcrect, OptionalRef< const SDL_FRect > dstrect, double angle, OptionalRef< const SDL_FPoint > center={}, FlipMode flip=SDL_FLIP_NONE)
 Copy a portion of the source texture to the current rendering target, with rotation and flipping, at subpixel precision.
 
void RenderTextureAffine (TextureBase &texture, OptionalRef< const SDL_FRect > srcrect, OptionalRef< const SDL_FPoint > origin, OptionalRef< const SDL_FPoint > right, OptionalRef< const SDL_FPoint > down)
 Copy a portion of the source texture to the current rendering target, with affine transform, at subpixel precision.
 
void RenderTextureTiled (TextureBase &texture, OptionalRef< const SDL_FRect > srcrect, float scale, OptionalRef< const SDL_FRect > dstrect)
 Tile a portion of the texture to the current rendering target at subpixel precision.
 
void RenderTexture9Grid (TextureBase &texture, OptionalRef< const SDL_FRect > srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, OptionalRef< const SDL_FRect > dstrect)
 Perform a scaled copy using the 9-grid algorithm to the current rendering target at subpixel precision.
 
void RenderGeometry (OptionalTexture texture, std::span< const Vertex > vertices, std::span< const int > indices={})
 Render a list of triangles, optionally using a texture and indices into the vertex array Color and alpha modulation is done per vertex (TextureBase.SetColorMod and TextureBase.SetAlphaMod are ignored).
 
void RenderGeometryRaw (OptionalTexture texture, const float *xy, int xy_stride, const FColor *color, int color_stride, const float *uv, int uv_stride, int num_vertices, const void *indices, int num_indices, int size_indices)
 Render a list of triangles, optionally using a texture and indices into the vertex arrays Color and alpha modulation is done per vertex (TextureBase.SetColorMod and TextureBase.SetAlphaMod are ignored).
 
Surface ReadPixels (OptionalRef< const SDL_Rect > rect={}) const
 Read pixels from the current rendering target.
 
void Present ()
 Update the screen with any rendering performed since the previous call.
 
void Flush ()
 Force the rendering context to flush any pending commands and state.
 
void SetVSync (int vsync)
 Toggle VSync of the given renderer.
 
int GetVSync () const
 Get VSync of the given renderer.
 
void RenderDebugText (FPoint p, StringParam str)
 Draw debug text to an RendererBase.
 
template<class... ARGS>
void RenderDebugTextFormat (FPoint p, std::string_view fmt, ARGS... args)
 Draw debug text to an SDL_Renderer.
 
constexpr Resource (T resource={})
 Constructs the underlying resource.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other)=delete
 
- Public Member Functions inherited from SDL::Resource< SDL_Renderer * >
constexpr Resource (SDL_Renderer * resource={})
 Constructs the underlying resource.
 
constexpr Resource (std::nullptr_t)
 Equivalent to default ctor.
 
constexpr Resource (std::nullopt_t)
 Equivalent to default ctor.
 
 Resource (const Resource &other)=delete
 
 Resource (Resource &&other)=delete
 
Resourceoperator= (const Resource &other)=delete
 
Resourceoperator= (Resource &&other)=delete
 
constexpr operator bool () const
 True if contains a valid resource.
 
constexpr bool operator== (const Resource &other) const=default
 Comparison.
 
constexpr bool operator== (std::nullopt_t) const
 Comparison.
 
constexpr bool operator== (std::nullptr_t) const
 Comparison.
 
constexpr SDL_Renderer * get () const
 Return contained resource;.
 
constexpr SDL_Renderer * release (SDL_Renderer * newResource={})
 Return contained resource and empties or replace value.
 
constexpr const SDL_Renderer * operator-> () const
 Access to fields.
 
constexpr SDL_Renderer * operator-> ()
 Access to fields.
 

Detailed Description

Category:
Resource
See also
RendererBase
RendererRef

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