libSDL2pp
C++ bindings/wrapper for SDL2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL2pp::Renderer Class Reference

2D rendering context More...

#include <SDL2pp/Renderer.hh>

Public Member Functions

 Renderer (SDL_Renderer *renderer)
 Construct from existing SDL_Renderer structure.
 
 Renderer (Window &window, int index, Uint32 flags)
 Create renderer.
 
virtual ~Renderer ()
 Destructor.
 
 Renderer (Renderer &&other) noexcept
 Move constructor.
 
Rendereroperator= (Renderer &&other) noexcept
 Move assignment operator.
 
 Renderer (const Renderer &other)=delete
 Deleted copy constructor.
 
Rendereroperator= (const Renderer &other)=delete
 Deleted assignment operator.
 
SDL_Renderer * Get () const
 Get pointer to managed SDL_Renderer structure.
 
RendererPresent ()
 Update the screen with any rendering performed since the previous call.
 
RendererClear ()
 Clear the current rendering target with the drawing color.
 
void GetInfo (SDL_RendererInfo &info)
 Get information about a rendering context.
 
RendererCopy (Texture &texture, const Optional< Rect > &srcrect=NullOpt, const Optional< Rect > &dstrect=NullOpt)
 Copy a portion of the texture to the current rendering target.
 
RendererCopy (Texture &texture, const Optional< Rect > &srcrect, const Point &dstpoint)
 Copy a portion of the texture to the current rendering target (preserve texture dimensions)
 
RendererCopy (Texture &texture, const Optional< Rect > &srcrect, const Optional< Rect > &dstrect, double angle, const Optional< Point > &center=NullOpt, int flip=0)
 Copy a portion of the texture to the current rendering target with optional rotating or flipping.
 
RendererCopy (Texture &texture, const Optional< Rect > &srcrect, const SDL2pp::Point &dstpoint, double angle, const Optional< Point > &center=NullOpt, int flip=0)
 Copy a portion of the texture to the current rendering target with optional rotating or flipping (preserve texture dimensions)
 
RendererFillCopy (Texture &texture, const Optional< Rect > &srcrect=NullOpt, const Optional< Rect > &dstrect=NullOpt, const Point &offset=Point(0, 0), int flip=0)
 Fill the target with repeated source texture.
 
RendererSetDrawColor (Uint8 r=0, Uint8 g=0, Uint8 b=0, Uint8 a=255)
 Set color user for drawing operations.
 
RendererSetDrawColor (const Color &color)
 Set color user for drawing operations.
 
RendererSetTarget ()
 Set current render target to default.
 
RendererSetTarget (Texture &texture)
 Set current render target to specified texture.
 
RendererSetDrawBlendMode (SDL_BlendMode blendMode=SDL_BLENDMODE_NONE)
 Set the blend mode used for drawing operations.
 
RendererDrawPoint (int x, int y)
 Draw a point on the current rendering target.
 
RendererDrawPoint (const Point &p)
 Draw a point on the current rendering target.
 
RendererDrawPoints (const Point *points, int count)
 Draw multiple points on the current rendering target.
 
RendererDrawLine (int x1, int y1, int x2, int y2)
 Draw a line on the current rendering target.
 
RendererDrawLine (const Point &p1, const Point &p2)
 Draw a line on the current rendering target.
 
RendererDrawLines (const Point *points, int count)
 Draw a polyline on the current rendering target.
 
RendererDrawRect (int x1, int y1, int x2, int y2)
 Draw a rectangle on the current rendering target.
 
RendererDrawRect (const Point &p1, const Point &p2)
 Draw a rectangle on the current rendering target.
 
RendererDrawRect (const Rect &r)
 Draw a rectangle on the current rendering target.
 
RendererDrawRects (const Rect *rects, int count)
 Draw multiple rectangles on the current rendering target.
 
RendererFillRect (int x1, int y1, int x2, int y2)
 Fill a rectangle on the current rendering target.
 
RendererFillRect (const Point &p1, const Point &p2)
 Fill a rectangle on the current rendering target.
 
RendererFillRect (const Rect &r)
 Fill a rectangle on the current rendering target.
 
RendererFillRects (const Rect *rects, int count)
 Fill multiple rectangles on the current rendering target.
 
void ReadPixels (const Optional< Rect > &rect, Uint32 format, void *pixels, int pitch)
 Read pixels from the current rendering target.
 
RendererSetClipRect (const Optional< Rect > &rect=NullOpt)
 Set the clipping rectangle for rendering.
 
RendererSetLogicalSize (int w, int h)
 Set a device independent resolution for rendering.
 
RendererSetScale (float scaleX, float scaleY)
 Set the drawing scale for rendering on the current target.
 
RendererSetViewport (const Optional< Rect > &rect=NullOpt)
 Set the drawing area for rendering on the current target.
 
bool TargetSupported () const
 Determine whether a window supports the use of render targets.
 
Optional< RectGetClipRect () const
 Get the clip rectangle for the current target.
 
Point GetLogicalSize () const
 Get device independent resolution for rendering.
 
int GetLogicalWidth () const
 Get device independent width resolution for rendering.
 
int GetLogicalHeight () const
 Get device independent width resolution for rendering.
 
void GetScale (float &scalex, float &scaley) const
 Get the drawing scale for the current target.
 
float GetXScale () const
 Get the drawing scale for the current target.
 
float GetYScale () const
 Get the drawing scale for the current target.
 
Rect GetViewport () const
 Get the drawing area for the current target.
 
SDL_BlendMode GetDrawBlendMode () const
 Get the blend mode used for drawing operations.
 
Color GetDrawColor () const
 Get the additional color value multiplied into render copy operations.
 
void GetDrawColor (Uint8 &r, Uint8 &g, Uint8 &b, Uint8 &a) const
 Get the additional color value multiplied into render copy operations.
 
Point GetOutputSize () const
 Get the output size of a rendering context.
 
int GetOutputWidth () const
 Get the output width of a rendering context.
 
int GetOutputHeight () const
 Get the output height of a rendering context.
 

Detailed Description

2D rendering context

Constructor & Destructor Documentation

◆ Renderer() [1/4]

SDL2pp::Renderer::Renderer ( SDL_Renderer *  renderer)
explicit

Construct from existing SDL_Renderer structure.

Parameters
[in]rendererExisting SDL_Renderer to manage

◆ Renderer() [2/4]

SDL2pp::Renderer::Renderer ( Window window,
int  index,
Uint32  flags 
)

Create renderer.

Parameters
[in]windowWindow where rendering is displayed
[in]indexIndex of the rendering driver to initialize, or -1 to initialize the first one supporting the requested flags
[in]flags0 or more SDL_RendererFlags OR'ed together
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_CreateRenderer

◆ ~Renderer()

SDL2pp::Renderer::~Renderer ( )
virtual

◆ Renderer() [3/4]

SDL2pp::Renderer::Renderer ( Renderer &&  other)
noexcept

Move constructor.

Parameters
[in]otherSDL2pp::Renderer object to move data from

◆ Renderer() [4/4]

SDL2pp::Renderer::Renderer ( const Renderer other)
delete

Deleted copy constructor.

This class is not copyable

Member Function Documentation

◆ Clear()

Renderer & SDL2pp::Renderer::Clear ( )

Clear the current rendering target with the drawing color.

Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderClear

◆ Copy() [1/4]

Renderer & SDL2pp::Renderer::Copy ( Texture texture,
const Optional< Rect > &  srcrect,
const Optional< Rect > &  dstrect,
double  angle,
const Optional< Point > &  center = NullOpt,
int  flip = 0 
)

Copy a portion of the texture to the current rendering target with optional rotating or flipping.

Parameters
[in]textureSource texture
[in]srcrectSource rectangle, NullOpt for the entire texture
[in]dstrectDestination rectangle, NullOpt for the entire rendering target
[in]angleAngle in degrees that indicates the rotation that will be applied to dstrect
[in]centerPoint indicating the point around which dstrect will be rotated (NullOpt to rotate around dstrect center)
[in]flipSDL_RendererFlip value stating which flipping actions should be performed on the texture
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RendererFlip
http://wiki.libsdl.org/SDL_RenderCopyEx

◆ Copy() [2/4]

Renderer & SDL2pp::Renderer::Copy ( Texture texture,
const Optional< Rect > &  srcrect,
const Point dstpoint 
)

Copy a portion of the texture to the current rendering target (preserve texture dimensions)

Parameters
[in]textureSource texture
[in]srcrectSource rectangle, NullOpt for the entire texture
[in]dstpointTarget point for source top left corner
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderCopy

◆ Copy() [3/4]

Renderer & SDL2pp::Renderer::Copy ( Texture texture,
const Optional< Rect > &  srcrect,
const SDL2pp::Point dstpoint,
double  angle,
const Optional< Point > &  center = NullOpt,
int  flip = 0 
)

Copy a portion of the texture to the current rendering target with optional rotating or flipping (preserve texture dimensions)

Parameters
[in]textureSource texture
[in]srcrectSource rectangle, NullOpt for the entire texture
[in]dstpointTarget point for source top left corner
[in]angleAngle in degrees that indicates the rotation that will be applied to dstrect
[in]centerPoint indicating the point around which dstrect will be rotated (NullOpt to rotate around dstrect center)
[in]flipSDL_RendererFlip value stating which flipping actions should be performed on the texture
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RendererFlip
http://wiki.libsdl.org/SDL_RenderCopyEx

◆ Copy() [4/4]

Renderer & SDL2pp::Renderer::Copy ( Texture texture,
const Optional< Rect > &  srcrect = NullOpt,
const Optional< Rect > &  dstrect = NullOpt 
)

Copy a portion of the texture to the current rendering target.

Parameters
[in]textureSource texture
[in]srcrectSource rectangle, NullOpt for the entire texture
[in]dstrectDestination rectangle, NullOpt for the entire rendering target
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderCopy

◆ DrawLine() [1/2]

Renderer & SDL2pp::Renderer::DrawLine ( const Point p1,
const Point p2 
)

Draw a line on the current rendering target.

Parameters
[in]p1Coordinates of the start point
[in]p2Coordinates of the end point
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderDrawLine

◆ DrawLine() [2/2]

Renderer & SDL2pp::Renderer::DrawLine ( int  x1,
int  y1,
int  x2,
int  y2 
)

Draw a line on the current rendering target.

Parameters
[in]x1X coordinate of the start point
[in]y1Y coordinate of the start point
[in]x2X coordinate of the end point
[in]y2Y coordinate of the end point
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderDrawLine

◆ DrawLines()

Renderer & SDL2pp::Renderer::DrawLines ( const Point points,
int  count 
)

Draw a polyline on the current rendering target.

Parameters
[in]pointsArray of coordinates of points along the polyline
[in]countNumber of points to draw count-1 polyline segments
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderDrawLines

◆ DrawPoint() [1/2]

Renderer & SDL2pp::Renderer::DrawPoint ( const Point p)

Draw a point on the current rendering target.

Parameters
[in]pCoordinates of the point
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderDrawPoint

◆ DrawPoint() [2/2]

Renderer & SDL2pp::Renderer::DrawPoint ( int  x,
int  y 
)

Draw a point on the current rendering target.

Parameters
[in]xX coordinate of the point
[in]yY coordinate of the point
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderDrawPoint

◆ DrawPoints()

Renderer & SDL2pp::Renderer::DrawPoints ( const Point points,
int  count 
)

Draw multiple points on the current rendering target.

Parameters
[in]pointsArray of coordinates of points to draw
[in]countNumber of points to draw
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderDrawPoints

◆ DrawRect() [1/3]

Renderer & SDL2pp::Renderer::DrawRect ( const Point p1,
const Point p2 
)

Draw a rectangle on the current rendering target.

Parameters
[in]p1Coordinates of the start corner
[in]p2Coordinates of the end corner
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderDrawRect

◆ DrawRect() [2/3]

Renderer & SDL2pp::Renderer::DrawRect ( const Rect r)

Draw a rectangle on the current rendering target.

Parameters
[in]rRectangle to draw
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderDrawRect

◆ DrawRect() [3/3]

Renderer & SDL2pp::Renderer::DrawRect ( int  x1,
int  y1,
int  x2,
int  y2 
)

Draw a rectangle on the current rendering target.

Parameters
[in]x1X coordinate of the start corner
[in]y1Y coordinate of the start corner
[in]x2X coordinate of the end corner
[in]y2Y coordinate of the end corner
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderDrawRect

◆ DrawRects()

Renderer & SDL2pp::Renderer::DrawRects ( const Rect rects,
int  count 
)

Draw multiple rectangles on the current rendering target.

Parameters
[in]rectsArray of rectangles to draw
[in]countNumber of rectangles
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderDrawRects

◆ FillCopy()

Renderer & SDL2pp::Renderer::FillCopy ( Texture texture,
const Optional< Rect > &  srcrect = NullOpt,
const Optional< Rect > &  dstrect = NullOpt,
const Point offset = Point(0, 0),
int  flip = 0 
)

Fill the target with repeated source texture.

Parameters
[in]textureSource texture
[in]srcrectSource rectangle, NullOpt for the entire texture
[in]dstrectDestination rectangle, NullOpt for the entire rendering target
[in]offsetOffset of tiled texture in pixels relative to dstrect
[in]flipSDL_RendererFlip value stating which flipping actions should be performed on the texture
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RendererFlip
http://wiki.libsdl.org/SDL_RenderCopy
http://wiki.libsdl.org/SDL_RenderCopyEx

◆ FillRect() [1/3]

Renderer & SDL2pp::Renderer::FillRect ( const Point p1,
const Point p2 
)

Fill a rectangle on the current rendering target.

Parameters
[in]p1Coordinates of the start corner
[in]p2Coordinates of the end corner
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderFillRect

◆ FillRect() [2/3]

Renderer & SDL2pp::Renderer::FillRect ( const Rect r)

Fill a rectangle on the current rendering target.

Parameters
[in]rRectangle to draw
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderFillRect

◆ FillRect() [3/3]

Renderer & SDL2pp::Renderer::FillRect ( int  x1,
int  y1,
int  x2,
int  y2 
)

Fill a rectangle on the current rendering target.

Parameters
[in]x1X coordinate of the start corner
[in]y1Y coordinate of the start corner
[in]x2X coordinate of the end corner
[in]y2Y coordinate of the end corner
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderFillRect

◆ FillRects()

Renderer & SDL2pp::Renderer::FillRects ( const Rect rects,
int  count 
)

Fill multiple rectangles on the current rendering target.

Parameters
[in]rectsArray of rectangles to draw
[in]countNumber of rectangles
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderFillRects

◆ Get()

SDL_Renderer * SDL2pp::Renderer::Get ( ) const

Get pointer to managed SDL_Renderer structure.

Returns
Pointer to managed SDL_Renderer structure

◆ GetClipRect()

Optional< Rect > SDL2pp::Renderer::GetClipRect ( ) const

Get the clip rectangle for the current target.

Returns
Rect representing current clipping area or NullOpt if clipping is disabled
See also
http://wiki.libsdl.org/SDL_RenderGetClipRect

◆ GetDrawBlendMode()

SDL_BlendMode SDL2pp::Renderer::GetDrawBlendMode ( ) const

Get the blend mode used for drawing operations.

Returns
Current SDL_BlendMode
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_GetRenderDrawBlendMode

◆ GetDrawColor() [1/2]

Color SDL2pp::Renderer::GetDrawColor ( ) const

Get the additional color value multiplied into render copy operations.

Returns
Color object with the value used to do render copy operations
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_GetRenderDrawColor

◆ GetDrawColor() [2/2]

void SDL2pp::Renderer::GetDrawColor ( Uint8 &  r,
Uint8 &  g,
Uint8 &  b,
Uint8 &  a 
) const

Get the additional color value multiplied into render copy operations.

Parameters
[out]rVariable to be filled in with red value used to draw on the rendering target
[out]gVariable to be filled in with green value used to draw on the rendering target
[out]bVariable to be filled in with blue value used to draw on the rendering target
[out]aVariable to be filled in with alpha value used to draw on the rendering target
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_GetRenderDrawColor

◆ GetInfo()

void SDL2pp::Renderer::GetInfo ( SDL_RendererInfo &  info)

Get information about a rendering context.

Parameters
[out]infoSDL_RendererInfo structure to be filled with information about the current renderer
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_GetRendererInfo

◆ GetLogicalHeight()

int SDL2pp::Renderer::GetLogicalHeight ( ) const

Get device independent width resolution for rendering.

Returns
Logical resolution height
See also
http://wiki.libsdl.org/SDL_RenderGetLogicalSize
Note
If this function is called on an Renderer who never had its logical size set by SetLogicalSize(), this function returns 0

◆ GetLogicalSize()

Point SDL2pp::Renderer::GetLogicalSize ( ) const

Get device independent resolution for rendering.

Returns
Point representing logical resolution
See also
http://wiki.libsdl.org/SDL_RenderGetLogicalSize
Note
If this function is called on an Renderer who never had its logical size set by SetLogicalSize(), this function returns {0, 0}

◆ GetLogicalWidth()

int SDL2pp::Renderer::GetLogicalWidth ( ) const

Get device independent width resolution for rendering.

Returns
Logical resolution width
See also
http://wiki.libsdl.org/SDL_RenderGetLogicalSize
Note
If this function is called on an Renderer who never had its logical size set by SetLogicalSize(), this function returns 0

◆ GetOutputHeight()

int SDL2pp::Renderer::GetOutputHeight ( ) const

Get the output height of a rendering context.

Returns
Output height
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_GetRendererOutputSize

◆ GetOutputSize()

Point SDL2pp::Renderer::GetOutputSize ( ) const

Get the output size of a rendering context.

Returns
Point representing output size
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_GetRendererOutputSize

◆ GetOutputWidth()

int SDL2pp::Renderer::GetOutputWidth ( ) const

Get the output width of a rendering context.

Returns
Output width
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_GetRendererOutputSize

◆ GetScale()

void SDL2pp::Renderer::GetScale ( float &  scalex,
float &  scaley 
) const

Get the drawing scale for the current target.

Parameters
[out]scalexVariable to be filled with the horizontal scaling factor
[out]scaleyVariable to be filled with the vertical scaling factor
See also
http://wiki.libsdl.org/SDL_RenderGetScale

◆ GetViewport()

Rect SDL2pp::Renderer::GetViewport ( ) const

Get the drawing area for the current target.

Returns
Rect representing current drawing area
See also
http://wiki.libsdl.org/SDL_RenderGetViewport

◆ GetXScale()

float SDL2pp::Renderer::GetXScale ( ) const

Get the drawing scale for the current target.

Returns
Horizontal scaling factor
See also
http://wiki.libsdl.org/SDL_RenderGetScale

◆ GetYScale()

float SDL2pp::Renderer::GetYScale ( ) const

Get the drawing scale for the current target.

Returns
Vertical scaling factor
See also
http://wiki.libsdl.org/SDL_RenderGetScale

◆ operator=() [1/2]

Renderer & SDL2pp::Renderer::operator= ( const Renderer other)
delete

Deleted assignment operator.

This class is not copyable

◆ operator=() [2/2]

Renderer & SDL2pp::Renderer::operator= ( Renderer &&  other)
noexcept

Move assignment operator.

Parameters
[in]otherSDL2pp::Renderer object to move data from
Returns
Reference to self

◆ Present()

Renderer & SDL2pp::Renderer::Present ( )

Update the screen with any rendering performed since the previous call.

SDL's rendering functions operate on a backbuffer; that is, calling a rendering function such as SDL_RenderDrawLine() does not directly put a line on the screen, but rather updates the backbuffer. As such, you compose your entire scene and present the composed backbuffer to the screen as a complete picture.

Therefore, when using SDL's rendering API, one does all drawing intended for the frame, and then calls this function once per frame to present the final drawing to the user.

Returns
Reference to self
See also
http://wiki.libsdl.org/SDL_RenderPresent

◆ ReadPixels()

void SDL2pp::Renderer::ReadPixels ( const Optional< Rect > &  rect,
Uint32  format,
void *  pixels,
int  pitch 
)

Read pixels from the current rendering target.

Parameters
[in]rectArea to read or NullOpt for the entire render target
[in]formatDesired format of the pixel data, or 0 to use the format of the rendering target
[in]pixelsPointer to memory to be filled with pixel data
[in]pitchNumber of bytes in a row of pixel data, including padding between lines
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderReadPixels

◆ SetClipRect()

Renderer & SDL2pp::Renderer::SetClipRect ( const Optional< Rect > &  rect = NullOpt)

Set the clipping rectangle for rendering.

Parameters
[in]rectNew clipping rectangle or NullOpt to disable clipping
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderSetClipRect

◆ SetDrawBlendMode()

Renderer & SDL2pp::Renderer::SetDrawBlendMode ( SDL_BlendMode  blendMode = SDL_BLENDMODE_NONE)

Set the blend mode used for drawing operations.

Parameters
[in]blendModeSDL_BlendMode to use for blending
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_BlendMode
http://wiki.libsdl.org/SDL_SetRenderDrawBlendMode

◆ SetDrawColor() [1/2]

Renderer & SDL2pp::Renderer::SetDrawColor ( const Color color)

Set color user for drawing operations.

Parameters
[in]colorColor to draw on the rendering target
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_SetRenderDrawColor

◆ SetDrawColor() [2/2]

Renderer & SDL2pp::Renderer::SetDrawColor ( Uint8  r = 0,
Uint8  g = 0,
Uint8  b = 0,
Uint8  a = 255 
)

Set color user for drawing operations.

Parameters
[in]rRed value used to draw on the rendering target
[in]gGreen value used to draw on the rendering target
[in]bBlue value used to draw on the rendering target
[in]aAlpha value used to draw on the rendering target
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_SetRenderDrawColor

◆ SetLogicalSize()

Renderer & SDL2pp::Renderer::SetLogicalSize ( int  w,
int  h 
)

Set a device independent resolution for rendering.

Parameters
[in]wWidth of the logical resolution
[in]hHeight of the logical resolution
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderSetLogicalSize

◆ SetScale()

Renderer & SDL2pp::Renderer::SetScale ( float  scaleX,
float  scaleY 
)

Set the drawing scale for rendering on the current target.

Parameters
[in]scaleXHorizontal scaling factor
[in]scaleYVertical scaling factor
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderSetScale

◆ SetTarget() [1/2]

Renderer & SDL2pp::Renderer::SetTarget ( )

Set current render target to default.

Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_SetRenderTarget

◆ SetTarget() [2/2]

Renderer & SDL2pp::Renderer::SetTarget ( Texture texture)

Set current render target to specified texture.

Parameters
[in]textureTarget texture, SDL2pp::Texture created with SDL_TEXTUREACCESS_TARGET
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_SetRenderTarget

◆ SetViewport()

Renderer & SDL2pp::Renderer::SetViewport ( const Optional< Rect > &  rect = NullOpt)

Set the drawing area for rendering on the current target.

Parameters
[in]rectRectangle representing the drawing area or NullOpt to set the viewport to the entire target
Returns
Reference to self
Exceptions
SDL2pp::Exception
See also
http://wiki.libsdl.org/SDL_RenderSetViewport

◆ TargetSupported()

bool SDL2pp::Renderer::TargetSupported ( ) const

Determine whether a window supports the use of render targets.

Returns
True if render targets are supported
See also
http://wiki.libsdl.org/SDL_RenderTargetSupported

The documentation for this class was generated from the following files: