SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL3pp_render.h
1#ifndef SDL3PP_RENDER_H_
2#define SDL3PP_RENDER_H_
3
4#include <SDL3/SDL_render.h>
5#include "SDL3pp_blendmode.h"
6#include "SDL3pp_events.h"
7#include "SDL3pp_gpu.h"
8#include "SDL3pp_pixels.h"
9#include "SDL3pp_video.h"
10
11namespace SDL {
12
42
44using RendererRaw = SDL_Renderer*;
45
46// Forward decl
47struct TextureBase;
48
49// Forward decl
50struct Texture;
51
53using TextureRaw = SDL_Texture*;
54
56using TextureRawConst = const SDL_Texture*;
57
64
67
68#if SDL_VERSION_ATLEAST(3, 3, 6)
69
70// Forward decl
72
73// Forward decl
74struct GPURenderState;
75
77using GPURenderStateRaw = SDL_GPURenderState*;
78
85
86#endif // SDL_VERSION_ATLEAST(3, 3, 6)
87
88// Forward decl
90
91// Forward decl
92struct TextureLock;
93
99constexpr auto SOFTWARE_RENDERER = SDL_SOFTWARE_RENDERER;
100
101#if SDL_VERSION_ATLEAST(3, 4, 0)
102
108constexpr auto GPU_RENDERER = SDL_GPU_RENDERER;
109
110#endif // SDL_VERSION_ATLEAST(3, 4, 0)
111
117using Vertex = SDL_Vertex;
118
124using TextureAccess = SDL_TextureAccess;
125
127 SDL_TEXTUREACCESS_STATIC;
128
130 SDL_TEXTUREACCESS_STREAMING;
131
133 SDL_TEXTUREACCESS_TARGET;
134
135#if SDL_VERSION_ATLEAST(3, 4, 0)
136
148using TextureAddressMode = SDL_TextureAddressMode;
149
151 SDL_TEXTURE_ADDRESS_INVALID;
152
157constexpr TextureAddressMode TEXTURE_ADDRESS_AUTO = SDL_TEXTURE_ADDRESS_AUTO;
158
160constexpr TextureAddressMode TEXTURE_ADDRESS_CLAMP = SDL_TEXTURE_ADDRESS_CLAMP;
161
163 SDL_TEXTURE_ADDRESS_WRAP;
164
165#endif // SDL_VERSION_ATLEAST(3, 4, 0)
166
172using RendererLogicalPresentation = SDL_RendererLogicalPresentation;
173
175 SDL_LOGICAL_PRESENTATION_DISABLED;
176
179 SDL_LOGICAL_PRESENTATION_STRETCH;
180
186 SDL_LOGICAL_PRESENTATION_LETTERBOX;
187
193 SDL_LOGICAL_PRESENTATION_OVERSCAN;
194
200 SDL_LOGICAL_PRESENTATION_INTEGER_SCALE;
201
202#if SDL_VERSION_ATLEAST(3, 4, 0)
203
211using GPURenderStateCreateInfo = SDL_GPURenderStateCreateInfo;
212
213#endif // SDL_VERSION_ATLEAST(3, 4, 0)
214
220struct RendererBase : ResourceBaseT<RendererRaw>
221{
223
236 void Destroy();
237
238#if SDL_VERSION_ATLEAST(3, 4, 0)
239
251
252#endif // SDL_VERSION_ATLEAST(3, 4, 0)
253
265
279 const char* GetName() const;
280
366
386 void GetOutputSize(int* w, int* h) const;
387
406 Point GetOutputSize() const;
407
427 void GetCurrentOutputSize(int* w, int* h) const;
428
448
471 TextureAccess access,
472 const PointRaw& size);
473
499
623
647 void SetTarget(TextureRef texture);
648
663 void ResetTarget();
664
680 Texture GetTarget() const;
681
724 void SetLogicalPresentation(const PointRaw& size,
726
748 void GetLogicalPresentation(int* w,
749 int* h,
750 RendererLogicalPresentation* mode) const;
751
774
796
818 FPoint RenderCoordinatesFromWindow(const FPointRaw& window_coord) const;
819
842 FPoint RenderCoordinatesToWindow(const FPointRaw& coord) const;
843
876 void ConvertEventToRenderCoordinates(Event* event) const;
877
902
918 void ResetViewport();
919
936 Rect GetViewport() const;
937
957 bool ViewportSet() const;
958
976 Rect GetSafeArea() const;
977
997
1013 void ResetClipRect();
1014
1032 Rect GetClipRect() const;
1033
1050 bool IsClipEnabled() const;
1051
1075 void SetScale(const FPointRaw& scale);
1076
1093 void GetScale(float* scaleX, float* scaleY) const;
1094
1110 FPoint GetScale() const;
1111
1128 void SetDrawColor(ColorRaw c);
1129
1146 void SetDrawColorFloat(const FColorRaw& c);
1147
1168 void GetDrawColor(Uint8* r, Uint8* g, Uint8* b, Uint8* a) const;
1169
1183 Color GetDrawColor() const;
1184
1205 void GetDrawColorFloat(float* r, float* g, float* b, float* a) const;
1206
1220 FColor GetDrawColorFloat() const;
1221
1242 void SetColorScale(float scale);
1243
1256 float GetColorScale() const;
1257
1275 void SetDrawBlendMode(BlendMode blendMode);
1276
1290
1307 void RenderClear();
1308
1321 void RenderPoint(const FPointRaw& p);
1322
1336
1350 void RenderLine(const FPointRaw& p1, const FPointRaw& p2);
1351
1366
1381
1396
1412
1427
1446 void RenderTexture(TextureRef texture,
1449
1474 void RenderTextureRotated(TextureRef texture,
1477 double angle,
1479 FlipMode flip = FlipMode::SDL_FLIP_NONE);
1480
1505 void RenderTextureAffine(TextureRef texture,
1510
1534 void RenderTextureTiled(TextureRef texture,
1536 float scale,
1538
1570 void RenderTexture9Grid(TextureRef texture,
1572 float left_width,
1573 float right_width,
1574 float top_height,
1575 float bottom_height,
1576 float scale,
1578
1579#if SDL_VERSION_ATLEAST(3, 4, 0)
1580
1616 const FRectRaw& srcrect,
1617 float left_width,
1618 float right_width,
1619 float top_height,
1620 float bottom_height,
1621 float scale,
1622 const FRectRaw& dstrect,
1623 float tileScale);
1624
1625#endif // SDL_VERSION_ATLEAST(3, 4, 0)
1626
1646 void RenderGeometry(TextureRef texture,
1647 std::span<const Vertex> vertices,
1648 std::span<const int> indices = {});
1649
1677 void RenderGeometryRaw(TextureRef texture,
1678 const float* xy,
1679 int xy_stride,
1680 const FColor* color,
1681 int color_stride,
1682 const float* uv,
1683 int uv_stride,
1684 int num_vertices,
1685 const void* indices,
1686 int num_indices,
1687 int size_indices);
1688
1689#if SDL_VERSION_ATLEAST(3, 4, 0)
1690
1709 TextureAddressMode v_mode);
1710
1729 TextureAddressMode* v_mode);
1730
1731#endif // SDL_VERSION_ATLEAST(3, 4, 0)
1732
1755
1801 void Present();
1802
1832 void Flush();
1833
1849 void* GetRenderMetalLayer();
1850
1872
1899 void AddVulkanRenderSemaphores(Uint32 wait_stage_mask,
1900 Sint64 wait_semaphore,
1901 Sint64 signal_semaphore);
1902
1924 void SetVSync(int vsync);
1925
1938 int GetVSync() const;
1939
1977 void RenderDebugText(const FPointRaw& p, StringParam str);
1978
2004 template<class... ARGS>
2005 void RenderDebugTextFormat(const FPointRaw& p,
2006 std::string_view fmt,
2007 ARGS... args);
2008
2009#if SDL_VERSION_ATLEAST(3, 4, 0)
2010
2025 void SetDefaultTextureScaleMode(ScaleMode scale_mode);
2026
2041 void GetDefaultTextureScaleMode(ScaleMode* scale_mode);
2042
2060 const GPURenderStateCreateInfo& createinfo);
2061
2078
2079#endif // SDL_VERSION_ATLEAST(3, 4, 0)
2080};
2081
2090{
2091 using RendererBase::RendererBase;
2092
2100 constexpr explicit Renderer(RendererRaw resource) noexcept
2101 : RendererBase(resource)
2102 {
2103 }
2104
2106 constexpr Renderer(Renderer&& other) noexcept
2107 : Renderer(other.release())
2108 {
2109 }
2110
2143 Renderer(WindowRef window, StringParam name = nullptr);
2144
2206 Renderer(PropertiesRef props);
2207
2226 Renderer(SurfaceRef surface);
2227
2229 ~Renderer() { SDL_DestroyRenderer(get()); }
2230
2232 constexpr Renderer& operator=(Renderer&& other) noexcept
2233 {
2234 swap(*this, other);
2235 return *this;
2236 }
2237};
2238
2244struct TextureBase : ResourceBaseT<TextureRaw, TextureRawConst>
2245{
2247
2249 constexpr operator TextureConstRef() const noexcept { return get(); }
2250
2264 void Destroy();
2265
2362
2373 RendererRef GetRenderer() const;
2374
2388 void GetSize(float* w, float* h) const;
2389
2391 Point GetSize() const;
2392
2394 FPoint GetSizeFloat() const;
2395
2397 int GetWidth() const;
2398
2400 int GetHeight() const;
2401
2403 PixelFormat GetFormat() const;
2404
2405#if SDL_VERSION_ATLEAST(3, 4, 0)
2406
2425 void SetPalette(PaletteRef palette);
2426
2440
2441#endif // SDL_VERSION_ATLEAST(3, 4, 0)
2442
2468 void SetColorMod(Uint8 r, Uint8 g, Uint8 b);
2469
2495 void SetColorModFloat(float r, float g, float b);
2496
2513 void GetColorMod(Uint8* r, Uint8* g, Uint8* b) const;
2514
2531 void GetColorModFloat(float* r, float* g, float* b) const;
2532
2555 void SetAlphaMod(Uint8 alpha);
2556
2579 void SetAlphaModFloat(float alpha);
2580
2595 Uint8 GetAlphaMod() const;
2596
2611 float GetAlphaModFloat() const;
2612
2635 void SetMod(Color c);
2636
2659 void SetModFloat(FColor c);
2660
2674 Color GetMod() const;
2675
2689 FColor GetModFloat() const;
2690
2709 void SetBlendMode(BlendMode blendMode);
2710
2723 BlendMode GetBlendMode() const;
2724
2741 void SetScaleMode(ScaleMode scaleMode);
2742
2755 ScaleMode GetScaleMode() const;
2756
2787 void Update(OptionalRef<const RectRaw> rect, const void* pixels, int pitch);
2788
2818 void Update(SurfaceConstRef surface,
2819 OptionalRef<const RectRaw> rect = std::nullopt);
2820
2850 const Uint8* Yplane,
2851 int Ypitch,
2852 const Uint8* Uplane,
2853 int Upitch,
2854 const Uint8* Vplane,
2855 int Vpitch);
2856
2882 const Uint8* Yplane,
2883 int Ypitch,
2884 const Uint8* UVplane,
2885 int UVpitch);
2886
2912 TextureLock Lock(OptionalRef<const RectRaw> rect, void** pixels, int* pitch);
2913
2945 OptionalRef<const RectRaw> rect = std::nullopt);
2946
2964 void Unlock(TextureLock&& lock);
2965
2983 void Unlock(TextureSurfaceLock&& lock);
2984};
2985
2999{
3000 using TextureBase::TextureBase;
3001
3009 constexpr explicit Texture(TextureRaw resource) noexcept
3010 : TextureBase(resource)
3011 {
3012 }
3013
3015 constexpr Texture(const Texture& other)
3016 : Texture(borrow(other.get()))
3017 {
3018 }
3019
3021 constexpr Texture(Texture&& other) noexcept
3022 : Texture(other.release())
3023 {
3024 }
3025
3047 Texture(RendererRef renderer,
3048 PixelFormat format,
3049 TextureAccess access,
3050 const PointRaw& size);
3051
3076 Texture(RendererRef renderer, SurfaceRef surface);
3077
3200 Texture(RendererRef renderer, PropertiesRef props);
3201
3231 Texture(RendererRef renderer, StringParam file);
3232
3273 Texture(RendererRef renderer, IOStreamRef src, bool closeio = false);
3274
3282 static Texture borrow(TextureRaw resource)
3283 {
3284 if (resource) {
3285 ++resource->refcount;
3286 return Texture(resource);
3287 }
3288 return {};
3289 }
3290
3292 ~Texture() { SDL_DestroyTexture(get()); }
3293
3295 constexpr Texture& operator=(Texture&& other) noexcept
3296 {
3297 swap(*this, other);
3298 return *this;
3299 }
3300
3303 {
3304 if (get() != other.get()) {
3305 Texture tmp(other);
3306 swap(*this, tmp);
3307 }
3308 return *this;
3309 }
3310};
3311
3329{
3330 TextureRef m_lock;
3331
3332public:
3364 void** pixels,
3365 int* pitch);
3366
3368 TextureLock(const TextureLock& other) = delete;
3369
3371 TextureLock(TextureLock&& other) noexcept
3372 : m_lock(std::move(other.m_lock))
3373 {
3374 }
3375
3394
3395 TextureLock& operator=(const TextureLock& other) = delete;
3396
3399 {
3400 std::swap(m_lock, other.m_lock);
3401 return *this;
3402 }
3403
3405 constexpr operator bool() const { return bool(m_lock); }
3406
3424 void reset();
3425
3427 TextureRef resource() const { return m_lock; }
3428
3430 void release() { m_lock.release(); }
3431};
3432
3456{
3457 TextureRef m_lock;
3458
3459public:
3493 OptionalRef<const RectRaw> rect = std::nullopt);
3494
3497
3500 : Surface(std::move(other))
3501 , m_lock(std::move(other.m_lock))
3502 {
3503 }
3504
3523
3524 TextureSurfaceLock& operator=(const TextureSurfaceLock& other) = delete;
3525
3528 {
3529 std::swap(m_lock, other.m_lock);
3530 Surface::operator=(std::move(other));
3531 return *this;
3532 }
3533
3551 void reset();
3552
3554 TextureRef resource() const { return m_lock; }
3555};
3556
3575inline int GetNumRenderDrivers() { return SDL_GetNumRenderDrivers(); }
3576
3599inline const char* GetRenderDriver(int index)
3600{
3601 return SDL_GetRenderDriver(index);
3602}
3603
3623 const PointRaw& size,
3624 WindowFlags window_flags,
3625 WindowRaw* window,
3626 RendererRaw* renderer)
3627{
3628 CheckError(SDL_CreateWindowAndRenderer(
3629 title, size.x, size.y, window_flags, window, renderer));
3630}
3631
3650 const PointRaw& size,
3651 WindowFlags window_flags,
3652 Window* window,
3653 Renderer* renderer)
3654{
3655 SDL_Window* windowRaw = nullptr;
3656 SDL_Renderer* rendererRaw = nullptr;
3658 title, size, window_flags, &windowRaw, &rendererRaw);
3659 if (window) *window = Window{windowRaw};
3660 if (renderer) *renderer = Renderer{rendererRaw};
3661}
3662
3681 const PointRaw& size,
3682 WindowFlags window_flags,
3683 Renderer* renderer = nullptr)
3684{
3685 Window window;
3686 CreateWindowAndRenderer(title, size, window_flags, &window, renderer);
3687 return window;
3688}
3689
3723inline Renderer CreateRenderer(WindowRef window, StringParam name = nullptr)
3724{
3725 return Renderer(window, name);
3726}
3727
3729 : Renderer(SDL_CreateRenderer(window, name))
3730{
3731}
3732
3734 : Renderer(SDL_CreateRendererWithProperties(props))
3735{
3736}
3737
3739 : Renderer(SDL_CreateSoftwareRenderer(surface))
3740{
3741}
3742
3806{
3807 return Renderer(props);
3808}
3809
3816
3817constexpr auto NAME_STRING =
3818 SDL_PROP_RENDERER_CREATE_NAME_STRING;
3819
3820constexpr auto WINDOW_POINTER =
3821 SDL_PROP_RENDERER_CREATE_WINDOW_POINTER;
3822
3823constexpr auto SURFACE_POINTER =
3824 SDL_PROP_RENDERER_CREATE_SURFACE_POINTER;
3825
3827 SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER;
3829
3830constexpr auto PRESENT_VSYNC_NUMBER =
3831 SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER;
3832
3833#if SDL_VERSION_ATLEAST(3, 4, 0)
3834
3835constexpr auto GPU_DEVICE_POINTER =
3836 SDL_PROP_RENDERER_CREATE_GPU_DEVICE_POINTER;
3837
3839 SDL_PROP_RENDERER_CREATE_GPU_SHADERS_SPIRV_BOOLEAN;
3841
3843 SDL_PROP_RENDERER_CREATE_GPU_SHADERS_DXIL_BOOLEAN;
3845
3847 SDL_PROP_RENDERER_CREATE_GPU_SHADERS_MSL_BOOLEAN;
3848
3849#endif // SDL_VERSION_ATLEAST(3, 4, 0)
3850
3852 SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER;
3854
3856 SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER;
3857
3859 SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER;
3862
3864 SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER;
3865
3867 SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER;
3873
3875 SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER;
3881
3882} // namespace prop::Renderer::Create
3883
3884#if SDL_VERSION_ATLEAST(3, 4, 0)
3885
3919{
3920 return SDL_CreateGPURenderer(device, window);
3921}
3922
3935{
3936 return SDL_GetGPURendererDevice(renderer);
3937}
3938
3943
3944#endif // SDL_VERSION_ATLEAST(3, 4, 0)
3945
3966{
3967 return Renderer(surface);
3968}
3969
3982{
3983 return CheckError(SDL_GetRenderer(window));
3984}
3985
3987{
3988 return SDL::GetRenderer(get());
3989}
3990
4003{
4004 return CheckError(SDL_GetRenderWindow(renderer));
4005}
4006
4008{
4009 return SDL::GetRenderWindow(get());
4010}
4011
4026inline const char* GetRendererName(RendererRef renderer)
4027{
4028 return CheckError(SDL_GetRendererName(renderer));
4029}
4030
4031inline const char* RendererBase::GetName() const
4032{
4033 return SDL::GetRendererName(get());
4034}
4035
4122{
4123 return CheckError(SDL_GetRendererProperties(renderer));
4124}
4125
4130
4141namespace prop::Renderer {
4142
4143constexpr auto NAME_STRING =
4144 SDL_PROP_RENDERER_NAME_STRING;
4145
4146constexpr auto WINDOW_POINTER =
4147 SDL_PROP_RENDERER_WINDOW_POINTER;
4148
4149constexpr auto SURFACE_POINTER =
4150 SDL_PROP_RENDERER_SURFACE_POINTER;
4151
4152constexpr auto VSYNC_NUMBER =
4153 SDL_PROP_RENDERER_VSYNC_NUMBER;
4154
4156 SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER;
4157
4159 SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER;
4160
4161#if SDL_VERSION_ATLEAST(3, 4, 0)
4162
4164 SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN;
4165
4166#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4167
4169 SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER;
4170
4171constexpr auto HDR_ENABLED_BOOLEAN =
4172 SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN;
4173
4175 SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT;
4176
4177constexpr auto HDR_HEADROOM_FLOAT =
4178 SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT;
4179
4180constexpr auto D3D9_DEVICE_POINTER =
4181 SDL_PROP_RENDERER_D3D9_DEVICE_POINTER;
4182
4183constexpr auto D3D11_DEVICE_POINTER =
4184 SDL_PROP_RENDERER_D3D11_DEVICE_POINTER;
4185
4187 SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER;
4188
4189constexpr auto D3D12_DEVICE_POINTER =
4190 SDL_PROP_RENDERER_D3D12_DEVICE_POINTER;
4191
4193 SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER;
4194
4196 SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER;
4198
4200 SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER;
4201
4203 SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER;
4204
4206 SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER;
4208
4210 SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER;
4211
4213 SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER;
4218
4220 SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER;
4224
4226 SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER;
4228
4229constexpr auto GPU_DEVICE_POINTER =
4230 SDL_PROP_RENDERER_GPU_DEVICE_POINTER;
4231
4232} // namespace prop::Renderer
4233
4254inline void GetRenderOutputSize(RendererRef renderer, int* w, int* h)
4255{
4256 CheckError(SDL_GetRenderOutputSize(renderer, w, h));
4257}
4258
4279{
4280 Point p;
4281 GetRenderOutputSize(renderer, &p.x, &p.y);
4282 return p;
4283}
4284
4285inline void RendererBase::GetOutputSize(int* w, int* h) const
4286{
4288}
4289
4291{
4292 return SDL::GetRenderOutputSize(get());
4293}
4294
4315inline void GetCurrentRenderOutputSize(RendererRef renderer, int* w, int* h)
4316{
4317 CheckError(SDL_GetCurrentRenderOutputSize(renderer, w, h));
4318}
4319
4340{
4341 Point p;
4342 GetCurrentRenderOutputSize(renderer, &p.x, &p.y);
4343 return p;
4344}
4345
4346inline void RendererBase::GetCurrentOutputSize(int* w, int* h) const
4347{
4349}
4350
4355
4379 PixelFormat format,
4380 TextureAccess access,
4381 const PointRaw& size)
4382{
4383 return Texture(renderer, format, access, size);
4384}
4385
4387 TextureAccess access,
4388 const PointRaw& size)
4389{
4390 return Texture(get(), format, access, size);
4391}
4392
4394 PixelFormat format,
4395 TextureAccess access,
4396 const PointRaw& size)
4397 : Texture(SDL_CreateTexture(renderer, format, access, size.x, size.y))
4398{
4399}
4400
4401inline Texture::Texture(RendererRef renderer, SurfaceRef surface)
4402 : Texture(SDL_CreateTextureFromSurface(renderer, surface))
4403{
4404}
4405
4407 : Texture(SDL_CreateTextureWithProperties(renderer, props))
4408{
4409}
4410
4437 SurfaceRef surface)
4438{
4439 return Texture(renderer, surface);
4440}
4441
4443{
4444 return Texture(get(), surface);
4445}
4446
4569 PropertiesRef props)
4570{
4571 return Texture(renderer, props);
4572}
4573
4575{
4576 return Texture(get(), props);
4577}
4578
4585
4586constexpr auto COLORSPACE_NUMBER =
4587 SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER;
4588
4589constexpr auto FORMAT_NUMBER =
4590 SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER;
4591
4592constexpr auto ACCESS_NUMBER =
4593 SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER;
4594
4595constexpr auto WIDTH_NUMBER =
4596 SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER;
4597
4598constexpr auto HEIGHT_NUMBER =
4599 SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER;
4600
4601#if SDL_VERSION_ATLEAST(3, 4, 0)
4602
4603constexpr auto PALETTE_POINTER =
4604 SDL_PROP_TEXTURE_CREATE_PALETTE_POINTER;
4605
4606#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4607
4609 SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT;
4610
4611constexpr auto HDR_HEADROOM_FLOAT =
4612 SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT;
4613
4615 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER;
4616
4618 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER;
4620
4622 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER;
4624
4626 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER;
4627
4629 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER;
4631
4633 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER;
4635
4637 SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER;
4639
4641 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER;
4642
4644 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER;
4646
4648 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER;
4650
4652 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER;
4654
4656 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER;
4658
4660 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER;
4662
4664 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER;
4666
4668 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER;
4670
4672 SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER;
4674
4675#if SDL_VERSION_ATLEAST(3, 4, 0)
4676
4677constexpr auto VULKAN_LAYOUT_NUMBER =
4678 SDL_PROP_TEXTURE_CREATE_VULKAN_LAYOUT_NUMBER;
4679
4680constexpr auto GPU_TEXTURE_POINTER =
4681 SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_POINTER;
4682
4684 SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_UV_POINTER;
4686
4688 SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_U_POINTER;
4689
4691 SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_V_POINTER;
4692
4693#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4694
4695} // namespace prop::Texture::Create
4696
4793{
4794 return CheckError(SDL_GetTextureProperties(texture));
4795}
4796
4801
4812namespace prop::Texture {
4813
4814constexpr auto COLORSPACE_NUMBER =
4815 SDL_PROP_TEXTURE_COLORSPACE_NUMBER;
4816
4817constexpr auto FORMAT_NUMBER =
4818 SDL_PROP_TEXTURE_FORMAT_NUMBER;
4819
4820constexpr auto ACCESS_NUMBER =
4821 SDL_PROP_TEXTURE_ACCESS_NUMBER;
4822
4823constexpr auto WIDTH_NUMBER =
4824 SDL_PROP_TEXTURE_WIDTH_NUMBER;
4825
4826constexpr auto HEIGHT_NUMBER =
4827 SDL_PROP_TEXTURE_HEIGHT_NUMBER;
4828
4830 SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT;
4831
4832constexpr auto HDR_HEADROOM_FLOAT =
4833 SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT;
4834
4836 SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER;
4837
4839 SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER;
4840
4842 SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER;
4843
4845 SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER;
4846
4848 SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER;
4849
4851 SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER;
4852
4854 SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER;
4855
4857 SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER;
4858
4860 SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER;
4861
4863 SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER;
4864
4866 SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER;
4868
4869constexpr auto OPENGL_TEX_W_FLOAT =
4870 SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT;
4871
4872constexpr auto OPENGL_TEX_H_FLOAT =
4873 SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT;
4874
4876 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER;
4877
4879 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER;
4881
4883 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER;
4885
4887 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER;
4889
4891 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER;
4893
4895 SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER;
4896
4897#if SDL_VERSION_ATLEAST(3, 4, 0)
4898
4899constexpr auto GPU_TEXTURE_POINTER =
4900 SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER;
4901
4903 SDL_PROP_TEXTURE_GPU_TEXTURE_UV_POINTER;
4904
4906 SDL_PROP_TEXTURE_GPU_TEXTURE_U_POINTER;
4907
4909 SDL_PROP_TEXTURE_GPU_TEXTURE_V_POINTER;
4910
4911#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4912
4913} // namespace prop::Texture
4914
4927{
4928 return CheckError(SDL_GetRendererFromTexture(texture));
4929}
4930
4932{
4934}
4935
4950inline void GetTextureSize(TextureConstRef texture, float* w, float* h)
4951{
4952 CheckError(SDL_GetTextureSize(texture, w, h));
4953}
4954
4957{
4958 return Point(texture->w, texture->h);
4959}
4960
4961inline void TextureBase::GetSize(float* w, float* h) const
4962{
4963 SDL::GetTextureSize(get(), w, h);
4964}
4965
4967
4970{
4971 FPoint p;
4972 GetTextureSize(texture, &p.x, &p.y);
4973 return p;
4974}
4975
4977{
4978 return SDL::GetTextureSizeFloat(get());
4979}
4980
4982inline int GetTextureWidth(TextureConstRef texture) { return texture->w; }
4983
4984inline int TextureBase::GetWidth() const { return SDL::GetTextureWidth(get()); }
4985
4987inline int GetTextureHeight(TextureConstRef texture) { return texture->h; }
4988
4989inline int TextureBase::GetHeight() const { return GetTextureHeight(get()); }
4990
4993{
4994 return texture->format;
4995}
4996
4998{
4999 return SDL::GetTextureFormat(get());
5000}
5001
5002#if SDL_VERSION_ATLEAST(3, 4, 0)
5003
5023inline void SetTexturePalette(TextureRef texture, PaletteRef palette)
5024{
5025 CheckError(SDL_SetTexturePalette(texture, palette));
5026}
5027
5029{
5030 SDL::SetTexturePalette(get(), palette);
5031}
5032
5047{
5048 return Palette::borrow(SDL_GetTexturePalette(texture));
5049}
5050
5052
5053#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5054
5081inline void SetTextureColorMod(TextureRef texture, Uint8 r, Uint8 g, Uint8 b)
5082{
5083 CheckError(SDL_SetTextureColorMod(texture, r, g, b));
5084}
5085
5087{
5088 SDL::SetTextureColorMod(get(), r, g, b);
5089}
5090
5118 float r,
5119 float g,
5120 float b)
5121{
5122 CheckError(SDL_SetTextureColorModFloat(texture, r, g, b));
5123}
5124
5125inline void TextureBase::SetColorModFloat(float r, float g, float b)
5126{
5128}
5129
5148 Uint8* r,
5149 Uint8* g,
5150 Uint8* b)
5151{
5152 CheckError(SDL_GetTextureColorMod(texture, r, g, b));
5153}
5154
5155inline void TextureBase::GetColorMod(Uint8* r, Uint8* g, Uint8* b) const
5156{
5157 SDL::GetTextureColorMod(get(), r, g, b);
5158}
5159
5178 float* r,
5179 float* g,
5180 float* b)
5181{
5182 CheckError(SDL_GetTextureColorModFloat(texture, r, g, b));
5183}
5184
5185inline void TextureBase::GetColorModFloat(float* r, float* g, float* b) const
5186{
5188}
5189
5213inline void SetTextureAlphaMod(TextureRef texture, Uint8 alpha)
5214{
5215 CheckError(SDL_SetTextureAlphaMod(texture, alpha));
5216}
5217
5219{
5220 SDL::SetTextureAlphaMod(get(), alpha);
5221}
5222
5246inline void SetTextureAlphaModFloat(TextureRef texture, float alpha)
5247{
5248 CheckError(SDL_SetTextureAlphaModFloat(texture, alpha));
5249}
5250
5251inline void TextureBase::SetAlphaModFloat(float alpha)
5252{
5254}
5255
5272{
5273 Uint8 alpha;
5274 CheckError(SDL_GetTextureAlphaMod(texture, &alpha));
5275 return alpha;
5276}
5277
5279{
5280 return SDL::GetTextureAlphaMod(get());
5281}
5282
5299{
5300 float alpha;
5301 CheckError(SDL_GetTextureAlphaModFloat(texture, &alpha));
5302 return alpha;
5303}
5304
5306{
5308}
5309
5333inline void SetTextureMod(TextureRef texture, Color c)
5334{
5335 SetTextureColorMod(texture, c.r, c.g, c.b);
5336 SetTextureAlphaMod(texture, c.a);
5337}
5338
5340
5364inline void SetTextureModFloat(TextureRef texture, FColor c)
5365{
5366 SetTextureColorModFloat(texture, c.r, c.g, c.b);
5367 SetTextureAlphaModFloat(texture, c.a);
5368}
5369
5371{
5373}
5374
5390{
5391 Color c;
5392 GetTextureColorMod(texture, &c.r, &c.g, &c.b);
5393 c.a = GetTextureAlphaMod(texture);
5394 return c;
5395}
5396
5398
5414{
5415 FColor c;
5416 GetTextureColorModFloat(texture, &c.r, &c.g, &c.b);
5417 c.a = GetTextureAlphaModFloat(texture);
5418 return c;
5419}
5420
5422{
5423 return SDL::GetTextureModFloat(get());
5424}
5425
5445inline void SetTextureBlendMode(TextureRef texture, BlendMode blendMode)
5446{
5447 CheckError(SDL_SetTextureBlendMode(texture, blendMode));
5448}
5449
5451{
5452 SDL::SetTextureBlendMode(get(), blendMode);
5453}
5454
5469{
5470 BlendMode blendMode;
5471 CheckError(SDL_GetTextureBlendMode(texture, &blendMode));
5472 return blendMode;
5473}
5474
5476{
5477 return SDL::GetTextureBlendMode(get());
5478}
5479
5497inline void SetTextureScaleMode(TextureRef texture, ScaleMode scaleMode)
5498{
5499 CheckError(SDL_SetTextureScaleMode(texture, scaleMode));
5500}
5501
5503{
5504 SDL::SetTextureScaleMode(get(), scaleMode);
5505}
5506
5521{
5522 ScaleMode scaleMode;
5523 CheckError(SDL_GetTextureScaleMode(texture, &scaleMode));
5524 return scaleMode;
5525}
5526
5528{
5529 return SDL::GetTextureScaleMode(get());
5530}
5531
5563inline void UpdateTexture(TextureRef texture,
5565 const void* pixels,
5566 int pitch)
5567{
5568 CheckError(SDL_UpdateTexture(texture, rect, pixels, pitch));
5569}
5570
5601inline void UpdateTexture(TextureRef texture,
5602 SurfaceConstRef surface,
5603 OptionalRef<const RectRaw> rect = std::nullopt)
5604{
5605 UpdateTexture(texture, rect, surface->pixels, surface->pitch);
5606}
5607
5609 const void* pixels,
5610 int pitch)
5611{
5612 SDL::UpdateTexture(get(), rect, pixels, pitch);
5613}
5614
5617{
5618 SDL::UpdateTexture(get(), surface, rect);
5619}
5620
5646inline void UpdateYUVTexture(TextureRef texture,
5648 const Uint8* Yplane,
5649 int Ypitch,
5650 const Uint8* Uplane,
5651 int Upitch,
5652 const Uint8* Vplane,
5653 int Vpitch)
5654{
5655 CheckError(SDL_UpdateYUVTexture(
5656 texture, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch));
5657}
5658
5660 const Uint8* Yplane,
5661 int Ypitch,
5662 const Uint8* Uplane,
5663 int Upitch,
5664 const Uint8* Vplane,
5665 int Vpitch)
5666{
5668 get(), rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch);
5669}
5670
5695inline void UpdateNVTexture(TextureRef texture,
5697 const Uint8* Yplane,
5698 int Ypitch,
5699 const Uint8* UVplane,
5700 int UVpitch)
5701{
5702 CheckError(
5703 SDL_UpdateNVTexture(texture, rect, Yplane, Ypitch, UVplane, UVpitch));
5704}
5705
5707 const Uint8* Yplane,
5708 int Ypitch,
5709 const Uint8* UVplane,
5710 int UVpitch)
5711{
5712 SDL::UpdateNVTexture(get(), rect, Yplane, Ypitch, UVplane, UVpitch);
5713}
5714
5742inline void LockTexture(TextureRef texture,
5744 void** pixels,
5745 int* pitch)
5746{
5747 CheckError(SDL_LockTexture(texture, rect, pixels, pitch));
5748}
5749
5751 void** pixels,
5752 int* pitch)
5753{
5754 return {TextureRef(*this), rect, pixels, pitch};
5755}
5756
5759 void** pixels,
5760 int* pitch)
5761 : m_lock(resource)
5762{
5763 LockTexture(m_lock, rect, pixels, pitch);
5764}
5765
5798 TextureRef texture,
5799 OptionalRef<const RectRaw> rect = std::nullopt)
5800{
5801 SurfaceRaw surface = nullptr;
5802 CheckError(SDL_LockTextureToSurface(texture, rect, &surface));
5803 return Surface::borrow(surface);
5804}
5805
5808{
5809 return {TextureRef(*this), rect};
5810}
5811
5818
5838inline void UnlockTexture(TextureRef texture) { SDL_UnlockTexture(texture); }
5839
5841{
5842 SDL_assert_paranoid(lock.resource() == *this);
5843 std::move(lock).reset();
5844}
5845
5847{
5848 SDL_assert_paranoid(lock.resource() == *this);
5849 std::move(lock).reset();
5850}
5851
5853{
5854 if (!m_lock) return;
5855 UnlockTexture(m_lock);
5856 m_lock = {};
5857}
5858
5860{
5861 if (!m_lock) return;
5862 UnlockTexture(m_lock);
5863 m_lock = {};
5864}
5865
5890inline void SetRenderTarget(RendererRef renderer, TextureRef texture)
5891{
5892 CheckError(SDL_SetRenderTarget(renderer, texture));
5893}
5894
5896{
5897 SDL::SetRenderTarget(get(), texture);
5898}
5899
5915inline void ResetRenderTarget(RendererRef renderer)
5916{
5917 SetRenderTarget(renderer, nullptr);
5918}
5919
5921
5938{
5939 if (auto texture = SDL_GetRenderTarget(renderer))
5940 return Texture::borrow(texture);
5941 return {};
5942}
5943
5945{
5946 return SDL::GetRenderTarget(get());
5947}
5948
5993 const PointRaw& size,
5995{
5996 CheckError(SDL_SetRenderLogicalPresentation(renderer, size.x, size.y, mode));
5997}
5998
6000 const PointRaw& size,
6002{
6004}
6005
6028 int* w,
6029 int* h,
6031{
6032 CheckError(SDL_GetRenderLogicalPresentation(renderer, w, h, mode));
6033}
6034
6057 PointRaw* size,
6059{
6060 if (size) {
6061 return GetRenderLogicalPresentation(renderer, &size->x, &size->y, mode);
6062 }
6063 return GetRenderLogicalPresentation(renderer, nullptr, nullptr, mode);
6064}
6065
6067 int* w,
6068 int* h,
6069 RendererLogicalPresentation* mode) const
6070{
6072}
6073
6075 PointRaw* size,
6077{
6079}
6080
6102{
6103 FRect rect;
6104 CheckError(SDL_GetRenderLogicalPresentationRect(renderer, &rect));
6105 return rect;
6106}
6107
6112
6136 const FPointRaw& window_coord)
6137{
6138 FPoint p;
6139 CheckError(SDL_RenderCoordinatesFromWindow(
6140 renderer, window_coord.x, window_coord.y, &p.x, &p.y));
6141 return p;
6142}
6143
6145 const FPointRaw& window_coord) const
6146{
6147 return SDL::RenderCoordinatesFromWindow(get(), window_coord);
6148}
6149
6174 const FPointRaw& coord)
6175{
6176 FPoint p;
6177 CheckError(
6178 SDL_RenderCoordinatesToWindow(renderer, coord.x, coord.y, &p.x, &p.y));
6179 return p;
6180}
6181
6183 const FPointRaw& coord) const
6184{
6185 return SDL::RenderCoordinatesToWindow(get(), coord);
6186}
6187
6221{
6222 CheckError(SDL_ConvertEventToRenderCoordinates(renderer, event));
6223}
6224
6229
6254inline void SetRenderViewport(RendererRef renderer,
6256{
6257 CheckError(SDL_SetRenderViewport(renderer, rect));
6258}
6259
6264
6282{
6283 SetRenderViewport(renderer, std::nullopt);
6284}
6285
6287
6306{
6307 Rect rect;
6308 CheckError(SDL_GetRenderViewport(renderer, &rect));
6309 return rect;
6310}
6311
6313{
6314 return SDL::GetRenderViewport(get());
6315}
6316
6337inline bool RenderViewportSet(RendererRef renderer)
6338{
6339 return SDL_RenderViewportSet(renderer);
6340}
6341
6342inline bool RendererBase::ViewportSet() const
6343{
6344 return SDL::RenderViewportSet(get());
6345}
6346
6366{
6367 Rect rect;
6368 CheckError(SDL_GetRenderSafeArea(renderer, &rect));
6369 return rect;
6370}
6371
6373{
6374 return SDL::GetRenderSafeArea(get());
6375}
6376
6396inline void SetRenderClipRect(RendererRef renderer,
6398{
6399 CheckError(SDL_SetRenderClipRect(renderer, rect));
6400}
6401
6406
6424{
6425 SetRenderClipRect(renderer, std::nullopt);
6426}
6427
6429
6449{
6450 Rect rect;
6451 CheckError(SDL_GetRenderClipRect(renderer, &rect));
6452 return rect;
6453}
6454
6456{
6457 return SDL::GetRenderClipRect(get());
6458}
6459
6477inline bool RenderClipEnabled(RendererRef renderer)
6478{
6479 return SDL_RenderClipEnabled(renderer);
6480}
6481
6483{
6484 return SDL::RenderClipEnabled(get());
6485}
6486
6511inline void SetRenderScale(RendererRef renderer, const FPointRaw& scale)
6512{
6513 CheckError(SDL_SetRenderScale(renderer, scale.x, scale.y));
6514}
6515
6516inline void RendererBase::SetScale(const FPointRaw& scale)
6517{
6518 SDL::SetRenderScale(get(), scale);
6519}
6520
6538inline void GetRenderScale(RendererRef renderer, float* scaleX, float* scaleY)
6539{
6540 CheckError(SDL_GetRenderScale(renderer, scaleX, scaleY));
6541}
6542
6559{
6560 FPoint p;
6561 GetRenderScale(renderer, &p.x, &p.y);
6562 return p;
6563}
6564
6565inline void RendererBase::GetScale(float* scaleX, float* scaleY) const
6566{
6567 SDL::GetRenderScale(get(), scaleX, scaleY);
6568}
6569
6571{
6572 return SDL::GetRenderScale(get());
6573}
6574
6593{
6594 CheckError(SDL_SetRenderDrawColor(renderer, c.r, c.g, c.b, c.a));
6595}
6596
6601
6619inline void SetRenderDrawColorFloat(RendererRef renderer, const FColorRaw& c)
6620{
6621 CheckError(SDL_SetRenderDrawColorFloat(renderer, c.r, c.g, c.b, c.a));
6622}
6623
6628
6650inline void GetRenderDrawColor(RendererRef renderer,
6651 Uint8* r,
6652 Uint8* g,
6653 Uint8* b,
6654 Uint8* a)
6655{
6656 CheckError(SDL_GetRenderDrawColor(renderer, r, g, b, a));
6657}
6658
6674{
6675 Color c;
6676 GetRenderDrawColor(renderer, &c.r, &c.g, &c.b, &c.a);
6677 return c;
6678}
6679
6681 Uint8* g,
6682 Uint8* b,
6683 Uint8* a) const
6684{
6685 SDL::GetRenderDrawColor(get(), r, g, b, a);
6686}
6687
6689{
6690 return SDL::GetRenderDrawColor(get());
6691}
6692
6715 float* r,
6716 float* g,
6717 float* b,
6718 float* a)
6719{
6720 CheckError(SDL_GetRenderDrawColorFloat(renderer, r, g, b, a));
6721}
6722
6738{
6739 FColor c;
6740 GetRenderDrawColorFloat(renderer, &c.r, &c.g, &c.b, &c.a);
6741 return c;
6742}
6743
6745 float* g,
6746 float* b,
6747 float* a) const
6748{
6749 SDL::GetRenderDrawColorFloat(get(), r, g, b, a);
6750}
6751
6756
6777inline void SetRenderColorScale(RendererRef renderer, float scale)
6778{
6779 CheckError(SDL_SetRenderColorScale(renderer, scale));
6780}
6781
6782inline void RendererBase::SetColorScale(float scale)
6783{
6784 SDL::SetRenderColorScale(get(), scale);
6785}
6786
6800inline float GetRenderColorScale(RendererRef renderer)
6801{
6802 float scale;
6803 CheckError(SDL_GetRenderColorScale(renderer, &scale));
6804 return scale;
6805}
6806
6808{
6809 return SDL::GetRenderColorScale(get());
6810}
6811
6830inline void SetRenderDrawBlendMode(RendererRef renderer, BlendMode blendMode)
6831{
6832 CheckError(SDL_SetRenderDrawBlendMode(renderer, blendMode));
6833}
6834
6836{
6837 SDL::SetRenderDrawBlendMode(get(), blendMode);
6838}
6839
6854{
6855 BlendMode blendMode;
6856 CheckError(SDL_GetRenderDrawBlendMode(renderer, &blendMode));
6857 return blendMode;
6858}
6859
6864
6882inline void RenderClear(RendererRef renderer)
6883{
6884 CheckError(SDL_RenderClear(renderer));
6885}
6886
6888
6902inline void RenderPoint(RendererRef renderer, const FPointRaw& p)
6903{
6904 CheckError(SDL_RenderPoint(renderer, p.x, p.y));
6905}
6906
6908{
6909 SDL::RenderPoint(get(), p);
6910}
6911
6926{
6927 CheckError(
6928 SDL_RenderPoints(renderer, points.data(), narrowS32(points.size())));
6929}
6930
6932{
6933 SDL::RenderPoints(get(), points);
6934}
6935
6950inline void RenderLine(RendererRef renderer,
6951 const FPointRaw& p1,
6952 const FPointRaw& p2)
6953{
6954 CheckError(SDL_RenderLine(renderer, p1.x, p1.y, p2.x, p2.y));
6955}
6956
6957inline void RendererBase::RenderLine(const FPointRaw& p1, const FPointRaw& p2)
6958{
6959 SDL::RenderLine(get(), p1, p2);
6960}
6961
6977{
6978 CheckError(
6979 SDL_RenderLines(renderer, points.data(), narrowS32(points.size())));
6980}
6981
6983{
6984 SDL::RenderLines(get(), points);
6985}
6986
7002{
7003 CheckError(SDL_RenderRect(renderer, rect));
7004}
7005
7010
7026{
7027 CheckError(SDL_RenderRects(renderer, rects.data(), narrowS32(rects.size())));
7028}
7029
7031{
7032 SDL::RenderRects(get(), rects);
7033}
7034
7050inline void RenderFillRect(RendererRef renderer,
7052{
7053 CheckError(SDL_RenderFillRect(renderer, rect));
7054}
7055
7060
7076{
7077 CheckError(
7078 SDL_RenderFillRects(renderer, rects.data(), narrowS32(rects.size())));
7079}
7080
7085
7105inline void RenderTexture(RendererRef renderer,
7106 TextureRef texture,
7109{
7110 CheckError(SDL_RenderTexture(renderer, texture, srcrect, dstrect));
7111}
7112
7116{
7117 SDL::RenderTexture(get(), texture, srcrect, dstrect);
7118}
7119
7146 TextureRef texture,
7149 double angle,
7151 FlipMode flip = FlipMode::SDL_FLIP_NONE)
7152{
7153 CheckError(SDL_RenderTextureRotated(
7154 renderer, texture, srcrect, dstrect, angle, center, flip));
7155}
7156
7158 TextureRef texture,
7161 double angle,
7163 FlipMode flip)
7164{
7166 get(), texture, srcrect, dstrect, angle, center, flip);
7167}
7168
7195 TextureRef texture,
7200{
7201 CheckError(
7202 SDL_RenderTextureAffine(renderer, texture, srcrect, origin, right, down));
7203}
7204
7206 TextureRef texture,
7211{
7212 SDL::RenderTextureAffine(get(), texture, srcrect, origin, right, down);
7213}
7214
7239inline void RenderTextureTiled(RendererRef renderer,
7240 TextureRef texture,
7242 float scale,
7244{
7245 CheckError(
7246 SDL_RenderTextureTiled(renderer, texture, srcrect, scale, dstrect));
7247}
7248
7250 TextureRef texture,
7252 float scale,
7254{
7255 SDL::RenderTextureTiled(get(), texture, srcrect, scale, dstrect);
7256}
7257
7290inline void RenderTexture9Grid(RendererRef renderer,
7291 TextureRef texture,
7293 float left_width,
7294 float right_width,
7295 float top_height,
7296 float bottom_height,
7297 float scale,
7299{
7300 CheckError(SDL_RenderTexture9Grid(renderer,
7301 texture,
7302 srcrect,
7303 left_width,
7304 right_width,
7305 top_height,
7306 bottom_height,
7307 scale,
7308 dstrect));
7309}
7310
7312 TextureRef texture,
7314 float left_width,
7315 float right_width,
7316 float top_height,
7317 float bottom_height,
7318 float scale,
7320{
7322 texture,
7323 srcrect,
7324 left_width,
7325 right_width,
7326 top_height,
7327 bottom_height,
7328 scale,
7329 dstrect);
7330}
7331
7332#if SDL_VERSION_ATLEAST(3, 4, 0)
7333
7370 TextureRef texture,
7371 const FRectRaw& srcrect,
7372 float left_width,
7373 float right_width,
7374 float top_height,
7375 float bottom_height,
7376 float scale,
7377 const FRectRaw& dstrect,
7378 float tileScale)
7379{
7380 CheckError(SDL_RenderTexture9GridTiled(renderer,
7381 texture,
7382 &srcrect,
7383 left_width,
7384 right_width,
7385 top_height,
7386 bottom_height,
7387 scale,
7388 &dstrect,
7389 tileScale));
7390}
7391
7393 const FRectRaw& srcrect,
7394 float left_width,
7395 float right_width,
7396 float top_height,
7397 float bottom_height,
7398 float scale,
7399 const FRectRaw& dstrect,
7400 float tileScale)
7401{
7403 texture,
7404 srcrect,
7405 left_width,
7406 right_width,
7407 top_height,
7408 bottom_height,
7409 scale,
7410 dstrect,
7411 tileScale);
7412}
7413
7414#endif // SDL_VERSION_ATLEAST(3, 4, 0)
7415
7436inline void RenderGeometry(RendererRef renderer,
7437 TextureRef texture,
7438 std::span<const Vertex> vertices,
7439 std::span<const int> indices = {})
7440{
7441 CheckError(SDL_RenderGeometry(renderer,
7442 texture,
7443 vertices.data(),
7444 narrowS32(vertices.size()),
7445 indices.data(),
7446 narrowS32(indices.size())));
7447}
7448
7450 std::span<const Vertex> vertices,
7451 std::span<const int> indices)
7452{
7453 SDL::RenderGeometry(get(), texture, vertices, indices);
7454}
7455
7483inline void RenderGeometryRaw(RendererRef renderer,
7484 TextureRef texture,
7485 const float* xy,
7486 int xy_stride,
7487 const FColor* color,
7488 int color_stride,
7489 const float* uv,
7490 int uv_stride,
7491 int num_vertices,
7492 const void* indices,
7493 int num_indices,
7494 int size_indices)
7495{
7496 CheckError(SDL_RenderGeometryRaw(renderer,
7497 texture,
7498 xy,
7499 xy_stride,
7500 color,
7501 color_stride,
7502 uv,
7503 uv_stride,
7504 num_vertices,
7505 indices,
7506 num_indices,
7507 size_indices));
7508}
7509
7511 const float* xy,
7512 int xy_stride,
7513 const FColor* color,
7514 int color_stride,
7515 const float* uv,
7516 int uv_stride,
7517 int num_vertices,
7518 const void* indices,
7519 int num_indices,
7520 int size_indices)
7521{
7523 texture,
7524 xy,
7525 xy_stride,
7526 color,
7527 color_stride,
7528 uv,
7529 uv_stride,
7530 num_vertices,
7531 indices,
7532 num_indices,
7533 size_indices);
7534}
7535
7536#if SDL_VERSION_ATLEAST(3, 4, 0)
7537
7557 TextureAddressMode u_mode,
7558 TextureAddressMode v_mode)
7559{
7560 CheckError(SDL_SetRenderTextureAddressMode(renderer, u_mode, v_mode));
7561}
7562
7568
7588 TextureAddressMode* u_mode,
7589 TextureAddressMode* v_mode)
7590{
7591 CheckError(SDL_GetRenderTextureAddressMode(renderer, u_mode, v_mode));
7592}
7593
7595 TextureAddressMode* u_mode,
7596 TextureAddressMode* v_mode)
7597{
7598 SDL::GetRenderTextureAddressMode(get(), u_mode, v_mode);
7599}
7600
7601#endif // SDL_VERSION_ATLEAST(3, 4, 0)
7602
7627{
7628 return Surface{CheckError(SDL_RenderReadPixels(renderer, rect))};
7629}
7630
7632{
7633 return SDL::RenderReadPixels(get(), rect);
7634}
7635
7681inline void RenderPresent(RendererRef renderer)
7682{
7683 CheckError(SDL_RenderPresent(renderer));
7684}
7685
7687
7703inline void DestroyTexture(TextureRaw texture) { SDL_DestroyTexture(texture); }
7704
7706
7720inline void DestroyRenderer(RendererRaw renderer)
7721{
7722 SDL_DestroyRenderer(renderer);
7723}
7724
7726
7757inline void FlushRenderer(RendererRef renderer)
7758{
7759 CheckError(SDL_FlushRenderer(renderer));
7760}
7761
7763
7780inline void* GetRenderMetalLayer(RendererRef renderer)
7781{
7782 return SDL_GetRenderMetalLayer(renderer);
7783}
7784
7786{
7787 return SDL::GetRenderMetalLayer(get());
7788}
7789
7812{
7813 return SDL_GetRenderMetalCommandEncoder(renderer);
7814}
7815
7820
7848 Uint32 wait_stage_mask,
7849 Sint64 wait_semaphore,
7850 Sint64 signal_semaphore)
7851{
7852 CheckError(SDL_AddVulkanRenderSemaphores(
7853 renderer, wait_stage_mask, wait_semaphore, signal_semaphore));
7854}
7855
7857 Sint64 wait_semaphore,
7858 Sint64 signal_semaphore)
7859{
7861 get(), wait_stage_mask, wait_semaphore, signal_semaphore);
7862}
7863
7886inline void SetRenderVSync(RendererRef renderer, int vsync)
7887{
7888 CheckError(SDL_SetRenderVSync(renderer, vsync));
7889}
7890
7891inline void RendererBase::SetVSync(int vsync)
7892{
7893 SDL::SetRenderVSync(get(), vsync);
7894}
7895
7897constexpr int RENDERER_VSYNC_DISABLED = SDL_RENDERER_VSYNC_DISABLED;
7898
7900constexpr int RENDERER_VSYNC_ADAPTIVE = SDL_RENDERER_VSYNC_ADAPTIVE;
7901
7916inline int GetRenderVSync(RendererRef renderer)
7917{
7918 int vsync;
7919 CheckError(SDL_GetRenderVSync(renderer, &vsync));
7920 return vsync;
7921}
7922
7923inline int RendererBase::GetVSync() const { return SDL::GetRenderVSync(get()); }
7924
7935 SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE;
7936
7974inline void RenderDebugText(RendererRef renderer,
7975 const FPointRaw& p,
7976 StringParam str)
7977{
7978 CheckError(SDL_RenderDebugText(renderer, p.x, p.y, str));
7979}
7980
7982{
7983 SDL::RenderDebugText(get(), p, str);
7984}
7985
8010template<class... ARGS>
8012 const FPointRaw& p,
8013 std::string_view fmt,
8014 ARGS... args)
8015{
8017 renderer, p, std::vformat(fmt, std::make_format_args(args...)));
8018}
8019
8020template<class... ARGS>
8022 std::string_view fmt,
8023 ARGS... args)
8024{
8025 SDL::RenderDebugTextFormat(get(), p, fmt, args...);
8026}
8027
8028#if SDL_VERSION_ATLEAST(3, 4, 0)
8029
8046 ScaleMode scale_mode)
8047{
8048 CheckError(SDL_SetDefaultTextureScaleMode(renderer, scale_mode));
8049}
8050
8052{
8053 SDL::SetDefaultTextureScaleMode(get(), scale_mode);
8054}
8055
8071 ScaleMode* scale_mode)
8072{
8073 CheckError(SDL_GetDefaultTextureScaleMode(renderer, scale_mode));
8074}
8075
8077{
8078 SDL::GetDefaultTextureScaleMode(get(), scale_mode);
8079}
8080
8086struct GPURenderStateBase : ResourceBaseT<GPURenderStateRaw>
8087{
8089
8100 void Destroy();
8101
8118 void SetFragmentUniforms(Uint32 slot_index, const void* data, Uint32 length);
8119};
8120
8134{
8135 using GPURenderStateBase::GPURenderStateBase;
8136
8144 constexpr explicit GPURenderState(GPURenderStateRaw resource) noexcept
8145 : GPURenderStateBase(resource)
8146 {
8147 }
8148
8150 constexpr GPURenderState(GPURenderState&& other) noexcept
8151 : GPURenderState(other.release())
8152 {
8153 }
8154
8172 GPURenderState(RendererRef renderer,
8173 const GPURenderStateCreateInfo& createinfo);
8174
8176 ~GPURenderState() { SDL_DestroyGPURenderState(get()); }
8177
8179 constexpr GPURenderState& operator=(GPURenderState&& other) noexcept
8180 {
8181 swap(*this, other);
8182 return *this;
8183 }
8184};
8185
8204 RendererRef renderer,
8205 const GPURenderStateCreateInfo& createinfo)
8206{
8207 return GPURenderState(renderer, createinfo);
8208}
8209
8211 const GPURenderStateCreateInfo& createinfo)
8212{
8213 return GPURenderState(get(), createinfo);
8214}
8215
8217 RendererRef renderer,
8218 const GPURenderStateCreateInfo& createinfo)
8219 : GPURenderState(SDL_CreateGPURenderState(renderer, &createinfo))
8220{
8221}
8222
8241 Uint32 slot_index,
8242 const void* data,
8243 Uint32 length)
8244{
8245 CheckError(
8246 SDL_SetGPURenderStateFragmentUniforms(state, slot_index, data, length));
8247}
8248
8250 const void* data,
8251 Uint32 length)
8252{
8253 SDL::SetGPURenderStateFragmentUniforms(get(), slot_index, data, length);
8254}
8255
8273{
8274 CheckError(SDL_SetGPURenderState(renderer, state));
8275}
8276
8281
8295{
8296 SDL_DestroyGPURenderState(state);
8297}
8298
8300
8301#endif // SDL_VERSION_ATLEAST(3, 4, 0)
8302
8304
8305} // namespace SDL
8306
8307#endif /* SDL3PP_RENDER_H_ */
Optional-like shim for references.
Definition SDL3pp_optionalRef.h:20
Pixel format.
Definition SDL3pp_pixels.h:361
constexpr RawPointer release() noexcept
Definition SDL3pp_resource.h:57
friend constexpr void swap(ResourceBaseT &lhs, ResourceBaseT &rhs) noexcept
Definition SDL3pp_resource.h:65
constexpr RawPointer get() const noexcept
Definition SDL3pp_resource.h:54
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
Const reference wrapper for a given resource,.
Definition SDL3pp_resource.h:115
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:58
Lock a portion of the texture for write-only pixel access.
Definition SDL3pp_render.h:3329
TextureRef resource() const
Get the reference to locked resource.
Definition SDL3pp_render.h:3427
~TextureLock()
Unlock a texture, uploading the changes to video memory, if needed.
Definition SDL3pp_render.h:3393
TextureLock & operator=(TextureLock &&other) noexcept
Assignment operator.
Definition SDL3pp_render.h:3398
TextureLock(const TextureLock &other)=delete
Copy constructor.
TextureLock(TextureLock &&other) noexcept
Move constructor.
Definition SDL3pp_render.h:3371
void release()
Releases the lock without unlocking.
Definition SDL3pp_render.h:3430
Lock a portion of the texture for write-only pixel access, and expose it as a SDL surface.
Definition SDL3pp_render.h:3456
~TextureSurfaceLock()
Unlock a texture, uploading the changes to video memory, if needed.
Definition SDL3pp_render.h:3522
TextureSurfaceLock(TextureSurfaceLock &&other) noexcept
Move constructor.
Definition SDL3pp_render.h:3499
TextureRef resource() const
Get the reference to locked resource.
Definition SDL3pp_render.h:3554
TextureSurfaceLock(const TextureSurfaceLock &other)=delete
Copy constructor.
TextureSurfaceLock & operator=(TextureSurfaceLock &&other) noexcept
Assignment operator.
Definition SDL3pp_render.h:3527
#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:199
SDL_Event Event
The structure for all events in SDL.
Definition SDL3pp_events.h:844
ResourceRefT< GPUDeviceBase > GPUDeviceRef
Reference for GPUDevice.
Definition SDL3pp_gpu.h:387
ResourceRefT< IOStreamBase > IOStreamRef
Reference for IOStream.
Definition SDL3pp_iostream.h:37
SDL_Color ColorRaw
Alias to raw representation for Color.
Definition SDL3pp_pixels.h:83
SDL_FColor FColorRaw
Alias to raw representation for FColor.
Definition SDL3pp_pixels.h:89
ResourceRefT< PaletteBase > PaletteRef
Reference for Palette.
Definition SDL3pp_pixels.h:111
ResourceRefT< PropertiesBase > PropertiesRef
Reference for Properties.
Definition SDL3pp_properties.h:55
SDL_FRect FRectRaw
Alias to raw representation for FRect.
Definition SDL3pp_rect.h:40
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
void GetColorModFloat(float *r, float *g, float *b) const
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5185
FPoint RenderCoordinatesFromWindow(RendererRef renderer, const FPointRaw &window_coord)
Get a point in render coordinates when given a point in window coordinates.
Definition SDL3pp_render.h:6135
void reset()
Unlock a texture, uploading the changes to video memory, if needed.
Definition SDL3pp_render.h:5859
void UpdateTexture(TextureRef texture, OptionalRef< const RectRaw > rect, const void *pixels, int pitch)
Update the given texture rectangle with new pixel data.
Definition SDL3pp_render.h:5563
RendererRef GetRenderer() const
Get the renderer associated with a window.
Definition SDL3pp_render.h:3986
constexpr TextureAddressMode TEXTURE_ADDRESS_AUTO
Wrapping is enabled if texture coordinates are outside [0, 1], this is the default.
Definition SDL3pp_render.h:157
void SetAlphaMod(Uint8 alpha)
Set an additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5218
void SetDrawBlendMode(BlendMode blendMode)
Set the blend mode used for drawing operations.
Definition SDL3pp_render.h:6835
void ResetTarget()
Set target texture back to window.
Definition SDL3pp_render.h:5920
void GetRenderScale(RendererRef renderer, float *scaleX, float *scaleY)
Get the drawing scale for the current target.
Definition SDL3pp_render.h:6538
constexpr int RENDERER_VSYNC_DISABLED
Constant for disabling renderer vsync.
Definition SDL3pp_render.h:7897
SDL_Vertex Vertex
Vertex structure.
Definition SDL3pp_render.h:117
FRect GetLogicalPresentationRect() const
Get the final presentation rectangle for rendering.
Definition SDL3pp_render.h:6108
void RenderTexture9Grid(RendererRef renderer, TextureRef 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:7290
void GetRenderTextureAddressMode(TextureAddressMode *u_mode, TextureAddressMode *v_mode)
Get the texture addressing mode used in RenderGeometry().
Definition SDL3pp_render.h:7594
void RenderRects(RendererRef renderer, SpanRef< const FRectRaw > rects)
Draw some number of rectangles on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:7025
void RenderTexture(TextureRef 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:7113
void ResetRenderViewport(RendererRef renderer)
Reset the drawing area for rendering to the entire target.
Definition SDL3pp_render.h:6281
const SDL_Texture * TextureRawConst
Alias to const raw representation for Texture.
Definition SDL3pp_render.h:56
void RenderGeometryRaw(TextureRef 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:7510
PropertiesRef GetProperties() const
Get the properties associated with a texture.
Definition SDL3pp_render.h:4797
Texture GetRenderTarget(RendererRef renderer)
Get the current render target.
Definition SDL3pp_render.h:5937
void SetColorModFloat(float r, float g, float b)
Set an additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5125
RendererRef CreateGPURenderer(GPUDeviceRef device, WindowRef window)
Create a 2D GPU rendering context.
Definition SDL3pp_render.h:3918
void Destroy()
Destroy custom GPU render state.
Definition SDL3pp_render.h:8299
Texture CreateTextureWithProperties(PropertiesRef props)
Create a texture for a rendering context with the specified properties.
Definition SDL3pp_render.h:4574
void FlushRenderer(RendererRef renderer)
Force the rendering context to flush any pending commands and state.
Definition SDL3pp_render.h:7757
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:7081
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:7056
GPURenderState CreateGPURenderState(RendererRef renderer, const GPURenderStateCreateInfo &createinfo)
Create custom GPU render state.
Definition SDL3pp_render.h:8203
void SetDefaultTextureScaleMode(RendererRef renderer, ScaleMode scale_mode)
Set default scale mode for new textures for given renderer.
Definition SDL3pp_render.h:8045
Rect GetSafeArea() const
Get the safe area for rendering within the current viewport.
Definition SDL3pp_render.h:6372
void CreateWindowAndRenderer(StringParam title, const PointRaw &size, WindowFlags window_flags, Window *window, Renderer *renderer)
Create a window and default renderer.
Definition SDL3pp_render.h:3649
ScaleMode GetTextureScaleMode(TextureConstRef texture)
Get the scale mode used for texture scale operations.
Definition SDL3pp_render.h:5520
void * GetRenderMetalLayer(RendererRef renderer)
Get the CAMetalLayer associated with the given Metal renderer.
Definition SDL3pp_render.h:7780
void SetClipRect(OptionalRef< const RectRaw > rect)
Set the clip rectangle for rendering on the specified target.
Definition SDL3pp_render.h:6402
void GetRenderOutputSize(RendererRef renderer, int *w, int *h)
Get the output size in pixels of a rendering context.
Definition SDL3pp_render.h:4254
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:5750
BlendMode GetTextureBlendMode(TextureConstRef texture)
Get the blend mode used for texture copy operations.
Definition SDL3pp_render.h:5468
void SetRenderTextureAddressMode(RendererRef renderer, TextureAddressMode u_mode, TextureAddressMode v_mode)
Set the texture addressing mode used in RenderGeometry().
Definition SDL3pp_render.h:7556
void RenderTexture9Grid(TextureRef 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:7311
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:8249
void CreateWindowAndRendererRaw(StringParam title, const PointRaw &size, WindowFlags window_flags, WindowRaw *window, RendererRaw *renderer)
Create a window and default renderer.
Definition SDL3pp_render.h:3622
void RenderDebugText(RendererRef renderer, const FPointRaw &p, StringParam str)
Draw debug text to an Renderer.
Definition SDL3pp_render.h:7974
void SetColorMod(Uint8 r, Uint8 g, Uint8 b)
Set an additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5086
void RenderFillRects(RendererRef 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:7075
void RenderDebugTextFormat(const FPointRaw &p, std::string_view fmt, ARGS... args)
Draw debug text to an Renderer.
Definition SDL3pp_render.h:8021
FColor GetModFloat() const
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5421
ResourceConstRef< TextureRaw, TextureRawConst > TextureConstRef
Safely wrap Texture for non owning const parameters.
Definition SDL3pp_render.h:66
void SetMod(Color c)
Set an additional color and alpha values multiplied into render copy operations.
Definition SDL3pp_render.h:5339
void SetVSync(int vsync)
Toggle VSync of the given renderer.
Definition SDL3pp_render.h:7891
void GetRenderDrawColor(RendererRef renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
Get the color used for drawing operations (Rect, Line and Clear).
Definition SDL3pp_render.h:6650
void SetGPURenderState(RendererRef renderer, GPURenderStateRef state)
Set custom GPU render state.
Definition SDL3pp_render.h:8272
void RenderPoint(RendererRef renderer, const FPointRaw &p)
Draw a point on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:6902
constexpr TextureAddressMode TEXTURE_ADDRESS_WRAP
The texture is repeated (tiled).
Definition SDL3pp_render.h:162
void RenderRect(RendererRef renderer, OptionalRef< const FRectRaw > rect)
Draw a rectangle on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:7001
Palette GetTexturePalette(TextureRef texture)
Get the palette used by a texture.
Definition SDL3pp_render.h:5046
void GetDefaultTextureScaleMode(ScaleMode *scale_mode)
Get default texture scale mode of the given renderer.
Definition SDL3pp_render.h:8076
void Flush()
Force the rendering context to flush any pending commands and state.
Definition SDL3pp_render.h:7762
Texture CreateTextureWithProperties(RendererRef renderer, PropertiesRef props)
Create a texture for a rendering context with the specified properties.
Definition SDL3pp_render.h:4568
SDL_TextureAccess TextureAccess
The access pattern allowed for a texture.
Definition SDL3pp_render.h:124
Rect GetRenderSafeArea(RendererRef renderer)
Get the safe area for rendering within the current viewport.
Definition SDL3pp_render.h:6365
void SetViewport(OptionalRef< const RectRaw > rect)
Set the drawing area for rendering on the current target.
Definition SDL3pp_render.h:6260
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:5706
constexpr int RENDERER_VSYNC_ADAPTIVE
Constant for enabling asaptive renderer vsync.
Definition SDL3pp_render.h:7900
Point GetCurrentOutputSize() const
Get the current output size in pixels of a rendering context.
Definition SDL3pp_render.h:4351
int GetTextureWidth(TextureConstRef texture)
Get the width in pixels.
Definition SDL3pp_render.h:4982
PropertiesRef GetRendererProperties(RendererRef renderer)
Get the properties associated with a renderer.
Definition SDL3pp_render.h:4121
constexpr auto SOFTWARE_RENDERER
The name of the software renderer.
Definition SDL3pp_render.h:99
void SetRenderColorScale(RendererRef renderer, float scale)
Set the color scale used for render operations.
Definition SDL3pp_render.h:6777
void GetTextureColorMod(TextureConstRef texture, Uint8 *r, Uint8 *g, Uint8 *b)
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5147
void ConvertEventToRenderCoordinates(Event *event) const
Convert the coordinates in an event to render coordinates.
Definition SDL3pp_render.h:6225
void SetRenderVSync(RendererRef renderer, int vsync)
Toggle VSync of the given renderer.
Definition SDL3pp_render.h:7886
GPUDeviceRef GetGPURendererDevice(RendererRef renderer)
Return the GPU device used by a renderer.
Definition SDL3pp_render.h:3934
bool IsClipEnabled() const
Get whether clipping is enabled on the given render target.
Definition SDL3pp_render.h:6482
void GetRenderLogicalPresentation(RendererRef renderer, int *w, int *h, RendererLogicalPresentation *mode)
Get device independent resolution and presentation mode for rendering.
Definition SDL3pp_render.h:6027
Texture CreateTextureFromSurface(SurfaceRef surface)
Create a texture from an existing surface.
Definition SDL3pp_render.h:4442
void SetTextureModFloat(TextureRef texture, FColor c)
Set an additional color and alpha values multiplied into render copy operations.
Definition SDL3pp_render.h:5364
void RenderLine(const FPointRaw &p1, const FPointRaw &p2)
Draw a line on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:6957
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:5659
void RenderTexture9GridTiled(TextureRef 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:7392
void SetRenderTextureAddressMode(TextureAddressMode u_mode, TextureAddressMode v_mode)
Set the texture addressing mode used in RenderGeometry().
Definition SDL3pp_render.h:7563
void ResetClipRect()
Reset the clip rectangle for rendering to the entire render target.
Definition SDL3pp_render.h:6428
SDL_GPURenderState * GPURenderStateRaw
Alias to raw representation for GPURenderState.
Definition SDL3pp_render.h:77
void SetScale(const FPointRaw &scale)
Set the drawing scale for rendering on the current target.
Definition SDL3pp_render.h:6516
constexpr TextureAddressMode TEXTURE_ADDRESS_INVALID
TEXTURE_ADDRESS_INVALID.
Definition SDL3pp_render.h:150
void DestroyRenderer(RendererRaw renderer)
Destroy the rendering context for a window and free all associated textures.
Definition SDL3pp_render.h:7720
void GetTextureSize(TextureConstRef texture, float *w, float *h)
Get the size of a texture, as floating point values.
Definition SDL3pp_render.h:4950
void RenderClear()
Clear the current rendering target with the drawing color.
Definition SDL3pp_render.h:6887
Texture CreateTexture(RendererRef renderer, PixelFormat format, TextureAccess access, const PointRaw &size)
Create a texture for a rendering context.
Definition SDL3pp_render.h:4378
void Destroy()
Destroy the specified texture.
Definition SDL3pp_render.h:7705
Surface RenderReadPixels(RendererRef renderer, OptionalRef< const RectRaw > rect={})
Read pixels from the current rendering target.
Definition SDL3pp_render.h:7625
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:5812
Texture GetTarget() const
Get the current render target.
Definition SDL3pp_render.h:5944
void SetTextureScaleMode(TextureRef texture, ScaleMode scaleMode)
Set the scale mode used for texture scale operations.
Definition SDL3pp_render.h:5497
bool RenderClipEnabled(RendererRef renderer)
Get whether clipping is enabled on the given render target.
Definition SDL3pp_render.h:6477
Color GetDrawColor() const
Get the color used for drawing operations (Rect, Line and Clear).
Definition SDL3pp_render.h:6688
void SetRenderDrawColorFloat(RendererRef renderer, const FColorRaw &c)
Set the color used for drawing operations (Rect, Line and Clear).
Definition SDL3pp_render.h:6619
FColor GetDrawColorFloat() const
Get the color used for drawing operations (Rect, Line and Clear).
Definition SDL3pp_render.h:6752
float GetRenderColorScale(RendererRef renderer)
Get the color scale used for render operations.
Definition SDL3pp_render.h:6800
void RenderRects(SpanRef< const FRectRaw > rects)
Draw some number of rectangles on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:7030
Rect GetClipRect() const
Get the clip rectangle for the current target.
Definition SDL3pp_render.h:6455
Rect GetViewport() const
Get the drawing area for the current target.
Definition SDL3pp_render.h:6312
FRect GetRenderLogicalPresentationRect(RendererRef renderer)
Get the final presentation rectangle for rendering.
Definition SDL3pp_render.h:6101
FPoint GetTextureSizeFloat(TextureConstRef texture)
Get the size of a texture, as floating point values.
Definition SDL3pp_render.h:4969
RendererRef GetRendererFromTexture(TextureConstRef texture)
Get the renderer that created an Texture.
Definition SDL3pp_render.h:4926
void SetRenderDrawBlendMode(RendererRef renderer, BlendMode blendMode)
Set the blend mode used for drawing operations.
Definition SDL3pp_render.h:6830
ResourceRefT< TextureBase > TextureRef
Reference for Texture.
Definition SDL3pp_render.h:63
Palette GetPalette()
Get the palette used by a texture.
Definition SDL3pp_render.h:5051
void RenderRect(OptionalRef< const FRectRaw > rect)
Draw a rectangle on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:7006
GPUDeviceRef GetGPUDevice()
Return the GPU device used by a renderer.
Definition SDL3pp_render.h:3939
void RenderTextureRotated(RendererRef renderer, TextureRef 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:7145
FPoint GetSizeFloat() const
Get the size of a texture, as floating point values.
Definition SDL3pp_render.h:4976
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:5806
void RenderTextureTiled(RendererRef renderer, TextureRef 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:7239
void RenderPoints(SpanRef< const FPointRaw > points)
Draw multiple points on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:6931
void SetTarget(TextureRef texture)
Set a texture as the current rendering target.
Definition SDL3pp_render.h:5895
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:192
void GetRenderDrawColorFloat(RendererRef renderer, float *r, float *g, float *b, float *a)
Get the color used for drawing operations (Rect, Line and Clear).
Definition SDL3pp_render.h:6714
constexpr auto GPU_RENDERER
The name of the GPU renderer.
Definition SDL3pp_render.h:108
void SetPalette(PaletteRef palette)
Set the palette used by a texture.
Definition SDL3pp_render.h:5028
void ResetRenderClipRect(RendererRef renderer)
Reset the clip rectangle for rendering to the entire render target.
Definition SDL3pp_render.h:6423
Texture CreateTexture(PixelFormat format, TextureAccess access, const PointRaw &size)
Create a texture for a rendering context.
Definition SDL3pp_render.h:4386
RendererRef GetRenderer(WindowRef window)
Get the renderer associated with a window.
Definition SDL3pp_render.h:3981
void * GetRenderMetalCommandEncoder(RendererRef renderer)
Get the Metal command encoder for the current frame.
Definition SDL3pp_render.h:7811
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_DISABLED
There is no logical size in effect.
Definition SDL3pp_render.h:174
WindowRef GetWindow()
Get the window associated with a renderer.
Definition SDL3pp_render.h:4007
void RenderDebugText(const FPointRaw &p, StringParam str)
Draw debug text to an Renderer.
Definition SDL3pp_render.h:7981
void UpdateNVTexture(TextureRef 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:5695
FPoint RenderCoordinatesToWindow(const FPointRaw &coord) const
Get a point in window coordinates when given a point in render coordinates.
Definition SDL3pp_render.h:6182
void RenderDebugTextFormat(RendererRef renderer, const FPointRaw &p, std::string_view fmt, ARGS... args)
Draw debug text to an Renderer.
Definition SDL3pp_render.h:8011
int GetVSync() const
Get VSync of the given renderer.
Definition SDL3pp_render.h:7923
constexpr TextureAccess TEXTUREACCESS_TARGET
Texture can be used as a render target.
Definition SDL3pp_render.h:132
void RenderPoints(RendererRef renderer, SpanRef< const FPointRaw > points)
Draw multiple points on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:6925
void DestroyTexture(TextureRaw texture)
Destroy the specified texture.
Definition SDL3pp_render.h:7703
void GetLogicalPresentation(int *w, int *h, RendererLogicalPresentation *mode) const
Get device independent resolution and presentation mode for rendering.
Definition SDL3pp_render.h:6066
FColor GetTextureModFloat(TextureConstRef texture)
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5413
void RenderFillRect(RendererRef renderer, OptionalRef< const FRectRaw > rect)
Fill a rectangle on the current rendering target with the drawing color at subpixel precision.
Definition SDL3pp_render.h:7050
void ResetViewport()
Reset the drawing area for rendering to the entire target.
Definition SDL3pp_render.h:6286
void RenderClear(RendererRef renderer)
Clear the current rendering target with the drawing color.
Definition SDL3pp_render.h:6882
int GetWidth() const
Get the width in pixels.
Definition SDL3pp_render.h:4984
Renderer CreateRenderer(WindowRef window, StringParam name=nullptr)
Create a 2D rendering context for a window.
Definition SDL3pp_render.h:3723
void DestroyGPURenderState(GPURenderStateRaw state)
Destroy custom GPU render state.
Definition SDL3pp_render.h:8294
void SetModFloat(FColor c)
Set an additional color and alpha values multiplied into render copy operations.
Definition SDL3pp_render.h:5370
PixelFormat GetTextureFormat(TextureConstRef texture)
Get the pixel format.
Definition SDL3pp_render.h:4992
float GetAlphaModFloat() const
Get the additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5305
void RenderPoint(const FPointRaw &p)
Draw a point on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:6907
Uint8 GetAlphaMod() const
Get the additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5278
ResourceRefT< GPURenderStateBase > GPURenderStateRef
Reference for GPURenderState.
Definition SDL3pp_render.h:84
void SetGPURenderState(GPURenderStateRef state)
Set custom GPU render state.
Definition SDL3pp_render.h:8277
void Present()
Update the screen with any rendering performed since the previous call.
Definition SDL3pp_render.h:7686
BlendMode GetDrawBlendMode() const
Get the blend mode used for drawing operations.
Definition SDL3pp_render.h:6860
void SetDrawColor(ColorRaw c)
Set the color used for drawing operations.
Definition SDL3pp_render.h:6597
Renderer CreateRendererWithProperties(PropertiesRef props)
Create a 2D rendering context for a window, with the specified properties.
Definition SDL3pp_render.h:3805
void GetColorMod(Uint8 *r, Uint8 *g, Uint8 *b) const
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5155
void UpdateYUVTexture(TextureRef 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:5646
constexpr TextureAccess TEXTUREACCESS_STATIC
Changes rarely, not lockable.
Definition SDL3pp_render.h:126
ScaleMode GetScaleMode() const
Get the scale mode used for texture scale operations.
Definition SDL3pp_render.h:5527
Rect GetRenderViewport(RendererRef renderer)
Get the drawing area for the current target.
Definition SDL3pp_render.h:6305
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_INTEGER_SCALE
The rendered content is scaled up by integer multiples to fit the output resolution.
Definition SDL3pp_render.h:199
SDL_GPURenderStateCreateInfo GPURenderStateCreateInfo
A structure specifying the parameters of a GPU render state.
Definition SDL3pp_render.h:211
constexpr TextureAccess TEXTUREACCESS_STREAMING
Changes frequently, lockable.
Definition SDL3pp_render.h:129
BlendMode GetBlendMode() const
Get the blend mode used for texture copy operations.
Definition SDL3pp_render.h:5475
void * GetRenderMetalCommandEncoder()
Get the Metal command encoder for the current frame.
Definition SDL3pp_render.h:7816
void SetDrawColorFloat(const FColorRaw &c)
Set the color used for drawing operations (Rect, Line and Clear).
Definition SDL3pp_render.h:6624
Point GetSize() const
Get the size of a texture.
Definition SDL3pp_render.h:4966
Rect GetRenderClipRect(RendererRef renderer)
Get the clip rectangle for the current target.
Definition SDL3pp_render.h:6448
void SetAlphaModFloat(float alpha)
Set an additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5251
void RenderLine(RendererRef renderer, const FPointRaw &p1, const FPointRaw &p2)
Draw a line on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:6950
void SetRenderLogicalPresentation(RendererRef renderer, const PointRaw &size, RendererLogicalPresentation mode)
Set a device-independent resolution and presentation mode for rendering.
Definition SDL3pp_render.h:5992
Color GetMod() const
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5397
void RenderGeometry(TextureRef 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:7449
void reset()
Unlock a texture, uploading the changes to video memory, if needed.
Definition SDL3pp_render.h:5852
void SetTextureColorMod(TextureRef texture, Uint8 r, Uint8 g, Uint8 b)
Set an additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5081
void GetDefaultTextureScaleMode(RendererRef renderer, ScaleMode *scale_mode)
Get default texture scale mode of the given renderer.
Definition SDL3pp_render.h:8070
SDL_RendererLogicalPresentation RendererLogicalPresentation
How the logical size is mapped to the output.
Definition SDL3pp_render.h:172
SDL_TextureAddressMode TextureAddressMode
The addressing mode for a texture when used in RenderGeometry().
Definition SDL3pp_render.h:148
float GetColorScale() const
Get the color scale used for render operations.
Definition SDL3pp_render.h:6807
void SetRenderTarget(RendererRef renderer, TextureRef texture)
Set a texture as the current rendering target.
Definition SDL3pp_render.h:5890
int GetRenderVSync(RendererRef renderer)
Get VSync of the given renderer.
Definition SDL3pp_render.h:7916
constexpr int DEBUG_TEXT_FONT_CHARACTER_SIZE
The size, in pixels, of a single RenderDebugText() character.
Definition SDL3pp_render.h:7934
BlendMode GetRenderDrawBlendMode(RendererRef renderer)
Get the blend mode used for drawing operations.
Definition SDL3pp_render.h:6853
PixelFormat GetFormat() const
Get the pixel format.
Definition SDL3pp_render.h:4997
int GetHeight() const
Get the height in pixels.
Definition SDL3pp_render.h:4989
constexpr TextureAddressMode TEXTURE_ADDRESS_CLAMP
Texture coordinates are clamped to the [0, 1] range.
Definition SDL3pp_render.h:160
void Destroy()
Destroy the rendering context for a window and free all associated textures.
Definition SDL3pp_render.h:7725
PropertiesRef GetTextureProperties(TextureConstRef texture)
Get the properties associated with a texture.
Definition SDL3pp_render.h:4792
void SetBlendMode(BlendMode blendMode)
Set the blend mode for a texture, used by RenderTexture().
Definition SDL3pp_render.h:5450
void SetRenderDrawColor(RendererRef renderer, ColorRaw c)
Set the color used for drawing operations.
Definition SDL3pp_render.h:6592
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:5757
void RenderTextureTiled(TextureRef 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:7249
FPoint RenderCoordinatesToWindow(RendererRef renderer, const FPointRaw &coord)
Get a point in window coordinates when given a point in render coordinates.
Definition SDL3pp_render.h:6173
void RenderGeometry(RendererRef renderer, TextureRef 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:7436
Point GetOutputSize() const
Get the output size in pixels of a rendering context.
Definition SDL3pp_render.h:4290
SDL_Renderer * RendererRaw
Alias to raw representation for Renderer.
Definition SDL3pp_render.h:44
void SetTextureColorModFloat(TextureRef texture, float r, float g, float b)
Set an additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5117
Texture CreateTextureFromSurface(RendererRef renderer, SurfaceRef surface)
Create a texture from an existing surface.
Definition SDL3pp_render.h:4436
SDL_Texture * TextureRaw
Alias to raw representation for Texture.
Definition SDL3pp_render.h:53
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:185
void RenderLines(SpanRef< const FPointRaw > points)
Draw a series of connected lines on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:6982
void SetTextureAlphaModFloat(TextureRef texture, float alpha)
Set an additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5246
void RenderTexture(RendererRef renderer, TextureRef 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:7105
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:7856
void GetRenderTextureAddressMode(RendererRef renderer, TextureAddressMode *u_mode, TextureAddressMode *v_mode)
Get the texture addressing mode used in RenderGeometry().
Definition SDL3pp_render.h:7587
Renderer CreateSoftwareRenderer(SurfaceRef surface)
Create a 2D software rendering context for a surface.
Definition SDL3pp_render.h:3965
const char * GetName() const
Get the name of a renderer.
Definition SDL3pp_render.h:4031
void ConvertEventToRenderCoordinates(RendererRef renderer, Event *event)
Convert the coordinates in an event to render coordinates.
Definition SDL3pp_render.h:6220
Color GetTextureMod(TextureConstRef texture)
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5389
FPoint RenderCoordinatesFromWindow(const FPointRaw &window_coord) const
Get a point in render coordinates when given a point in window coordinates.
Definition SDL3pp_render.h:6144
void RenderGeometryRaw(RendererRef renderer, TextureRef 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:7483
void SetLogicalPresentation(const PointRaw &size, RendererLogicalPresentation mode)
Set a device-independent resolution and presentation mode for rendering.
Definition SDL3pp_render.h:5999
GPURenderState CreateGPURenderState(const GPURenderStateCreateInfo &createinfo)
Create custom GPU render state.
Definition SDL3pp_render.h:8210
void SetRenderScale(RendererRef renderer, const FPointRaw &scale)
Set the drawing scale for rendering on the current target.
Definition SDL3pp_render.h:6511
void SetRenderViewport(RendererRef renderer, OptionalRef< const RectRaw > rect)
Set the drawing area for rendering on the current target.
Definition SDL3pp_render.h:6254
void RenderPresent(RendererRef renderer)
Update the screen with any rendering performed since the previous call.
Definition SDL3pp_render.h:7681
void SetDefaultTextureScaleMode(ScaleMode scale_mode)
Set default scale mode for new textures for given renderer.
Definition SDL3pp_render.h:8051
void RenderTextureAffine(RendererRef renderer, TextureRef 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:7194
void UnlockTexture(TextureRef texture)
Unlock a texture, uploading the changes to video memory, if needed.
Definition SDL3pp_render.h:5838
void AddVulkanRenderSemaphores(RendererRef 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:7847
void SetScaleMode(ScaleMode scaleMode)
Set the scale mode used for texture scale operations.
Definition SDL3pp_render.h:5502
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_STRETCH
The rendered content is stretched to the output resolution.
Definition SDL3pp_render.h:178
const char * GetRendererName(RendererRef renderer)
Get the name of a renderer.
Definition SDL3pp_render.h:4026
FPoint GetScale() const
Get the drawing scale for the current target.
Definition SDL3pp_render.h:6570
void GetCurrentRenderOutputSize(RendererRef renderer, int *w, int *h)
Get the current output size in pixels of a rendering context.
Definition SDL3pp_render.h:4315
float GetTextureAlphaModFloat(TextureConstRef texture)
Get the additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5298
void SetColorScale(float scale)
Set the color scale used for render operations.
Definition SDL3pp_render.h:6782
int GetNumRenderDrivers()
Get the number of 2D rendering drivers available for the current display.
Definition SDL3pp_render.h:3575
const char * GetRenderDriver(int index)
Use this function to get the name of a built in 2D rendering driver.
Definition SDL3pp_render.h:3599
void RenderLines(RendererRef renderer, SpanRef< const FPointRaw > points)
Draw a series of connected lines on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:6976
void RenderTextureAffine(TextureRef 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:7205
WindowRef GetRenderWindow(RendererRef renderer)
Get the window associated with a renderer.
Definition SDL3pp_render.h:4002
void * GetRenderMetalLayer()
Get the CAMetalLayer associated with the given Metal renderer.
Definition SDL3pp_render.h:7785
RendererRef GetRenderer() const
Get the renderer that created an Texture.
Definition SDL3pp_render.h:4931
void Update(OptionalRef< const RectRaw > rect, const void *pixels, int pitch)
Update the given texture rectangle with new pixel data.
Definition SDL3pp_render.h:5608
bool RenderViewportSet(RendererRef renderer)
Return whether an explicit rectangle was set as the viewport.
Definition SDL3pp_render.h:6337
void GetTextureColorModFloat(TextureConstRef texture, float *r, float *g, float *b)
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5177
PropertiesRef GetProperties() const
Get the properties associated with a renderer.
Definition SDL3pp_render.h:4126
void SetTextureBlendMode(TextureRef texture, BlendMode blendMode)
Set the blend mode for a texture, used by RenderTexture().
Definition SDL3pp_render.h:5445
bool ViewportSet() const
Return whether an explicit rectangle was set as the viewport.
Definition SDL3pp_render.h:6342
Uint8 GetTextureAlphaMod(TextureConstRef texture)
Get the additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5271
void LockTexture(TextureRef texture, OptionalRef< const RectRaw > rect, void **pixels, int *pitch)
Lock a portion of the texture for write-only pixel access.
Definition SDL3pp_render.h:5742
void Unlock(TextureLock &&lock)
Unlock a texture, uploading the changes to video memory, if needed.
Definition SDL3pp_render.h:5840
void RenderTexture9GridTiled(RendererRef renderer, TextureRef 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:7369
void SetTextureAlphaMod(TextureRef texture, Uint8 alpha)
Set an additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5213
void SetTexturePalette(TextureRef texture, PaletteRef palette)
Set the palette used by a texture.
Definition SDL3pp_render.h:5023
Surface ReadPixels(OptionalRef< const RectRaw > rect={}) const
Read pixels from the current rendering target.
Definition SDL3pp_render.h:7631
Surface LockTextureToSurface(TextureRef 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:5797
void ResetRenderTarget(RendererRef renderer)
Set target texture back to window.
Definition SDL3pp_render.h:5915
void SetTextureMod(TextureRef texture, Color c)
Set an additional color and alpha values multiplied into render copy operations.
Definition SDL3pp_render.h:5333
void SetRenderClipRect(RendererRef renderer, OptionalRef< const RectRaw > rect)
Set the clip rectangle for rendering on the specified target.
Definition SDL3pp_render.h:6396
void SetGPURenderStateFragmentUniforms(GPURenderStateRef state, Uint32 slot_index, const void *data, Uint32 length)
Set fragment shader uniform variables in a custom GPU render state.
Definition SDL3pp_render.h:8240
int GetTextureHeight(TextureConstRef texture)
Get the height in pixels.
Definition SDL3pp_render.h:4987
void RenderTextureRotated(TextureRef 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:7157
::Sint64 Sint64
A signed 64-bit integer type.
Definition SDL3pp_stdinc.h:311
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition SDL3pp_stdinc.h:296
::Uint8 Uint8
An unsigned 8-bit integer type.
Definition SDL3pp_stdinc.h:244
SDL_FlipMode FlipMode
The flip mode.
Definition SDL3pp_surface.h:130
SDL_ScaleMode ScaleMode
The scaling mode.
Definition SDL3pp_surface.h:101
SDL_Surface * SurfaceRaw
Alias to raw representation for Surface.
Definition SDL3pp_surface.h:47
ResourceRefT< SurfaceBase > SurfaceRef
Reference for Surface.
Definition SDL3pp_surface.h:57
ResourceConstRef< SurfaceRaw, SurfaceRawConst > SurfaceConstRef
Safely wrap Surface for non owning const parameters.
Definition SDL3pp_surface.h:60
ResourceRefT< RendererBase > RendererRef
Reference for Renderer.
Definition SDL3pp_video.h:86
Uint64 WindowFlags
The flags on a window.
Definition SDL3pp_video.h:526
SDL_Window * WindowRaw
Alias to raw representation for Window.
Definition SDL3pp_video.h:50
ResourceRefT< WindowBase > WindowRef
Reference for Window.
Definition SDL3pp_video.h:57
Properties for Renderer creation.
Definition SDL3pp_render.h:3815
constexpr auto SURFACE_POINTER
Pointer to surface.
Definition SDL3pp_render.h:3823
constexpr auto PRESENT_VSYNC_NUMBER
Number for present vsync.
Definition SDL3pp_render.h:3830
constexpr auto VULKAN_PHYSICAL_DEVICE_POINTER
Pointer to vulkan physical device.
Definition SDL3pp_render.h:3858
constexpr auto VULKAN_INSTANCE_POINTER
Pointer to vulkan instance.
Definition SDL3pp_render.h:3851
constexpr auto VULKAN_SURFACE_NUMBER
Vulkan surface number.
Definition SDL3pp_render.h:3855
constexpr auto GPU_SHADERS_SPIRV_BOOLEAN
Enable gpu shaders spirv.
Definition SDL3pp_render.h:3838
constexpr auto GPU_SHADERS_DXIL_BOOLEAN
Enable gpu shaders dxil.
Definition SDL3pp_render.h:3842
constexpr auto OUTPUT_COLORSPACE_NUMBER
Number for output colorspace.
Definition SDL3pp_render.h:3826
constexpr auto VULKAN_DEVICE_POINTER
Pointer to vulkan device.
Definition SDL3pp_render.h:3863
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_render.h:3817
constexpr auto VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER
Vulkan graphics queue family index number.
Definition SDL3pp_render.h:3866
constexpr auto VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER
Vulkan present queue family index number.
Definition SDL3pp_render.h:3874
constexpr auto GPU_DEVICE_POINTER
Pointer to gpu device.
Definition SDL3pp_render.h:3835
constexpr auto GPU_SHADERS_MSL_BOOLEAN
Enable gpu shaders msl.
Definition SDL3pp_render.h:3846
constexpr auto WINDOW_POINTER
Pointer to window.
Definition SDL3pp_render.h:3820
Properties for Renderer.
Definition SDL3pp_render.h:3815
constexpr auto WINDOW_POINTER
Pointer to window.
Definition SDL3pp_render.h:4146
constexpr auto VULKAN_PHYSICAL_DEVICE_POINTER
Pointer to vulkan physical device.
Definition SDL3pp_render.h:4205
constexpr auto TEXTURE_FORMATS_POINTER
Pointer to texture formats.
Definition SDL3pp_render.h:4158
constexpr auto MAX_TEXTURE_SIZE_NUMBER
Number for max texture size.
Definition SDL3pp_render.h:4155
constexpr auto D3D12_DEVICE_POINTER
Pointer to d3d12 device.
Definition SDL3pp_render.h:4189
constexpr auto VULKAN_SURFACE_NUMBER
Vulkan surface number.
Definition SDL3pp_render.h:4202
constexpr auto D3D11_DEVICE_POINTER
Pointer to d3d11 device.
Definition SDL3pp_render.h:4183
constexpr auto VULKAN_DEVICE_POINTER
Pointer to vulkan device.
Definition SDL3pp_render.h:4209
constexpr auto GPU_DEVICE_POINTER
Pointer to gpu device.
Definition SDL3pp_render.h:4229
constexpr auto SURFACE_POINTER
Pointer to surface.
Definition SDL3pp_render.h:4149
constexpr auto D3D12_SWAPCHAIN_POINTER
Pointer to d3d12 swapchain.
Definition SDL3pp_render.h:4192
constexpr auto D3D12_COMMAND_QUEUE_POINTER
Pointer to d3d12 command queue.
Definition SDL3pp_render.h:4195
constexpr auto SDR_WHITE_POINT_FLOAT
Float for sdr white point.
Definition SDL3pp_render.h:4174
constexpr auto VULKAN_INSTANCE_POINTER
Pointer to vulkan instance.
Definition SDL3pp_render.h:4199
constexpr auto HDR_ENABLED_BOOLEAN
Hdr enabled enabled.
Definition SDL3pp_render.h:4171
constexpr auto TEXTURE_WRAPPING_BOOLEAN
Texture wrapping enabled.
Definition SDL3pp_render.h:4163
constexpr auto VSYNC_NUMBER
Number for vsync.
Definition SDL3pp_render.h:4152
constexpr auto VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER
Number for vulkan graphics queue family index.
Definition SDL3pp_render.h:4212
constexpr auto D3D11_SWAPCHAIN_POINTER
Pointer to d3d11 swapchain.
Definition SDL3pp_render.h:4186
constexpr auto VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER
Number for vulkan present queue family index.
Definition SDL3pp_render.h:4219
constexpr auto VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER
Vulkan swapchain image count.
Definition SDL3pp_render.h:4225
constexpr auto HDR_HEADROOM_FLOAT
Float for hdr headroom.
Definition SDL3pp_render.h:4177
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_render.h:4143
constexpr auto D3D9_DEVICE_POINTER
Pointer to d3d9 device.
Definition SDL3pp_render.h:4180
constexpr auto OUTPUT_COLORSPACE_NUMBER
Number for output colorspace.
Definition SDL3pp_render.h:4168
Properties for Texture creation.
Definition SDL3pp_render.h:4584
constexpr auto PALETTE_POINTER
Pointer to palette.
Definition SDL3pp_render.h:4603
constexpr auto METAL_PIXELBUFFER_POINTER
Pointer to metal pixelbuffer.
Definition SDL3pp_render.h:4636
constexpr auto FORMAT_NUMBER
Number for format.
Definition SDL3pp_render.h:4589
constexpr auto WIDTH_NUMBER
Number for width.
Definition SDL3pp_render.h:4595
constexpr auto HEIGHT_NUMBER
Number for height.
Definition SDL3pp_render.h:4598
constexpr auto D3D12_TEXTURE_U_POINTER
Pointer to d3d12 texture u.
Definition SDL3pp_render.h:4628
constexpr auto OPENGLES2_TEXTURE_V_NUMBER
Opengles2 texture v number.
Definition SDL3pp_render.h:4667
constexpr auto SDR_WHITE_POINT_FLOAT
Float for sdr white point.
Definition SDL3pp_render.h:4608
constexpr auto D3D11_TEXTURE_POINTER
Pointer to d3d11 texture.
Definition SDL3pp_render.h:4614
constexpr auto OPENGL_TEXTURE_V_NUMBER
Opengl texture v number.
Definition SDL3pp_render.h:4651
constexpr auto COLORSPACE_NUMBER
Number for colorspace.
Definition SDL3pp_render.h:4586
constexpr auto GPU_TEXTURE_V_POINTER
Pointer to gpu texture v.
Definition SDL3pp_render.h:4690
constexpr auto D3D12_TEXTURE_POINTER
Pointer to d3d12 texture.
Definition SDL3pp_render.h:4625
constexpr auto OPENGL_TEXTURE_NUMBER
Opengl texture number.
Definition SDL3pp_render.h:4640
constexpr auto GPU_TEXTURE_POINTER
Pointer to gpu texture.
Definition SDL3pp_render.h:4680
constexpr auto GPU_TEXTURE_U_POINTER
Pointer to gpu texture u.
Definition SDL3pp_render.h:4687
constexpr auto OPENGLES2_TEXTURE_UV_NUMBER
Opengles2 texture uv number.
Definition SDL3pp_render.h:4659
constexpr auto D3D11_TEXTURE_U_POINTER
Pointer to d3d11 texture u.
Definition SDL3pp_render.h:4617
constexpr auto OPENGL_TEXTURE_U_NUMBER
Opengl texture u number.
Definition SDL3pp_render.h:4647
constexpr auto GPU_TEXTURE_UV_POINTER
Pointer to gpu texture uv.
Definition SDL3pp_render.h:4683
constexpr auto OPENGLES2_TEXTURE_NUMBER
Opengles2 texture number.
Definition SDL3pp_render.h:4655
constexpr auto HDR_HEADROOM_FLOAT
Float for hdr headroom.
Definition SDL3pp_render.h:4611
constexpr auto D3D11_TEXTURE_V_POINTER
Pointer to d3d11 texture v.
Definition SDL3pp_render.h:4621
constexpr auto OPENGLES2_TEXTURE_U_NUMBER
Opengles2 texture u number.
Definition SDL3pp_render.h:4663
constexpr auto D3D12_TEXTURE_V_POINTER
Pointer to d3d12 texture v.
Definition SDL3pp_render.h:4632
constexpr auto ACCESS_NUMBER
Number for access.
Definition SDL3pp_render.h:4592
constexpr auto OPENGL_TEXTURE_UV_NUMBER
Opengl texture uv number.
Definition SDL3pp_render.h:4643
constexpr auto VULKAN_TEXTURE_NUMBER
Vulkans texture number.
Definition SDL3pp_render.h:4671
constexpr auto VULKAN_LAYOUT_NUMBER
Number for vulkan layout.
Definition SDL3pp_render.h:4677
Properties for Texture.
Definition SDL3pp_render.h:4584
constexpr auto OPENGL_TEX_W_FLOAT
Float for opengl tex w.
Definition SDL3pp_render.h:4869
constexpr auto D3D11_TEXTURE_U_POINTER
Pointer to d3d11 texture u.
Definition SDL3pp_render.h:4838
constexpr auto SDR_WHITE_POINT_FLOAT
Float for sdr white point.
Definition SDL3pp_render.h:4829
constexpr auto WIDTH_NUMBER
Number for width.
Definition SDL3pp_render.h:4823
constexpr auto VULKAN_TEXTURE_NUMBER
Vulkan texture number.
Definition SDL3pp_render.h:4894
constexpr auto D3D11_TEXTURE_V_POINTER
Pointer to d3d11 texture v.
Definition SDL3pp_render.h:4841
constexpr auto OPENGLES2_TEXTURE_NUMBER
Opengles2 texture number.
Definition SDL3pp_render.h:4875
constexpr auto D3D12_TEXTURE_U_POINTER
Pointer to d3d12 texture u.
Definition SDL3pp_render.h:4847
constexpr auto D3D12_TEXTURE_POINTER
Pointer to d3d12 texture.
Definition SDL3pp_render.h:4844
constexpr auto OPENGL_TEXTURE_TARGET_NUMBER
Opengl texture target number.
Definition SDL3pp_render.h:4865
constexpr auto OPENGLES2_TEXTURE_TARGET_NUMBER
Opengles2 texture target number.
Definition SDL3pp_render.h:4890
constexpr auto OPENGLES2_TEXTURE_V_NUMBER
Opengles2 texture v number.
Definition SDL3pp_render.h:4886
constexpr auto COLORSPACE_NUMBER
Number for colorspace.
Definition SDL3pp_render.h:4814
constexpr auto OPENGL_TEXTURE_NUMBER
Opengl texture number.
Definition SDL3pp_render.h:4853
constexpr auto OPENGL_TEXTURE_V_NUMBER
Opengl texture v number.
Definition SDL3pp_render.h:4862
constexpr auto GPU_TEXTURE_V_POINTER
Pointer to gpu texture v.
Definition SDL3pp_render.h:4908
constexpr auto OPENGL_TEXTURE_UV_NUMBER
Opengl texture uv number.
Definition SDL3pp_render.h:4856
constexpr auto FORMAT_NUMBER
Number for format.
Definition SDL3pp_render.h:4817
constexpr auto OPENGL_TEX_H_FLOAT
Float for opengl tex h.
Definition SDL3pp_render.h:4872
constexpr auto OPENGLES2_TEXTURE_UV_NUMBER
Opengles2 texture uv number.
Definition SDL3pp_render.h:4878
constexpr auto OPENGL_TEXTURE_U_NUMBER
Opengl texture u number.
Definition SDL3pp_render.h:4859
constexpr auto GPU_TEXTURE_U_POINTER
Pointer to gpu texture u.
Definition SDL3pp_render.h:4905
constexpr auto HDR_HEADROOM_FLOAT
Float for hdr headroom.
Definition SDL3pp_render.h:4832
constexpr auto ACCESS_NUMBER
Number for access.
Definition SDL3pp_render.h:4820
constexpr auto GPU_TEXTURE_UV_POINTER
Pointer to gpu texture uv.
Definition SDL3pp_render.h:4902
constexpr auto OPENGLES2_TEXTURE_U_NUMBER
Opengles2 texture u number.
Definition SDL3pp_render.h:4882
constexpr auto D3D12_TEXTURE_V_POINTER
Pointer to d3d12 texture v.
Definition SDL3pp_render.h:4850
constexpr auto HEIGHT_NUMBER
Number for height.
Definition SDL3pp_render.h:4826
constexpr auto GPU_TEXTURE_POINTER
Pointer to gpu texture.
Definition SDL3pp_render.h:4899
constexpr auto D3D11_TEXTURE_POINTER
Pointer to d3d11 texture.
Definition SDL3pp_render.h:4835
Main include header for the SDL3pp library.
Sint32 narrowS32(T value)
Narrows to Sint32.
Definition SDL3pp_stdinc.h:6262
A structure that represents a color as RGBA components.
Definition SDL3pp_pixels.h:2121
The bits of this structure can be directly reinterpreted as a float-packed color which uses the PIXEL...
Definition SDL3pp_pixels.h:2294
The structure that defines a point (using floating point values).
Definition SDL3pp_rect.h:422
A rectangle stored using floating point values.
Definition SDL3pp_rect.h:1351
Base class to GPURenderState.
Definition SDL3pp_render.h:8087
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
A custom GPU render state.
Definition SDL3pp_render.h:8134
constexpr GPURenderState & operator=(GPURenderState &&other) noexcept
Assignment operator.
Definition SDL3pp_render.h:8179
~GPURenderState()
Destructor.
Definition SDL3pp_render.h:8176
constexpr GPURenderState(GPURenderState &&other) noexcept
Move constructor.
Definition SDL3pp_render.h:8150
constexpr GPURenderState(GPURenderStateRaw resource) noexcept
Constructs from raw GPURenderState.
Definition SDL3pp_render.h:8144
A set of indexed colors representing a palette.
Definition SDL3pp_pixels.h:2498
static Palette borrow(PaletteRaw resource)
Safely borrows the from PaletteRaw.
Definition SDL3pp_pixels.h:2551
The structure that defines a point (using integers).
Definition SDL3pp_rect.h:97
A rectangle, with the origin at the upper left (using integers).
Definition SDL3pp_rect.h:706
Base class to Renderer.
Definition SDL3pp_render.h:221
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
A structure representing rendering state.
Definition SDL3pp_render.h:2090
constexpr Renderer(Renderer &&other) noexcept
Move constructor.
Definition SDL3pp_render.h:2106
constexpr Renderer(RendererRaw resource) noexcept
Constructs from raw Renderer.
Definition SDL3pp_render.h:2100
constexpr Renderer & operator=(Renderer &&other) noexcept
Assignment operator.
Definition SDL3pp_render.h:2232
~Renderer()
Destructor.
Definition SDL3pp_render.h:2229
A non-owning reference wrapper for a given resource.
Definition SDL3pp_resource.h:93
A collection of pixels used in software blitting.
Definition SDL3pp_surface.h:1677
static Surface borrow(SurfaceRaw resource)
Safely borrows the from SurfaceRaw.
Definition SDL3pp_surface.h:1844
constexpr Surface & operator=(Surface &&other) noexcept
Assignment operator.
Definition SDL3pp_surface.h:1857
constexpr Surface(SurfaceRaw resource) noexcept
Constructs from raw Surface.
Definition SDL3pp_surface.h:1687
Base class to Texture.
Definition SDL3pp_render.h:2245
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
An efficient driver-specific representation of pixel data.
Definition SDL3pp_render.h:2999
constexpr Texture & operator=(Texture &&other) noexcept
Assignment operator.
Definition SDL3pp_render.h:3295
constexpr Texture(const Texture &other)
Copy constructor.
Definition SDL3pp_render.h:3015
Texture & operator=(const Texture &other)
Assignment operator.
Definition SDL3pp_render.h:3302
~Texture()
Destructor.
Definition SDL3pp_render.h:3292
static Texture borrow(TextureRaw resource)
Safely borrows the from TextureRaw.
Definition SDL3pp_render.h:3282
constexpr Texture(TextureRaw resource) noexcept
Constructs from raw Texture.
Definition SDL3pp_render.h:3009
constexpr Texture(Texture &&other) noexcept
Move constructor.
Definition SDL3pp_render.h:3021
The struct used as an opaque handle to a window.
Definition SDL3pp_video.h:2724