1#ifndef SDL3PP_RENDER_H_
2#define SDL3PP_RENDER_H_
4#include <SDL3/SDL_render.h>
5#include "SDL3pp_blendmode.h"
6#include "SDL3pp_events.h"
7#include "SDL3pp_pixels.h"
8#include "SDL3pp_video.h"
69 constexpr explicit operator bool()
const {
return !!
value; }
102 constexpr explicit operator bool()
const {
return !!
value; }
118#define SDL_SOFTWARE_RENDERER "software"
137 SDL_TEXTUREACCESS_STATIC;
140 SDL_TEXTUREACCESS_STREAMING;
143 SDL_TEXTUREACCESS_TARGET;
153 SDL_LOGICAL_PRESENTATION_DISABLED;
157 SDL_LOGICAL_PRESENTATION_STRETCH;
164 SDL_LOGICAL_PRESENTATION_LETTERBOX;
171 SDL_LOGICAL_PRESENTATION_OVERSCAN;
178 SDL_LOGICAL_PRESENTATION_INTEGER_SCALE;
203 : m_resource(resource)
252 : m_resource(
CheckError(SDL_CreateRenderer(window, nullptr)))
290 : m_resource(
CheckError(SDL_CreateRenderer(window, name)))
345 : m_resource(
CheckError(SDL_CreateRendererWithProperties(props)))
368 : m_resource(
CheckError(SDL_CreateSoftwareRenderer(surface)))
378 std::swap(m_resource, other.m_resource);
389 m_resource =
nullptr;
397 constexpr bool operator==(std::nullptr_t _)
const {
return !m_resource; }
400 constexpr explicit operator bool()
const {
return !!m_resource; }
1109 void GetScale(
float* scaleX,
float* scaleY)
const;
1485 FlipMode flip = FlipMode::SDL_FLIP_NONE);
1580 float bottom_height,
1603 std::span<const Vertex> vertices,
1604 std::span<const int> indices = {});
1635 const FColor* color,
1640 const void* indices,
1668 Surface
ReadPixels(OptionalRef<const RectRaw> rect = {})
const;
1850 template<
class... ARGS>
1852 std::string_view fmt,
2085 Sint64 signal_semaphore);
2141 : m_resource(resource)
2180 CheckError(SDL_CreateTexture(renderer, format, access, size.x, size.y)))
2209 : m_resource(
CheckError(SDL_CreateTextureFromSurface(renderer, surface)))
2323 : m_resource(
CheckError(SDL_CreateTextureWithProperties(renderer, props)))
2413 ++resource.
value->refcount;
2425 std::swap(m_resource, other.m_resource);
2435 auto r = m_resource;
2436 m_resource =
nullptr;
2444 constexpr bool operator==(std::nullptr_t _)
const {
return !m_resource; }
2447 constexpr explicit operator bool()
const {
return !!m_resource; }
2959 const Uint8* Yplane,
2961 const Uint8* Uplane,
2963 const Uint8* Vplane,
2991 const Uint8* Yplane,
2993 const Uint8* UVplane,
3107 void GetSize(
float* w,
float* h)
const;
3169 return SDL_GetRenderDriver(index);
3194 SDL_Window* window =
nullptr;
3195 SDL_Renderer* renderer =
nullptr;
3197 title, size.x, size.y, window_flags, &window, &renderer));
3237 return Renderer(window, std::move(name));
3296namespace prop::Renderer {
3298constexpr auto CREATE_NAME_STRING = SDL_PROP_RENDERER_CREATE_NAME_STRING;
3300constexpr auto CREATE_WINDOW_POINTER = SDL_PROP_RENDERER_CREATE_WINDOW_POINTER;
3302constexpr auto CREATE_SURFACE_POINTER =
3303 SDL_PROP_RENDERER_CREATE_SURFACE_POINTER;
3305constexpr auto CREATE_OUTPUT_COLORSPACE_NUMBER =
3306 SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER;
3308constexpr auto CREATE_PRESENT_VSYNC_NUMBER =
3309 SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER;
3311constexpr auto CREATE_VULKAN_INSTANCE_POINTER =
3312 SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER;
3314constexpr auto CREATE_VULKAN_SURFACE_NUMBER =
3315 SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER;
3317constexpr auto CREATE_VULKAN_PHYSICAL_DEVICE_POINTER =
3318 SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER;
3320constexpr auto CREATE_VULKAN_DEVICE_POINTER =
3321 SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER;
3323constexpr auto CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER =
3324 SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER;
3326constexpr auto CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER =
3327 SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER;
3329constexpr auto NAME_STRING = SDL_PROP_RENDERER_NAME_STRING;
3331constexpr auto WINDOW_POINTER = SDL_PROP_RENDERER_WINDOW_POINTER;
3333constexpr auto SURFACE_POINTER = SDL_PROP_RENDERER_SURFACE_POINTER;
3335constexpr auto VSYNC_NUMBER = SDL_PROP_RENDERER_VSYNC_NUMBER;
3337constexpr auto MAX_TEXTURE_SIZE_NUMBER =
3338 SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER;
3340constexpr auto TEXTURE_FORMATS_POINTER =
3341 SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER;
3343constexpr auto OUTPUT_COLORSPACE_NUMBER =
3344 SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER;
3346constexpr auto HDR_ENABLED_BOOLEAN = SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN;
3348constexpr auto SDR_WHITE_POINT_FLOAT = SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT;
3350constexpr auto HDR_HEADROOM_FLOAT = SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT;
3352constexpr auto D3D9_DEVICE_POINTER = SDL_PROP_RENDERER_D3D9_DEVICE_POINTER;
3354constexpr auto D3D11_DEVICE_POINTER = SDL_PROP_RENDERER_D3D11_DEVICE_POINTER;
3356constexpr auto D3D11_SWAPCHAIN_POINTER =
3357 SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER;
3359constexpr auto D3D12_DEVICE_POINTER = SDL_PROP_RENDERER_D3D12_DEVICE_POINTER;
3361constexpr auto D3D12_SWAPCHAIN_POINTER =
3362 SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER;
3364constexpr auto D3D12_COMMAND_QUEUE_POINTER =
3365 SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER;
3367constexpr auto VULKAN_INSTANCE_POINTER =
3368 SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER;
3370constexpr auto VULKAN_SURFACE_NUMBER = SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER;
3372constexpr auto VULKAN_PHYSICAL_DEVICE_POINTER =
3373 SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER;
3375constexpr auto VULKAN_DEVICE_POINTER = SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER;
3377constexpr auto VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER =
3378 SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER;
3380constexpr auto VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER =
3381 SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER;
3383constexpr auto VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER =
3384 SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER;
3386constexpr auto GPU_DEVICE_POINTER = SDL_PROP_RENDERER_GPU_DEVICE_POINTER;
3416 return {
CheckError(SDL_GetRenderer(m_resource))};
3432 return {
CheckError(SDL_GetRenderWindow(renderer))};
3456 return SDL_GetRendererName(renderer);
3550 return {
CheckError(SDL_GetRendererProperties(renderer))};
3580 CheckError(SDL_GetRenderOutputSize(renderer, w, h));
3610 CheckError(SDL_GetCurrentRenderOutputSize(renderer, w, h));
3645 return Texture(renderer, format, access, size);
3652 return Texture(m_resource, format, access, size);
3684 return Texture(renderer, surface);
3689 return Texture(m_resource, surface);
3805 return Texture(renderer, props);
3810 return Texture(m_resource, props);
3813namespace prop::Texture {
3815constexpr auto CREATE_COLORSPACE_NUMBER =
3816 SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER;
3818constexpr auto CREATE_FORMAT_NUMBER = SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER;
3820constexpr auto CREATE_ACCESS_NUMBER = SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER;
3822constexpr auto CREATE_WIDTH_NUMBER = SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER;
3824constexpr auto CREATE_HEIGHT_NUMBER = SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER;
3826constexpr auto CREATE_SDR_WHITE_POINT_FLOAT =
3827 SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT;
3829constexpr auto CREATE_HDR_HEADROOM_FLOAT =
3830 SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT;
3832constexpr auto CREATE_D3D11_TEXTURE_POINTER =
3833 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER;
3835constexpr auto CREATE_D3D11_TEXTURE_U_POINTER =
3836 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER;
3838constexpr auto CREATE_D3D11_TEXTURE_V_POINTER =
3839 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER;
3841constexpr auto CREATE_D3D12_TEXTURE_POINTER =
3842 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER;
3844constexpr auto CREATE_D3D12_TEXTURE_U_POINTER =
3845 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER;
3847constexpr auto CREATE_D3D12_TEXTURE_V_POINTER =
3848 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER;
3850constexpr auto CREATE_METAL_PIXELBUFFER_POINTER =
3851 SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER;
3853constexpr auto CREATE_OPENGL_TEXTURE_NUMBER =
3854 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER;
3856constexpr auto CREATE_OPENGL_TEXTURE_UV_NUMBER =
3857 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER;
3859constexpr auto CREATE_OPENGL_TEXTURE_U_NUMBER =
3860 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER;
3862constexpr auto CREATE_OPENGL_TEXTURE_V_NUMBER =
3863 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER;
3865constexpr auto CREATE_OPENGLES2_TEXTURE_NUMBER =
3866 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER;
3868constexpr auto CREATE_OPENGLES2_TEXTURE_UV_NUMBER =
3869 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER;
3871constexpr auto CREATE_OPENGLES2_TEXTURE_U_NUMBER =
3872 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER;
3874constexpr auto CREATE_OPENGLES2_TEXTURE_V_NUMBER =
3875 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER;
3877constexpr auto CREATE_VULKAN_TEXTURE_NUMBER =
3878 SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER;
3880constexpr auto COLORSPACE_NUMBER = SDL_PROP_TEXTURE_COLORSPACE_NUMBER;
3882constexpr auto FORMAT_NUMBER = SDL_PROP_TEXTURE_FORMAT_NUMBER;
3884constexpr auto ACCESS_NUMBER = SDL_PROP_TEXTURE_ACCESS_NUMBER;
3886constexpr auto WIDTH_NUMBER = SDL_PROP_TEXTURE_WIDTH_NUMBER;
3888constexpr auto HEIGHT_NUMBER = SDL_PROP_TEXTURE_HEIGHT_NUMBER;
3890constexpr auto SDR_WHITE_POINT_FLOAT = SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT;
3892constexpr auto HDR_HEADROOM_FLOAT = SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT;
3894constexpr auto D3D11_TEXTURE_POINTER = SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER;
3896constexpr auto D3D11_TEXTURE_U_POINTER =
3897 SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER;
3899constexpr auto D3D11_TEXTURE_V_POINTER =
3900 SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER;
3902constexpr auto D3D12_TEXTURE_POINTER = SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER;
3904constexpr auto D3D12_TEXTURE_U_POINTER =
3905 SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER;
3907constexpr auto D3D12_TEXTURE_V_POINTER =
3908 SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER;
3910constexpr auto OPENGL_TEXTURE_NUMBER = SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER;
3912constexpr auto OPENGL_TEXTURE_UV_NUMBER =
3913 SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER;
3915constexpr auto OPENGL_TEXTURE_U_NUMBER =
3916 SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER;
3918constexpr auto OPENGL_TEXTURE_V_NUMBER =
3919 SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER;
3921constexpr auto OPENGL_TEXTURE_TARGET_NUMBER =
3922 SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER;
3924constexpr auto OPENGL_TEX_W_FLOAT = SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT;
3926constexpr auto OPENGL_TEX_H_FLOAT = SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT;
3928constexpr auto OPENGLES2_TEXTURE_NUMBER =
3929 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER;
3931constexpr auto OPENGLES2_TEXTURE_UV_NUMBER =
3932 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER;
3934constexpr auto OPENGLES2_TEXTURE_U_NUMBER =
3935 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER;
3937constexpr auto OPENGLES2_TEXTURE_V_NUMBER =
3938 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER;
3940constexpr auto OPENGLES2_TEXTURE_TARGET_NUMBER =
3941 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER;
3943constexpr auto VULKAN_TEXTURE_NUMBER = SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER;
4035 return {
CheckError(SDL_GetTextureProperties(texture))};
4056 return {SDL_GetRendererFromTexture(texture)};
4080 CheckError(SDL_GetTextureSize(texture, w, h));
4116 CheckError(SDL_SetTextureColorMod(texture, r, g, b));
4155 CheckError(SDL_SetTextureColorModFloat(texture, r, g, b));
4185 CheckError(SDL_GetTextureColorMod(texture, r, g, b));
4215 CheckError(SDL_GetTextureColorModFloat(texture, r, g, b));
4248 CheckError(SDL_SetTextureAlphaMod(texture, alpha));
4281 CheckError(SDL_SetTextureAlphaModFloat(texture, alpha));
4307 CheckError(SDL_GetTextureAlphaMod(texture, &alpha));
4334 CheckError(SDL_GetTextureAlphaModFloat(texture, &alpha));
4361 CheckError(SDL_SetTextureBlendMode(texture, blendMode));
4385 CheckError(SDL_GetTextureBlendMode(texture, &blendMode));
4413 CheckError(SDL_SetTextureScaleMode(texture, scaleMode));
4437 CheckError(SDL_GetTextureScaleMode(texture, &scaleMode));
4482 CheckError(SDL_UpdateTexture(texture, rect, pixels, pitch));
4523 const Uint8* Yplane,
4525 const Uint8* Uplane,
4527 const Uint8* Vplane,
4531 texture, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch));
4535 const Uint8* Yplane,
4537 const Uint8* Uplane,
4539 const Uint8* Vplane,
4543 m_resource, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch);
4573 const Uint8* Yplane,
4575 const Uint8* UVplane,
4579 SDL_UpdateNVTexture(texture, rect, Yplane, Ypitch, UVplane, UVpitch));
4583 const Uint8* Yplane,
4585 const Uint8* UVplane,
4624 CheckError(SDL_LockTexture(texture, rect, pixels, pitch));
4671 CheckError(SDL_LockTextureToSurface(texture, rect, &surface));
4729 CheckError(SDL_SetRenderTarget(renderer, texture));
4754 TextureRaw texture = SDL_GetRenderTarget(renderer);
4819 CheckError(SDL_SetRenderLogicalPresentation(renderer, size.x, size.y, mode));
4854 CheckError(SDL_GetRenderLogicalPresentation(renderer, w, h, mode));
4889 CheckError(SDL_GetRenderLogicalPresentationRect(renderer, &rect));
4925 renderer, window_coord.x, window_coord.y, &p.x, &p.y));
4963 SDL_RenderCoordinatesToWindow(renderer, coord.x, coord.y, &p.x, &p.y));
5008 CheckError(SDL_ConvertEventToRenderCoordinates(renderer, event));
5043 CheckError(SDL_SetRenderViewport(renderer, rect));
5071 CheckError(SDL_GetRenderViewport(renderer, &rect));
5102 return SDL_RenderViewportSet(renderer);
5131 CheckError(SDL_GetRenderSafeArea(renderer, &rect));
5161 CheckError(SDL_SetRenderClipRect(renderer, rect));
5190 CheckError(SDL_GetRenderClipRect(renderer, &rect));
5218 return SDL_RenderClipEnabled(renderer);
5252 CheckError(SDL_SetRenderScale(renderer, scale.x, scale.y));
5279 CheckError(SDL_GetRenderScale(renderer, scaleX, scaleY));
5306 CheckError(SDL_SetRenderDrawColor(renderer, c.r, c.g, c.b, c.a));
5333 CheckError(SDL_SetRenderDrawColorFloat(renderer, c.r, c.g, c.b, c.a));
5368 CheckError(SDL_GetRenderDrawColor(renderer, r, g, b, a));
5403 CheckError(SDL_GetRenderDrawColorFloat(renderer, r, g, b, a));
5437 CheckError(SDL_SetRenderColorScale(renderer, scale));
5461 CheckError(SDL_GetRenderColorScale(renderer, &scale));
5487 CheckError(SDL_SetRenderDrawBlendMode(renderer, blendMode));
5511 CheckError(SDL_GetRenderDrawBlendMode(renderer, &blendMode));
5559 CheckError(SDL_RenderPoint(renderer, p.x, p.y));
5609 CheckError(SDL_RenderLine(renderer, p1.x, p1.y, p2.x, p2.y));
5707 CheckError(SDL_RenderFillRect(renderer, rect));
5764 CheckError(SDL_RenderTexture(renderer, texture, srcrect, dstrect));
5805 FlipMode flip = FlipMode::SDL_FLIP_NONE)
5808 renderer, texture, srcrect, dstrect, angle, center, flip));
5819 m_resource, texture, srcrect, dstrect, angle, center, flip);
5855 SDL_RenderTextureAffine(renderer, texture, srcrect, origin, right, down));
5898 SDL_RenderTextureTiled(renderer, texture, srcrect, scale, dstrect));
5946 float bottom_height,
5966 float bottom_height,
6002 std::span<const Vertex> vertices,
6003 std::span<const int> indices = {})
6014 std::span<const Vertex> vertices,
6015 std::span<const int> indices)
6055 const void* indices,
6081 const void* indices,
6127 return Surface{
CheckError(SDL_RenderReadPixels(renderer, rect))};
6224 SDL_DestroyRenderer(renderer);
6284 return CheckError(SDL_GetRenderMetalLayer(renderer));
6315 return CheckError(SDL_GetRenderMetalCommandEncoder(renderer));
6356 renderer, wait_stage_mask, wait_semaphore, signal_semaphore));
6364 m_resource, wait_stage_mask, wait_semaphore, signal_semaphore);
6391 CheckError(SDL_SetRenderVSync(renderer, vsync));
6400#define SDL_RENDERER_VSYNC_DISABLED 0
6403#define SDL_RENDERER_VSYNC_ADAPTIVE (-1)
6422 CheckError(SDL_GetRenderVSync(renderer, &vsync));
6440#define SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE 8
6483 CheckError(SDL_RenderDebugText(renderer, p.x, p.y, str));
6515template<
class... ARGS>
6518 std::string_view fmt,
6522 renderer, p, std::vformat(fmt, std::make_format_args(args...)));
6525template<
class... ARGS>
6527 std::string_view fmt,
Optional-like shim for references.
Definition: SDL3pp_optionalRef.h:20
A structure representing rendering state.
Definition: SDL3pp_render.h:188
Point GetCurrentOutputSize() const
Get the current output size in pixels of a rendering context.
Definition: SDL3pp_render.h:499
constexpr bool operator==(std::nullptr_t _) const
Comparison.
Definition: SDL3pp_render.h:397
constexpr RendererRaw get() const
Retrieves underlying RendererRaw.
Definition: SDL3pp_render.h:383
FPoint GetScale() const
Get the drawing scale for the current target.
Definition: SDL3pp_render.h:1086
constexpr RendererRaw release()
Retrieves underlying RendererRaw and clear this.
Definition: SDL3pp_render.h:386
void ResetTarget()
Set target texture back to window.
Definition: SDL3pp_render.h:626
Renderer(WindowParam window)
Create a 2D rendering context for a window.
Definition: SDL3pp_render.h:251
constexpr Renderer(const RendererRaw resource)
Constructs from RendererParam.
Definition: SDL3pp_render.h:202
FColor GetDrawColorFloat() const
Get the color used for drawing operations (Rect, Line and Clear).
Definition: SDL3pp_render.h:1202
Renderer(WindowParam window, StringParam name)
Create a 2D rendering context for a window.
Definition: SDL3pp_render.h:289
constexpr Renderer()=default
Default ctor.
Point GetOutputSize() const
Get the output size in pixels of a rendering context.
Definition: SDL3pp_render.h:455
void ResetViewport()
Reset the drawing area for rendering to the entire target.
Definition: SDL3pp_render.h:887
Renderer(SurfaceParam surface)
Create a 2D software rendering context for a surface.
Definition: SDL3pp_render.h:367
constexpr auto operator<=>(const Renderer &other) const =default
Comparison.
Renderer & operator=(Renderer other)
Assignment operator.
Definition: SDL3pp_render.h:376
Renderer(PropertiesParam props)
Create a 2D rendering context for a window, with the specified properties.
Definition: SDL3pp_render.h:344
~Renderer()
Destructor.
Definition: SDL3pp_render.h:373
void GetLogicalPresentation(PointRaw *size, RendererLogicalPresentation *mode)
Get device independent resolution and presentation mode for rendering.
Definition: SDL3pp_render.h:739
constexpr Renderer(Renderer &&other)
Move constructor.
Definition: SDL3pp_render.h:211
void ResetClipRect()
Reset the clip rectangle for rendering to the entire render target.
Definition: SDL3pp_render.h:987
constexpr Renderer(const Renderer &other)=delete
Copy constructor.
Color GetDrawColor() const
Get the color used for drawing operations (Rect, Line and Clear).
Definition: SDL3pp_render.h:1160
span-like for empty-derived structs
Definition: SDL3pp_spanRef.h:24
constexpr T * data() const
Retrieves contained data.
Definition: SDL3pp_spanRef.h:75
constexpr size_t size() const
Retrieves contained size.
Definition: SDL3pp_spanRef.h:69
Helpers to use C++ strings parameters.
Definition: SDL3pp_strings.h:43
A collection of pixels used in software blitting.
Definition: SDL3pp_surface.h:195
static constexpr Surface Borrow(SurfaceParam resource)
Safely borrows the from SurfaceParam.
Definition: SDL3pp_surface.h:374
An efficient driver-specific representation of pixel data.
Definition: SDL3pp_render.h:2126
constexpr auto operator<=>(const Texture &other) const =default
Comparison.
constexpr TextureRaw release()
Retrieves underlying TextureRaw and clear this.
Definition: SDL3pp_render.h:2433
constexpr TextureRaw get() const
Retrieves underlying TextureRaw.
Definition: SDL3pp_render.h:2430
constexpr Texture(const TextureRaw resource)
Constructs from TextureParam.
Definition: SDL3pp_render.h:2140
Point GetSize() const
Get the size in pixels.
Definition: SDL3pp_render.h:3092
FPoint GetSizeFloat() const
Get the size in pixels.
Definition: SDL3pp_render.h:3112
Texture & operator=(Texture other)
Assignment operator.
Definition: SDL3pp_render.h:2423
PixelFormat GetFormat() const
Get the pixel format.
Definition: SDL3pp_render.h:3122
int GetHeight() const
Get the height in pixels.
Definition: SDL3pp_render.h:3087
void SetModFloat(FColor c)
Set an additional color and alpha values multiplied into render copy operations.
Definition: SDL3pp_render.h:2617
constexpr Texture(const Texture &other)
Copy constructor.
Definition: SDL3pp_render.h:2146
void SetMod(Color c)
Set an additional color and alpha values multiplied into render copy operations.
Definition: SDL3pp_render.h:2589
Color GetMod() const
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:2636
Texture(RendererParam renderer, SurfaceParam surface)
Create a texture from an existing surface.
Definition: SDL3pp_render.h:2208
constexpr Texture()=default
Default ctor.
int GetWidth() const
Get the width in pixels.
Definition: SDL3pp_render.h:3082
FColor GetModFloat() const
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:2657
static constexpr Texture Borrow(TextureParam resource)
Safely borrows the from TextureParam.
Definition: SDL3pp_render.h:2410
constexpr Texture(Texture &&other)
Move constructor.
Definition: SDL3pp_render.h:2149
~Texture()
Destructor.
Definition: SDL3pp_render.h:2420
Texture(RendererParam renderer, PropertiesParam props)
Create a texture for a rendering context with the specified properties.
Definition: SDL3pp_render.h:2322
Texture(RendererParam renderer, PixelFormat format, TextureAccess access, const PointRaw &size)
Create a texture for a rendering context.
Definition: SDL3pp_render.h:2175
constexpr bool operator==(std::nullptr_t _) const
Comparison.
Definition: SDL3pp_render.h:2444
The struct used as an opaque handle to a window.
Definition: SDL3pp_video.h:737
Uint32 BlendMode
A set of blend modes used in drawing operations.
Definition: SDL3pp_blendmode.h:35
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition: SDL3pp_error.h:198
SDL_Event Event
The structure for all events in SDL.
Definition: SDL3pp_events.h:804
SDL_FColor FColorRaw
Alias to raw representation for FColor.
Definition: SDL3pp_pixels.h:90
SDL_Color ColorRaw
Alias to raw representation for Color.
Definition: SDL3pp_pixels.h:84
SDL_FPoint FPointRaw
Alias to raw representation for FPoint.
Definition: SDL3pp_rect.h:28
SDL_Point PointRaw
Alias to raw representation for Point.
Definition: SDL3pp_rect.h:22
Rect GetRenderSafeArea(RendererParam renderer)
Get the safe area for rendering within the current viewport.
Definition: SDL3pp_render.h:5128
Surface LockToSurface(OptionalRef< const SDL_Rect > rect=std::nullopt)
Lock a portion of the texture for write-only pixel access, and expose it as a SDL surface.
Definition: SDL3pp_render.h:4675
Renderer CreateRendererWithProperties(PropertiesParam props)
Create a 2D rendering context for a window, with the specified properties.
Definition: SDL3pp_render.h:3291
void SetDrawColorFloat(const FColorRaw &c)
Set the color used for drawing operations (Rect, Line and Clear).
Definition: SDL3pp_render.h:5336
void RenderPoints(RendererParam renderer, SpanRef< const FPointRaw > points)
Draw multiple points on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:5580
void SetDrawColor(ColorRaw c)
Set the color used for drawing operations.
Definition: SDL3pp_render.h:5309
Texture GetTarget() const
Get the current render target.
Definition: SDL3pp_render.h:4759
void Destroy()
Destroy the rendering context for a window and free all associated textures.
Definition: SDL3pp_render.h:6227
const char * GetName() const
Get the name of a renderer.
Definition: SDL3pp_render.h:3459
void SetRenderViewport(RendererParam renderer, OptionalRef< const RectRaw > rect)
Set the drawing area for rendering on the current target.
Definition: SDL3pp_render.h:5040
void SetRenderScale(RendererParam renderer, const FPointRaw &scale)
Set the drawing scale for rendering on the current target.
Definition: SDL3pp_render.h:5250
bool RenderViewportSet(RendererParam renderer)
Return whether an explicit rectangle was set as the viewport.
Definition: SDL3pp_render.h:5100
void UpdateTexture(TextureParam texture, OptionalRef< const RectRaw > rect, const void *pixels, int pitch)
Update the given texture rectangle with new pixel data.
Definition: SDL3pp_render.h:4477
void SetColorModFloat(float r, float g, float b)
Set an additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4158
void RenderPoint(const FPointRaw &p)
Draw a point on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:5562
void SetRenderDrawColor(RendererParam renderer, ColorRaw c)
Set the color used for drawing operations.
Definition: SDL3pp_render.h:5304
std::pair< Window, Renderer > CreateWindowAndRenderer(StringParam title, const PointRaw &size, WindowFlags window_flags=0)
Create a window and default renderer.
Definition: SDL3pp_render.h:3189
void SetTextureBlendMode(TextureParam texture, BlendMode blendMode)
Set the blend mode for a texture, used by Renderer.RenderTexture().
Definition: SDL3pp_render.h:4359
void GetCurrentRenderOutputSize(RendererParam renderer, int *w, int *h)
Get the current output size in pixels of a rendering context.
Definition: SDL3pp_render.h:3608
void SetBlendMode(BlendMode blendMode)
Set the blend mode for a texture, used by Renderer.RenderTexture().
Definition: SDL3pp_render.h:4364
Rect GetViewport() const
Get the drawing area for the current target.
Definition: SDL3pp_render.h:5075
void RenderFillRect(RendererParam renderer, OptionalRef< const FRectRaw > rect)
Fill a rectangle on the current rendering target with the drawing color at subpixel precision.
Definition: SDL3pp_render.h:5704
void SetDrawBlendMode(BlendMode blendMode)
Set the blend mode used for drawing operations (Fill and Line).
Definition: SDL3pp_render.h:5490
void SetAlphaMod(Uint8 alpha)
Set an additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4251
void RenderTextureRotated(RendererParam renderer, 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,...
Definition: SDL3pp_render.h:5799
void SetTextureColorModFloat(TextureParam texture, float r, float g, float b)
Set an additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4150
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 precisio...
Definition: SDL3pp_render.h:5961
SDL_Renderer * RendererRaw
Alias to raw representation for Renderer.
Definition: SDL3pp_render.h:46
void Destroy()
Destroy the specified texture.
Definition: SDL3pp_render.h:6206
bool IsClipEnabled() const
Get whether clipping is enabled on the given render target.
Definition: SDL3pp_render.h:5221
FPoint RenderCoordinatesToWindow(const FPointRaw &coord) const
Get a point in window coordinates when given a point in render coordinates.
Definition: SDL3pp_render.h:4967
void SetRenderVSync(RendererParam renderer, int vsync)
Toggle VSync of the given renderer.
Definition: SDL3pp_render.h:6389
void RenderPresent(RendererParam renderer)
Update the screen with any rendering performed since the previous call.
Definition: SDL3pp_render.h:6182
void RenderDebugText(RendererParam renderer, const FPointRaw &p, StringParam str)
Draw debug text to an Renderer.
Definition: SDL3pp_render.h:6479
void SetRenderClipRect(RendererParam renderer, OptionalRef< const RectRaw > rect)
Set the clip rectangle for rendering on the specified target.
Definition: SDL3pp_render.h:5158
FPoint RenderCoordinatesToWindow(RendererParam renderer, const FPointRaw &coord)
Get a point in window coordinates when given a point in render coordinates.
Definition: SDL3pp_render.h:4958
Texture GetRenderTarget(RendererParam renderer)
Get the current render target.
Definition: SDL3pp_render.h:4752
void RenderPoints(SpanRef< const FPointRaw > points)
Draw multiple points on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:5586
void RenderTextureAffine(RendererParam renderer, 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,...
Definition: SDL3pp_render.h:5847
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 a...
Definition: SDL3pp_render.h:6073
BlendMode GetTextureBlendMode(TextureParam texture)
Get the blend mode used for texture copy operations.
Definition: SDL3pp_render.h:4382
SDL_Vertex Vertex
Vertex structure.
Definition: SDL3pp_render.h:127
void RenderGeometryRaw(RendererParam renderer, 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 a...
Definition: SDL3pp_render.h:6046
float GetTextureAlphaModFloat(TextureParam texture)
Get the additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4331
Uint8 GetTextureAlphaMod(TextureParam texture)
Get the additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4304
void RenderLine(RendererParam renderer, const FPointRaw &p1, const FPointRaw &p2)
Draw a line on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:5605
Texture CreateTextureFromSurface(RendererParam renderer, SurfaceParam surface)
Create a texture from an existing surface.
Definition: SDL3pp_render.h:3681
PropertiesRef GetTextureProperties(TextureParam texture)
Get the properties associated with a texture.
Definition: SDL3pp_render.h:4033
FPoint RenderCoordinatesFromWindow(RendererParam renderer, const FPointRaw &window_coord)
Get a point in render coordinates when given a point in window coordinates.
Definition: SDL3pp_render.h:4920
Uint8 GetAlphaMod() const
Get the additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4311
void RenderLines(RendererParam renderer, SpanRef< const FPointRaw > points)
Draw a series of connected lines on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:5631
void DestroyRenderer(RendererRaw renderer)
Destroy the rendering context for a window and free all associated textures.
Definition: SDL3pp_render.h:6222
void UnlockTexture(TextureParam texture)
Unlock a texture, uploading the changes to video memory, if needed.
Definition: SDL3pp_render.h:4699
void SetColorScale(float scale)
Set the color scale used for render operations.
Definition: SDL3pp_render.h:5440
int GetVSync() const
Get VSync of the given renderer.
Definition: SDL3pp_render.h:6426
Surface RenderReadPixels(RendererParam renderer, OptionalRef< const RectRaw > rect={})
Read pixels from the current rendering target.
Definition: SDL3pp_render.h:6124
BlendMode GetRenderDrawBlendMode(RendererParam renderer)
Get the blend mode used for drawing operations.
Definition: SDL3pp_render.h:5508
void GetColorModFloat(float *r, float *g, float *b) const
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4218
void SetColorMod(Uint8 r, Uint8 g, Uint8 b)
Set an additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4119
void RenderGeometry(RendererParam renderer, 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 al...
Definition: SDL3pp_render.h:6000
void Update(OptionalRef< const RectRaw > rect, const void *pixels, int pitch)
Update the given texture rectangle with new pixel data.
Definition: SDL3pp_render.h:4485
void RenderRect(OptionalRef< const FRectRaw > rect)
Draw a rectangle on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:5660
RendererRef GetRenderer() const
Get the renderer associated with a window.
Definition: SDL3pp_render.h:3414
void SetRenderTarget(RendererParam renderer, TextureParam texture)
Set a texture as the current rendering target.
Definition: SDL3pp_render.h:4727
void SetRenderDrawColorFloat(RendererParam renderer, const FColorRaw &c)
Set the color used for drawing operations (Rect, Line and Clear).
Definition: SDL3pp_render.h:5331
void Present()
Update the screen with any rendering performed since the previous call.
Definition: SDL3pp_render.h:6187
BlendMode GetDrawBlendMode() const
Get the blend mode used for drawing operations.
Definition: SDL3pp_render.h:5515
void RenderClear()
Clear the current rendering target with the drawing color.
Definition: SDL3pp_render.h:5542
SDL_TextureAccess TextureAccess
The access pattern allowed for a texture.
Definition: SDL3pp_render.h:134
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.
Definition: SDL3pp_render.h:5767
Renderer CreateSoftwareRenderer(SurfaceParam surface)
Create a 2D software rendering context for a surface.
Definition: SDL3pp_render.h:3409
Surface LockTextureToSurface(TextureParam texture, OptionalRef< const SDL_Rect > rect=std::nullopt)
Lock a portion of the texture for write-only pixel access, and expose it as a SDL surface.
Definition: SDL3pp_render.h:4666
void GetTextureColorModFloat(TextureParam texture, float *r, float *g, float *b)
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4210
void RenderLine(const FPointRaw &p1, const FPointRaw &p2)
Draw a line on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:5612
RendererRef GetRendererFromTexture(TextureParam texture)
Get the renderer that created an Texture.
Definition: SDL3pp_render.h:4054
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_OVERSCAN
The rendered content is fit to the smallest dimension and the other dimension extends beyond the outp...
Definition: SDL3pp_render.h:170
PropertiesRef GetProperties() const
Get the properties associated with a texture.
Definition: SDL3pp_render.h:4038
void RenderDebugText(const FPointRaw &p, StringParam str)
Draw debug text to an Renderer.
Definition: SDL3pp_render.h:6486
void SetAlphaModFloat(float alpha)
Set an additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4284
PropertiesRef GetRendererProperties(RendererParam renderer)
Get the properties associated with a renderer.
Definition: SDL3pp_render.h:3548
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_DISABLED
There is no logical size in effect.
Definition: SDL3pp_render.h:152
void GetRenderDrawColorFloat(RendererParam renderer, float *r, float *g, float *b, float *a)
Get the color used for drawing operations (Rect, Line and Clear).
Definition: SDL3pp_render.h:5397
void UpdateYUVTexture(TextureParam texture, OptionalRef< const RectRaw > rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch)
Update a rectangle within a planar YV12 or IYUV texture with new pixel data.
Definition: SDL3pp_render.h:4521
void RenderRects(RendererParam renderer, SpanRef< const FRectRaw > rects)
Draw some number of rectangles on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:5679
void * GetRenderMetalCommandEncoder(RendererParam renderer)
Get the Metal command encoder for the current frame.
Definition: SDL3pp_render.h:6313
Rect GetClipRect() const
Get the clip rectangle for the current target.
Definition: SDL3pp_render.h:5194
void * GetRenderMetalLayer()
Get the CAMetalLayer associated with the given Metal renderer.
Definition: SDL3pp_render.h:6287
void GetRenderScale(RendererParam renderer, float *scaleX, float *scaleY)
Get the drawing scale for the current target.
Definition: SDL3pp_render.h:5277
void SetRenderColorScale(RendererParam renderer, float scale)
Set the color scale used for render operations.
Definition: SDL3pp_render.h:5435
SDL_RendererLogicalPresentation RendererLogicalPresentation
How the logical size is mapped to the output.
Definition: SDL3pp_render.h:150
constexpr TextureAccess TEXTUREACCESS_TARGET
Texture can be used as a render target.
Definition: SDL3pp_render.h:142
void GetRenderOutputSize(RendererParam renderer, int *w, int *h)
Get the output size in pixels of a rendering context.
Definition: SDL3pp_render.h:3578
FPoint RenderCoordinatesFromWindow(const FPointRaw &window_coord) const
Get a point in render coordinates when given a point in window coordinates.
Definition: SDL3pp_render.h:4929
void DestroyTexture(TextureRaw texture)
Destroy the specified texture.
Definition: SDL3pp_render.h:6204
void SetTextureAlphaModFloat(TextureParam texture, float alpha)
Set an additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4279
Rect GetSafeArea() const
Get the safe area for rendering within the current viewport.
Definition: SDL3pp_render.h:5135
Rect GetRenderViewport(RendererParam renderer)
Get the drawing area for the current target.
Definition: SDL3pp_render.h:5068
void ConvertEventToRenderCoordinates(RendererParam renderer, Event *event)
Convert the coordinates in an event to render coordinates.
Definition: SDL3pp_render.h:5005
void RenderFillRects(RendererParam renderer, SpanRef< const FRectRaw > rects)
Fill some number of rectangles on the current rendering target with the drawing color at subpixel pre...
Definition: SDL3pp_render.h:5729
bool IsViewportSet() const
Return whether an explicit rectangle was set as the viewport.
Definition: SDL3pp_render.h:5105
void RenderTexture(RendererParam renderer, TextureParam texture, OptionalRef< const FRectRaw > srcrect, OptionalRef< const FRectRaw > dstrect)
Copy a portion of the texture to the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:5759
ScaleMode GetTextureScaleMode(TextureParam texture)
Get the scale mode used for texture scale operations.
Definition: SDL3pp_render.h:4434
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,...
Definition: SDL3pp_render.h:5858
constexpr TextureAccess TEXTUREACCESS_STATIC
Changes rarely, not lockable.
Definition: SDL3pp_render.h:136
SDL_Texture * TextureRaw
Alias to raw representation for Texture.
Definition: SDL3pp_render.h:82
bool RenderClipEnabled(RendererParam renderer)
Get whether clipping is enabled on the given render target.
Definition: SDL3pp_render.h:5216
void AddVulkanRenderSemaphores(RendererParam renderer, Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore)
Add a set of synchronization semaphores for the current frame.
Definition: SDL3pp_render.h:6350
void * GetRenderMetalCommandEncoder()
Get the Metal command encoder for the current frame.
Definition: SDL3pp_render.h:6318
void SetViewport(OptionalRef< const RectRaw > rect)
Set the drawing area for rendering on the current target.
Definition: SDL3pp_render.h:5046
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_INTEGER_SCALE
The rendered content is scaled up by integer multiples to fit the output resolution.
Definition: SDL3pp_render.h:177
WindowRef GetWindow()
Get the window associated with a renderer.
Definition: SDL3pp_render.h:3435
constexpr TextureAccess TEXTUREACCESS_STREAMING
Changes frequently, lockable.
Definition: SDL3pp_render.h:139
BlendMode GetBlendMode() const
Get the blend mode used for texture copy operations.
Definition: SDL3pp_render.h:4389
void UpdateYUV(OptionalRef< const RectRaw > rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch)
Update a rectangle within a planar YV12 or IYUV texture with new pixel data.
Definition: SDL3pp_render.h:4534
PropertiesRef GetProperties() const
Get the properties associated with a renderer.
Definition: SDL3pp_render.h:3553
void RenderTextureTiled(RendererParam renderer, 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.
Definition: SDL3pp_render.h:5891
void Flush()
Force the rendering context to flush any pending commands and state.
Definition: SDL3pp_render.h:6264
Texture CreateTextureWithProperties(PropertiesParam props)
Create a texture for a rendering context with the specified properties.
Definition: SDL3pp_render.h:3808
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.
Definition: SDL3pp_render.h:5901
void Lock(OptionalRef< const SDL_Rect > rect, void **pixels, int *pitch)
Lock a portion of the texture for write-only pixel access.
Definition: SDL3pp_render.h:4627
FRect GetLogicalPresentationRect() const
Get the final presentation rectangle for rendering.
Definition: SDL3pp_render.h:4893
void SetTextureColorMod(TextureParam texture, Uint8 r, Uint8 g, Uint8 b)
Set an additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4114
void SetClipRect(OptionalRef< const RectRaw > rect)
Set the clip rectangle for rendering on the specified target.
Definition: SDL3pp_render.h:5164
Renderer CreateRenderer(WindowParam window, StringParam name)
Create a 2D rendering context for a window.
Definition: SDL3pp_render.h:3235
void ConvertEventToRenderCoordinates(Event *event) const
Convert the coordinates in an event to render coordinates.
Definition: SDL3pp_render.h:5011
Surface ReadPixels(OptionalRef< const RectRaw > rect={}) const
Read pixels from the current rendering target.
Definition: SDL3pp_render.h:6130
float GetRenderColorScale(RendererParam renderer)
Get the color scale used for render operations.
Definition: SDL3pp_render.h:5458
void SetScale(const FPointRaw &scale)
Set the drawing scale for rendering on the current target.
Definition: SDL3pp_render.h:5255
Texture CreateTextureFromSurface(SurfaceParam surface)
Create a texture from an existing surface.
Definition: SDL3pp_render.h:3687
Texture CreateTexture(RendererParam renderer, PixelFormat format, TextureAccess access, const PointRaw &size)
Create a texture for a rendering context.
Definition: SDL3pp_render.h:3640
float GetColorScale() const
Get the color scale used for render operations.
Definition: SDL3pp_render.h:5465
Rect GetRenderClipRect(RendererParam renderer)
Get the clip rectangle for the current target.
Definition: SDL3pp_render.h:5187
void UpdateNV(OptionalRef< const RectRaw > rect, const Uint8 *Yplane, int Ypitch, const Uint8 *UVplane, int UVpitch)
Update a rectangle within a planar NV12 or NV21 texture with new pixels.
Definition: SDL3pp_render.h:4582
void RenderFillRects(SpanRef< const FRectRaw > rects)
Fill some number of rectangles on the current rendering target with the drawing color at subpixel pre...
Definition: SDL3pp_render.h:5735
const char * GetRendererName(RendererParam renderer)
Get the name of a renderer.
Definition: SDL3pp_render.h:3454
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_LETTERBOX
The rendered content is fit to the largest dimension and the other dimension is letterboxed with blac...
Definition: SDL3pp_render.h:163
void RenderLines(SpanRef< const FPointRaw > points)
Draw a series of connected lines on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:5636
void RenderTexture9Grid(RendererParam renderer, 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 precisio...
Definition: SDL3pp_render.h:5940
void SetLogicalPresentation(const PointRaw &size, RendererLogicalPresentation mode)
Set a device-independent resolution and presentation mode for rendering.
Definition: SDL3pp_render.h:4822
void SetTarget(TextureParam texture)
Set a texture as the current rendering target.
Definition: SDL3pp_render.h:4732
ScaleMode GetScaleMode() const
Get the scale mode used for texture scale operations.
Definition: SDL3pp_render.h:4441
void SetTextureAlphaMod(TextureParam texture, Uint8 alpha)
Set an additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4246
void LockTexture(TextureParam texture, OptionalRef< const SDL_Rect > rect, void **pixels, int *pitch)
Lock a portion of the texture for write-only pixel access.
Definition: SDL3pp_render.h:4619
void * GetRenderMetalLayer(RendererParam renderer)
Get the CAMetalLayer associated with the given Metal renderer.
Definition: SDL3pp_render.h:6282
void RenderRects(SpanRef< const FRectRaw > rects)
Draw some number of rectangles on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:5684
void RenderDebugTextFormat(const FPointRaw &p, std::string_view fmt, ARGS... args)
Draw debug text to an Renderer.
Definition: SDL3pp_render.h:6526
void GetRenderDrawColor(RendererParam renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
Get the color used for drawing operations (Rect, Line and Clear).
Definition: SDL3pp_render.h:5362
Texture CreateTextureWithProperties(RendererParam renderer, PropertiesParam props)
Create a texture for a rendering context with the specified properties.
Definition: SDL3pp_render.h:3802
void RenderDebugTextFormat(RendererParam renderer, const FPointRaw &p, std::string_view fmt, ARGS... args)
Draw debug text to an Renderer.
Definition: SDL3pp_render.h:6516
FRect GetRenderLogicalPresentationRect(RendererParam renderer)
Get the final presentation rectangle for rendering.
Definition: SDL3pp_render.h:4886
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_STRETCH
The rendered content is stretched to the output resolution.
Definition: SDL3pp_render.h:156
void GetRenderLogicalPresentation(RendererParam renderer, int *w, int *h, RendererLogicalPresentation *mode)
Get device independent resolution and presentation mode for rendering.
Definition: SDL3pp_render.h:4849
void RenderPoint(RendererParam renderer, const FPointRaw &p)
Draw a point on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:5557
void RenderRect(RendererParam renderer, OptionalRef< const FRectRaw > rect)
Draw a rectangle on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:5655
void UpdateNVTexture(TextureParam texture, OptionalRef< const RectRaw > rect, const Uint8 *Yplane, int Ypitch, const Uint8 *UVplane, int UVpitch)
Update a rectangle within a planar NV12 or NV21 texture with new pixels.
Definition: SDL3pp_render.h:4571
void RenderFillRect(OptionalRef< const FRectRaw > rect)
Fill a rectangle on the current rendering target with the drawing color at subpixel precision.
Definition: SDL3pp_render.h:5710
int GetNumRenderDrivers()
Get the number of 2D rendering drivers available for the current display.
Definition: SDL3pp_render.h:3143
const char * GetRenderDriver(int index)
Use this function to get the name of a built in 2D rendering driver.
Definition: SDL3pp_render.h:3167
void SetRenderLogicalPresentation(RendererParam renderer, const PointRaw &size, RendererLogicalPresentation mode)
Set a device-independent resolution and presentation mode for rendering.
Definition: SDL3pp_render.h:4815
void Unlock()
Unlock a texture, uploading the changes to video memory, if needed.
Definition: SDL3pp_render.h:4701
RendererRef GetRenderer() const
Get the renderer that created an Texture.
Definition: SDL3pp_render.h:4059
void SetVSync(int vsync)
Toggle VSync of the given renderer.
Definition: SDL3pp_render.h:6394
float GetAlphaModFloat() const
Get the additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4338
void AddVulkanRenderSemaphores(Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore)
Add a set of synchronization semaphores for the current frame.
Definition: SDL3pp_render.h:6359
void FlushRenderer(RendererParam renderer)
Force the rendering context to flush any pending commands and state.
Definition: SDL3pp_render.h:6259
void GetColorMod(Uint8 *r, Uint8 *g, Uint8 *b) const
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4188
void RenderClear(RendererParam renderer)
Clear the current rendering target with the drawing color.
Definition: SDL3pp_render.h:5537
void SetRenderDrawBlendMode(RendererParam renderer, BlendMode blendMode)
Set the blend mode used for drawing operations (Fill and Line).
Definition: SDL3pp_render.h:5485
Texture CreateTexture(PixelFormat format, TextureAccess access, const PointRaw &size)
Create a texture for a rendering context.
Definition: SDL3pp_render.h:3648
WindowRef GetRenderWindow(RendererParam renderer)
Get the window associated with a renderer.
Definition: SDL3pp_render.h:3430
int GetRenderVSync(RendererParam renderer)
Get VSync of the given renderer.
Definition: SDL3pp_render.h:6419
void GetTextureSize(TextureParam texture, float *w, float *h)
Get the size of a texture, as floating point values.
Definition: SDL3pp_render.h:4078
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 al...
Definition: SDL3pp_render.h:6013
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,...
Definition: SDL3pp_render.h:5811
void SetTextureScaleMode(TextureParam texture, ScaleMode scaleMode)
Set the scale mode used for texture scale operations.
Definition: SDL3pp_render.h:4411
void GetTextureColorMod(TextureParam texture, Uint8 *r, Uint8 *g, Uint8 *b)
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4180
void SetScaleMode(ScaleMode scaleMode)
Set the scale mode used for texture scale operations.
Definition: SDL3pp_render.h:4416
Sint64 Sint64
A signed 64-bit integer type.
Definition: SDL3pp_stdinc.h:347
Uint32 Uint32
An unsigned 32-bit integer type.
Definition: SDL3pp_stdinc.h:328
Uint8 Uint8
An unsigned 8-bit integer type.
Definition: SDL3pp_stdinc.h:260
SDL_Surface * SurfaceRaw
Alias to raw representation for Surface.
Definition: SDL3pp_surface.h:42
SDL_FlipMode FlipMode
The flip mode.
Definition: SDL3pp_surface.h:156
SDL_ScaleMode ScaleMode
The scaling mode.
Definition: SDL3pp_surface.h:137
Uint64 WindowFlags
The flags on a window.
Definition: SDL3pp_video.h:553
Main include header for the SDL3pp library.
A structure that represents a color as RGBA components.
Definition: SDL3pp_pixels.h:2191
The bits of this structure can be directly reinterpreted as a float-packed color which uses the PIXEL...
Definition: SDL3pp_pixels.h:2364
The structure that defines a point (using floating point values).
Definition: SDL3pp_rect.h:509
A rectangle, with the origin at the upper left (using floating point values).
Definition: SDL3pp_rect.h:1432
Safely wrap IOStream for non owning parameters.
Definition: SDL3pp_iostream.h:34
The structure that defines a point (using integers).
Definition: SDL3pp_rect.h:83
Safely wrap Properties for non owning parameters.
Definition: SDL3pp_properties.h:52
Semi-safe reference for Properties.
Definition: SDL3pp_properties.h:701
A rectangle, with the origin at the upper left (using integers).
Definition: SDL3pp_rect.h:839
Safely wrap Renderer for non owning parameters.
Definition: SDL3pp_render.h:53
constexpr RendererParam(std::nullptr_t _=nullptr)
Constructs null/invalid.
Definition: SDL3pp_render.h:63
constexpr auto operator<=>(const RendererParam &other) const =default
Comparison.
RendererRaw value
parameter's RendererRaw
Definition: SDL3pp_render.h:54
constexpr RendererParam(RendererRaw value)
Constructs from RendererRaw.
Definition: SDL3pp_render.h:57
Semi-safe reference for Renderer.
Definition: SDL3pp_render.h:2090
~RendererRef()
Destructor.
Definition: SDL3pp_render.h:2110
RendererRef(const RendererRef &other)
Copy constructor.
Definition: SDL3pp_render.h:2104
RendererRef(RendererParam resource)
Constructs from RendererParam.
Definition: SDL3pp_render.h:2098
Safely wrap Surface for non owning parameters.
Definition: SDL3pp_surface.h:46
Safely wrap Texture for non owning parameters.
Definition: SDL3pp_render.h:86
constexpr TextureParam(std::nullptr_t _=nullptr)
Constructs null/invalid.
Definition: SDL3pp_render.h:96
constexpr auto operator<=>(const TextureParam &other) const =default
Comparison.
constexpr TextureParam(TextureRaw value)
Constructs from TextureRaw.
Definition: SDL3pp_render.h:90
TextureRaw value
parameter's TextureRaw
Definition: SDL3pp_render.h:87
Safely wrap Window for non owning parameters.
Definition: SDL3pp_video.h:57
Semi-safe reference for Window.
Definition: SDL3pp_video.h:2925