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"
8#include "SDL3pp_pixels.h"
9#include "SDL3pp_video.h"
70 constexpr explicit operator bool()
const {
return !!
value; }
106 constexpr explicit operator bool()
const {
return !!
value; }
142 constexpr explicit operator bool()
const {
return !!
value; }
154#if SDL_VERSION_ATLEAST(3, 3, 6)
157struct GPURenderState;
183 constexpr explicit operator bool()
const {
return !!
value; }
195struct TextureSurfaceLock;
207#if SDL_VERSION_ATLEAST(3, 4, 0)
233 SDL_TEXTUREACCESS_STATIC;
236 SDL_TEXTUREACCESS_STREAMING;
239 SDL_TEXTUREACCESS_TARGET;
241#if SDL_VERSION_ATLEAST(3, 4, 0)
257 SDL_TEXTURE_ADDRESS_INVALID;
269 SDL_TEXTURE_ADDRESS_WRAP;
281 SDL_LOGICAL_PRESENTATION_DISABLED;
285 SDL_LOGICAL_PRESENTATION_STRETCH;
292 SDL_LOGICAL_PRESENTATION_LETTERBOX;
299 SDL_LOGICAL_PRESENTATION_OVERSCAN;
306 SDL_LOGICAL_PRESENTATION_INTEGER_SCALE;
308#if SDL_VERSION_ATLEAST(3, 4, 0)
334 constexpr Renderer(std::nullptr_t =
nullptr) noexcept
347 : m_resource(resource)
398 : m_resource(
CheckError(SDL_CreateRenderer(window, nullptr)))
435 : m_resource(
CheckError(SDL_CreateRenderer(window, name)))
501 : m_resource(
CheckError(SDL_CreateRendererWithProperties(props)))
524 : m_resource(
CheckError(SDL_CreateSoftwareRenderer(surface)))
534 std::swap(m_resource, other.m_resource);
550 m_resource =
nullptr;
558 constexpr explicit operator bool() const noexcept {
return !!m_resource; }
577#if SDL_VERSION_ATLEAST(3, 4, 0)
1433 void GetScale(
float* scaleX,
float* scaleY)
const;
1816 FlipMode flip = FlipMode::SDL_FLIP_NONE);
1912 float bottom_height,
1916#if SDL_VERSION_ATLEAST(3, 4, 0)
1957 float bottom_height,
1984 std::span<const Vertex> vertices,
1985 std::span<const int> indices = {});
2017 const FColor* color,
2022 const void* indices,
2026#if SDL_VERSION_ATLEAST(3, 4, 0)
2090 Surface
ReadPixels(OptionalRef<const RectRaw> rect = {})
const;
2237 Sint64 signal_semaphore);
2340 template<
class... ARGS>
2342 std::string_view fmt,
2345#if SDL_VERSION_ATLEAST(3, 4, 0)
2471 constexpr Texture(std::nullptr_t =
nullptr) noexcept
2484 : m_resource(resource)
2490 : m_resource(other.m_resource)
2492 if (m_resource) ++m_resource->refcount;
2527 CheckError(SDL_CreateTexture(renderer, format, access, size.x, size.y)))
2555 : m_resource(
CheckError(SDL_CreateTextureFromSurface(renderer, surface)))
2684 : m_resource(
CheckError(SDL_CreateTextureWithProperties(renderer, props)))
2771 ++resource.
value->refcount;
2789 std::swap(m_resource, other.m_resource);
2802 auto r = m_resource;
2803 m_resource =
nullptr;
2811 constexpr explicit operator bool() const noexcept {
return !!m_resource; }
2954 void GetSize(
float* w,
float* h)
const;
2971#if SDL_VERSION_ATLEAST(3, 4, 0)
3413 const Uint8* Yplane,
3415 const Uint8* Uplane,
3417 const Uint8* Vplane,
3445 const Uint8* Yplane,
3447 const Uint8* UVplane,
3568 :
Texture(std::move(resource))
3646 : m_lock(other.m_lock)
3675 std::swap(m_lock, other.m_lock);
3680 constexpr operator bool()
const {
return bool(m_lock); }
3776 , m_lock(other.m_lock)
3805 std::swap(m_lock, other.m_lock);
3811 constexpr operator bool()
const {
return bool(m_lock); }
3887 return SDL_GetRenderDriver(index);
3915 title, size.x, size.y, window_flags, window, renderer));
3942 SDL_Window* windowRaw =
nullptr;
3943 SDL_Renderer* rendererRaw =
nullptr;
3945 std::move(title), size, window_flags, &windowRaw, &rendererRaw);
3946 if (window) *window =
Window{windowRaw};
3947 if (renderer) *renderer =
Renderer{rendererRaw};
3972 SDL_Window* window =
nullptr;
3973 SDL_Renderer* renderer =
nullptr;
3975 std::move(title), size, window_flags, &window, &renderer);
4004 std::move(title), size, window_flags, &window, renderer);
4052 return Renderer(window, std::move(name));
4122namespace prop::Renderer {
4124constexpr auto CREATE_NAME_STRING = SDL_PROP_RENDERER_CREATE_NAME_STRING;
4126constexpr auto CREATE_WINDOW_POINTER = SDL_PROP_RENDERER_CREATE_WINDOW_POINTER;
4128constexpr auto CREATE_SURFACE_POINTER =
4129 SDL_PROP_RENDERER_CREATE_SURFACE_POINTER;
4131constexpr auto CREATE_OUTPUT_COLORSPACE_NUMBER =
4132 SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER;
4134constexpr auto CREATE_PRESENT_VSYNC_NUMBER =
4135 SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER;
4137#if SDL_VERSION_ATLEAST(3, 4, 0)
4139constexpr auto CREATE_GPU_DEVICE_POINTER =
4140 SDL_PROP_RENDERER_CREATE_GPU_DEVICE_POINTER;
4142constexpr auto CREATE_GPU_SHADERS_SPIRV_BOOLEAN =
4143 SDL_PROP_RENDERER_CREATE_GPU_SHADERS_SPIRV_BOOLEAN;
4145constexpr auto CREATE_GPU_SHADERS_DXIL_BOOLEAN =
4146 SDL_PROP_RENDERER_CREATE_GPU_SHADERS_DXIL_BOOLEAN;
4148constexpr auto CREATE_GPU_SHADERS_MSL_BOOLEAN =
4149 SDL_PROP_RENDERER_CREATE_GPU_SHADERS_MSL_BOOLEAN;
4153constexpr auto CREATE_VULKAN_INSTANCE_POINTER =
4154 SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER;
4156constexpr auto CREATE_VULKAN_SURFACE_NUMBER =
4157 SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER;
4159constexpr auto CREATE_VULKAN_PHYSICAL_DEVICE_POINTER =
4160 SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER;
4162constexpr auto CREATE_VULKAN_DEVICE_POINTER =
4163 SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER;
4165constexpr auto CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER =
4166 SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER;
4168constexpr auto CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER =
4169 SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER;
4171constexpr auto NAME_STRING = SDL_PROP_RENDERER_NAME_STRING;
4173constexpr auto WINDOW_POINTER = SDL_PROP_RENDERER_WINDOW_POINTER;
4175constexpr auto SURFACE_POINTER = SDL_PROP_RENDERER_SURFACE_POINTER;
4177constexpr auto VSYNC_NUMBER = SDL_PROP_RENDERER_VSYNC_NUMBER;
4179constexpr auto MAX_TEXTURE_SIZE_NUMBER =
4180 SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER;
4182constexpr auto TEXTURE_FORMATS_POINTER =
4183 SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER;
4185#if SDL_VERSION_ATLEAST(3, 4, 0)
4187constexpr auto TEXTURE_WRAPPING_BOOLEAN =
4188 SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN;
4192constexpr auto OUTPUT_COLORSPACE_NUMBER =
4193 SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER;
4195constexpr auto HDR_ENABLED_BOOLEAN = SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN;
4197constexpr auto SDR_WHITE_POINT_FLOAT = SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT;
4199constexpr auto HDR_HEADROOM_FLOAT = SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT;
4201constexpr auto D3D9_DEVICE_POINTER = SDL_PROP_RENDERER_D3D9_DEVICE_POINTER;
4203constexpr auto D3D11_DEVICE_POINTER = SDL_PROP_RENDERER_D3D11_DEVICE_POINTER;
4205constexpr auto D3D11_SWAPCHAIN_POINTER =
4206 SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER;
4208constexpr auto D3D12_DEVICE_POINTER = SDL_PROP_RENDERER_D3D12_DEVICE_POINTER;
4210constexpr auto D3D12_SWAPCHAIN_POINTER =
4211 SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER;
4213constexpr auto D3D12_COMMAND_QUEUE_POINTER =
4214 SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER;
4216constexpr auto VULKAN_INSTANCE_POINTER =
4217 SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER;
4219constexpr auto VULKAN_SURFACE_NUMBER = SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER;
4221constexpr auto VULKAN_PHYSICAL_DEVICE_POINTER =
4222 SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER;
4224constexpr auto VULKAN_DEVICE_POINTER = SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER;
4226constexpr auto VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER =
4227 SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER;
4229constexpr auto VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER =
4230 SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER;
4232constexpr auto VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER =
4233 SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER;
4235constexpr auto GPU_DEVICE_POINTER = SDL_PROP_RENDERER_GPU_DEVICE_POINTER;
4239#if SDL_VERSION_ATLEAST(3, 4, 0)
4275 return SDL_CreateGPURenderer(device, window);
4291 return SDL_GetGPURendererDevice(renderer);
4327 return {
CheckError(SDL_GetRenderer(m_resource))};
4343 return {
CheckError(SDL_GetRenderWindow(renderer))};
4367 return SDL_GetRendererName(renderer);
4462 return {
CheckError(SDL_GetRendererProperties(renderer))};
4492 CheckError(SDL_GetRenderOutputSize(renderer, w, h));
4553 CheckError(SDL_GetCurrentRenderOutputSize(renderer, w, h));
4619 return Texture(renderer, format, access, size);
4626 return Texture(m_resource, format, access, size);
4657 return Texture(renderer, surface);
4662 return Texture(m_resource, surface);
4791 return Texture(renderer, props);
4796 return Texture(m_resource, props);
4799namespace prop::Texture {
4801constexpr auto CREATE_COLORSPACE_NUMBER =
4802 SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER;
4804constexpr auto CREATE_FORMAT_NUMBER = SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER;
4806constexpr auto CREATE_ACCESS_NUMBER = SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER;
4808constexpr auto CREATE_WIDTH_NUMBER = SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER;
4810constexpr auto CREATE_HEIGHT_NUMBER = SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER;
4812#if SDL_VERSION_ATLEAST(3, 4, 0)
4814constexpr auto CREATE_PALETTE_POINTER = SDL_PROP_TEXTURE_CREATE_PALETTE_POINTER;
4818constexpr auto CREATE_SDR_WHITE_POINT_FLOAT =
4819 SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT;
4821constexpr auto CREATE_HDR_HEADROOM_FLOAT =
4822 SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT;
4824constexpr auto CREATE_D3D11_TEXTURE_POINTER =
4825 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER;
4827constexpr auto CREATE_D3D11_TEXTURE_U_POINTER =
4828 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER;
4830constexpr auto CREATE_D3D11_TEXTURE_V_POINTER =
4831 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER;
4833constexpr auto CREATE_D3D12_TEXTURE_POINTER =
4834 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER;
4836constexpr auto CREATE_D3D12_TEXTURE_U_POINTER =
4837 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER;
4839constexpr auto CREATE_D3D12_TEXTURE_V_POINTER =
4840 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER;
4842constexpr auto CREATE_METAL_PIXELBUFFER_POINTER =
4843 SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER;
4845constexpr auto CREATE_OPENGL_TEXTURE_NUMBER =
4846 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER;
4848constexpr auto CREATE_OPENGL_TEXTURE_UV_NUMBER =
4849 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER;
4851constexpr auto CREATE_OPENGL_TEXTURE_U_NUMBER =
4852 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER;
4854constexpr auto CREATE_OPENGL_TEXTURE_V_NUMBER =
4855 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER;
4857constexpr auto CREATE_OPENGLES2_TEXTURE_NUMBER =
4858 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER;
4860constexpr auto CREATE_OPENGLES2_TEXTURE_UV_NUMBER =
4861 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER;
4863constexpr auto CREATE_OPENGLES2_TEXTURE_U_NUMBER =
4864 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER;
4866constexpr auto CREATE_OPENGLES2_TEXTURE_V_NUMBER =
4867 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER;
4869constexpr auto CREATE_VULKAN_TEXTURE_NUMBER =
4870 SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER;
4872#if SDL_VERSION_ATLEAST(3, 4, 0)
4874constexpr auto CREATE_VULKAN_LAYOUT_NUMBER =
4875 SDL_PROP_TEXTURE_CREATE_VULKAN_LAYOUT_NUMBER;
4879#if SDL_VERSION_ATLEAST(3, 4, 0)
4881constexpr auto CREATE_GPU_TEXTURE_POINTER =
4882 SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_POINTER;
4884constexpr auto CREATE_GPU_TEXTURE_UV_POINTER =
4885 SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_UV_POINTER;
4887constexpr auto CREATE_GPU_TEXTURE_U_POINTER =
4888 SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_U_POINTER;
4890constexpr auto CREATE_GPU_TEXTURE_V_POINTER =
4891 SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_V_POINTER;
4895constexpr auto COLORSPACE_NUMBER = SDL_PROP_TEXTURE_COLORSPACE_NUMBER;
4897constexpr auto FORMAT_NUMBER = SDL_PROP_TEXTURE_FORMAT_NUMBER;
4899constexpr auto ACCESS_NUMBER = SDL_PROP_TEXTURE_ACCESS_NUMBER;
4901constexpr auto WIDTH_NUMBER = SDL_PROP_TEXTURE_WIDTH_NUMBER;
4903constexpr auto HEIGHT_NUMBER = SDL_PROP_TEXTURE_HEIGHT_NUMBER;
4905constexpr auto SDR_WHITE_POINT_FLOAT = SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT;
4907constexpr auto HDR_HEADROOM_FLOAT = SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT;
4909constexpr auto D3D11_TEXTURE_POINTER = SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER;
4911constexpr auto D3D11_TEXTURE_U_POINTER =
4912 SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER;
4914constexpr auto D3D11_TEXTURE_V_POINTER =
4915 SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER;
4917constexpr auto D3D12_TEXTURE_POINTER = SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER;
4919constexpr auto D3D12_TEXTURE_U_POINTER =
4920 SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER;
4922constexpr auto D3D12_TEXTURE_V_POINTER =
4923 SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER;
4925constexpr auto OPENGL_TEXTURE_NUMBER = SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER;
4927constexpr auto OPENGL_TEXTURE_UV_NUMBER =
4928 SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER;
4930constexpr auto OPENGL_TEXTURE_U_NUMBER =
4931 SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER;
4933constexpr auto OPENGL_TEXTURE_V_NUMBER =
4934 SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER;
4936constexpr auto OPENGL_TEXTURE_TARGET_NUMBER =
4937 SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER;
4939constexpr auto OPENGL_TEX_W_FLOAT = SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT;
4941constexpr auto OPENGL_TEX_H_FLOAT = SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT;
4943constexpr auto OPENGLES2_TEXTURE_NUMBER =
4944 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER;
4946constexpr auto OPENGLES2_TEXTURE_UV_NUMBER =
4947 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER;
4949constexpr auto OPENGLES2_TEXTURE_U_NUMBER =
4950 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER;
4952constexpr auto OPENGLES2_TEXTURE_V_NUMBER =
4953 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER;
4955constexpr auto OPENGLES2_TEXTURE_TARGET_NUMBER =
4956 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER;
4958constexpr auto VULKAN_TEXTURE_NUMBER = SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER;
4960#if SDL_VERSION_ATLEAST(3, 4, 0)
4962constexpr auto GPU_TEXTURE_POINTER = SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER;
4964constexpr auto GPU_TEXTURE_UV_POINTER = SDL_PROP_TEXTURE_GPU_TEXTURE_UV_POINTER;
4966constexpr auto GPU_TEXTURE_U_POINTER = SDL_PROP_TEXTURE_GPU_TEXTURE_U_POINTER;
4968constexpr auto GPU_TEXTURE_V_POINTER = SDL_PROP_TEXTURE_GPU_TEXTURE_V_POINTER;
5071 return {
CheckError(SDL_GetTextureProperties(texture))};
5092 return {SDL_GetRendererFromTexture(texture)};
5116 CheckError(SDL_GetTextureSize(texture, w, h));
5122 return Point(texture->w, texture->h);
5167 return texture->format;
5175#if SDL_VERSION_ATLEAST(3, 4, 0)
5198 CheckError(SDL_SetTexturePalette(texture, palette));
5259 CheckError(SDL_SetTextureColorMod(texture, r, g, b));
5298 CheckError(SDL_SetTextureColorModFloat(texture, r, g, b));
5328 CheckError(SDL_GetTextureColorMod(texture, r, g, b));
5358 CheckError(SDL_GetTextureColorModFloat(texture, r, g, b));
5391 CheckError(SDL_SetTextureAlphaMod(texture, alpha));
5424 CheckError(SDL_SetTextureAlphaModFloat(texture, alpha));
5450 CheckError(SDL_GetTextureAlphaMod(texture, &alpha));
5477 CheckError(SDL_GetTextureAlphaModFloat(texture, &alpha));
5620 CheckError(SDL_SetTextureBlendMode(texture, blendMode));
5644 CheckError(SDL_GetTextureBlendMode(texture, &blendMode));
5672 CheckError(SDL_SetTextureScaleMode(texture, scaleMode));
5696 CheckError(SDL_GetTextureScaleMode(texture, &scaleMode));
5741 CheckError(SDL_UpdateTexture(texture, rect, pixels, pitch));
5778 UpdateTexture(texture, rect, surface->pixels, surface->pitch);
5821 const Uint8* Yplane,
5823 const Uint8* Uplane,
5825 const Uint8* Vplane,
5829 texture, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch));
5833 const Uint8* Yplane,
5835 const Uint8* Uplane,
5837 const Uint8* Vplane,
5841 m_resource, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch);
5870 const Uint8* Yplane,
5872 const Uint8* UVplane,
5876 SDL_UpdateNVTexture(texture, rect, Yplane, Ypitch, UVplane, UVpitch));
5880 const Uint8* Yplane,
5882 const Uint8* UVplane,
5920 CheckError(SDL_LockTexture(texture, rect, pixels, pitch));
5927 return {
TextureRef(*
this), rect, pixels, pitch};
5934 : m_lock(std::move(resource))
5975 CheckError(SDL_LockTextureToSurface(texture, rect, &surface));
5988 , m_lock(std::move(resource))
6027 if (!m_lock)
return;
6035 if (!m_lock)
return;
6066 CheckError(SDL_SetRenderTarget(renderer, texture));
6113 if (
auto texture = SDL_GetRenderTarget(renderer))
6170 CheckError(SDL_SetRenderLogicalPresentation(renderer, size.x, size.y, mode));
6205 CheckError(SDL_GetRenderLogicalPresentation(renderer, w, h, mode));
6276 CheckError(SDL_GetRenderLogicalPresentationRect(renderer, &rect));
6312 renderer, window_coord.x, window_coord.y, &p.x, &p.y));
6350 SDL_RenderCoordinatesToWindow(renderer, coord.x, coord.y, &p.x, &p.y));
6394 CheckError(SDL_ConvertEventToRenderCoordinates(renderer, event));
6429 CheckError(SDL_SetRenderViewport(renderer, rect));
6480 CheckError(SDL_GetRenderViewport(renderer, &rect));
6511 return SDL_RenderViewportSet(renderer);
6540 CheckError(SDL_GetRenderSafeArea(renderer, &rect));
6570 CheckError(SDL_SetRenderClipRect(renderer, rect));
6622 CheckError(SDL_GetRenderClipRect(renderer, &rect));
6650 return SDL_RenderClipEnabled(renderer);
6684 CheckError(SDL_SetRenderScale(renderer, scale.x, scale.y));
6711 CheckError(SDL_GetRenderScale(renderer, scaleX, scaleY));
6765 CheckError(SDL_SetRenderDrawColor(renderer, c.r, c.g, c.b, c.a));
6792 CheckError(SDL_SetRenderDrawColorFloat(renderer, c.r, c.g, c.b, c.a));
6827 CheckError(SDL_GetRenderDrawColor(renderer, r, g, b, a));
6888 CheckError(SDL_GetRenderDrawColorFloat(renderer, r, g, b, a));
6947 CheckError(SDL_SetRenderColorScale(renderer, scale));
6971 CheckError(SDL_GetRenderColorScale(renderer, &scale));
6997 CheckError(SDL_SetRenderDrawBlendMode(renderer, blendMode));
7021 CheckError(SDL_GetRenderDrawBlendMode(renderer, &blendMode));
7069 CheckError(SDL_RenderPoint(renderer, p.x, p.y));
7119 CheckError(SDL_RenderLine(renderer, p1.x, p1.y, p2.x, p2.y));
7217 CheckError(SDL_RenderFillRect(renderer, rect));
7274 CheckError(SDL_RenderTexture(renderer, texture, srcrect, dstrect));
7315 FlipMode flip = FlipMode::SDL_FLIP_NONE)
7318 renderer, texture, srcrect, dstrect, angle, center, flip));
7329 m_resource, texture, srcrect, dstrect, angle, center, flip);
7365 SDL_RenderTextureAffine(renderer, texture, srcrect, origin, right, down));
7408 SDL_RenderTextureTiled(renderer, texture, srcrect, scale, dstrect));
7457 float bottom_height,
7477 float bottom_height,
7492#if SDL_VERSION_ATLEAST(3, 4, 0)
7535 float bottom_height,
7540 CheckError(SDL_RenderTexture9GridTiled(renderer,
7557 float bottom_height,
7598 std::span<const Vertex> vertices,
7599 std::span<const int> indices = {})
7610 std::span<const Vertex> vertices,
7611 std::span<const int> indices)
7652 const void* indices,
7678 const void* indices,
7696#if SDL_VERSION_ATLEAST(3, 4, 0)
7718 CheckError(SDL_SetRenderTextureAddressMode(renderer, u_mode, v_mode));
7747 CheckError(SDL_GetRenderTextureAddressMode(renderer, u_mode, v_mode));
7786 return Surface{
CheckError(SDL_RenderReadPixels(renderer, rect))};
7880 SDL_DestroyRenderer(renderer);
7940 return CheckError(SDL_GetRenderMetalLayer(renderer));
7971 return CheckError(SDL_GetRenderMetalCommandEncoder(renderer));
8011 renderer, wait_stage_mask, wait_semaphore, signal_semaphore));
8019 m_resource, wait_stage_mask, wait_semaphore, signal_semaphore);
8046 CheckError(SDL_SetRenderVSync(renderer, vsync));
8077 CheckError(SDL_GetRenderVSync(renderer, &vsync));
8096 SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE;
8139 CheckError(SDL_RenderDebugText(renderer, p.x, p.y, str));
8171template<
class... ARGS>
8174 std::string_view fmt,
8178 renderer, p, std::vformat(fmt, std::make_format_args(args...)));
8181template<
class... ARGS>
8183 std::string_view fmt,
8189#if SDL_VERSION_ATLEAST(3, 4, 0)
8209 CheckError(SDL_SetDefaultTextureScaleMode(renderer, scale_mode));
8235 CheckError(SDL_GetDefaultTextureScaleMode(renderer, scale_mode));
8271 : m_resource(resource)
8308 : m_resource(SDL_CreateGPURenderState(renderer, createinfo))
8318 std::swap(m_resource, other.m_resource);
8328 auto r = m_resource;
8329 m_resource =
nullptr;
8337 constexpr bool operator==(std::nullptr_t _)
const {
return !m_resource; }
8340 constexpr explicit operator bool()
const {
return !!m_resource; }
8345 return {m_resource};
8455 SDL_SetGPURenderStateFragmentUniforms(state, slot_index, data, length));
8483 CheckError(SDL_SetGPURenderState(renderer, state));
8505 SDL_DestroyGPURenderState(state);
A custom GPU render state.
Definition: SDL3pp_render.h:8256
constexpr GPURenderState(GPURenderState &&other)
Move constructor.
Definition: SDL3pp_render.h:8281
constexpr GPURenderStateRaw release()
Retrieves underlying GPURenderStateRaw and clear this.
Definition: SDL3pp_render.h:8326
GPURenderState(RendererParam renderer, GPURenderStateCreateInfo *createinfo)
Create custom GPU render state.
Definition: SDL3pp_render.h:8307
constexpr GPURenderState(const GPURenderState &other) noexcept=default
Copy constructor.
constexpr GPURenderStateRaw get() const
Retrieves underlying GPURenderStateRaw.
Definition: SDL3pp_render.h:8323
constexpr bool operator==(std::nullptr_t _) const
Comparison.
Definition: SDL3pp_render.h:8337
constexpr GPURenderState(const GPURenderStateRaw resource)
Constructs from GPURenderStateParam.
Definition: SDL3pp_render.h:8270
constexpr auto operator<=>(const GPURenderState &other) const =default
Comparison.
~GPURenderState()
Destructor.
Definition: SDL3pp_render.h:8313
constexpr GPURenderState()=default
Default ctor.
GPURenderState & operator=(GPURenderState other)
Assignment operator.
Definition: SDL3pp_render.h:8316
Optional-like shim for references.
Definition: SDL3pp_optionalRef.h:20
A set of indexed colors representing a palette.
Definition: SDL3pp_pixels.h:2479
static constexpr Palette Borrow(PaletteParam resource)
Safely borrows the from PaletteParam.
Definition: SDL3pp_pixels.h:2543
A structure representing rendering state.
Definition: SDL3pp_render.h:329
constexpr Renderer(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_render.h:334
Renderer(WindowParam window)
Create a 2D rendering context for a window.
Definition: SDL3pp_render.h:397
constexpr Renderer(Renderer &&other) noexcept
Move constructor.
Definition: SDL3pp_render.h:357
Renderer(WindowParam window, StringParam name)
Create a 2D rendering context for a window.
Definition: SDL3pp_render.h:434
constexpr RendererRaw release() noexcept
Retrieves underlying RendererRaw and clear this.
Definition: SDL3pp_render.h:547
constexpr Renderer(const Renderer &other) noexcept=default
Copy constructor.
constexpr RendererRaw get() const noexcept
Retrieves underlying RendererRaw.
Definition: SDL3pp_render.h:544
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:523
constexpr Renderer(const RendererRaw resource) noexcept
Constructs from RendererParam.
Definition: SDL3pp_render.h:346
constexpr Renderer & operator=(Renderer &&other) noexcept
Assignment operator.
Definition: SDL3pp_render.h:532
Renderer(PropertiesParam props)
Create a 2D rendering context for a window, with the specified properties.
Definition: SDL3pp_render.h:500
constexpr auto operator<=>(const Renderer &other) const noexcept=default
Comparison.
~Renderer()
Destructor.
Definition: SDL3pp_render.h:529
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:227
constexpr SurfaceRaw release() noexcept
Retrieves underlying SurfaceRaw and clear this.
Definition: SDL3pp_surface.h:534
constexpr Surface & operator=(Surface &&other) noexcept
Assignment operator.
Definition: SDL3pp_surface.h:521
static constexpr Surface Borrow(SurfaceParam resource)
Safely borrows the from SurfaceParam.
Definition: SDL3pp_surface.h:409
Lock a portion of the texture for write-only pixel access.
Definition: SDL3pp_render.h:3603
TextureRef get()
Get the reference to locked resource.
Definition: SDL3pp_render.h:3702
~TextureLock()
Unlock a texture, uploading the changes to video memory, if needed.
Definition: SDL3pp_render.h:3668
TextureLock & operator=(TextureLock &&other) noexcept
Assignment operator.
Definition: SDL3pp_render.h:3673
TextureLock(const TextureLock &other)=delete
Copy constructor.
constexpr TextureLock(TextureLock &&other) noexcept
Move constructor.
Definition: SDL3pp_render.h:3645
void release()
Releases the lock without unlocking.
Definition: SDL3pp_render.h:3705
Lock a portion of the texture for write-only pixel access, and expose it as a SDL surface.
Definition: SDL3pp_render.h:3731
~TextureSurfaceLock()
Unlock a texture, uploading the changes to video memory, if needed.
Definition: SDL3pp_render.h:3798
void release()
Releases the lock without unlocking.
Definition: SDL3pp_render.h:3836
TextureSurfaceLock(const TextureSurfaceLock &other)=delete
Copy constructor.
constexpr TextureSurfaceLock(TextureSurfaceLock &&other) noexcept
Move constructor.
Definition: SDL3pp_render.h:3774
TextureSurfaceLock & operator=(TextureSurfaceLock &&other) noexcept
Assignment operator.
Definition: SDL3pp_render.h:3803
TextureRef get()
Get the reference to locked resource.
Definition: SDL3pp_render.h:3833
An efficient driver-specific representation of pixel data.
Definition: SDL3pp_render.h:2466
constexpr Texture & operator=(Texture &&other) noexcept
Assignment operator.
Definition: SDL3pp_render.h:2787
constexpr Texture & operator=(const Texture &other) noexcept=default
Assignment operator.
constexpr TextureRaw operator->() noexcept
member access to underlying TextureRaw.
Definition: SDL3pp_render.h:2781
constexpr Texture(const TextureRaw resource) noexcept
Constructs from TextureParam.
Definition: SDL3pp_render.h:2483
constexpr Texture(const Texture &other)
Copy constructor.
Definition: SDL3pp_render.h:2489
Texture(RendererParam renderer, SurfaceParam surface)
Create a texture from an existing surface.
Definition: SDL3pp_render.h:2554
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:2768
constexpr TextureRaw get() const noexcept
Retrieves underlying TextureRaw.
Definition: SDL3pp_render.h:2797
constexpr TextureRaw release() noexcept
Retrieves underlying TextureRaw and clear this.
Definition: SDL3pp_render.h:2800
~Texture()
Destructor.
Definition: SDL3pp_render.h:2784
constexpr const TextureRaw operator->() const noexcept
member access to underlying TextureRaw.
Definition: SDL3pp_render.h:2778
Texture(RendererParam renderer, PropertiesParam props)
Create a texture for a rendering context with the specified properties.
Definition: SDL3pp_render.h:2683
Texture(RendererParam renderer, PixelFormat format, TextureAccess access, const PointRaw &size)
Create a texture for a rendering context.
Definition: SDL3pp_render.h:2522
constexpr Texture(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_render.h:2471
constexpr Texture(Texture &&other) noexcept
Move constructor.
Definition: SDL3pp_render.h:2496
The struct used as an opaque handle to a window.
Definition: SDL3pp_video.h:789
constexpr Window(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_video.h:794
#define SDL_assert_paranoid(condition)
An assertion test that is performed only when built with paranoid settings.
Definition: SDL3pp_assert.h:383
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:844
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_FRect FRectRaw
Alias to raw representation for FRect.
Definition: SDL3pp_rect.h:40
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:6537
void reset()
Unlock a texture, uploading the changes to video memory, if needed.
Definition: SDL3pp_render.h:6033
constexpr TextureAddressMode TEXTURE_ADDRESS_AUTO
Wrapping is enabled if texture coordinates are outside [0, 1], this is the default.
Definition: SDL3pp_render.h:263
FColor GetTextureModFloat(TextureConstParam texture)
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:5589
Renderer CreateRendererWithProperties(PropertiesParam props)
Create a 2D rendering context for a window, with the specified properties.
Definition: SDL3pp_render.h:4117
void SetDrawColorFloat(const FColorRaw &c)
Set the color used for drawing operations (Rect, Line and Clear).
Definition: SDL3pp_render.h:6795
constexpr int RENDERER_VSYNC_DISABLED
Constant for disabling renderer vsync.
Definition: SDL3pp_render.h:8055
void RenderPoints(RendererParam renderer, SpanRef< const FPointRaw > points)
Draw multiple points on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:7090
void SetDrawColor(ColorRaw c)
Set the color used for drawing operations.
Definition: SDL3pp_render.h:6768
Texture GetTarget() const
Get the current render target.
Definition: SDL3pp_render.h:6118
void Destroy()
Destroy the rendering context for a window and free all associated textures.
Definition: SDL3pp_render.h:7883
const char * GetName() const
Get the name of a renderer.
Definition: SDL3pp_render.h:4370
SDL_GPURenderState * GPURenderStateRaw
Alias to raw representation for GPURenderState.
Definition: SDL3pp_render.h:160
void SetRenderViewport(RendererParam renderer, OptionalRef< const RectRaw > rect)
Set the drawing area for rendering on the current target.
Definition: SDL3pp_render.h:6426
void SetFragmentUniforms(Uint32 slot_index, const void *data, Uint32 length)
Set fragment shader uniform variables in a custom GPU render state.
Definition: SDL3pp_render.h:8458
void SetRenderScale(RendererParam renderer, const FPointRaw &scale)
Set the drawing scale for rendering on the current target.
Definition: SDL3pp_render.h:6682
bool RenderViewportSet(RendererParam renderer)
Return whether an explicit rectangle was set as the viewport.
Definition: SDL3pp_render.h:6509
void SetTexturePalette(TextureParam texture, PaletteParam palette)
Set the palette used by a texture.
Definition: SDL3pp_render.h:5196
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:5736
Point GetCurrentOutputSize() const
Get the current output size in pixels of a rendering context.
Definition: SDL3pp_render.h:4587
void GetTextureSize(TextureConstParam texture, float *w, float *h)
Get the size of a texture, as floating point values.
Definition: SDL3pp_render.h:5114
void SetColorModFloat(float r, float g, float b)
Set an additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:5301
void ResetRenderClipRect(RendererParam renderer)
Reset the clip rectangle for rendering to the entire render target.
Definition: SDL3pp_render.h:6594
void ResetRenderTarget(RendererParam renderer)
Set target texture back to window.
Definition: SDL3pp_render.h:6089
void RenderPoint(const FPointRaw &p)
Draw a point on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:7072
GPURenderState CreateGPURenderState(GPURenderStateCreateInfo *createinfo)
Create custom GPU render state.
Definition: SDL3pp_render.h:8426
void GetTextureColorMod(TextureConstParam texture, Uint8 *r, Uint8 *g, Uint8 *b)
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:5323
void CreateWindowAndRenderer(StringParam title, const PointRaw &size, WindowFlags window_flags, Window *window, Renderer *renderer)
Create a window and default renderer.
Definition: SDL3pp_render.h:3936
void SetRenderDrawColor(RendererParam renderer, ColorRaw c)
Set the color used for drawing operations.
Definition: SDL3pp_render.h:6763
void SetTextureMod(TextureParam texture, Color c)
Set an additional color and alpha values multiplied into render copy operations.
Definition: SDL3pp_render.h:5509
void SetTextureBlendMode(TextureParam texture, BlendMode blendMode)
Set the blend mode for a texture, used by Renderer.RenderTexture().
Definition: SDL3pp_render.h:5618
void GetCurrentRenderOutputSize(RendererParam renderer, int *w, int *h)
Get the current output size in pixels of a rendering context.
Definition: SDL3pp_render.h:4551
void CreateWindowAndRendererRaw(StringParam title, const PointRaw &size, WindowFlags window_flags, WindowRaw *window, RendererRaw *renderer)
Create a window and default renderer.
Definition: SDL3pp_render.h:3908
void GetRenderTextureAddressMode(TextureAddressMode *u_mode, TextureAddressMode *v_mode)
Get the texture addressing mode used in Renderer.RenderGeometry().
Definition: SDL3pp_render.h:7750
void SetBlendMode(BlendMode blendMode)
Set the blend mode for a texture, used by Renderer.RenderTexture().
Definition: SDL3pp_render.h:5623
Palette GetPalette()
Get the palette used by a texture.
Definition: SDL3pp_render.h:5224
Rect GetViewport() const
Get the drawing area for the current target.
Definition: SDL3pp_render.h:6484
Point GetSize() const
Get the size of a texture.
Definition: SDL3pp_render.h:5130
bool ViewportSet() const
Return whether an explicit rectangle was set as the viewport.
Definition: SDL3pp_render.h:6514
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:7214
void SetDrawBlendMode(BlendMode blendMode)
Set the blend mode used for drawing operations (Fill and Line).
Definition: SDL3pp_render.h:7000
FPoint GetSizeFloat() const
Get the size of a texture, as floating point values.
Definition: SDL3pp_render.h:5143
void SetDefaultTextureScaleMode(ScaleMode scale_mode)
Set default scale mode for new textures for given renderer.
Definition: SDL3pp_render.h:8212
RendererRef CreateGPURenderer(GPUDeviceParam device, WindowParam window)
Create a 2D GPU rendering context.
Definition: SDL3pp_render.h:4273
void SetAlphaMod(Uint8 alpha)
Set an additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:5394
constexpr TextureAddressMode TEXTURE_ADDRESS_WRAP
The texture is repeated (tiled)
Definition: SDL3pp_render.h:268
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:7309
void SetTextureColorModFloat(TextureParam texture, float r, float g, float b)
Set an additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:5293
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:7472
int GetTextureWidth(TextureConstParam texture)
Get the width in pixels.
Definition: SDL3pp_render.h:5149
Uint8 GetTextureAlphaMod(TextureConstParam texture)
Get the additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:5447
FPoint GetScale() const
Get the drawing scale for the current target.
Definition: SDL3pp_render.h:6741
SDL_Renderer * RendererRaw
Alias to raw representation for Renderer.
Definition: SDL3pp_render.h:47
PixelFormat GetFormat() const
Get the pixel format.
Definition: SDL3pp_render.h:5170
void Destroy()
Destroy the specified texture.
Definition: SDL3pp_render.h:7863
int GetTextureHeight(TextureConstParam texture)
Get the height in pixels.
Definition: SDL3pp_render.h:5157
bool IsClipEnabled() const
Get whether clipping is enabled on the given render target.
Definition: SDL3pp_render.h:6653
constexpr int RENDERER_VSYNC_ADAPTIVE
Constant for enabling asaptive renderer vsync.
Definition: SDL3pp_render.h:8058
GPUDeviceRef GetGPURendererDevice(RendererParam renderer)
Return the GPU device used by a renderer.
Definition: SDL3pp_render.h:4289
FPoint RenderCoordinatesToWindow(const FPointRaw &coord) const
Get a point in window coordinates when given a point in render coordinates.
Definition: SDL3pp_render.h:6354
void SetRenderVSync(RendererParam renderer, int vsync)
Toggle VSync of the given renderer.
Definition: SDL3pp_render.h:8044
void LockTexture(TextureParam texture, OptionalRef< const RectRaw > rect, void **pixels, int *pitch)
Lock a portion of the texture for write-only pixel access.
Definition: SDL3pp_render.h:5915
void RenderPresent(RendererParam renderer)
Update the screen with any rendering performed since the previous call.
Definition: SDL3pp_render.h:7839
constexpr auto SOFTWARE_RENDERER
The name of the software renderer.
Definition: SDL3pp_render.h:205
void RenderDebugText(RendererParam renderer, const FPointRaw &p, StringParam str)
Draw debug text to an Renderer.
Definition: SDL3pp_render.h:8135
void SetRenderClipRect(RendererParam renderer, OptionalRef< const RectRaw > rect)
Set the clip rectangle for rendering on the specified target.
Definition: SDL3pp_render.h:6567
void GetTextureColorModFloat(TextureConstParam texture, float *r, float *g, float *b)
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:5353
FPoint RenderCoordinatesToWindow(RendererParam renderer, const FPointRaw &coord)
Get a point in window coordinates when given a point in render coordinates.
Definition: SDL3pp_render.h:6345
float GetTextureAlphaModFloat(TextureConstParam texture)
Get the additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:5474
Texture GetRenderTarget(RendererParam renderer)
Get the current render target.
Definition: SDL3pp_render.h:6111
void RenderPoints(SpanRef< const FPointRaw > points)
Draw multiple points on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:7096
void GetRenderTextureAddressMode(RendererParam renderer, TextureAddressMode *u_mode, TextureAddressMode *v_mode)
Get the texture addressing mode used in Renderer.RenderGeometry().
Definition: SDL3pp_render.h:7743
void ResetTarget()
Set target texture back to window.
Definition: SDL3pp_render.h:6094
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:7357
void GetDefaultTextureScaleMode(RendererParam renderer, ScaleMode *scale_mode)
Get default texture scale mode of the given renderer.
Definition: SDL3pp_render.h:8232
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:7670
TextureSurfaceLock LockToSurface(OptionalRef< const RectRaw > 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:5979
SDL_Vertex Vertex
Vertex structure.
Definition: SDL3pp_render.h:223
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:7643
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:7115
int GetHeight() const
Get the height in pixels.
Definition: SDL3pp_render.h:5159
GPURenderState CreateGPURenderState(RendererParam renderer, GPURenderStateCreateInfo *createinfo)
Create custom GPU render state.
Definition: SDL3pp_render.h:8420
PixelFormat GetTextureFormat(TextureConstParam texture)
Get the pixel format.
Definition: SDL3pp_render.h:5165
Texture CreateTextureFromSurface(RendererParam renderer, SurfaceParam surface)
Create a texture from an existing surface.
Definition: SDL3pp_render.h:4654
BlendMode GetTextureBlendMode(TextureConstParam texture)
Get the blend mode used for texture copy operations.
Definition: SDL3pp_render.h:5641
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:6307
FColor GetDrawColorFloat() const
Get the color used for drawing operations (Rect, Line and Clear).
Definition: SDL3pp_render.h:6920
Uint8 GetAlphaMod() const
Get the additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:5454
constexpr TextureAddressMode TEXTURE_ADDRESS_INVALID
TEXTURE_ADDRESS_INVALID.
Definition: SDL3pp_render.h:256
FPoint GetTextureSizeFloat(TextureConstParam texture)
Get the size of a texture, as floating point values.
Definition: SDL3pp_render.h:5136
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:7141
void SetModFloat(FColor c)
Set an additional color and alpha values multiplied into render copy operations.
Definition: SDL3pp_render.h:5546
void DestroyRenderer(RendererRaw renderer)
Destroy the rendering context for a window and free all associated textures.
Definition: SDL3pp_render.h:7878
void Destroy()
Destroy custom GPU render state.
Definition: SDL3pp_render.h:8508
void UnlockTexture(TextureParam texture)
Unlock a texture, uploading the changes to video memory, if needed.
Definition: SDL3pp_render.h:6011
Palette GetTexturePalette(TextureParam texture)
Get the palette used by a texture.
Definition: SDL3pp_render.h:5219
void SetColorScale(float scale)
Set the color scale used for render operations.
Definition: SDL3pp_render.h:6950
int GetVSync() const
Get VSync of the given renderer.
Definition: SDL3pp_render.h:8081
void ResetRenderViewport(RendererParam renderer)
Reset the drawing area for rendering to the entire target.
Definition: SDL3pp_render.h:6453
Surface RenderReadPixels(RendererParam renderer, OptionalRef< const RectRaw > rect={})
Read pixels from the current rendering target.
Definition: SDL3pp_render.h:7783
BlendMode GetRenderDrawBlendMode(RendererParam renderer)
Get the blend mode used for drawing operations.
Definition: SDL3pp_render.h:7018
TextureSurfaceLock(TextureRef resource, OptionalRef< const RectRaw > 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:5985
Point GetOutputSize() const
Get the output size in pixels of a rendering context.
Definition: SDL3pp_render.h:4526
void GetColorModFloat(float *r, float *g, float *b) const
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:5361
void SetColorMod(Uint8 r, Uint8 g, Uint8 b)
Set an additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:5262
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:7596
void Update(OptionalRef< const RectRaw > rect, const void *pixels, int pitch)
Update the given texture rectangle with new pixel data.
Definition: SDL3pp_render.h:5781
void RenderRect(OptionalRef< const FRectRaw > rect)
Draw a rectangle on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:7170
RendererRef GetRenderer() const
Get the renderer associated with a window.
Definition: SDL3pp_render.h:4325
void SetRenderTarget(RendererParam renderer, TextureParam texture)
Set a texture as the current rendering target.
Definition: SDL3pp_render.h:6064
void SetRenderDrawColorFloat(RendererParam renderer, const FColorRaw &c)
Set the color used for drawing operations (Rect, Line and Clear).
Definition: SDL3pp_render.h:6790
void SetGPURenderState(RendererParam renderer, GPURenderStateParam state)
Set custom GPU render state.
Definition: SDL3pp_render.h:8481
void Present()
Update the screen with any rendering performed since the previous call.
Definition: SDL3pp_render.h:7844
void ResetViewport()
Reset the drawing area for rendering to the entire target.
Definition: SDL3pp_render.h:6458
BlendMode GetDrawBlendMode() const
Get the blend mode used for drawing operations.
Definition: SDL3pp_render.h:7025
void RenderClear()
Clear the current rendering target with the drawing color.
Definition: SDL3pp_render.h:7052
SDL_TextureAccess TextureAccess
The access pattern allowed for a texture.
Definition: SDL3pp_render.h:230
SDL_GPURenderStateCreateInfo GPURenderStateCreateInfo
A structure specifying the parameters of a GPU render state.
Definition: SDL3pp_render.h:317
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:7277
Renderer CreateSoftwareRenderer(SurfaceParam surface)
Create a 2D software rendering context for a surface.
Definition: SDL3pp_render.h:4320
void SetMod(Color c)
Set an additional color and alpha values multiplied into render copy operations.
Definition: SDL3pp_render.h:5515
void SetTextureModFloat(TextureParam texture, FColor c)
Set an additional color and alpha values multiplied into render copy operations.
Definition: SDL3pp_render.h:5540
void RenderLine(const FPointRaw &p1, const FPointRaw &p2)
Draw a line on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:7122
Color GetMod() const
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:5573
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:298
constexpr auto GPU_RENDERER
The name of the GPU renderer.
Definition: SDL3pp_render.h:214
PropertiesRef GetProperties() const
Get the properties associated with a texture.
Definition: SDL3pp_render.h:5074
void RenderDebugText(const FPointRaw &p, StringParam str)
Draw debug text to an Renderer.
Definition: SDL3pp_render.h:8142
Color GetTextureMod(TextureConstParam texture)
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:5565
void SetAlphaModFloat(float alpha)
Set an additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:5427
RendererRef GetRendererFromTexture(TextureConstParam texture)
Get the renderer that created an Texture.
Definition: SDL3pp_render.h:5090
SDL_TextureAddressMode TextureAddressMode
The addressing mode for a texture when used in Renderer.RenderGeometry().
Definition: SDL3pp_render.h:254
PropertiesRef GetRendererProperties(RendererParam renderer)
Get the properties associated with a renderer.
Definition: SDL3pp_render.h:4460
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_DISABLED
There is no logical size in effect.
Definition: SDL3pp_render.h:280
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:6882
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:5819
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:7189
ScaleMode GetTextureScaleMode(TextureConstParam texture)
Get the scale mode used for texture scale operations.
Definition: SDL3pp_render.h:5693
void * GetRenderMetalCommandEncoder(RendererParam renderer)
Get the Metal command encoder for the current frame.
Definition: SDL3pp_render.h:7969
Rect GetClipRect() const
Get the clip rectangle for the current target.
Definition: SDL3pp_render.h:6626
void * GetRenderMetalLayer()
Get the CAMetalLayer associated with the given Metal renderer.
Definition: SDL3pp_render.h:7943
void GetRenderScale(RendererParam renderer, float *scaleX, float *scaleY)
Get the drawing scale for the current target.
Definition: SDL3pp_render.h:6709
void SetRenderColorScale(RendererParam renderer, float scale)
Set the color scale used for render operations.
Definition: SDL3pp_render.h:6945
SDL_RendererLogicalPresentation RendererLogicalPresentation
How the logical size is mapped to the output.
Definition: SDL3pp_render.h:278
constexpr TextureAccess TEXTUREACCESS_TARGET
Texture can be used as a render target.
Definition: SDL3pp_render.h:238
void SetGPURenderState(GPURenderStateParam state)
Set custom GPU render state.
Definition: SDL3pp_render.h:8486
void GetRenderOutputSize(RendererParam renderer, int *w, int *h)
Get the output size in pixels of a rendering context.
Definition: SDL3pp_render.h:4490
FPoint RenderCoordinatesFromWindow(const FPointRaw &window_coord) const
Get a point in render coordinates when given a point in window coordinates.
Definition: SDL3pp_render.h:6316
void DestroyTexture(TextureRaw texture)
Destroy the specified texture.
Definition: SDL3pp_render.h:7861
void SetTextureAlphaModFloat(TextureParam texture, float alpha)
Set an additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:5422
Rect GetSafeArea() const
Get the safe area for rendering within the current viewport.
Definition: SDL3pp_render.h:6544
Rect GetRenderViewport(RendererParam renderer)
Get the drawing area for the current target.
Definition: SDL3pp_render.h:6477
PropertiesRef GetTextureProperties(TextureConstParam texture)
Get the properties associated with a texture.
Definition: SDL3pp_render.h:5069
void ConvertEventToRenderCoordinates(RendererParam renderer, Event *event)
Convert the coordinates in an event to render coordinates.
Definition: SDL3pp_render.h:6391
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:7239
void DestroyGPURenderState(GPURenderStateRaw state)
Destroy custom GPU render state.
Definition: SDL3pp_render.h:8503
int GetWidth() const
Get the width in pixels.
Definition: SDL3pp_render.h:5151
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:7269
FColor GetModFloat() const
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:5597
void SetPalette(PaletteParam palette)
Set the palette used by a texture.
Definition: SDL3pp_render.h:5201
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:7368
constexpr TextureAccess TEXTUREACCESS_STATIC
Changes rarely, not lockable.
Definition: SDL3pp_render.h:232
SDL_Texture * TextureRaw
Alias to raw representation for Texture.
Definition: SDL3pp_render.h:83
bool RenderClipEnabled(RendererParam renderer)
Get whether clipping is enabled on the given render target.
Definition: SDL3pp_render.h:6648
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:8005
void * GetRenderMetalCommandEncoder()
Get the Metal command encoder for the current frame.
Definition: SDL3pp_render.h:7974
void SetViewport(OptionalRef< const RectRaw > rect)
Set the drawing area for rendering on the current target.
Definition: SDL3pp_render.h:6432
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_INTEGER_SCALE
The rendered content is scaled up by integer multiples to fit the output resolution.
Definition: SDL3pp_render.h:305
WindowRef GetWindow()
Get the window associated with a renderer.
Definition: SDL3pp_render.h:4346
constexpr TextureAccess TEXTUREACCESS_STREAMING
Changes frequently, lockable.
Definition: SDL3pp_render.h:235
BlendMode GetBlendMode() const
Get the blend mode used for texture copy operations.
Definition: SDL3pp_render.h:5648
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:5832
PropertiesRef GetProperties() const
Get the properties associated with a renderer.
Definition: SDL3pp_render.h:4465
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:7401
void Flush()
Force the rendering context to flush any pending commands and state.
Definition: SDL3pp_render.h:7920
Texture CreateTextureWithProperties(PropertiesParam props)
Create a texture for a rendering context with the specified properties.
Definition: SDL3pp_render.h:4794
GPUDeviceRef GetGPUDevice()
Return the GPU device used by a renderer.
Definition: SDL3pp_render.h:4294
void reset()
Unlock a texture, uploading the changes to video memory, if needed.
Definition: SDL3pp_render.h:6025
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:7411
Surface LockTextureToSurface(TextureParam texture, OptionalRef< const RectRaw > 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:5970
void SetGPURenderStateFragmentUniforms(GPURenderStateParam state, Uint32 slot_index, const void *data, Uint32 length)
Set fragment shader uniform variables in a custom GPU render state.
Definition: SDL3pp_render.h:8449
FRect GetLogicalPresentationRect() const
Get the final presentation rectangle for rendering.
Definition: SDL3pp_render.h:6280
void SetTextureColorMod(TextureParam texture, Uint8 r, Uint8 g, Uint8 b)
Set an additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:5257
void SetClipRect(OptionalRef< const RectRaw > rect)
Set the clip rectangle for rendering on the specified target.
Definition: SDL3pp_render.h:6573
constexpr int DEBUG_TEXT_FONT_CHARACTER_SIZE
The size, in pixels, of a single Renderer.RenderDebugText() character.
Definition: SDL3pp_render.h:8095
Renderer CreateRenderer(WindowParam window, StringParam name)
Create a 2D rendering context for a window.
Definition: SDL3pp_render.h:4050
constexpr TextureAddressMode TEXTURE_ADDRESS_CLAMP
Texture coordinates are clamped to the [0, 1] range.
Definition: SDL3pp_render.h:266
void ConvertEventToRenderCoordinates(Event *event) const
Convert the coordinates in an event to render coordinates.
Definition: SDL3pp_render.h:6397
TextureLock(TextureRef resource, OptionalRef< const RectRaw > rect, void **pixels, int *pitch)
Lock a portion of the texture for write-only pixel access.
Definition: SDL3pp_render.h:5930
void SetDefaultTextureScaleMode(RendererParam renderer, ScaleMode scale_mode)
Set default scale mode for new textures for given renderer.
Definition: SDL3pp_render.h:8206
Surface ReadPixels(OptionalRef< const RectRaw > rect={}) const
Read pixels from the current rendering target.
Definition: SDL3pp_render.h:7789
float GetRenderColorScale(RendererParam renderer)
Get the color scale used for render operations.
Definition: SDL3pp_render.h:6968
void SetScale(const FPointRaw &scale)
Set the drawing scale for rendering on the current target.
Definition: SDL3pp_render.h:6687
Texture CreateTextureFromSurface(SurfaceParam surface)
Create a texture from an existing surface.
Definition: SDL3pp_render.h:4660
Texture CreateTexture(RendererParam renderer, PixelFormat format, TextureAccess access, const PointRaw &size)
Create a texture for a rendering context.
Definition: SDL3pp_render.h:4614
float GetColorScale() const
Get the color scale used for render operations.
Definition: SDL3pp_render.h:6975
Rect GetRenderClipRect(RendererParam renderer)
Get the clip rectangle for the current target.
Definition: SDL3pp_render.h:6619
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:5879
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:7245
const char * GetRendererName(RendererParam renderer)
Get the name of a renderer.
Definition: SDL3pp_render.h:4365
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_LETTERBOX
The rendered content is fit to the largest dimension and the other dimension is letterboxed with the ...
Definition: SDL3pp_render.h:291
void RenderLines(SpanRef< const FPointRaw > points)
Draw a series of connected lines on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:7146
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:7451
void SetLogicalPresentation(const PointRaw &size, RendererLogicalPresentation mode)
Set a device-independent resolution and presentation mode for rendering.
Definition: SDL3pp_render.h:6173
void GetLogicalPresentation(int *w, int *h, RendererLogicalPresentation *mode) const
Get device independent resolution and presentation mode for rendering.
Definition: SDL3pp_render.h:6239
void SetTarget(TextureParam texture)
Set a texture as the current rendering target.
Definition: SDL3pp_render.h:6069
ScaleMode GetScaleMode() const
Get the scale mode used for texture scale operations.
Definition: SDL3pp_render.h:5700
void SetTextureAlphaMod(TextureParam texture, Uint8 alpha)
Set an additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:5389
void * GetRenderMetalLayer(RendererParam renderer)
Get the CAMetalLayer associated with the given Metal renderer.
Definition: SDL3pp_render.h:7938
void RenderRects(SpanRef< const FRectRaw > rects)
Draw some number of rectangles on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:7194
void RenderDebugTextFormat(const FPointRaw &p, std::string_view fmt, ARGS... args)
Draw debug text to an Renderer.
Definition: SDL3pp_render.h:8182
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:6821
TextureLock Lock(OptionalRef< const RectRaw > rect, void **pixels, int *pitch)
Lock a portion of the texture for write-only pixel access.
Definition: SDL3pp_render.h:5923
void RenderTexture9GridTiled(RendererParam renderer, TextureParam texture, const FRectRaw &srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, const FRectRaw &dstrect, float tileScale)
Perform a scaled copy using the 9-grid algorithm to the current rendering target at subpixel precisio...
Definition: SDL3pp_render.h:7529
Texture CreateTextureWithProperties(RendererParam renderer, PropertiesParam props)
Create a texture for a rendering context with the specified properties.
Definition: SDL3pp_render.h:4788
void RenderDebugTextFormat(RendererParam renderer, const FPointRaw &p, std::string_view fmt, ARGS... args)
Draw debug text to an Renderer.
Definition: SDL3pp_render.h:8172
void SetRenderTextureAddressMode(RendererParam renderer, TextureAddressMode u_mode, TextureAddressMode v_mode)
Set the texture addressing mode used in Renderer.RenderGeometry().
Definition: SDL3pp_render.h:7714
FRect GetRenderLogicalPresentationRect(RendererParam renderer)
Get the final presentation rectangle for rendering.
Definition: SDL3pp_render.h:6273
void SetRenderTextureAddressMode(TextureAddressMode u_mode, TextureAddressMode v_mode)
Set the texture addressing mode used in Renderer.RenderGeometry().
Definition: SDL3pp_render.h:7721
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_STRETCH
The rendered content is stretched to the output resolution.
Definition: SDL3pp_render.h:284
void GetRenderLogicalPresentation(RendererParam renderer, int *w, int *h, RendererLogicalPresentation *mode)
Get device independent resolution and presentation mode for rendering.
Definition: SDL3pp_render.h:6200
void RenderPoint(RendererParam renderer, const FPointRaw &p)
Draw a point on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:7067
void GetDefaultTextureScaleMode(ScaleMode *scale_mode)
Get default texture scale mode of the given renderer.
Definition: SDL3pp_render.h:8238
void RenderRect(RendererParam renderer, OptionalRef< const FRectRaw > rect)
Draw a rectangle on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:7165
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:5868
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:7220
int GetNumRenderDrivers()
Get the number of 2D rendering drivers available for the current display.
Definition: SDL3pp_render.h:3861
const char * GetRenderDriver(int index)
Use this function to get the name of a built in 2D rendering driver.
Definition: SDL3pp_render.h:3885
void SetRenderLogicalPresentation(RendererParam renderer, const PointRaw &size, RendererLogicalPresentation mode)
Set a device-independent resolution and presentation mode for rendering.
Definition: SDL3pp_render.h:6166
void Unlock(TextureLock &&lock)
Unlock a texture, uploading the changes to video memory, if needed.
Definition: SDL3pp_render.h:6013
RendererRef GetRenderer() const
Get the renderer that created an Texture.
Definition: SDL3pp_render.h:5095
void SetVSync(int vsync)
Toggle VSync of the given renderer.
Definition: SDL3pp_render.h:8049
void ResetClipRect()
Reset the clip rectangle for rendering to the entire render target.
Definition: SDL3pp_render.h:6599
float GetAlphaModFloat() const
Get the additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:5481
void RenderTexture9GridTiled(TextureParam texture, const FRectRaw &srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, const FRectRaw &dstrect, float tileScale)
Perform a scaled copy using the 9-grid algorithm to the current rendering target at subpixel precisio...
Definition: SDL3pp_render.h:7552
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:8014
void FlushRenderer(RendererParam renderer)
Force the rendering context to flush any pending commands and state.
Definition: SDL3pp_render.h:7915
void GetColorMod(Uint8 *r, Uint8 *g, Uint8 *b) const
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:5331
void RenderClear(RendererParam renderer)
Clear the current rendering target with the drawing color.
Definition: SDL3pp_render.h:7047
void SetRenderDrawBlendMode(RendererParam renderer, BlendMode blendMode)
Set the blend mode used for drawing operations (Fill and Line).
Definition: SDL3pp_render.h:6995
Texture CreateTexture(PixelFormat format, TextureAccess access, const PointRaw &size)
Create a texture for a rendering context.
Definition: SDL3pp_render.h:4622
WindowRef GetRenderWindow(RendererParam renderer)
Get the window associated with a renderer.
Definition: SDL3pp_render.h:4341
int GetRenderVSync(RendererParam renderer)
Get VSync of the given renderer.
Definition: SDL3pp_render.h:8074
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:7609
Color GetDrawColor() const
Get the color used for drawing operations (Rect, Line and Clear).
Definition: SDL3pp_render.h:6856
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:7321
void SetTextureScaleMode(TextureParam texture, ScaleMode scaleMode)
Set the scale mode used for texture scale operations.
Definition: SDL3pp_render.h:5670
void SetScaleMode(ScaleMode scaleMode)
Set the scale mode used for texture scale operations.
Definition: SDL3pp_render.h:5675
::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:46
SDL_FlipMode FlipMode
The flip mode.
Definition: SDL3pp_surface.h:182
SDL_ScaleMode ScaleMode
The scaling mode.
Definition: SDL3pp_surface.h:153
Uint64 WindowFlags
The flags on a window.
Definition: SDL3pp_video.h:556
SDL_Window * WindowRaw
Alias to raw representation for Window.
Definition: SDL3pp_video.h:47
Main include header for the SDL3pp library.
A structure that represents a color as RGBA components.
Definition: SDL3pp_pixels.h:2192
The bits of this structure can be directly reinterpreted as a float-packed color which uses the PIXEL...
Definition: SDL3pp_pixels.h:2365
The structure that defines a point (using floating point values).
Definition: SDL3pp_rect.h:512
A rectangle stored using floating point values.
Definition: SDL3pp_rect.h:1441
Safely wrap GPUDevice for non owning parameters.
Definition: SDL3pp_gpu.h:387
Semi-safe reference for GPUDevice.
Definition: SDL3pp_gpu.h:4160
Safely wrap GPURenderState for non owning parameters.
Definition: SDL3pp_render.h:167
GPURenderStateRaw value
parameter's GPURenderStateRaw
Definition: SDL3pp_render.h:168
constexpr auto operator<=>(const GPURenderStateParam &other) const =default
Comparison.
constexpr GPURenderStateParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_render.h:177
constexpr GPURenderStateParam(GPURenderStateRaw value)
Constructs from GPURenderStateRaw.
Definition: SDL3pp_render.h:171
Semi-safe reference for GPURenderState.
Definition: SDL3pp_render.h:8382
constexpr GPURenderStateRef(const GPURenderStateRef &other) noexcept=default
Copy constructor.
~GPURenderStateRef()
Destructor.
Definition: SDL3pp_render.h:8400
GPURenderStateRef(GPURenderStateParam resource)
Constructs from GPURenderStateParam.
Definition: SDL3pp_render.h:8390
Safely wrap IOStream for non owning parameters.
Definition: SDL3pp_iostream.h:34
Safely wrap Palette for non owning parameters.
Definition: SDL3pp_pixels.h:105
The structure that defines a point (using integers).
Definition: SDL3pp_rect.h:83
Safely wrap Properties for non owning parameters.
Definition: SDL3pp_properties.h:53
Semi-safe reference for Properties.
Definition: SDL3pp_properties.h:716
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:54
constexpr RendererParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_render.h:64
constexpr auto operator<=>(const RendererParam &other) const =default
Comparison.
RendererRaw value
parameter's RendererRaw
Definition: SDL3pp_render.h:55
constexpr RendererParam(RendererRaw value)
Constructs from RendererRaw.
Definition: SDL3pp_render.h:58
Semi-safe reference for Renderer.
Definition: SDL3pp_render.h:2419
RendererRef(RendererRaw resource) noexcept
Constructs from RendererParam.
Definition: SDL3pp_render.h:2441
constexpr RendererRef(const RendererRef &other) noexcept=default
Copy constructor.
~RendererRef()
Destructor.
Definition: SDL3pp_render.h:2450
RendererRef(RendererParam resource) noexcept
Constructs from RendererParam.
Definition: SDL3pp_render.h:2429
Safely wrap Surface for non owning const parameters.
Definition: SDL3pp_surface.h:83
Safely wrap Surface for non owning parameters.
Definition: SDL3pp_surface.h:53
Safely wrap Texture for non owning const parameters.
Definition: SDL3pp_render.h:120
constexpr TextureConstParam(TextureParam value)
Constructs from TextureParam.
Definition: SDL3pp_render.h:130
const TextureRaw value
parameter's const TextureRaw
Definition: SDL3pp_render.h:121
constexpr TextureConstParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_render.h:136
constexpr auto operator->()
member access to underlying TextureRaw.
Definition: SDL3pp_render.h:151
constexpr auto operator<=>(const TextureConstParam &other) const =default
Comparison.
constexpr TextureConstParam(const TextureRaw value)
Constructs from const TextureRaw.
Definition: SDL3pp_render.h:124
Safely wrap Texture for non owning parameters.
Definition: SDL3pp_render.h:90
constexpr auto operator->()
member access to underlying TextureRaw.
Definition: SDL3pp_render.h:115
constexpr auto operator<=>(const TextureParam &other) const =default
Comparison.
constexpr TextureParam(TextureRaw value)
Constructs from TextureRaw.
Definition: SDL3pp_render.h:94
constexpr TextureParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_render.h:100
TextureRaw value
parameter's TextureRaw
Definition: SDL3pp_render.h:91
Safe reference for Texture.
Definition: SDL3pp_render.h:3551
TextureRef(Texture resource) noexcept
Constructs from Texture.
Definition: SDL3pp_render.h:3567
TextureRef(TextureRaw resource) noexcept
Constructs from TextureRaw.
Definition: SDL3pp_render.h:3561
Safely wrap Window for non owning parameters.
Definition: SDL3pp_video.h:54
Semi-safe reference for Window.
Definition: SDL3pp_video.h:3169