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

Semi-safe reference for Renderer.

Inheritance diagram for SDL::RendererRef:
Inheritance graph
[legend]
Collaboration diagram for SDL::RendererRef:
Collaboration graph
[legend]

Public Member Functions

 RendererRef (RendererParam resource)
 Constructs from RendererParam. More...
 
 RendererRef (const RendererRef &other)
 Copy constructor.
 
 ~RendererRef ()
 Destructor.
 
- Public Member Functions inherited from SDL::Renderer
constexpr Renderer ()=default
 Default ctor.
 
constexpr Renderer (const RendererRaw resource)
 Constructs from RendererParam. More...
 
constexpr Renderer (const Renderer &other)=delete
 Copy constructor.
 
constexpr Renderer (Renderer &&other)
 Move constructor.
 
constexpr Renderer (const RendererRef &other)=delete
 
constexpr Renderer (RendererRef &&other)=delete
 
 Renderer (WindowParam window)
 Create a 2D rendering context for a window. More...
 
 Renderer (WindowParam window, StringParam name)
 Create a 2D rendering context for a window. More...
 
 Renderer (PropertiesParam props)
 Create a 2D rendering context for a window, with the specified properties. More...
 
 Renderer (SurfaceParam surface)
 Create a 2D software rendering context for a surface. More...
 
 ~Renderer ()
 Destructor.
 
Rendereroperator= (Renderer other)
 Assignment operator.
 
constexpr RendererRaw get () const
 Retrieves underlying RendererRaw.
 
constexpr RendererRaw release ()
 Retrieves underlying RendererRaw and clear this.
 
constexpr auto operator<=> (const Renderer &other) const =default
 Comparison.
 
constexpr bool operator== (std::nullptr_t _) const
 Comparison.
 
constexpr operator bool () const
 Converts to bool.
 
constexpr operator RendererParam () const
 Converts to RendererParam.
 
void Destroy ()
 Destroy the rendering context for a window and free all associated textures. More...
 
WindowRef GetWindow ()
 Get the window associated with a renderer. More...
 
const char * GetName () const
 Get the name of a renderer. More...
 
PropertiesRef GetProperties () const
 Get the properties associated with a renderer. More...
 
void GetOutputSize (int *w, int *h) const
 Get the output size in pixels of a rendering context. More...
 
Point GetOutputSize () const
 Get the output size in pixels of a rendering context. More...
 
void GetCurrentOutputSize (int *w, int *h) const
 Get the current output size in pixels of a rendering context. More...
 
Point GetCurrentOutputSize () const
 Get the current output size in pixels of a rendering context. More...
 
Texture CreateTexture (PixelFormat format, TextureAccess access, const PointRaw &size)
 Create a texture for a rendering context. More...
 
Texture CreateTextureFromSurface (SurfaceParam surface)
 Create a texture from an existing surface. More...
 
Texture CreateTextureWithProperties (PropertiesParam props)
 Create a texture for a rendering context with the specified properties. More...
 
void SetTarget (TextureParam texture)
 Set a texture as the current rendering target. More...
 
void ResetTarget ()
 Set target texture back to window. More...
 
Texture GetTarget () const
 Get the current render target. More...
 
void SetLogicalPresentation (const PointRaw &size, RendererLogicalPresentation mode)
 Set a device-independent resolution and presentation mode for rendering. More...
 
void GetLogicalPresentation (int *w, int *h, RendererLogicalPresentation *mode) const
 Get device independent resolution and presentation mode for rendering. More...
 
void GetLogicalPresentation (PointRaw *size, RendererLogicalPresentation *mode)
 Get device independent resolution and presentation mode for rendering. More...
 
FRect GetLogicalPresentationRect () const
 Get the final presentation rectangle for rendering. More...
 
FPoint RenderCoordinatesFromWindow (const FPointRaw &window_coord) const
 Get a point in render coordinates when given a point in window coordinates. More...
 
FPoint RenderCoordinatesToWindow (const FPointRaw &coord) const
 Get a point in window coordinates when given a point in render coordinates. More...
 
void ConvertEventToRenderCoordinates (Event *event) const
 Convert the coordinates in an event to render coordinates. More...
 
void SetViewport (OptionalRef< const RectRaw > rect)
 Set the drawing area for rendering on the current target. More...
 
void ResetViewport ()
 Reset the drawing area for rendering to the entire target. More...
 
Rect GetViewport () const
 Get the drawing area for the current target. More...
 
bool ViewportSet () const
 Return whether an explicit rectangle was set as the viewport. More...
 
Rect GetSafeArea () const
 Get the safe area for rendering within the current viewport. More...
 
void SetClipRect (OptionalRef< const RectRaw > rect)
 Set the clip rectangle for rendering on the specified target. More...
 
void ResetClipRect ()
 Reset the clip rectangle for rendering to the entire render target. More...
 
Rect GetClipRect () const
 Get the clip rectangle for the current target. More...
 
bool IsClipEnabled () const
 Get whether clipping is enabled on the given render target. More...
 
void SetScale (const FPointRaw &scale)
 Set the drawing scale for rendering on the current target. More...
 
void GetScale (float *scaleX, float *scaleY) const
 Get the drawing scale for the current target. More...
 
FPoint GetScale () const
 Get the drawing scale for the current target. More...
 
void SetDrawColor (ColorRaw c)
 Set the color used for drawing operations. More...
 
void SetDrawColorFloat (const FColorRaw &c)
 Set the color used for drawing operations (Rect, Line and Clear). More...
 
void GetDrawColor (Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a) const
 Get the color used for drawing operations (Rect, Line and Clear). More...
 
Color GetDrawColor () const
 Get the color used for drawing operations (Rect, Line and Clear). More...
 
void GetDrawColorFloat (float *r, float *g, float *b, float *a) const
 Get the color used for drawing operations (Rect, Line and Clear). More...
 
FColor GetDrawColorFloat () const
 Get the color used for drawing operations (Rect, Line and Clear). More...
 
void SetColorScale (float scale)
 Set the color scale used for render operations. More...
 
float GetColorScale () const
 Get the color scale used for render operations. More...
 
void SetDrawBlendMode (BlendMode blendMode)
 Set the blend mode used for drawing operations (Fill and Line). More...
 
BlendMode GetDrawBlendMode () const
 Get the blend mode used for drawing operations. More...
 
void RenderClear ()
 Clear the current rendering target with the drawing color. More...
 
void RenderPoint (const FPointRaw &p)
 Draw a point on the current rendering target at subpixel precision. More...
 
void RenderPoints (SpanRef< const FPointRaw > points)
 Draw multiple points on the current rendering target at subpixel precision. More...
 
void RenderLine (const FPointRaw &p1, const FPointRaw &p2)
 Draw a line on the current rendering target at subpixel precision. More...
 
void RenderLines (SpanRef< const FPointRaw > points)
 Draw a series of connected lines on the current rendering target at subpixel precision. More...
 
void RenderRect (OptionalRef< const FRectRaw > rect)
 Draw a rectangle on the current rendering target at subpixel precision. More...
 
void RenderRects (SpanRef< const FRectRaw > rects)
 Draw some number of rectangles on the current rendering target at subpixel precision. More...
 
void RenderFillRect (OptionalRef< const FRectRaw > rect)
 Fill a rectangle on the current rendering target with the drawing color at subpixel precision. More...
 
void RenderFillRects (SpanRef< const FRectRaw > rects)
 Fill some number of rectangles on the current rendering target with the drawing color at subpixel precision. More...
 
void RenderTexture (TextureParam texture, OptionalRef< const FRectRaw > srcrect, OptionalRef< const FRectRaw > dstrect)
 Copy a portion of the texture to the current rendering target at subpixel precision. More...
 
void RenderTextureRotated (TextureParam texture, OptionalRef< const FRectRaw > srcrect, OptionalRef< const FRectRaw > dstrect, double angle, OptionalRef< const FPointRaw > center, FlipMode flip=FlipMode::SDL_FLIP_NONE)
 Copy a portion of the source texture to the current rendering target, with rotation and flipping, at subpixel precision. More...
 
void RenderTextureAffine (TextureParam texture, OptionalRef< const FRectRaw > srcrect, OptionalRef< const FPointRaw > origin, OptionalRef< const FPointRaw > right, OptionalRef< const FPointRaw > down)
 Copy a portion of the source texture to the current rendering target, with affine transform, at subpixel precision. More...
 
void RenderTextureTiled (TextureParam texture, OptionalRef< const FRectRaw > srcrect, float scale, OptionalRef< const FRectRaw > dstrect)
 Tile a portion of the texture to the current rendering target at subpixel precision. More...
 
void RenderTexture9Grid (TextureParam texture, OptionalRef< const FRectRaw > srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, OptionalRef< const FRectRaw > dstrect)
 Perform a scaled copy using the 9-grid algorithm to the current rendering target at subpixel precision. More...
 
void RenderGeometry (TextureParam 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 (Texture.SetColorMod and Texture.SetAlphaMod are ignored). More...
 
void RenderGeometryRaw (TextureParam 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 (Texture.SetColorMod and Texture.SetAlphaMod are ignored). More...
 
Surface ReadPixels (OptionalRef< const RectRaw > rect={}) const
 Read pixels from the current rendering target. More...
 
void Present ()
 Update the screen with any rendering performed since the previous call. More...
 
void Flush ()
 Force the rendering context to flush any pending commands and state. More...
 
void * GetRenderMetalLayer ()
 Get the CAMetalLayer associated with the given Metal renderer. More...
 
void * GetRenderMetalCommandEncoder ()
 Get the Metal command encoder for the current frame. More...
 
void AddVulkanRenderSemaphores (Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore)
 Add a set of synchronization semaphores for the current frame. More...
 
void SetVSync (int vsync)
 Toggle VSync of the given renderer. More...
 
int GetVSync () const
 Get VSync of the given renderer. More...
 
void RenderDebugText (const FPointRaw &p, StringParam str)
 Draw debug text to an Renderer. More...
 
template<class... ARGS>
void RenderDebugTextFormat (const FPointRaw &p, std::string_view fmt, ARGS... args)
 Draw debug text to an Renderer. More...
 

Constructor & Destructor Documentation

◆ RendererRef()

SDL::RendererRef::RendererRef ( RendererParam  resource)
inline
Parameters
resourcea RendererRaw or Renderer.

This does not takes ownership!


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