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; }
138 constexpr explicit operator bool()
const {
return !!
value; }
172 SDL_TEXTUREACCESS_STATIC;
175 SDL_TEXTUREACCESS_STREAMING;
178 SDL_TEXTUREACCESS_TARGET;
188 SDL_LOGICAL_PRESENTATION_DISABLED;
192 SDL_LOGICAL_PRESENTATION_STRETCH;
199 SDL_LOGICAL_PRESENTATION_LETTERBOX;
206 SDL_LOGICAL_PRESENTATION_OVERSCAN;
213 SDL_LOGICAL_PRESENTATION_INTEGER_SCALE;
228 constexpr Renderer(std::nullptr_t =
nullptr) noexcept
241 : m_resource(resource)
290 : m_resource(
CheckError(SDL_CreateRenderer(window, nullptr)))
327 : m_resource(
CheckError(SDL_CreateRenderer(window, name)))
382 : m_resource(
CheckError(SDL_CreateRendererWithProperties(props)))
405 : m_resource(
CheckError(SDL_CreateSoftwareRenderer(surface)))
415 std::swap(m_resource, other.m_resource);
431 m_resource =
nullptr;
439 constexpr explicit operator bool() const noexcept {
return !!m_resource; }
1280 void GetScale(
float* scaleX,
float* scaleY)
const;
1663 FlipMode flip = FlipMode::SDL_FLIP_NONE);
1758 float bottom_height,
1781 std::span<const Vertex> vertices,
1782 std::span<const int> indices = {});
1813 const FColor* color,
1818 const void* indices,
1846 Surface
ReadPixels(OptionalRef<const RectRaw> rect = {})
const;
1994 Sint64 signal_semaphore);
2097 template<
class... ARGS>
2099 std::string_view fmt,
2160 constexpr Texture(std::nullptr_t =
nullptr) noexcept
2173 : m_resource(resource)
2212 CheckError(SDL_CreateTexture(renderer, format, access, size.x, size.y)))
2240 : m_resource(
CheckError(SDL_CreateTextureFromSurface(renderer, surface)))
2352 : m_resource(
CheckError(SDL_CreateTextureWithProperties(renderer, props)))
2440 ++resource.
value->refcount;
2458 std::swap(m_resource, other.m_resource);
2471 auto r = m_resource;
2472 m_resource =
nullptr;
2480 constexpr explicit operator bool() const noexcept {
return !!m_resource; }
2612 void GetSize(
float* w,
float* h)
const;
3033 const Uint8* Yplane,
3035 const Uint8* Uplane,
3037 const Uint8* Vplane,
3065 const Uint8* Yplane,
3067 const Uint8* UVplane,
3193 return SDL_GetRenderDriver(index);
3218 SDL_Window* window =
nullptr;
3219 SDL_Renderer* renderer =
nullptr;
3221 title, size.x, size.y, window_flags, &window, &renderer));
3260 return Renderer(window, std::move(name));
3319namespace prop::Renderer {
3321constexpr auto CREATE_NAME_STRING = SDL_PROP_RENDERER_CREATE_NAME_STRING;
3323constexpr auto CREATE_WINDOW_POINTER = SDL_PROP_RENDERER_CREATE_WINDOW_POINTER;
3325constexpr auto CREATE_SURFACE_POINTER =
3326 SDL_PROP_RENDERER_CREATE_SURFACE_POINTER;
3328constexpr auto CREATE_OUTPUT_COLORSPACE_NUMBER =
3329 SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER;
3331constexpr auto CREATE_PRESENT_VSYNC_NUMBER =
3332 SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER;
3334constexpr auto CREATE_VULKAN_INSTANCE_POINTER =
3335 SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER;
3337constexpr auto CREATE_VULKAN_SURFACE_NUMBER =
3338 SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER;
3340constexpr auto CREATE_VULKAN_PHYSICAL_DEVICE_POINTER =
3341 SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER;
3343constexpr auto CREATE_VULKAN_DEVICE_POINTER =
3344 SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER;
3346constexpr auto CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER =
3347 SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER;
3349constexpr auto CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER =
3350 SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER;
3352constexpr auto NAME_STRING = SDL_PROP_RENDERER_NAME_STRING;
3354constexpr auto WINDOW_POINTER = SDL_PROP_RENDERER_WINDOW_POINTER;
3356constexpr auto SURFACE_POINTER = SDL_PROP_RENDERER_SURFACE_POINTER;
3358constexpr auto VSYNC_NUMBER = SDL_PROP_RENDERER_VSYNC_NUMBER;
3360constexpr auto MAX_TEXTURE_SIZE_NUMBER =
3361 SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER;
3363constexpr auto TEXTURE_FORMATS_POINTER =
3364 SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER;
3366constexpr auto OUTPUT_COLORSPACE_NUMBER =
3367 SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER;
3369constexpr auto HDR_ENABLED_BOOLEAN = SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN;
3371constexpr auto SDR_WHITE_POINT_FLOAT = SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT;
3373constexpr auto HDR_HEADROOM_FLOAT = SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT;
3375constexpr auto D3D9_DEVICE_POINTER = SDL_PROP_RENDERER_D3D9_DEVICE_POINTER;
3377constexpr auto D3D11_DEVICE_POINTER = SDL_PROP_RENDERER_D3D11_DEVICE_POINTER;
3379constexpr auto D3D11_SWAPCHAIN_POINTER =
3380 SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER;
3382constexpr auto D3D12_DEVICE_POINTER = SDL_PROP_RENDERER_D3D12_DEVICE_POINTER;
3384constexpr auto D3D12_SWAPCHAIN_POINTER =
3385 SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER;
3387constexpr auto D3D12_COMMAND_QUEUE_POINTER =
3388 SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER;
3390constexpr auto VULKAN_INSTANCE_POINTER =
3391 SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER;
3393constexpr auto VULKAN_SURFACE_NUMBER = SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER;
3395constexpr auto VULKAN_PHYSICAL_DEVICE_POINTER =
3396 SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER;
3398constexpr auto VULKAN_DEVICE_POINTER = SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER;
3400constexpr auto VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER =
3401 SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER;
3403constexpr auto VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER =
3404 SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER;
3406constexpr auto VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER =
3407 SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER;
3409constexpr auto GPU_DEVICE_POINTER = SDL_PROP_RENDERER_GPU_DEVICE_POINTER;
3439 return {
CheckError(SDL_GetRenderer(m_resource))};
3455 return {
CheckError(SDL_GetRenderWindow(renderer))};
3479 return SDL_GetRendererName(renderer);
3572 return {
CheckError(SDL_GetRendererProperties(renderer))};
3602 CheckError(SDL_GetRenderOutputSize(renderer, w, h));
3663 CheckError(SDL_GetCurrentRenderOutputSize(renderer, w, h));
3729 return Texture(renderer, format, access, size);
3736 return Texture(m_resource, format, access, size);
3767 return Texture(renderer, surface);
3772 return Texture(m_resource, surface);
3886 return Texture(renderer, props);
3891 return Texture(m_resource, props);
3894namespace prop::Texture {
3896constexpr auto CREATE_COLORSPACE_NUMBER =
3897 SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER;
3899constexpr auto CREATE_FORMAT_NUMBER = SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER;
3901constexpr auto CREATE_ACCESS_NUMBER = SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER;
3903constexpr auto CREATE_WIDTH_NUMBER = SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER;
3905constexpr auto CREATE_HEIGHT_NUMBER = SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER;
3907constexpr auto CREATE_SDR_WHITE_POINT_FLOAT =
3908 SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT;
3910constexpr auto CREATE_HDR_HEADROOM_FLOAT =
3911 SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT;
3913constexpr auto CREATE_D3D11_TEXTURE_POINTER =
3914 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER;
3916constexpr auto CREATE_D3D11_TEXTURE_U_POINTER =
3917 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER;
3919constexpr auto CREATE_D3D11_TEXTURE_V_POINTER =
3920 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER;
3922constexpr auto CREATE_D3D12_TEXTURE_POINTER =
3923 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER;
3925constexpr auto CREATE_D3D12_TEXTURE_U_POINTER =
3926 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER;
3928constexpr auto CREATE_D3D12_TEXTURE_V_POINTER =
3929 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER;
3931constexpr auto CREATE_METAL_PIXELBUFFER_POINTER =
3932 SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER;
3934constexpr auto CREATE_OPENGL_TEXTURE_NUMBER =
3935 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER;
3937constexpr auto CREATE_OPENGL_TEXTURE_UV_NUMBER =
3938 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER;
3940constexpr auto CREATE_OPENGL_TEXTURE_U_NUMBER =
3941 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER;
3943constexpr auto CREATE_OPENGL_TEXTURE_V_NUMBER =
3944 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER;
3946constexpr auto CREATE_OPENGLES2_TEXTURE_NUMBER =
3947 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER;
3949constexpr auto CREATE_OPENGLES2_TEXTURE_UV_NUMBER =
3950 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER;
3952constexpr auto CREATE_OPENGLES2_TEXTURE_U_NUMBER =
3953 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER;
3955constexpr auto CREATE_OPENGLES2_TEXTURE_V_NUMBER =
3956 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER;
3958constexpr auto CREATE_VULKAN_TEXTURE_NUMBER =
3959 SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER;
3961constexpr auto COLORSPACE_NUMBER = SDL_PROP_TEXTURE_COLORSPACE_NUMBER;
3963constexpr auto FORMAT_NUMBER = SDL_PROP_TEXTURE_FORMAT_NUMBER;
3965constexpr auto ACCESS_NUMBER = SDL_PROP_TEXTURE_ACCESS_NUMBER;
3967constexpr auto WIDTH_NUMBER = SDL_PROP_TEXTURE_WIDTH_NUMBER;
3969constexpr auto HEIGHT_NUMBER = SDL_PROP_TEXTURE_HEIGHT_NUMBER;
3971constexpr auto SDR_WHITE_POINT_FLOAT = SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT;
3973constexpr auto HDR_HEADROOM_FLOAT = SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT;
3975constexpr auto D3D11_TEXTURE_POINTER = SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER;
3977constexpr auto D3D11_TEXTURE_U_POINTER =
3978 SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER;
3980constexpr auto D3D11_TEXTURE_V_POINTER =
3981 SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER;
3983constexpr auto D3D12_TEXTURE_POINTER = SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER;
3985constexpr auto D3D12_TEXTURE_U_POINTER =
3986 SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER;
3988constexpr auto D3D12_TEXTURE_V_POINTER =
3989 SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER;
3991constexpr auto OPENGL_TEXTURE_NUMBER = SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER;
3993constexpr auto OPENGL_TEXTURE_UV_NUMBER =
3994 SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER;
3996constexpr auto OPENGL_TEXTURE_U_NUMBER =
3997 SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER;
3999constexpr auto OPENGL_TEXTURE_V_NUMBER =
4000 SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER;
4002constexpr auto OPENGL_TEXTURE_TARGET_NUMBER =
4003 SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER;
4005constexpr auto OPENGL_TEX_W_FLOAT = SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT;
4007constexpr auto OPENGL_TEX_H_FLOAT = SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT;
4009constexpr auto OPENGLES2_TEXTURE_NUMBER =
4010 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER;
4012constexpr auto OPENGLES2_TEXTURE_UV_NUMBER =
4013 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER;
4015constexpr auto OPENGLES2_TEXTURE_U_NUMBER =
4016 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER;
4018constexpr auto OPENGLES2_TEXTURE_V_NUMBER =
4019 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER;
4021constexpr auto OPENGLES2_TEXTURE_TARGET_NUMBER =
4022 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER;
4024constexpr auto VULKAN_TEXTURE_NUMBER = SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER;
4114 return {
CheckError(SDL_GetTextureProperties(texture))};
4135 return {SDL_GetRendererFromTexture(texture)};
4159 CheckError(SDL_GetTextureSize(texture, w, h));
4165 return Point(texture->w, texture->h);
4210 return texture->format;
4246 CheckError(SDL_SetTextureColorMod(texture, r, g, b));
4285 CheckError(SDL_SetTextureColorModFloat(texture, r, g, b));
4315 CheckError(SDL_GetTextureColorMod(texture, r, g, b));
4345 CheckError(SDL_GetTextureColorModFloat(texture, r, g, b));
4378 CheckError(SDL_SetTextureAlphaMod(texture, alpha));
4411 CheckError(SDL_SetTextureAlphaModFloat(texture, alpha));
4437 CheckError(SDL_GetTextureAlphaMod(texture, &alpha));
4464 CheckError(SDL_GetTextureAlphaModFloat(texture, &alpha));
4607 CheckError(SDL_SetTextureBlendMode(texture, blendMode));
4631 CheckError(SDL_GetTextureBlendMode(texture, &blendMode));
4659 CheckError(SDL_SetTextureScaleMode(texture, scaleMode));
4683 CheckError(SDL_GetTextureScaleMode(texture, &scaleMode));
4728 CheckError(SDL_UpdateTexture(texture, rect, pixels, pitch));
4765 UpdateTexture(texture, rect, surface->pixels, surface->pitch);
4808 const Uint8* Yplane,
4810 const Uint8* Uplane,
4812 const Uint8* Vplane,
4816 texture, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch));
4820 const Uint8* Yplane,
4822 const Uint8* Uplane,
4824 const Uint8* Vplane,
4828 m_resource, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch);
4857 const Uint8* Yplane,
4859 const Uint8* UVplane,
4863 SDL_UpdateNVTexture(texture, rect, Yplane, Ypitch, UVplane, UVpitch));
4867 const Uint8* Yplane,
4869 const Uint8* UVplane,
4907 CheckError(SDL_LockTexture(texture, rect, pixels, pitch));
4953 CheckError(SDL_LockTextureToSurface(texture, rect, &surface));
5011 CheckError(SDL_SetRenderTarget(renderer, texture));
5058 TextureRaw texture = SDL_GetRenderTarget(renderer);
5123 CheckError(SDL_SetRenderLogicalPresentation(renderer, size.x, size.y, mode));
5158 CheckError(SDL_GetRenderLogicalPresentation(renderer, w, h, mode));
5228 CheckError(SDL_GetRenderLogicalPresentationRect(renderer, &rect));
5264 renderer, window_coord.x, window_coord.y, &p.x, &p.y));
5302 SDL_RenderCoordinatesToWindow(renderer, coord.x, coord.y, &p.x, &p.y));
5346 CheckError(SDL_ConvertEventToRenderCoordinates(renderer, event));
5381 CheckError(SDL_SetRenderViewport(renderer, rect));
5432 CheckError(SDL_GetRenderViewport(renderer, &rect));
5463 return SDL_RenderViewportSet(renderer);
5492 CheckError(SDL_GetRenderSafeArea(renderer, &rect));
5522 CheckError(SDL_SetRenderClipRect(renderer, rect));
5574 CheckError(SDL_GetRenderClipRect(renderer, &rect));
5602 return SDL_RenderClipEnabled(renderer);
5636 CheckError(SDL_SetRenderScale(renderer, scale.x, scale.y));
5663 CheckError(SDL_GetRenderScale(renderer, scaleX, scaleY));
5717 CheckError(SDL_SetRenderDrawColor(renderer, c.r, c.g, c.b, c.a));
5744 CheckError(SDL_SetRenderDrawColorFloat(renderer, c.r, c.g, c.b, c.a));
5779 CheckError(SDL_GetRenderDrawColor(renderer, r, g, b, a));
5840 CheckError(SDL_GetRenderDrawColorFloat(renderer, r, g, b, a));
5899 CheckError(SDL_SetRenderColorScale(renderer, scale));
5923 CheckError(SDL_GetRenderColorScale(renderer, &scale));
5949 CheckError(SDL_SetRenderDrawBlendMode(renderer, blendMode));
5973 CheckError(SDL_GetRenderDrawBlendMode(renderer, &blendMode));
6021 CheckError(SDL_RenderPoint(renderer, p.x, p.y));
6071 CheckError(SDL_RenderLine(renderer, p1.x, p1.y, p2.x, p2.y));
6169 CheckError(SDL_RenderFillRect(renderer, rect));
6226 CheckError(SDL_RenderTexture(renderer, texture, srcrect, dstrect));
6267 FlipMode flip = FlipMode::SDL_FLIP_NONE)
6270 renderer, texture, srcrect, dstrect, angle, center, flip));
6281 m_resource, texture, srcrect, dstrect, angle, center, flip);
6317 SDL_RenderTextureAffine(renderer, texture, srcrect, origin, right, down));
6360 SDL_RenderTextureTiled(renderer, texture, srcrect, scale, dstrect));
6408 float bottom_height,
6428 float bottom_height,
6464 std::span<const Vertex> vertices,
6465 std::span<const int> indices = {})
6476 std::span<const Vertex> vertices,
6477 std::span<const int> indices)
6517 const void* indices,
6543 const void* indices,
6589 return Surface{
CheckError(SDL_RenderReadPixels(renderer, rect))};
6684 SDL_DestroyRenderer(renderer);
6744 return CheckError(SDL_GetRenderMetalLayer(renderer));
6775 return CheckError(SDL_GetRenderMetalCommandEncoder(renderer));
6815 renderer, wait_stage_mask, wait_semaphore, signal_semaphore));
6823 m_resource, wait_stage_mask, wait_semaphore, signal_semaphore);
6850 CheckError(SDL_SetRenderVSync(renderer, vsync));
6881 CheckError(SDL_GetRenderVSync(renderer, &vsync));
6900 SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE;
6943 CheckError(SDL_RenderDebugText(renderer, p.x, p.y, str));
6975template<
class... ARGS>
6978 std::string_view fmt,
6982 renderer, p, std::vformat(fmt, std::make_format_args(args...)));
6985template<
class... ARGS>
6987 std::string_view fmt,
Optional-like shim for references.
Definition: SDL3pp_optionalRef.h:20
A structure representing rendering state.
Definition: SDL3pp_render.h:223
constexpr Renderer(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_render.h:228
Renderer(WindowParam window)
Create a 2D rendering context for a window.
Definition: SDL3pp_render.h:289
constexpr Renderer(Renderer &&other) noexcept
Move constructor.
Definition: SDL3pp_render.h:249
Renderer(WindowParam window, StringParam name)
Create a 2D rendering context for a window.
Definition: SDL3pp_render.h:326
constexpr RendererRaw release() noexcept
Retrieves underlying RendererRaw and clear this.
Definition: SDL3pp_render.h:428
constexpr RendererRaw get() const noexcept
Retrieves underlying RendererRaw.
Definition: SDL3pp_render.h:425
constexpr Renderer & operator=(const Renderer &other) noexcept=default
Assignment operator.
Renderer(SurfaceParam surface)
Create a 2D software rendering context for a surface.
Definition: SDL3pp_render.h:404
constexpr Renderer(const RendererRaw resource) noexcept
Constructs from RendererParam.
Definition: SDL3pp_render.h:240
constexpr Renderer & operator=(Renderer &&other) noexcept
Assignment operator.
Definition: SDL3pp_render.h:413
Renderer(PropertiesParam props)
Create a 2D rendering context for a window, with the specified properties.
Definition: SDL3pp_render.h:381
constexpr auto operator<=>(const Renderer &other) const noexcept=default
Comparison.
~Renderer()
Destructor.
Definition: SDL3pp_render.h:410
constexpr Renderer(const Renderer &other)=delete
Copy constructor.
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:201
static constexpr Surface Borrow(SurfaceParam resource)
Safely borrows the from SurfaceParam.
Definition: SDL3pp_surface.h:381
An efficient driver-specific representation of pixel data.
Definition: SDL3pp_render.h:2155
constexpr Texture & operator=(Texture &&other) noexcept
Assignment operator.
Definition: SDL3pp_render.h:2456
constexpr Texture & operator=(const Texture &other) noexcept=default
Assignment operator.
constexpr TextureRaw operator->() noexcept
member access to underlying TextureRaw.
Definition: SDL3pp_render.h:2450
constexpr Texture(const TextureRaw resource) noexcept
Constructs from TextureParam.
Definition: SDL3pp_render.h:2172
constexpr Texture(const Texture &other)
Copy constructor.
Definition: SDL3pp_render.h:2178
Texture(RendererParam renderer, SurfaceParam surface)
Create a texture from an existing surface.
Definition: SDL3pp_render.h:2239
constexpr auto operator<=>(const Texture &other) const noexcept=default
Comparison.
static constexpr Texture Borrow(TextureParam resource)
Safely borrows the from TextureParam.
Definition: SDL3pp_render.h:2437
constexpr TextureRaw get() const noexcept
Retrieves underlying TextureRaw.
Definition: SDL3pp_render.h:2466
constexpr TextureRaw release() noexcept
Retrieves underlying TextureRaw and clear this.
Definition: SDL3pp_render.h:2469
~Texture()
Destructor.
Definition: SDL3pp_render.h:2453
constexpr const TextureRaw operator->() const noexcept
member access to underlying TextureRaw.
Definition: SDL3pp_render.h:2447
Texture(RendererParam renderer, PropertiesParam props)
Create a texture for a rendering context with the specified properties.
Definition: SDL3pp_render.h:2351
Texture(RendererParam renderer, PixelFormat format, TextureAccess access, const PointRaw &size)
Create a texture for a rendering context.
Definition: SDL3pp_render.h:2207
constexpr Texture(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_render.h:2160
constexpr Texture(Texture &&other) noexcept
Move constructor.
Definition: SDL3pp_render.h:2181
The struct used as an opaque handle to a window.
Definition: SDL3pp_video.h:731
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:197
SDL_Event Event
The structure for all events in SDL.
Definition: SDL3pp_events.h:798
SDL_FColor FColorRaw
Alias to raw representation for FColor.
Definition: SDL3pp_pixels.h:89
SDL_Color ColorRaw
Alias to raw representation for Color.
Definition: SDL3pp_pixels.h:83
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:5489
FColor GetTextureModFloat(TextureConstParam texture)
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4576
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:4957
Renderer CreateRendererWithProperties(PropertiesParam props)
Create a 2D rendering context for a window, with the specified properties.
Definition: SDL3pp_render.h:3314
void SetDrawColorFloat(const FColorRaw &c)
Set the color used for drawing operations (Rect, Line and Clear).
Definition: SDL3pp_render.h:5747
constexpr int RENDERER_VSYNC_DISABLED
Constant for disabling renderer vsync.
Definition: SDL3pp_render.h:6859
void RenderPoints(RendererParam renderer, SpanRef< const FPointRaw > points)
Draw multiple points on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6042
void SetDrawColor(ColorRaw c)
Set the color used for drawing operations.
Definition: SDL3pp_render.h:5720
Texture GetTarget() const
Get the current render target.
Definition: SDL3pp_render.h:5063
void Destroy()
Destroy the rendering context for a window and free all associated textures.
Definition: SDL3pp_render.h:6687
const char * GetName() const
Get the name of a renderer.
Definition: SDL3pp_render.h:3482
void SetRenderViewport(RendererParam renderer, OptionalRef< const RectRaw > rect)
Set the drawing area for rendering on the current target.
Definition: SDL3pp_render.h:5378
void SetRenderScale(RendererParam renderer, const FPointRaw &scale)
Set the drawing scale for rendering on the current target.
Definition: SDL3pp_render.h:5634
bool RenderViewportSet(RendererParam renderer)
Return whether an explicit rectangle was set as the viewport.
Definition: SDL3pp_render.h:5461
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:4723
Point GetCurrentOutputSize() const
Get the current output size in pixels of a rendering context.
Definition: SDL3pp_render.h:3697
void GetTextureSize(TextureConstParam texture, float *w, float *h)
Get the size of a texture, as floating point values.
Definition: SDL3pp_render.h:4157
void SetColorModFloat(float r, float g, float b)
Set an additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4288
void ResetRenderClipRect(RendererParam renderer)
Reset the clip rectangle for rendering to the entire render target.
Definition: SDL3pp_render.h:5546
void ResetRenderTarget(RendererParam renderer)
Set target texture back to window.
Definition: SDL3pp_render.h:5034
void RenderPoint(const FPointRaw &p)
Draw a point on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6024
void GetTextureColorMod(TextureConstParam texture, Uint8 *r, Uint8 *g, Uint8 *b)
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4310
void SetRenderDrawColor(RendererParam renderer, ColorRaw c)
Set the color used for drawing operations.
Definition: SDL3pp_render.h:5715
std::pair< Window, Renderer > CreateWindowAndRenderer(StringParam title, const PointRaw &size, WindowFlags window_flags=0)
Create a window and default renderer.
Definition: SDL3pp_render.h:3213
void SetTextureMod(TextureParam texture, Color c)
Set an additional color and alpha values multiplied into render copy operations.
Definition: SDL3pp_render.h:4496
void SetTextureBlendMode(TextureParam texture, BlendMode blendMode)
Set the blend mode for a texture, used by Renderer.RenderTexture().
Definition: SDL3pp_render.h:4605
void GetCurrentRenderOutputSize(RendererParam renderer, int *w, int *h)
Get the current output size in pixels of a rendering context.
Definition: SDL3pp_render.h:3661
void SetBlendMode(BlendMode blendMode)
Set the blend mode for a texture, used by Renderer.RenderTexture().
Definition: SDL3pp_render.h:4610
Rect GetViewport() const
Get the drawing area for the current target.
Definition: SDL3pp_render.h:5436
Point GetSize() const
Get the size of a texture.
Definition: SDL3pp_render.h:4173
bool ViewportSet() const
Return whether an explicit rectangle was set as the viewport.
Definition: SDL3pp_render.h:5466
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:6166
void SetDrawBlendMode(BlendMode blendMode)
Set the blend mode used for drawing operations (Fill and Line).
Definition: SDL3pp_render.h:5952
FPoint GetSizeFloat() const
Get the size of a texture, as floating point values.
Definition: SDL3pp_render.h:4186
void SetAlphaMod(Uint8 alpha)
Set an additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4381
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:6261
void SetTextureColorModFloat(TextureParam texture, float r, float g, float b)
Set an additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4280
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:6423
int GetTextureWidth(TextureConstParam texture)
Get the width in pixels.
Definition: SDL3pp_render.h:4192
Uint8 GetTextureAlphaMod(TextureConstParam texture)
Get the additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4434
FPoint GetScale() const
Get the drawing scale for the current target.
Definition: SDL3pp_render.h:5693
SDL_Renderer * RendererRaw
Alias to raw representation for Renderer.
Definition: SDL3pp_render.h:46
PixelFormat GetFormat() const
Get the pixel format.
Definition: SDL3pp_render.h:4213
void Destroy()
Destroy the specified texture.
Definition: SDL3pp_render.h:6667
int GetTextureHeight(TextureConstParam texture)
Get the height in pixels.
Definition: SDL3pp_render.h:4200
bool IsClipEnabled() const
Get whether clipping is enabled on the given render target.
Definition: SDL3pp_render.h:5605
constexpr int RENDERER_VSYNC_ADAPTIVE
Constant for enabling asaptive renderer vsync.
Definition: SDL3pp_render.h:6862
FPoint RenderCoordinatesToWindow(const FPointRaw &coord) const
Get a point in window coordinates when given a point in render coordinates.
Definition: SDL3pp_render.h:5306
void SetRenderVSync(RendererParam renderer, int vsync)
Toggle VSync of the given renderer.
Definition: SDL3pp_render.h:6848
void RenderPresent(RendererParam renderer)
Update the screen with any rendering performed since the previous call.
Definition: SDL3pp_render.h:6643
constexpr auto SOFTWARE_RENDERER
The name of the software renderer.
Definition: SDL3pp_render.h:155
void RenderDebugText(RendererParam renderer, const FPointRaw &p, StringParam str)
Draw debug text to an Renderer.
Definition: SDL3pp_render.h:6939
void SetRenderClipRect(RendererParam renderer, OptionalRef< const RectRaw > rect)
Set the clip rectangle for rendering on the specified target.
Definition: SDL3pp_render.h:5519
void GetTextureColorModFloat(TextureConstParam texture, float *r, float *g, float *b)
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4340
FPoint RenderCoordinatesToWindow(RendererParam renderer, const FPointRaw &coord)
Get a point in window coordinates when given a point in render coordinates.
Definition: SDL3pp_render.h:5297
float GetTextureAlphaModFloat(TextureConstParam texture)
Get the additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4461
Texture GetRenderTarget(RendererParam renderer)
Get the current render target.
Definition: SDL3pp_render.h:5056
void RenderPoints(SpanRef< const FPointRaw > points)
Draw multiple points on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6048
void ResetTarget()
Set target texture back to window.
Definition: SDL3pp_render.h:5039
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:6309
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:6535
SDL_Vertex Vertex
Vertex structure.
Definition: SDL3pp_render.h:162
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:6508
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:6067
int GetHeight() const
Get the height in pixels.
Definition: SDL3pp_render.h:4202
PixelFormat GetTextureFormat(TextureConstParam texture)
Get the pixel format.
Definition: SDL3pp_render.h:4208
Texture CreateTextureFromSurface(RendererParam renderer, SurfaceParam surface)
Create a texture from an existing surface.
Definition: SDL3pp_render.h:3764
BlendMode GetTextureBlendMode(TextureConstParam texture)
Get the blend mode used for texture copy operations.
Definition: SDL3pp_render.h:4628
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:5259
FColor GetDrawColorFloat() const
Get the color used for drawing operations (Rect, Line and Clear).
Definition: SDL3pp_render.h:5872
Uint8 GetAlphaMod() const
Get the additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4441
FPoint GetTextureSizeFloat(TextureConstParam texture)
Get the size of a texture, as floating point values.
Definition: SDL3pp_render.h:4179
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:6093
void SetModFloat(FColor c)
Set an additional color and alpha values multiplied into render copy operations.
Definition: SDL3pp_render.h:4533
void DestroyRenderer(RendererRaw renderer)
Destroy the rendering context for a window and free all associated textures.
Definition: SDL3pp_render.h:6682
void UnlockTexture(TextureParam texture)
Unlock a texture, uploading the changes to video memory, if needed.
Definition: SDL3pp_render.h:4981
void SetColorScale(float scale)
Set the color scale used for render operations.
Definition: SDL3pp_render.h:5902
int GetVSync() const
Get VSync of the given renderer.
Definition: SDL3pp_render.h:6885
void ResetRenderViewport(RendererParam renderer)
Reset the drawing area for rendering to the entire target.
Definition: SDL3pp_render.h:5405
Surface RenderReadPixels(RendererParam renderer, OptionalRef< const RectRaw > rect={})
Read pixels from the current rendering target.
Definition: SDL3pp_render.h:6586
BlendMode GetRenderDrawBlendMode(RendererParam renderer)
Get the blend mode used for drawing operations.
Definition: SDL3pp_render.h:5970
Point GetOutputSize() const
Get the output size in pixels of a rendering context.
Definition: SDL3pp_render.h:3636
void GetColorModFloat(float *r, float *g, float *b) const
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4348
void SetColorMod(Uint8 r, Uint8 g, Uint8 b)
Set an additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4249
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:6462
void Update(OptionalRef< const RectRaw > rect, const void *pixels, int pitch)
Update the given texture rectangle with new pixel data.
Definition: SDL3pp_render.h:4768
void RenderRect(OptionalRef< const FRectRaw > rect)
Draw a rectangle on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6122
RendererRef GetRenderer() const
Get the renderer associated with a window.
Definition: SDL3pp_render.h:3437
void SetRenderTarget(RendererParam renderer, TextureParam texture)
Set a texture as the current rendering target.
Definition: SDL3pp_render.h:5009
void SetRenderDrawColorFloat(RendererParam renderer, const FColorRaw &c)
Set the color used for drawing operations (Rect, Line and Clear).
Definition: SDL3pp_render.h:5742
void Present()
Update the screen with any rendering performed since the previous call.
Definition: SDL3pp_render.h:6648
void ResetViewport()
Reset the drawing area for rendering to the entire target.
Definition: SDL3pp_render.h:5410
BlendMode GetDrawBlendMode() const
Get the blend mode used for drawing operations.
Definition: SDL3pp_render.h:5977
void RenderClear()
Clear the current rendering target with the drawing color.
Definition: SDL3pp_render.h:6004
SDL_TextureAccess TextureAccess
The access pattern allowed for a texture.
Definition: SDL3pp_render.h:169
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:6229
Renderer CreateSoftwareRenderer(SurfaceParam surface)
Create a 2D software rendering context for a surface.
Definition: SDL3pp_render.h:3432
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:4948
void SetMod(Color c)
Set an additional color and alpha values multiplied into render copy operations.
Definition: SDL3pp_render.h:4502
void SetTextureModFloat(TextureParam texture, FColor c)
Set an additional color and alpha values multiplied into render copy operations.
Definition: SDL3pp_render.h:4527
void RenderLine(const FPointRaw &p1, const FPointRaw &p2)
Draw a line on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6074
Color GetMod() const
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4560
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:205
PropertiesRef GetProperties() const
Get the properties associated with a texture.
Definition: SDL3pp_render.h:4117
void RenderDebugText(const FPointRaw &p, StringParam str)
Draw debug text to an Renderer.
Definition: SDL3pp_render.h:6946
Color GetTextureMod(TextureConstParam texture)
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4552
void SetAlphaModFloat(float alpha)
Set an additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4414
RendererRef GetRendererFromTexture(TextureConstParam texture)
Get the renderer that created an Texture.
Definition: SDL3pp_render.h:4133
PropertiesRef GetRendererProperties(RendererParam renderer)
Get the properties associated with a renderer.
Definition: SDL3pp_render.h:3570
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_DISABLED
There is no logical size in effect.
Definition: SDL3pp_render.h:187
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:5834
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:4806
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:6141
ScaleMode GetTextureScaleMode(TextureConstParam texture)
Get the scale mode used for texture scale operations.
Definition: SDL3pp_render.h:4680
void * GetRenderMetalCommandEncoder(RendererParam renderer)
Get the Metal command encoder for the current frame.
Definition: SDL3pp_render.h:6773
Rect GetClipRect() const
Get the clip rectangle for the current target.
Definition: SDL3pp_render.h:5578
void * GetRenderMetalLayer()
Get the CAMetalLayer associated with the given Metal renderer.
Definition: SDL3pp_render.h:6747
void GetRenderScale(RendererParam renderer, float *scaleX, float *scaleY)
Get the drawing scale for the current target.
Definition: SDL3pp_render.h:5661
void SetRenderColorScale(RendererParam renderer, float scale)
Set the color scale used for render operations.
Definition: SDL3pp_render.h:5897
SDL_RendererLogicalPresentation RendererLogicalPresentation
How the logical size is mapped to the output.
Definition: SDL3pp_render.h:185
constexpr TextureAccess TEXTUREACCESS_TARGET
Texture can be used as a render target.
Definition: SDL3pp_render.h:177
void GetRenderOutputSize(RendererParam renderer, int *w, int *h)
Get the output size in pixels of a rendering context.
Definition: SDL3pp_render.h:3600
FPoint RenderCoordinatesFromWindow(const FPointRaw &window_coord) const
Get a point in render coordinates when given a point in window coordinates.
Definition: SDL3pp_render.h:5268
void DestroyTexture(TextureRaw texture)
Destroy the specified texture.
Definition: SDL3pp_render.h:6665
void SetTextureAlphaModFloat(TextureParam texture, float alpha)
Set an additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4409
Rect GetSafeArea() const
Get the safe area for rendering within the current viewport.
Definition: SDL3pp_render.h:5496
Rect GetRenderViewport(RendererParam renderer)
Get the drawing area for the current target.
Definition: SDL3pp_render.h:5429
PropertiesRef GetTextureProperties(TextureConstParam texture)
Get the properties associated with a texture.
Definition: SDL3pp_render.h:4112
void ConvertEventToRenderCoordinates(RendererParam renderer, Event *event)
Convert the coordinates in an event to render coordinates.
Definition: SDL3pp_render.h:5343
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:6191
int GetWidth() const
Get the width in pixels.
Definition: SDL3pp_render.h:4194
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:6221
FColor GetModFloat() const
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4584
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:6320
constexpr TextureAccess TEXTUREACCESS_STATIC
Changes rarely, not lockable.
Definition: SDL3pp_render.h:171
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:5600
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:6809
void * GetRenderMetalCommandEncoder()
Get the Metal command encoder for the current frame.
Definition: SDL3pp_render.h:6778
void SetViewport(OptionalRef< const RectRaw > rect)
Set the drawing area for rendering on the current target.
Definition: SDL3pp_render.h:5384
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_INTEGER_SCALE
The rendered content is scaled up by integer multiples to fit the output resolution.
Definition: SDL3pp_render.h:212
WindowRef GetWindow()
Get the window associated with a renderer.
Definition: SDL3pp_render.h:3458
constexpr TextureAccess TEXTUREACCESS_STREAMING
Changes frequently, lockable.
Definition: SDL3pp_render.h:174
BlendMode GetBlendMode() const
Get the blend mode used for texture copy operations.
Definition: SDL3pp_render.h:4635
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:4819
PropertiesRef GetProperties() const
Get the properties associated with a renderer.
Definition: SDL3pp_render.h:3575
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:6353
void Flush()
Force the rendering context to flush any pending commands and state.
Definition: SDL3pp_render.h:6724
Texture CreateTextureWithProperties(PropertiesParam props)
Create a texture for a rendering context with the specified properties.
Definition: SDL3pp_render.h:3889
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:6363
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:4910
FRect GetLogicalPresentationRect() const
Get the final presentation rectangle for rendering.
Definition: SDL3pp_render.h:5232
void SetTextureColorMod(TextureParam texture, Uint8 r, Uint8 g, Uint8 b)
Set an additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4244
void SetClipRect(OptionalRef< const RectRaw > rect)
Set the clip rectangle for rendering on the specified target.
Definition: SDL3pp_render.h:5525
constexpr int DEBUG_TEXT_FONT_CHARACTER_SIZE
The size, in pixels, of a single Renderer.RenderDebugText() character.
Definition: SDL3pp_render.h:6899
Renderer CreateRenderer(WindowParam window, StringParam name)
Create a 2D rendering context for a window.
Definition: SDL3pp_render.h:3258
void ConvertEventToRenderCoordinates(Event *event) const
Convert the coordinates in an event to render coordinates.
Definition: SDL3pp_render.h:5349
Surface ReadPixels(OptionalRef< const RectRaw > rect={}) const
Read pixels from the current rendering target.
Definition: SDL3pp_render.h:6592
float GetRenderColorScale(RendererParam renderer)
Get the color scale used for render operations.
Definition: SDL3pp_render.h:5920
void SetScale(const FPointRaw &scale)
Set the drawing scale for rendering on the current target.
Definition: SDL3pp_render.h:5639
Texture CreateTextureFromSurface(SurfaceParam surface)
Create a texture from an existing surface.
Definition: SDL3pp_render.h:3770
Texture CreateTexture(RendererParam renderer, PixelFormat format, TextureAccess access, const PointRaw &size)
Create a texture for a rendering context.
Definition: SDL3pp_render.h:3724
float GetColorScale() const
Get the color scale used for render operations.
Definition: SDL3pp_render.h:5927
Rect GetRenderClipRect(RendererParam renderer)
Get the clip rectangle for the current target.
Definition: SDL3pp_render.h:5571
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:4866
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:6197
const char * GetRendererName(RendererParam renderer)
Get the name of a renderer.
Definition: SDL3pp_render.h:3477
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:198
void RenderLines(SpanRef< const FPointRaw > points)
Draw a series of connected lines on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6098
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:6402
void SetLogicalPresentation(const PointRaw &size, RendererLogicalPresentation mode)
Set a device-independent resolution and presentation mode for rendering.
Definition: SDL3pp_render.h:5126
void GetLogicalPresentation(int *w, int *h, RendererLogicalPresentation *mode) const
Get device independent resolution and presentation mode for rendering.
Definition: SDL3pp_render.h:5191
void SetTarget(TextureParam texture)
Set a texture as the current rendering target.
Definition: SDL3pp_render.h:5014
ScaleMode GetScaleMode() const
Get the scale mode used for texture scale operations.
Definition: SDL3pp_render.h:4687
void SetTextureAlphaMod(TextureParam texture, Uint8 alpha)
Set an additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4376
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:4902
void * GetRenderMetalLayer(RendererParam renderer)
Get the CAMetalLayer associated with the given Metal renderer.
Definition: SDL3pp_render.h:6742
void RenderRects(SpanRef< const FRectRaw > rects)
Draw some number of rectangles on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6146
void RenderDebugTextFormat(const FPointRaw &p, std::string_view fmt, ARGS... args)
Draw debug text to an Renderer.
Definition: SDL3pp_render.h:6986
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:5773
Texture CreateTextureWithProperties(RendererParam renderer, PropertiesParam props)
Create a texture for a rendering context with the specified properties.
Definition: SDL3pp_render.h:3883
void RenderDebugTextFormat(RendererParam renderer, const FPointRaw &p, std::string_view fmt, ARGS... args)
Draw debug text to an Renderer.
Definition: SDL3pp_render.h:6976
FRect GetRenderLogicalPresentationRect(RendererParam renderer)
Get the final presentation rectangle for rendering.
Definition: SDL3pp_render.h:5225
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_STRETCH
The rendered content is stretched to the output resolution.
Definition: SDL3pp_render.h:191
void GetRenderLogicalPresentation(RendererParam renderer, int *w, int *h, RendererLogicalPresentation *mode)
Get device independent resolution and presentation mode for rendering.
Definition: SDL3pp_render.h:5153
void RenderPoint(RendererParam renderer, const FPointRaw &p)
Draw a point on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6019
void RenderRect(RendererParam renderer, OptionalRef< const FRectRaw > rect)
Draw a rectangle on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6117
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:4855
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:6172
int GetNumRenderDrivers()
Get the number of 2D rendering drivers available for the current display.
Definition: SDL3pp_render.h:3167
const char * GetRenderDriver(int index)
Use this function to get the name of a built in 2D rendering driver.
Definition: SDL3pp_render.h:3191
void SetRenderLogicalPresentation(RendererParam renderer, const PointRaw &size, RendererLogicalPresentation mode)
Set a device-independent resolution and presentation mode for rendering.
Definition: SDL3pp_render.h:5119
void Unlock()
Unlock a texture, uploading the changes to video memory, if needed.
Definition: SDL3pp_render.h:4983
RendererRef GetRenderer() const
Get the renderer that created an Texture.
Definition: SDL3pp_render.h:4138
void SetVSync(int vsync)
Toggle VSync of the given renderer.
Definition: SDL3pp_render.h:6853
void ResetClipRect()
Reset the clip rectangle for rendering to the entire render target.
Definition: SDL3pp_render.h:5551
float GetAlphaModFloat() const
Get the additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4468
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:6818
void FlushRenderer(RendererParam renderer)
Force the rendering context to flush any pending commands and state.
Definition: SDL3pp_render.h:6719
void GetColorMod(Uint8 *r, Uint8 *g, Uint8 *b) const
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4318
void RenderClear(RendererParam renderer)
Clear the current rendering target with the drawing color.
Definition: SDL3pp_render.h:5999
void SetRenderDrawBlendMode(RendererParam renderer, BlendMode blendMode)
Set the blend mode used for drawing operations (Fill and Line).
Definition: SDL3pp_render.h:5947
Texture CreateTexture(PixelFormat format, TextureAccess access, const PointRaw &size)
Create a texture for a rendering context.
Definition: SDL3pp_render.h:3732
WindowRef GetRenderWindow(RendererParam renderer)
Get the window associated with a renderer.
Definition: SDL3pp_render.h:3453
int GetRenderVSync(RendererParam renderer)
Get VSync of the given renderer.
Definition: SDL3pp_render.h:6878
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:6475
Color GetDrawColor() const
Get the color used for drawing operations (Rect, Line and Clear).
Definition: SDL3pp_render.h:5808
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:6273
void SetTextureScaleMode(TextureParam texture, ScaleMode scaleMode)
Set the scale mode used for texture scale operations.
Definition: SDL3pp_render.h:4657
void SetScaleMode(ScaleMode scaleMode)
Set the scale mode used for texture scale operations.
Definition: SDL3pp_render.h:4662
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition: SDL3pp_stdinc.h:341
::Uint8 Uint8
An unsigned 8-bit integer type.
Definition: SDL3pp_stdinc.h:289
::Sint64 Sint64
A signed 64-bit integer type.
Definition: SDL3pp_stdinc.h:356
SDL_Surface * SurfaceRaw
Alias to raw representation for Surface.
Definition: SDL3pp_surface.h:42
SDL_FlipMode FlipMode
The flip mode.
Definition: SDL3pp_surface.h:162
SDL_ScaleMode ScaleMode
The scaling mode.
Definition: SDL3pp_surface.h:143
Uint64 WindowFlags
The flags on a window.
Definition: SDL3pp_video.h:538
Main include header for the SDL3pp library.
A structure that represents a color as RGBA components.
Definition: SDL3pp_pixels.h:2189
The bits of this structure can be directly reinterpreted as a float-packed color which uses the PIXEL...
Definition: SDL3pp_pixels.h:2362
The structure that defines a point (using floating point values).
Definition: SDL3pp_rect.h:512
A rectangle, with the origin at the upper left (using floating point values).
Definition: SDL3pp_rect.h:1437
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:708
A rectangle, with the origin at the upper left (using integers).
Definition: SDL3pp_rect.h:845
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:2105
RendererRef(RendererRaw resource) noexcept
Constructs from RendererParam.
Definition: SDL3pp_render.h:2127
~RendererRef()
Destructor.
Definition: SDL3pp_render.h:2139
RendererRef(const RendererRef &other) noexcept
Copy constructor.
Definition: SDL3pp_render.h:2133
RendererRef(RendererParam resource) noexcept
Constructs from RendererParam.
Definition: SDL3pp_render.h:2115
Safely wrap Surface for non owning const parameters.
Definition: SDL3pp_surface.h:76
Safely wrap Surface for non owning parameters.
Definition: SDL3pp_surface.h:46
Safely wrap Texture for non owning const parameters.
Definition: SDL3pp_render.h:116
constexpr TextureConstParam(TextureParam value)
Constructs from TextureParam.
Definition: SDL3pp_render.h:126
const TextureRaw value
parameter's const TextureRaw
Definition: SDL3pp_render.h:117
constexpr auto operator->()
member access to underlying TextureRaw.
Definition: SDL3pp_render.h:147
constexpr TextureConstParam(std::nullptr_t _=nullptr)
Constructs null/invalid.
Definition: SDL3pp_render.h:132
constexpr auto operator<=>(const TextureConstParam &other) const =default
Comparison.
constexpr TextureConstParam(const TextureRaw value)
Constructs from const TextureRaw.
Definition: SDL3pp_render.h:120
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->()
member access to underlying TextureRaw.
Definition: SDL3pp_render.h:111
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:54
Semi-safe reference for Window.
Definition: SDL3pp_video.h:2962