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_pixels.h"
8#include "SDL3pp_video.h"
9
10namespace SDL {
11
42// Forward decl
43struct Renderer;
44
46using RendererRaw = SDL_Renderer*;
47
48// Forward decl
49struct RendererRef;
50
53{
55
58 : value(value)
59 {
60 }
61
63 constexpr RendererParam(std::nullptr_t _ = nullptr)
64 : value(nullptr)
65 {
66 }
67
69 constexpr explicit operator bool() const { return !!value; }
70
72 constexpr auto operator<=>(const RendererParam& other) const = default;
73
75 constexpr operator RendererRaw() const { return value; }
76};
77
78// Forward decl
79struct Texture;
80
82using TextureRaw = SDL_Texture*;
83
86{
88
91 : value(value)
92 {
93 }
94
96 constexpr TextureParam(std::nullptr_t _ = nullptr)
97 : value(nullptr)
98 {
99 }
100
102 constexpr explicit operator bool() const { return !!value; }
103
105 constexpr auto operator<=>(const TextureParam& other) const = default;
106
108 constexpr operator TextureRaw() const { return value; }
109
111 constexpr auto operator->() { return value; }
112};
113
116{
118
121 : value(value)
122 {
123 }
124
127 : value(value.value)
128 {
129 }
130
132 constexpr TextureConstParam(std::nullptr_t _ = nullptr)
133 : value(nullptr)
134 {
135 }
136
138 constexpr explicit operator bool() const { return !!value; }
139
141 constexpr auto operator<=>(const TextureConstParam& other) const = default;
142
144 constexpr operator const TextureRaw() const { return value; }
145
147 constexpr auto operator->() { return value; }
148};
149
155constexpr auto SOFTWARE_RENDERER = SDL_SOFTWARE_RENDERER;
156
162using Vertex = SDL_Vertex;
163
169using TextureAccess = SDL_TextureAccess;
170
172 SDL_TEXTUREACCESS_STATIC;
173
175 SDL_TEXTUREACCESS_STREAMING;
176
178 SDL_TEXTUREACCESS_TARGET;
179
185using RendererLogicalPresentation = SDL_RendererLogicalPresentation;
186
188 SDL_LOGICAL_PRESENTATION_DISABLED;
189
192 SDL_LOGICAL_PRESENTATION_STRETCH;
193
199 SDL_LOGICAL_PRESENTATION_LETTERBOX;
200
206 SDL_LOGICAL_PRESENTATION_OVERSCAN;
207
213 SDL_LOGICAL_PRESENTATION_INTEGER_SCALE;
214
223{
224 RendererRaw m_resource = nullptr;
225
226public:
228 constexpr Renderer(std::nullptr_t = nullptr) noexcept
229 : m_resource(0)
230 {
231 }
232
240 constexpr explicit Renderer(const RendererRaw resource) noexcept
241 : m_resource(resource)
242 {
243 }
244
246 constexpr Renderer(const Renderer& other) = delete;
247
249 constexpr Renderer(Renderer&& other) noexcept
250 : Renderer(other.release())
251 {
252 }
253
254 constexpr Renderer(const RendererRef& other) = delete;
255
256 constexpr Renderer(RendererRef&& other) = delete;
257
290 : m_resource(CheckError(SDL_CreateRenderer(window, nullptr)))
291 {
292 }
293
327 : m_resource(CheckError(SDL_CreateRenderer(window, name)))
328 {
329 }
330
382 : m_resource(CheckError(SDL_CreateRendererWithProperties(props)))
383 {
384 }
385
405 : m_resource(CheckError(SDL_CreateSoftwareRenderer(surface)))
406 {
407 }
408
410 ~Renderer() { SDL_DestroyRenderer(m_resource); }
411
413 constexpr Renderer& operator=(Renderer&& other) noexcept
414 {
415 std::swap(m_resource, other.m_resource);
416 return *this;
417 }
418
419protected:
421 constexpr Renderer& operator=(const Renderer& other) noexcept = default;
422
423public:
425 constexpr RendererRaw get() const noexcept { return m_resource; }
426
428 constexpr RendererRaw release() noexcept
429 {
430 auto r = m_resource;
431 m_resource = nullptr;
432 return r;
433 }
434
436 constexpr auto operator<=>(const Renderer& other) const noexcept = default;
437
439 constexpr explicit operator bool() const noexcept { return !!m_resource; }
440
442 constexpr operator RendererParam() const noexcept { return {m_resource}; }
443
456 void Destroy();
457
469
482 const char* GetName() const;
483
567
587 void GetOutputSize(int* w, int* h) const;
588
605 Point GetOutputSize() const;
606
626 void GetCurrentOutputSize(int* w, int* h) const;
627
647
670 TextureAccess access,
671 const PointRaw& size);
672
698
807
831 void SetTarget(TextureParam texture);
832
847 void ResetTarget();
848
864 Texture GetTarget() const;
865
916 void SetLogicalPresentation(const PointRaw& size,
918
939 void GetLogicalPresentation(int* w,
940 int* h,
941 RendererLogicalPresentation* mode) const;
942
961
983
1005 FPoint RenderCoordinatesFromWindow(const FPointRaw& window_coord) const;
1006
1029 FPoint RenderCoordinatesToWindow(const FPointRaw& coord) const;
1030
1063 void ConvertEventToRenderCoordinates(Event* event) const;
1064
1089
1105 void ResetViewport();
1106
1123 Rect GetViewport() const;
1124
1144 bool ViewportSet() const;
1145
1163 Rect GetSafeArea() const;
1164
1184
1200 void ResetClipRect();
1201
1219 Rect GetClipRect() const;
1220
1237 bool IsClipEnabled() const;
1238
1262 void SetScale(const FPointRaw& scale);
1263
1280 void GetScale(float* scaleX, float* scaleY) const;
1281
1297 FPoint GetScale() const;
1298
1315 void SetDrawColor(ColorRaw c);
1316
1333 void SetDrawColorFloat(const FColorRaw& c);
1334
1355 void GetDrawColor(Uint8* r, Uint8* g, Uint8* b, Uint8* a) const;
1356
1370 Color GetDrawColor() const;
1371
1392 void GetDrawColorFloat(float* r, float* g, float* b, float* a) const;
1393
1407 FColor GetDrawColorFloat() const;
1408
1429 void SetColorScale(float scale);
1430
1443 float GetColorScale() const;
1444
1459 void SetDrawBlendMode(BlendMode blendMode);
1460
1474
1491 void RenderClear();
1492
1505 void RenderPoint(const FPointRaw& p);
1506
1520
1534 void RenderLine(const FPointRaw& p1, const FPointRaw& p2);
1535
1550
1565
1580
1596
1611
1630 void RenderTexture(TextureParam texture,
1633
1661 double angle,
1663 FlipMode flip = FlipMode::SDL_FLIP_NONE);
1664
1689 void RenderTextureAffine(TextureParam texture,
1694
1718 void RenderTextureTiled(TextureParam texture,
1720 float scale,
1722
1753 void RenderTexture9Grid(TextureParam texture,
1755 float left_width,
1756 float right_width,
1757 float top_height,
1758 float bottom_height,
1759 float scale,
1761
1780 void RenderGeometry(TextureParam texture,
1781 std::span<const Vertex> vertices,
1782 std::span<const int> indices = {});
1783
1810 void RenderGeometryRaw(TextureParam texture,
1811 const float* xy,
1812 int xy_stride,
1813 const FColor* color,
1814 int color_stride,
1815 const float* uv,
1816 int uv_stride,
1817 int num_vertices,
1818 const void* indices,
1819 int num_indices,
1820 int size_indices);
1821
1846 Surface ReadPixels(OptionalRef<const RectRaw> rect = {}) const;
1847
1894 void Present();
1895
1925 void Flush();
1926
1942 void* GetRenderMetalLayer();
1943
1965
1992 void AddVulkanRenderSemaphores(Uint32 wait_stage_mask,
1993 Sint64 wait_semaphore,
1994 Sint64 signal_semaphore);
1995
2017 void SetVSync(int vsync);
2018
2031 int GetVSync() const;
2032
2070 void RenderDebugText(const FPointRaw& p, StringParam str);
2071
2097 template<class... ARGS>
2098 void RenderDebugTextFormat(const FPointRaw& p,
2099 std::string_view fmt,
2100 ARGS... args);
2101};
2102
2105{
2106 using Renderer::Renderer;
2107
2115 RendererRef(RendererParam resource) noexcept
2116 : Renderer(resource.value)
2117 {
2118 }
2119
2127 RendererRef(RendererRaw resource) noexcept
2128 : Renderer(resource)
2129 {
2130 }
2131
2133 RendererRef(const RendererRef& other) noexcept
2134 : Renderer(other.get())
2135 {
2136 }
2137
2140};
2141
2155{
2156 TextureRaw m_resource = nullptr;
2157
2158public:
2160 constexpr Texture(std::nullptr_t = nullptr) noexcept
2161 : m_resource(0)
2162 {
2163 }
2164
2172 constexpr explicit Texture(const TextureRaw resource) noexcept
2173 : m_resource(resource)
2174 {
2175 }
2176
2178 constexpr Texture(const Texture& other) { ++m_resource->refcount; }
2179
2181 constexpr Texture(Texture&& other) noexcept
2182 : Texture(other.release())
2183 {
2184 }
2185
2208 PixelFormat format,
2209 TextureAccess access,
2210 const PointRaw& size)
2211 : m_resource(
2212 CheckError(SDL_CreateTexture(renderer, format, access, size.x, size.y)))
2213 {
2214 }
2215
2240 : m_resource(CheckError(SDL_CreateTextureFromSurface(renderer, surface)))
2241 {
2242 }
2243
2352 : m_resource(CheckError(SDL_CreateTextureWithProperties(renderer, props)))
2353 {
2354 }
2355
2385 Texture(RendererParam renderer, StringParam file);
2386
2428 Texture(RendererParam renderer, IOStreamParam src, bool closeio = false);
2429
2437 static constexpr Texture Borrow(TextureParam resource)
2438 {
2439 if (resource) {
2440 ++resource.value->refcount;
2441 return Texture(resource.value);
2442 }
2443 return {};
2444 }
2445
2447 constexpr const TextureRaw operator->() const noexcept { return m_resource; }
2448
2450 constexpr TextureRaw operator->() noexcept { return m_resource; }
2451
2453 ~Texture() { SDL_DestroyTexture(m_resource); }
2454
2456 constexpr Texture& operator=(Texture&& other) noexcept
2457 {
2458 std::swap(m_resource, other.m_resource);
2459 return *this;
2460 }
2461
2463 constexpr Texture& operator=(const Texture& other) noexcept = default;
2464
2466 constexpr TextureRaw get() const noexcept { return m_resource; }
2467
2469 constexpr TextureRaw release() noexcept
2470 {
2471 auto r = m_resource;
2472 m_resource = nullptr;
2473 return r;
2474 }
2475
2477 constexpr auto operator<=>(const Texture& other) const noexcept = default;
2478
2480 constexpr explicit operator bool() const noexcept { return !!m_resource; }
2481
2483 constexpr operator TextureParam() const noexcept { return {m_resource}; }
2484
2498 void Destroy();
2499
2586
2597 RendererRef GetRenderer() const;
2598
2612 void GetSize(float* w, float* h) const;
2613
2615 Point GetSize() const;
2616
2618 FPoint GetSizeFloat() const;
2619
2621 int GetWidth() const;
2622
2624 int GetHeight() const;
2625
2627 PixelFormat GetFormat() const;
2628
2654 void SetColorMod(Uint8 r, Uint8 g, Uint8 b);
2655
2681 void SetColorModFloat(float r, float g, float b);
2682
2699 void GetColorMod(Uint8* r, Uint8* g, Uint8* b) const;
2700
2717 void GetColorModFloat(float* r, float* g, float* b) const;
2718
2741 void SetAlphaMod(Uint8 alpha);
2742
2765 void SetAlphaModFloat(float alpha);
2766
2781 Uint8 GetAlphaMod() const;
2782
2797 float GetAlphaModFloat() const;
2798
2821 void SetMod(Color c);
2822
2845 void SetModFloat(FColor c);
2846
2860 Color GetMod() const;
2861
2875 FColor GetModFloat() const;
2876
2892 void SetBlendMode(BlendMode blendMode);
2893
2906 BlendMode GetBlendMode() const;
2907
2924 void SetScaleMode(ScaleMode scaleMode);
2925
2938 ScaleMode GetScaleMode() const;
2939
2970 void Update(OptionalRef<const RectRaw> rect, const void* pixels, int pitch);
2971
3001 void Update(SurfaceConstParam surface,
3002 OptionalRef<const RectRaw> rect = std::nullopt);
3003
3033 const Uint8* Yplane,
3034 int Ypitch,
3035 const Uint8* Uplane,
3036 int Upitch,
3037 const Uint8* Vplane,
3038 int Vpitch);
3039
3065 const Uint8* Yplane,
3066 int Ypitch,
3067 const Uint8* UVplane,
3068 int UVpitch);
3069
3095 void Lock(OptionalRef<const SDL_Rect> rect, void** pixels, int* pitch);
3096
3128
3146 void Unlock();
3147};
3148
3167inline int GetNumRenderDrivers() { return SDL_GetNumRenderDrivers(); }
3168
3191inline const char* GetRenderDriver(int index)
3192{
3193 return SDL_GetRenderDriver(index);
3194}
3195
3213inline std::pair<Window, Renderer> CreateWindowAndRenderer(
3214 StringParam title,
3215 const PointRaw& size,
3216 WindowFlags window_flags = 0)
3217{
3218 SDL_Window* window = nullptr;
3219 SDL_Renderer* renderer = nullptr;
3220 CheckError(SDL_CreateWindowAndRenderer(
3221 title, size.x, size.y, window_flags, &window, &renderer));
3222 return {Window{window}, Renderer(renderer)};
3223}
3224
3259{
3260 return Renderer(window, std::move(name));
3261}
3262
3315{
3316 return Renderer(props);
3317}
3318
3319namespace prop::Renderer {
3320
3321constexpr auto CREATE_NAME_STRING = SDL_PROP_RENDERER_CREATE_NAME_STRING;
3322
3323constexpr auto CREATE_WINDOW_POINTER = SDL_PROP_RENDERER_CREATE_WINDOW_POINTER;
3324
3325constexpr auto CREATE_SURFACE_POINTER =
3326 SDL_PROP_RENDERER_CREATE_SURFACE_POINTER;
3327
3328constexpr auto CREATE_OUTPUT_COLORSPACE_NUMBER =
3329 SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER;
3330
3331constexpr auto CREATE_PRESENT_VSYNC_NUMBER =
3332 SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER;
3333
3334constexpr auto CREATE_VULKAN_INSTANCE_POINTER =
3335 SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER;
3336
3337constexpr auto CREATE_VULKAN_SURFACE_NUMBER =
3338 SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER;
3339
3340constexpr auto CREATE_VULKAN_PHYSICAL_DEVICE_POINTER =
3341 SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER;
3342
3343constexpr auto CREATE_VULKAN_DEVICE_POINTER =
3344 SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER;
3345
3346constexpr auto CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER =
3347 SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER;
3348
3349constexpr auto CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER =
3350 SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER;
3351
3352constexpr auto NAME_STRING = SDL_PROP_RENDERER_NAME_STRING;
3353
3354constexpr auto WINDOW_POINTER = SDL_PROP_RENDERER_WINDOW_POINTER;
3355
3356constexpr auto SURFACE_POINTER = SDL_PROP_RENDERER_SURFACE_POINTER;
3357
3358constexpr auto VSYNC_NUMBER = SDL_PROP_RENDERER_VSYNC_NUMBER;
3359
3360constexpr auto MAX_TEXTURE_SIZE_NUMBER =
3361 SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER;
3362
3363constexpr auto TEXTURE_FORMATS_POINTER =
3364 SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER;
3365
3366constexpr auto OUTPUT_COLORSPACE_NUMBER =
3367 SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER;
3368
3369constexpr auto HDR_ENABLED_BOOLEAN = SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN;
3370
3371constexpr auto SDR_WHITE_POINT_FLOAT = SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT;
3372
3373constexpr auto HDR_HEADROOM_FLOAT = SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT;
3374
3375constexpr auto D3D9_DEVICE_POINTER = SDL_PROP_RENDERER_D3D9_DEVICE_POINTER;
3376
3377constexpr auto D3D11_DEVICE_POINTER = SDL_PROP_RENDERER_D3D11_DEVICE_POINTER;
3378
3379constexpr auto D3D11_SWAPCHAIN_POINTER =
3380 SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER;
3381
3382constexpr auto D3D12_DEVICE_POINTER = SDL_PROP_RENDERER_D3D12_DEVICE_POINTER;
3383
3384constexpr auto D3D12_SWAPCHAIN_POINTER =
3385 SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER;
3386
3387constexpr auto D3D12_COMMAND_QUEUE_POINTER =
3388 SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER;
3389
3390constexpr auto VULKAN_INSTANCE_POINTER =
3391 SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER;
3392
3393constexpr auto VULKAN_SURFACE_NUMBER = SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER;
3394
3395constexpr auto VULKAN_PHYSICAL_DEVICE_POINTER =
3396 SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER;
3397
3398constexpr auto VULKAN_DEVICE_POINTER = SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER;
3399
3400constexpr auto VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER =
3401 SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER;
3402
3403constexpr auto VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER =
3404 SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER;
3405
3406constexpr auto VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER =
3407 SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER;
3408
3409constexpr auto GPU_DEVICE_POINTER = SDL_PROP_RENDERER_GPU_DEVICE_POINTER;
3410
3411} // namespace prop::Renderer
3412
3433{
3434 return Renderer(surface);
3435}
3436
3438{
3439 return {CheckError(SDL_GetRenderer(m_resource))};
3440}
3441
3454{
3455 return {CheckError(SDL_GetRenderWindow(renderer))};
3456}
3457
3459{
3460 return SDL::GetRenderWindow(m_resource);
3461}
3462
3477inline const char* GetRendererName(RendererParam renderer)
3478{
3479 return SDL_GetRendererName(renderer);
3480}
3481
3482inline const char* Renderer::GetName() const
3483{
3484 return SDL::GetRendererName(m_resource);
3485}
3486
3571{
3572 return {CheckError(SDL_GetRendererProperties(renderer))};
3573}
3574
3576{
3577 return SDL::GetRendererProperties(m_resource);
3578}
3579
3600inline void GetRenderOutputSize(RendererParam renderer, int* w, int* h)
3601{
3602 CheckError(SDL_GetRenderOutputSize(renderer, w, h));
3603}
3604
3625{
3626 Point p;
3627 GetRenderOutputSize(renderer, &p.x, &p.y);
3628 return p;
3629}
3630
3631inline void Renderer::GetOutputSize(int* w, int* h) const
3632{
3633 SDL::GetRenderOutputSize(m_resource, w, h);
3634}
3635
3637{
3638 return SDL::GetRenderOutputSize(m_resource);
3639}
3640
3661inline void GetCurrentRenderOutputSize(RendererParam renderer, int* w, int* h)
3662{
3663 CheckError(SDL_GetCurrentRenderOutputSize(renderer, w, h));
3664}
3665
3686{
3687 Point p;
3688 GetCurrentRenderOutputSize(renderer, &p.x, &p.y);
3689 return p;
3690}
3691
3692inline void Renderer::GetCurrentOutputSize(int* w, int* h) const
3693{
3694 SDL::GetCurrentRenderOutputSize(m_resource, w, h);
3695}
3696
3698{
3699 return SDL::GetCurrentRenderOutputSize(m_resource);
3700}
3701
3725 PixelFormat format,
3726 TextureAccess access,
3727 const PointRaw& size)
3728{
3729 return Texture(renderer, format, access, size);
3730}
3731
3733 TextureAccess access,
3734 const PointRaw& size)
3735{
3736 return Texture(m_resource, format, access, size);
3737}
3738
3765 SurfaceParam surface)
3766{
3767 return Texture(renderer, surface);
3768}
3769
3771{
3772 return Texture(m_resource, surface);
3773}
3774
3884 PropertiesParam props)
3885{
3886 return Texture(renderer, props);
3887}
3888
3890{
3891 return Texture(m_resource, props);
3892}
3893
3894namespace prop::Texture {
3895
3896constexpr auto CREATE_COLORSPACE_NUMBER =
3897 SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER;
3898
3899constexpr auto CREATE_FORMAT_NUMBER = SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER;
3900
3901constexpr auto CREATE_ACCESS_NUMBER = SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER;
3902
3903constexpr auto CREATE_WIDTH_NUMBER = SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER;
3904
3905constexpr auto CREATE_HEIGHT_NUMBER = SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER;
3906
3907constexpr auto CREATE_SDR_WHITE_POINT_FLOAT =
3908 SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT;
3909
3910constexpr auto CREATE_HDR_HEADROOM_FLOAT =
3911 SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT;
3912
3913constexpr auto CREATE_D3D11_TEXTURE_POINTER =
3914 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER;
3915
3916constexpr auto CREATE_D3D11_TEXTURE_U_POINTER =
3917 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER;
3918
3919constexpr auto CREATE_D3D11_TEXTURE_V_POINTER =
3920 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER;
3921
3922constexpr auto CREATE_D3D12_TEXTURE_POINTER =
3923 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER;
3924
3925constexpr auto CREATE_D3D12_TEXTURE_U_POINTER =
3926 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER;
3927
3928constexpr auto CREATE_D3D12_TEXTURE_V_POINTER =
3929 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER;
3930
3931constexpr auto CREATE_METAL_PIXELBUFFER_POINTER =
3932 SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER;
3933
3934constexpr auto CREATE_OPENGL_TEXTURE_NUMBER =
3935 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER;
3936
3937constexpr auto CREATE_OPENGL_TEXTURE_UV_NUMBER =
3938 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER;
3939
3940constexpr auto CREATE_OPENGL_TEXTURE_U_NUMBER =
3941 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER;
3942
3943constexpr auto CREATE_OPENGL_TEXTURE_V_NUMBER =
3944 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER;
3945
3946constexpr auto CREATE_OPENGLES2_TEXTURE_NUMBER =
3947 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER;
3948
3949constexpr auto CREATE_OPENGLES2_TEXTURE_UV_NUMBER =
3950 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER;
3951
3952constexpr auto CREATE_OPENGLES2_TEXTURE_U_NUMBER =
3953 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER;
3954
3955constexpr auto CREATE_OPENGLES2_TEXTURE_V_NUMBER =
3956 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER;
3957
3958constexpr auto CREATE_VULKAN_TEXTURE_NUMBER =
3959 SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER;
3960
3961constexpr auto COLORSPACE_NUMBER = SDL_PROP_TEXTURE_COLORSPACE_NUMBER;
3962
3963constexpr auto FORMAT_NUMBER = SDL_PROP_TEXTURE_FORMAT_NUMBER;
3964
3965constexpr auto ACCESS_NUMBER = SDL_PROP_TEXTURE_ACCESS_NUMBER;
3966
3967constexpr auto WIDTH_NUMBER = SDL_PROP_TEXTURE_WIDTH_NUMBER;
3968
3969constexpr auto HEIGHT_NUMBER = SDL_PROP_TEXTURE_HEIGHT_NUMBER;
3970
3971constexpr auto SDR_WHITE_POINT_FLOAT = SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT;
3972
3973constexpr auto HDR_HEADROOM_FLOAT = SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT;
3974
3975constexpr auto D3D11_TEXTURE_POINTER = SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER;
3976
3977constexpr auto D3D11_TEXTURE_U_POINTER =
3978 SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER;
3979
3980constexpr auto D3D11_TEXTURE_V_POINTER =
3981 SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER;
3982
3983constexpr auto D3D12_TEXTURE_POINTER = SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER;
3984
3985constexpr auto D3D12_TEXTURE_U_POINTER =
3986 SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER;
3987
3988constexpr auto D3D12_TEXTURE_V_POINTER =
3989 SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER;
3990
3991constexpr auto OPENGL_TEXTURE_NUMBER = SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER;
3992
3993constexpr auto OPENGL_TEXTURE_UV_NUMBER =
3994 SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER;
3995
3996constexpr auto OPENGL_TEXTURE_U_NUMBER =
3997 SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER;
3998
3999constexpr auto OPENGL_TEXTURE_V_NUMBER =
4000 SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER;
4001
4002constexpr auto OPENGL_TEXTURE_TARGET_NUMBER =
4003 SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER;
4004
4005constexpr auto OPENGL_TEX_W_FLOAT = SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT;
4006
4007constexpr auto OPENGL_TEX_H_FLOAT = SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT;
4008
4009constexpr auto OPENGLES2_TEXTURE_NUMBER =
4010 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER;
4011
4012constexpr auto OPENGLES2_TEXTURE_UV_NUMBER =
4013 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER;
4014
4015constexpr auto OPENGLES2_TEXTURE_U_NUMBER =
4016 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER;
4017
4018constexpr auto OPENGLES2_TEXTURE_V_NUMBER =
4019 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER;
4020
4021constexpr auto OPENGLES2_TEXTURE_TARGET_NUMBER =
4022 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER;
4023
4024constexpr auto VULKAN_TEXTURE_NUMBER = SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER;
4025
4026} // namespace prop::Texture
4027
4113{
4114 return {CheckError(SDL_GetTextureProperties(texture))};
4115}
4116
4118{
4119 return SDL::GetTextureProperties(m_resource);
4120}
4121
4134{
4135 return {SDL_GetRendererFromTexture(texture)};
4136}
4137
4139{
4140 return SDL::GetRendererFromTexture(m_resource);
4141}
4142
4157inline void GetTextureSize(TextureConstParam texture, float* w, float* h)
4158{
4159 CheckError(SDL_GetTextureSize(texture, w, h));
4160}
4161
4164{
4165 return Point(texture->w, texture->h);
4166}
4167
4168inline void Texture::GetSize(float* w, float* h) const
4169{
4170 SDL::GetTextureSize(m_resource, w, h);
4171}
4172
4174{
4175 return SDL::GetTextureSize(m_resource);
4176}
4177
4180{
4181 FPoint p;
4182 GetTextureSize(texture, &p.x, &p.y);
4183 return p;
4184}
4185
4187{
4188 return SDL::GetTextureSizeFloat(m_resource);
4189}
4190
4192inline int GetTextureWidth(TextureConstParam texture) { return texture->w; }
4193
4194inline int Texture::GetWidth() const
4195{
4196 return SDL::GetTextureWidth(m_resource);
4197}
4198
4200inline int GetTextureHeight(TextureConstParam texture) { return texture->h; }
4201
4202inline int Texture::GetHeight() const
4203{
4204 return SDL::GetTextureHeight(m_resource);
4205}
4206
4209{
4210 return texture->format;
4211}
4212
4214{
4215 return SDL::GetTextureFormat(m_resource);
4216}
4217
4244inline void SetTextureColorMod(TextureParam texture, Uint8 r, Uint8 g, Uint8 b)
4245{
4246 CheckError(SDL_SetTextureColorMod(texture, r, g, b));
4247}
4248
4250{
4251 SDL::SetTextureColorMod(m_resource, r, g, b);
4252}
4253
4281 float r,
4282 float g,
4283 float b)
4284{
4285 CheckError(SDL_SetTextureColorModFloat(texture, r, g, b));
4286}
4287
4288inline void Texture::SetColorModFloat(float r, float g, float b)
4289{
4290 SDL::SetTextureColorModFloat(m_resource, r, g, b);
4291}
4292
4311 Uint8* r,
4312 Uint8* g,
4313 Uint8* b)
4314{
4315 CheckError(SDL_GetTextureColorMod(texture, r, g, b));
4316}
4317
4318inline void Texture::GetColorMod(Uint8* r, Uint8* g, Uint8* b) const
4319{
4320 SDL::GetTextureColorMod(m_resource, r, g, b);
4321}
4322
4341 float* r,
4342 float* g,
4343 float* b)
4344{
4345 CheckError(SDL_GetTextureColorModFloat(texture, r, g, b));
4346}
4347
4348inline void Texture::GetColorModFloat(float* r, float* g, float* b) const
4349{
4350 SDL::GetTextureColorModFloat(m_resource, r, g, b);
4351}
4352
4376inline void SetTextureAlphaMod(TextureParam texture, Uint8 alpha)
4377{
4378 CheckError(SDL_SetTextureAlphaMod(texture, alpha));
4379}
4380
4381inline void Texture::SetAlphaMod(Uint8 alpha)
4382{
4383 SDL::SetTextureAlphaMod(m_resource, alpha);
4384}
4385
4409inline void SetTextureAlphaModFloat(TextureParam texture, float alpha)
4410{
4411 CheckError(SDL_SetTextureAlphaModFloat(texture, alpha));
4412}
4413
4414inline void Texture::SetAlphaModFloat(float alpha)
4415{
4416 SDL::SetTextureAlphaModFloat(m_resource, alpha);
4417}
4418
4435{
4436 Uint8 alpha;
4437 CheckError(SDL_GetTextureAlphaMod(texture, &alpha));
4438 return alpha;
4439}
4440
4442{
4443 return SDL::GetTextureAlphaMod(m_resource);
4444}
4445
4462{
4463 float alpha;
4464 CheckError(SDL_GetTextureAlphaModFloat(texture, &alpha));
4465 return alpha;
4466}
4467
4468inline float Texture::GetAlphaModFloat() const
4469{
4470 return SDL::GetTextureAlphaModFloat(m_resource);
4471}
4472
4496inline void SetTextureMod(TextureParam texture, Color c)
4497{
4498 SetTextureColorMod(texture, c.r, c.g, c.b);
4499 SetTextureAlphaMod(texture, c.a);
4500}
4501
4502inline void Texture::SetMod(Color c) { SDL::SetTextureMod(m_resource, c); }
4503
4528{
4529 SetTextureColorModFloat(texture, c.r, c.g, c.b);
4530 SetTextureAlphaModFloat(texture, c.a);
4531}
4532
4534{
4535 SDL::SetTextureModFloat(m_resource, c);
4536}
4537
4553{
4554 Color c;
4555 GetTextureColorMod(texture, &c.r, &c.g, &c.b);
4556 c.a = GetTextureAlphaMod(texture);
4557 return c;
4558}
4559
4560inline Color Texture::GetMod() const { return SDL::GetTextureMod(m_resource); }
4561
4577{
4578 FColor c;
4579 GetTextureColorModFloat(texture, &c.r, &c.g, &c.b);
4580 c.a = GetTextureAlphaModFloat(texture);
4581 return c;
4582}
4583
4585{
4586 return SDL::GetTextureModFloat(m_resource);
4587}
4588
4605inline void SetTextureBlendMode(TextureParam texture, BlendMode blendMode)
4606{
4607 CheckError(SDL_SetTextureBlendMode(texture, blendMode));
4608}
4609
4610inline void Texture::SetBlendMode(BlendMode blendMode)
4611{
4612 SDL::SetTextureBlendMode(m_resource, blendMode);
4613}
4614
4629{
4630 BlendMode blendMode;
4631 CheckError(SDL_GetTextureBlendMode(texture, &blendMode));
4632 return blendMode;
4633}
4634
4636{
4637 return SDL::GetTextureBlendMode(m_resource);
4638}
4639
4657inline void SetTextureScaleMode(TextureParam texture, ScaleMode scaleMode)
4658{
4659 CheckError(SDL_SetTextureScaleMode(texture, scaleMode));
4660}
4661
4662inline void Texture::SetScaleMode(ScaleMode scaleMode)
4663{
4664 SDL::SetTextureScaleMode(m_resource, scaleMode);
4665}
4666
4681{
4682 ScaleMode scaleMode;
4683 CheckError(SDL_GetTextureScaleMode(texture, &scaleMode));
4684 return scaleMode;
4685}
4686
4688{
4689 return SDL::GetTextureScaleMode(m_resource);
4690}
4691
4723inline void UpdateTexture(TextureParam texture,
4725 const void* pixels,
4726 int pitch)
4727{
4728 CheckError(SDL_UpdateTexture(texture, rect, pixels, pitch));
4729}
4730
4761inline void UpdateTexture(TextureParam texture,
4762 SurfaceConstParam surface,
4763 OptionalRef<const RectRaw> rect = std::nullopt)
4764{
4765 UpdateTexture(texture, rect, surface->pixels, surface->pitch);
4766}
4767
4769 const void* pixels,
4770 int pitch)
4771{
4772 SDL::UpdateTexture(m_resource, rect, pixels, pitch);
4773}
4774
4777{
4778 SDL::UpdateTexture(m_resource, surface, rect);
4779}
4780
4806inline void UpdateYUVTexture(TextureParam texture,
4808 const Uint8* Yplane,
4809 int Ypitch,
4810 const Uint8* Uplane,
4811 int Upitch,
4812 const Uint8* Vplane,
4813 int Vpitch)
4814{
4815 CheckError(SDL_UpdateYUVTexture(
4816 texture, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch));
4817}
4818
4820 const Uint8* Yplane,
4821 int Ypitch,
4822 const Uint8* Uplane,
4823 int Upitch,
4824 const Uint8* Vplane,
4825 int Vpitch)
4826{
4828 m_resource, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch);
4829}
4830
4855inline void UpdateNVTexture(TextureParam texture,
4857 const Uint8* Yplane,
4858 int Ypitch,
4859 const Uint8* UVplane,
4860 int UVpitch)
4861{
4862 CheckError(
4863 SDL_UpdateNVTexture(texture, rect, Yplane, Ypitch, UVplane, UVpitch));
4864}
4865
4867 const Uint8* Yplane,
4868 int Ypitch,
4869 const Uint8* UVplane,
4870 int UVpitch)
4871{
4872 SDL::UpdateNVTexture(m_resource, rect, Yplane, Ypitch, UVplane, UVpitch);
4873}
4874
4902inline void LockTexture(TextureParam texture,
4904 void** pixels,
4905 int* pitch)
4906{
4907 CheckError(SDL_LockTexture(texture, rect, pixels, pitch));
4908}
4909
4911 void** pixels,
4912 int* pitch)
4913{
4914 SDL::LockTexture(m_resource, rect, pixels, pitch);
4915}
4916
4949 TextureParam texture,
4950 OptionalRef<const SDL_Rect> rect = std::nullopt)
4951{
4952 SurfaceRaw surface = nullptr;
4953 CheckError(SDL_LockTextureToSurface(texture, rect, &surface));
4954 return Surface::Borrow(surface);
4955}
4956
4958{
4959 return SDL::LockTextureToSurface(m_resource, rect);
4960}
4961
4981inline void UnlockTexture(TextureParam texture) { SDL_UnlockTexture(texture); }
4982
4983inline void Texture::Unlock() { SDL::UnlockTexture(m_resource); }
4984
5009inline void SetRenderTarget(RendererParam renderer, TextureParam texture)
5010{
5011 CheckError(SDL_SetRenderTarget(renderer, texture));
5012}
5013
5015{
5016 SDL::SetRenderTarget(m_resource, texture);
5017}
5018
5035{
5036 SetRenderTarget(renderer, nullptr);
5037}
5038
5039inline void Renderer::ResetTarget() { SDL::ResetRenderTarget(m_resource); }
5040
5057{
5058 TextureRaw texture = SDL_GetRenderTarget(renderer);
5059 if (texture) return Texture::Borrow(texture);
5060 return {};
5061}
5062
5064{
5065 return SDL::GetRenderTarget(m_resource);
5066}
5067
5120 const PointRaw& size,
5122{
5123 CheckError(SDL_SetRenderLogicalPresentation(renderer, size.x, size.y, mode));
5124}
5125
5128{
5129 SDL::SetRenderLogicalPresentation(m_resource, size, mode);
5130}
5131
5154 int* w,
5155 int* h,
5157{
5158 CheckError(SDL_GetRenderLogicalPresentation(renderer, w, h, mode));
5159}
5160
5182 PointRaw* size,
5184{
5185 if (size) {
5186 return GetRenderLogicalPresentation(renderer, &size->x, &size->y, mode);
5187 }
5188 return GetRenderLogicalPresentation(renderer, nullptr, nullptr, mode);
5189}
5190
5192 int* w,
5193 int* h,
5194 RendererLogicalPresentation* mode) const
5195{
5196 SDL::GetRenderLogicalPresentation(m_resource, w, h, mode);
5197}
5198
5201{
5202 SDL::GetRenderLogicalPresentation(m_resource, size, mode);
5203}
5204
5226{
5227 FRect rect;
5228 CheckError(SDL_GetRenderLogicalPresentationRect(renderer, &rect));
5229 return rect;
5230}
5231
5233{
5234 return SDL::GetRenderLogicalPresentationRect(m_resource);
5235}
5236
5260 const FPointRaw& window_coord)
5261{
5262 FPoint p;
5263 CheckError(SDL_RenderCoordinatesFromWindow(
5264 renderer, window_coord.x, window_coord.y, &p.x, &p.y));
5265 return p;
5266}
5267
5269 const FPointRaw& window_coord) const
5270{
5271 return SDL::RenderCoordinatesFromWindow(m_resource, window_coord);
5272}
5273
5298 const FPointRaw& coord)
5299{
5300 FPoint p;
5301 CheckError(
5302 SDL_RenderCoordinatesToWindow(renderer, coord.x, coord.y, &p.x, &p.y));
5303 return p;
5304}
5305
5307{
5308 return SDL::RenderCoordinatesToWindow(m_resource, coord);
5309}
5310
5344 Event* event)
5345{
5346 CheckError(SDL_ConvertEventToRenderCoordinates(renderer, event));
5347}
5348
5350{
5351 SDL::ConvertEventToRenderCoordinates(m_resource, event);
5352}
5353
5380{
5381 CheckError(SDL_SetRenderViewport(renderer, rect));
5382}
5383
5385{
5386 SDL::SetRenderViewport(m_resource, rect);
5387}
5388
5406{
5407 SetRenderViewport(renderer, std::nullopt);
5408}
5409
5411
5430{
5431 Rect rect;
5432 CheckError(SDL_GetRenderViewport(renderer, &rect));
5433 return rect;
5434}
5435
5437{
5438 return SDL::GetRenderViewport(m_resource);
5439}
5440
5462{
5463 return SDL_RenderViewportSet(renderer);
5464}
5465
5466inline bool Renderer::ViewportSet() const
5467{
5468 return SDL::RenderViewportSet(m_resource);
5469}
5470
5490{
5491 Rect rect;
5492 CheckError(SDL_GetRenderSafeArea(renderer, &rect));
5493 return rect;
5494}
5495
5497{
5498 return SDL::GetRenderSafeArea(m_resource);
5499}
5500
5521{
5522 CheckError(SDL_SetRenderClipRect(renderer, rect));
5523}
5524
5526{
5527 SDL::SetRenderClipRect(m_resource, rect);
5528}
5529
5547{
5548 SetRenderClipRect(renderer, std::nullopt);
5549}
5550
5552
5572{
5573 Rect rect;
5574 CheckError(SDL_GetRenderClipRect(renderer, &rect));
5575 return rect;
5576}
5577
5579{
5580 return SDL::GetRenderClipRect(m_resource);
5581}
5582
5601{
5602 return SDL_RenderClipEnabled(renderer);
5603}
5604
5605inline bool Renderer::IsClipEnabled() const
5606{
5607 return SDL::RenderClipEnabled(m_resource);
5608}
5609
5634inline void SetRenderScale(RendererParam renderer, const FPointRaw& scale)
5635{
5636 CheckError(SDL_SetRenderScale(renderer, scale.x, scale.y));
5637}
5638
5639inline void Renderer::SetScale(const FPointRaw& scale)
5640{
5641 SDL::SetRenderScale(m_resource, scale);
5642}
5643
5661inline void GetRenderScale(RendererParam renderer, float* scaleX, float* scaleY)
5662{
5663 CheckError(SDL_GetRenderScale(renderer, scaleX, scaleY));
5664}
5665
5682{
5683 FPoint p;
5684 GetRenderScale(renderer, &p.x, &p.y);
5685 return p;
5686}
5687
5688inline void Renderer::GetScale(float* scaleX, float* scaleY) const
5689{
5690 SDL::GetRenderScale(m_resource, scaleX, scaleY);
5691}
5692
5694{
5695 return SDL::GetRenderScale(m_resource);
5696}
5697
5716{
5717 CheckError(SDL_SetRenderDrawColor(renderer, c.r, c.g, c.b, c.a));
5718}
5719
5721{
5722 SDL::SetRenderDrawColor(m_resource, c);
5723}
5724
5742inline void SetRenderDrawColorFloat(RendererParam renderer, const FColorRaw& c)
5743{
5744 CheckError(SDL_SetRenderDrawColorFloat(renderer, c.r, c.g, c.b, c.a));
5745}
5746
5748{
5749 SDL::SetRenderDrawColorFloat(m_resource, c);
5750}
5751
5774 Uint8* r,
5775 Uint8* g,
5776 Uint8* b,
5777 Uint8* a)
5778{
5779 CheckError(SDL_GetRenderDrawColor(renderer, r, g, b, a));
5780}
5781
5797{
5798 Color c;
5799 GetRenderDrawColor(renderer, &c.r, &c.g, &c.b, &c.a);
5800 return c;
5801}
5802
5803inline void Renderer::GetDrawColor(Uint8* r, Uint8* g, Uint8* b, Uint8* a) const
5804{
5805 SDL::GetRenderDrawColor(m_resource, r, g, b, a);
5806}
5807
5809{
5810 return SDL::GetRenderDrawColor(m_resource);
5811}
5812
5835 float* r,
5836 float* g,
5837 float* b,
5838 float* a)
5839{
5840 CheckError(SDL_GetRenderDrawColorFloat(renderer, r, g, b, a));
5841}
5842
5858{
5859 FColor c;
5860 GetRenderDrawColorFloat(renderer, &c.r, &c.g, &c.b, &c.a);
5861 return c;
5862}
5863
5864inline void Renderer::GetDrawColorFloat(float* r,
5865 float* g,
5866 float* b,
5867 float* a) const
5868{
5869 SDL::GetRenderDrawColorFloat(m_resource, r, g, b, a);
5870}
5871
5873{
5874 return SDL::GetRenderDrawColorFloat(m_resource);
5875}
5876
5897inline void SetRenderColorScale(RendererParam renderer, float scale)
5898{
5899 CheckError(SDL_SetRenderColorScale(renderer, scale));
5900}
5901
5902inline void Renderer::SetColorScale(float scale)
5903{
5904 SDL::SetRenderColorScale(m_resource, scale);
5905}
5906
5921{
5922 float scale;
5923 CheckError(SDL_GetRenderColorScale(renderer, &scale));
5924 return scale;
5925}
5926
5927inline float Renderer::GetColorScale() const
5928{
5929 return SDL::GetRenderColorScale(m_resource);
5930}
5931
5947inline void SetRenderDrawBlendMode(RendererParam renderer, BlendMode blendMode)
5948{
5949 CheckError(SDL_SetRenderDrawBlendMode(renderer, blendMode));
5950}
5951
5953{
5954 SDL::SetRenderDrawBlendMode(m_resource, blendMode);
5955}
5956
5971{
5972 BlendMode blendMode;
5973 CheckError(SDL_GetRenderDrawBlendMode(renderer, &blendMode));
5974 return blendMode;
5975}
5976
5978{
5979 return SDL::GetRenderDrawBlendMode(m_resource);
5980}
5981
5999inline void RenderClear(RendererParam renderer)
6000{
6001 CheckError(SDL_RenderClear(renderer));
6002}
6003
6004inline void Renderer::RenderClear() { SDL::RenderClear(m_resource); }
6005
6019inline void RenderPoint(RendererParam renderer, const FPointRaw& p)
6020{
6021 CheckError(SDL_RenderPoint(renderer, p.x, p.y));
6022}
6023
6025{
6026 SDL::RenderPoint(m_resource, p);
6027}
6028
6042inline void RenderPoints(RendererParam renderer,
6044{
6045 CheckError(SDL_RenderPoints(renderer, points.data(), points.size()));
6046}
6047
6049{
6050 SDL::RenderPoints(m_resource, points);
6051}
6052
6067inline void RenderLine(RendererParam renderer,
6068 const FPointRaw& p1,
6069 const FPointRaw& p2)
6070{
6071 CheckError(SDL_RenderLine(renderer, p1.x, p1.y, p2.x, p2.y));
6072}
6073
6074inline void Renderer::RenderLine(const FPointRaw& p1, const FPointRaw& p2)
6075{
6076 SDL::RenderLine(m_resource, p1, p2);
6077}
6078
6094{
6095 CheckError(SDL_RenderLines(renderer, points.data(), points.size()));
6096}
6097
6099{
6100 SDL::RenderLines(m_resource, points);
6101}
6102
6118{
6119 CheckError(SDL_RenderRect(renderer, rect));
6120}
6121
6123{
6124 SDL::RenderRect(m_resource, rect);
6125}
6126
6142{
6143 CheckError(SDL_RenderRects(renderer, rects.data(), rects.size()));
6144}
6145
6147{
6148 SDL::RenderRects(m_resource, rects);
6149}
6150
6166inline void RenderFillRect(RendererParam renderer,
6168{
6169 CheckError(SDL_RenderFillRect(renderer, rect));
6170}
6171
6173{
6174 SDL::RenderFillRect(m_resource, rect);
6175}
6176
6191inline void RenderFillRects(RendererParam renderer,
6193{
6194 CheckError(SDL_RenderFillRects(renderer, rects.data(), rects.size()));
6195}
6196
6198{
6199 SDL::RenderFillRects(m_resource, rects);
6200}
6201
6221inline void RenderTexture(RendererParam renderer,
6222 TextureParam texture,
6225{
6226 CheckError(SDL_RenderTexture(renderer, texture, srcrect, dstrect));
6227}
6228
6232{
6233 SDL::RenderTexture(m_resource, texture, srcrect, dstrect);
6234}
6235
6262 TextureParam texture,
6265 double angle,
6267 FlipMode flip = FlipMode::SDL_FLIP_NONE)
6268{
6269 CheckError(SDL_RenderTextureRotated(
6270 renderer, texture, srcrect, dstrect, angle, center, flip));
6271}
6272
6276 double angle,
6278 FlipMode flip)
6279{
6281 m_resource, texture, srcrect, dstrect, angle, center, flip);
6282}
6283
6310 TextureParam texture,
6315{
6316 CheckError(
6317 SDL_RenderTextureAffine(renderer, texture, srcrect, origin, right, down));
6318}
6319
6325{
6326 SDL::RenderTextureAffine(m_resource, texture, srcrect, origin, right, down);
6327}
6328
6354 TextureParam texture,
6356 float scale,
6358{
6359 CheckError(
6360 SDL_RenderTextureTiled(renderer, texture, srcrect, scale, dstrect));
6361}
6362
6365 float scale,
6367{
6368 SDL::RenderTextureTiled(m_resource, texture, srcrect, scale, dstrect);
6369}
6370
6403 TextureParam texture,
6405 float left_width,
6406 float right_width,
6407 float top_height,
6408 float bottom_height,
6409 float scale,
6411{
6412 CheckError(SDL_RenderTexture9Grid(renderer,
6413 texture,
6414 srcrect,
6415 left_width,
6416 right_width,
6417 top_height,
6418 bottom_height,
6419 scale,
6420 dstrect));
6421}
6422
6425 float left_width,
6426 float right_width,
6427 float top_height,
6428 float bottom_height,
6429 float scale,
6431{
6432 SDL::RenderTexture9Grid(m_resource,
6433 texture,
6434 srcrect,
6435 left_width,
6436 right_width,
6437 top_height,
6438 bottom_height,
6439 scale,
6440 dstrect);
6441}
6442
6462inline void RenderGeometry(RendererParam renderer,
6463 TextureParam texture,
6464 std::span<const Vertex> vertices,
6465 std::span<const int> indices = {})
6466{
6467 CheckError(SDL_RenderGeometry(renderer,
6468 texture,
6469 vertices.data(),
6470 vertices.size(),
6471 indices.data(),
6472 indices.size()));
6473}
6474
6476 std::span<const Vertex> vertices,
6477 std::span<const int> indices)
6478{
6479 SDL::RenderGeometry(m_resource, texture, vertices, indices);
6480}
6481
6509 TextureParam texture,
6510 const float* xy,
6511 int xy_stride,
6512 const FColor* color,
6513 int color_stride,
6514 const float* uv,
6515 int uv_stride,
6516 int num_vertices,
6517 const void* indices,
6518 int num_indices,
6519 int size_indices)
6520{
6521 CheckError(SDL_RenderGeometryRaw(renderer,
6522 texture,
6523 xy,
6524 xy_stride,
6525 color,
6526 color_stride,
6527 uv,
6528 uv_stride,
6529 num_vertices,
6530 indices,
6531 num_indices,
6532 size_indices));
6533}
6534
6536 const float* xy,
6537 int xy_stride,
6538 const FColor* color,
6539 int color_stride,
6540 const float* uv,
6541 int uv_stride,
6542 int num_vertices,
6543 const void* indices,
6544 int num_indices,
6545 int size_indices)
6546{
6547 SDL::RenderGeometryRaw(m_resource,
6548 texture,
6549 xy,
6550 xy_stride,
6551 color,
6552 color_stride,
6553 uv,
6554 uv_stride,
6555 num_vertices,
6556 indices,
6557 num_indices,
6558 size_indices);
6559}
6560
6588{
6589 return Surface{CheckError(SDL_RenderReadPixels(renderer, rect))};
6590}
6591
6593{
6594 return SDL::RenderReadPixels(m_resource, rect);
6595}
6596
6643inline void RenderPresent(RendererParam renderer)
6644{
6645 CheckError(SDL_RenderPresent(renderer));
6646}
6647
6648inline void Renderer::Present() { SDL::RenderPresent(m_resource); }
6649
6665inline void DestroyTexture(TextureRaw texture) { SDL_DestroyTexture(texture); }
6666
6668
6682inline void DestroyRenderer(RendererRaw renderer)
6683{
6684 SDL_DestroyRenderer(renderer);
6685}
6686
6688
6719inline void FlushRenderer(RendererParam renderer)
6720{
6721 CheckError(SDL_FlushRenderer(renderer));
6722}
6723
6724inline void Renderer::Flush() { SDL::FlushRenderer(m_resource); }
6725
6743{
6744 return CheckError(SDL_GetRenderMetalLayer(renderer));
6745}
6746
6748{
6749 return SDL::GetRenderMetalLayer(m_resource);
6750}
6751
6774{
6775 return CheckError(SDL_GetRenderMetalCommandEncoder(renderer));
6776}
6777
6779{
6780 return SDL::GetRenderMetalCommandEncoder(m_resource);
6781}
6782
6810 Uint32 wait_stage_mask,
6811 Sint64 wait_semaphore,
6812 Sint64 signal_semaphore)
6813{
6814 CheckError(SDL_AddVulkanRenderSemaphores(
6815 renderer, wait_stage_mask, wait_semaphore, signal_semaphore));
6816}
6817
6819 Sint64 wait_semaphore,
6820 Sint64 signal_semaphore)
6821{
6823 m_resource, wait_stage_mask, wait_semaphore, signal_semaphore);
6824}
6825
6848inline void SetRenderVSync(RendererParam renderer, int vsync)
6849{
6850 CheckError(SDL_SetRenderVSync(renderer, vsync));
6851}
6852
6853inline void Renderer::SetVSync(int vsync)
6854{
6855 SDL::SetRenderVSync(m_resource, vsync);
6856}
6857
6859constexpr int RENDERER_VSYNC_DISABLED = SDL_RENDERER_VSYNC_DISABLED;
6860
6862constexpr int RENDERER_VSYNC_ADAPTIVE = SDL_RENDERER_VSYNC_ADAPTIVE;
6863
6878inline int GetRenderVSync(RendererParam renderer)
6879{
6880 int vsync;
6881 CheckError(SDL_GetRenderVSync(renderer, &vsync));
6882 return vsync;
6883}
6884
6885inline int Renderer::GetVSync() const
6886{
6887 return SDL::GetRenderVSync(m_resource);
6888}
6889
6900 SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE;
6901
6939inline void RenderDebugText(RendererParam renderer,
6940 const FPointRaw& p,
6941 StringParam str)
6942{
6943 CheckError(SDL_RenderDebugText(renderer, p.x, p.y, str));
6944}
6945
6947{
6948 SDL::RenderDebugText(m_resource, p, std::move(str));
6949}
6950
6975template<class... ARGS>
6977 const FPointRaw& p,
6978 std::string_view fmt,
6979 ARGS... args)
6980{
6982 renderer, p, std::vformat(fmt, std::make_format_args(args...)));
6983}
6984
6985template<class... ARGS>
6987 std::string_view fmt,
6988 ARGS... args)
6989{
6990 SDL::RenderDebugTextFormat(m_resource, p, fmt, args...);
6991}
6992
6994
6995} // namespace SDL
6996
6997#endif /* SDL3PP_RENDER_H_ */
Optional-like shim for references.
Definition: SDL3pp_optionalRef.h:20
Pixel format.
Definition: SDL3pp_pixels.h:411
A structure representing rendering state.
Definition: SDL3pp_render.h:223
constexpr Renderer(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_render.h:228
Renderer(WindowParam window)
Create a 2D rendering context for a window.
Definition: SDL3pp_render.h:289
constexpr Renderer(Renderer &&other) noexcept
Move constructor.
Definition: SDL3pp_render.h:249
Renderer(WindowParam window, StringParam name)
Create a 2D rendering context for a window.
Definition: SDL3pp_render.h:326
constexpr RendererRaw release() noexcept
Retrieves underlying RendererRaw and clear this.
Definition: SDL3pp_render.h:428
constexpr RendererRaw get() const noexcept
Retrieves underlying RendererRaw.
Definition: SDL3pp_render.h:425
constexpr Renderer & operator=(const Renderer &other) noexcept=default
Assignment operator.
Renderer(SurfaceParam surface)
Create a 2D software rendering context for a surface.
Definition: SDL3pp_render.h:404
constexpr Renderer(const RendererRaw resource) noexcept
Constructs from RendererParam.
Definition: SDL3pp_render.h:240
constexpr Renderer & operator=(Renderer &&other) noexcept
Assignment operator.
Definition: SDL3pp_render.h:413
Renderer(PropertiesParam props)
Create a 2D rendering context for a window, with the specified properties.
Definition: SDL3pp_render.h:381
constexpr auto operator<=>(const Renderer &other) const noexcept=default
Comparison.
~Renderer()
Destructor.
Definition: SDL3pp_render.h:410
constexpr Renderer(const Renderer &other)=delete
Copy constructor.
span-like for empty-derived structs
Definition: SDL3pp_spanRef.h:24
constexpr T * data() const
Retrieves contained data.
Definition: SDL3pp_spanRef.h:75
constexpr size_t size() const
Retrieves contained size.
Definition: SDL3pp_spanRef.h:69
Helpers to use C++ strings parameters.
Definition: SDL3pp_strings.h:43
A collection of pixels used in software blitting.
Definition: SDL3pp_surface.h:201
static constexpr Surface Borrow(SurfaceParam resource)
Safely borrows the from SurfaceParam.
Definition: SDL3pp_surface.h:381
An efficient driver-specific representation of pixel data.
Definition: SDL3pp_render.h:2155
constexpr Texture & operator=(Texture &&other) noexcept
Assignment operator.
Definition: SDL3pp_render.h:2456
constexpr Texture & operator=(const Texture &other) noexcept=default
Assignment operator.
constexpr TextureRaw operator->() noexcept
member access to underlying TextureRaw.
Definition: SDL3pp_render.h:2450
constexpr Texture(const TextureRaw resource) noexcept
Constructs from TextureParam.
Definition: SDL3pp_render.h:2172
constexpr Texture(const Texture &other)
Copy constructor.
Definition: SDL3pp_render.h:2178
Texture(RendererParam renderer, SurfaceParam surface)
Create a texture from an existing surface.
Definition: SDL3pp_render.h:2239
constexpr auto operator<=>(const Texture &other) const noexcept=default
Comparison.
static constexpr Texture Borrow(TextureParam resource)
Safely borrows the from TextureParam.
Definition: SDL3pp_render.h:2437
constexpr TextureRaw get() const noexcept
Retrieves underlying TextureRaw.
Definition: SDL3pp_render.h:2466
constexpr TextureRaw release() noexcept
Retrieves underlying TextureRaw and clear this.
Definition: SDL3pp_render.h:2469
~Texture()
Destructor.
Definition: SDL3pp_render.h:2453
constexpr const TextureRaw operator->() const noexcept
member access to underlying TextureRaw.
Definition: SDL3pp_render.h:2447
Texture(RendererParam renderer, PropertiesParam props)
Create a texture for a rendering context with the specified properties.
Definition: SDL3pp_render.h:2351
Texture(RendererParam renderer, PixelFormat format, TextureAccess access, const PointRaw &size)
Create a texture for a rendering context.
Definition: SDL3pp_render.h:2207
constexpr Texture(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_render.h:2160
constexpr Texture(Texture &&other) noexcept
Move constructor.
Definition: SDL3pp_render.h:2181
The struct used as an opaque handle to a window.
Definition: SDL3pp_video.h:731
Uint32 BlendMode
A set of blend modes used in drawing operations.
Definition: SDL3pp_blendmode.h:35
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition: SDL3pp_error.h:197
SDL_Event Event
The structure for all events in SDL.
Definition: SDL3pp_events.h:798
SDL_FColor FColorRaw
Alias to raw representation for FColor.
Definition: SDL3pp_pixels.h:89
SDL_Color ColorRaw
Alias to raw representation for Color.
Definition: SDL3pp_pixels.h:83
SDL_FPoint FPointRaw
Alias to raw representation for FPoint.
Definition: SDL3pp_rect.h:28
SDL_Point PointRaw
Alias to raw representation for Point.
Definition: SDL3pp_rect.h:22
Rect GetRenderSafeArea(RendererParam renderer)
Get the safe area for rendering within the current viewport.
Definition: SDL3pp_render.h:5489
FColor GetTextureModFloat(TextureConstParam texture)
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4576
Surface LockToSurface(OptionalRef< const SDL_Rect > rect=std::nullopt)
Lock a portion of the texture for write-only pixel access, and expose it as a SDL surface.
Definition: SDL3pp_render.h:4957
Renderer CreateRendererWithProperties(PropertiesParam props)
Create a 2D rendering context for a window, with the specified properties.
Definition: SDL3pp_render.h:3314
void SetDrawColorFloat(const FColorRaw &c)
Set the color used for drawing operations (Rect, Line and Clear).
Definition: SDL3pp_render.h:5747
constexpr int RENDERER_VSYNC_DISABLED
Constant for disabling renderer vsync.
Definition: SDL3pp_render.h:6859
void RenderPoints(RendererParam renderer, SpanRef< const FPointRaw > points)
Draw multiple points on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6042
void SetDrawColor(ColorRaw c)
Set the color used for drawing operations.
Definition: SDL3pp_render.h:5720
Texture GetTarget() const
Get the current render target.
Definition: SDL3pp_render.h:5063
void Destroy()
Destroy the rendering context for a window and free all associated textures.
Definition: SDL3pp_render.h:6687
const char * GetName() const
Get the name of a renderer.
Definition: SDL3pp_render.h:3482
void SetRenderViewport(RendererParam renderer, OptionalRef< const RectRaw > rect)
Set the drawing area for rendering on the current target.
Definition: SDL3pp_render.h:5378
void SetRenderScale(RendererParam renderer, const FPointRaw &scale)
Set the drawing scale for rendering on the current target.
Definition: SDL3pp_render.h:5634
bool RenderViewportSet(RendererParam renderer)
Return whether an explicit rectangle was set as the viewport.
Definition: SDL3pp_render.h:5461
void UpdateTexture(TextureParam texture, OptionalRef< const RectRaw > rect, const void *pixels, int pitch)
Update the given texture rectangle with new pixel data.
Definition: SDL3pp_render.h:4723
Point GetCurrentOutputSize() const
Get the current output size in pixels of a rendering context.
Definition: SDL3pp_render.h:3697
void GetTextureSize(TextureConstParam texture, float *w, float *h)
Get the size of a texture, as floating point values.
Definition: SDL3pp_render.h:4157
void SetColorModFloat(float r, float g, float b)
Set an additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4288
void ResetRenderClipRect(RendererParam renderer)
Reset the clip rectangle for rendering to the entire render target.
Definition: SDL3pp_render.h:5546
void ResetRenderTarget(RendererParam renderer)
Set target texture back to window.
Definition: SDL3pp_render.h:5034
void RenderPoint(const FPointRaw &p)
Draw a point on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6024
void GetTextureColorMod(TextureConstParam texture, Uint8 *r, Uint8 *g, Uint8 *b)
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4310
void SetRenderDrawColor(RendererParam renderer, ColorRaw c)
Set the color used for drawing operations.
Definition: SDL3pp_render.h:5715
std::pair< Window, Renderer > CreateWindowAndRenderer(StringParam title, const PointRaw &size, WindowFlags window_flags=0)
Create a window and default renderer.
Definition: SDL3pp_render.h:3213
void SetTextureMod(TextureParam texture, Color c)
Set an additional color and alpha values multiplied into render copy operations.
Definition: SDL3pp_render.h:4496
void SetTextureBlendMode(TextureParam texture, BlendMode blendMode)
Set the blend mode for a texture, used by Renderer.RenderTexture().
Definition: SDL3pp_render.h:4605
void GetCurrentRenderOutputSize(RendererParam renderer, int *w, int *h)
Get the current output size in pixels of a rendering context.
Definition: SDL3pp_render.h:3661
void SetBlendMode(BlendMode blendMode)
Set the blend mode for a texture, used by Renderer.RenderTexture().
Definition: SDL3pp_render.h:4610
Rect GetViewport() const
Get the drawing area for the current target.
Definition: SDL3pp_render.h:5436
Point GetSize() const
Get the size of a texture.
Definition: SDL3pp_render.h:4173
bool ViewportSet() const
Return whether an explicit rectangle was set as the viewport.
Definition: SDL3pp_render.h:5466
void RenderFillRect(RendererParam renderer, OptionalRef< const FRectRaw > rect)
Fill a rectangle on the current rendering target with the drawing color at subpixel precision.
Definition: SDL3pp_render.h:6166
void SetDrawBlendMode(BlendMode blendMode)
Set the blend mode used for drawing operations (Fill and Line).
Definition: SDL3pp_render.h:5952
FPoint GetSizeFloat() const
Get the size of a texture, as floating point values.
Definition: SDL3pp_render.h:4186
void SetAlphaMod(Uint8 alpha)
Set an additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4381
void RenderTextureRotated(RendererParam renderer, TextureParam texture, OptionalRef< const FRectRaw > srcrect, OptionalRef< const FRectRaw > dstrect, double angle, OptionalRef< const FPointRaw > center, FlipMode flip=FlipMode::SDL_FLIP_NONE)
Copy a portion of the source texture to the current rendering target, with rotation and flipping,...
Definition: SDL3pp_render.h:6261
void SetTextureColorModFloat(TextureParam texture, float r, float g, float b)
Set an additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4280
void RenderTexture9Grid(TextureParam texture, OptionalRef< const FRectRaw > srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, OptionalRef< const FRectRaw > dstrect)
Perform a scaled copy using the 9-grid algorithm to the current rendering target at subpixel precisio...
Definition: SDL3pp_render.h:6423
int GetTextureWidth(TextureConstParam texture)
Get the width in pixels.
Definition: SDL3pp_render.h:4192
Uint8 GetTextureAlphaMod(TextureConstParam texture)
Get the additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4434
FPoint GetScale() const
Get the drawing scale for the current target.
Definition: SDL3pp_render.h:5693
SDL_Renderer * RendererRaw
Alias to raw representation for Renderer.
Definition: SDL3pp_render.h:46
PixelFormat GetFormat() const
Get the pixel format.
Definition: SDL3pp_render.h:4213
void Destroy()
Destroy the specified texture.
Definition: SDL3pp_render.h:6667
int GetTextureHeight(TextureConstParam texture)
Get the height in pixels.
Definition: SDL3pp_render.h:4200
bool IsClipEnabled() const
Get whether clipping is enabled on the given render target.
Definition: SDL3pp_render.h:5605
constexpr int RENDERER_VSYNC_ADAPTIVE
Constant for enabling asaptive renderer vsync.
Definition: SDL3pp_render.h:6862
FPoint RenderCoordinatesToWindow(const FPointRaw &coord) const
Get a point in window coordinates when given a point in render coordinates.
Definition: SDL3pp_render.h:5306
void SetRenderVSync(RendererParam renderer, int vsync)
Toggle VSync of the given renderer.
Definition: SDL3pp_render.h:6848
void RenderPresent(RendererParam renderer)
Update the screen with any rendering performed since the previous call.
Definition: SDL3pp_render.h:6643
constexpr auto SOFTWARE_RENDERER
The name of the software renderer.
Definition: SDL3pp_render.h:155
void RenderDebugText(RendererParam renderer, const FPointRaw &p, StringParam str)
Draw debug text to an Renderer.
Definition: SDL3pp_render.h:6939
void SetRenderClipRect(RendererParam renderer, OptionalRef< const RectRaw > rect)
Set the clip rectangle for rendering on the specified target.
Definition: SDL3pp_render.h:5519
void GetTextureColorModFloat(TextureConstParam texture, float *r, float *g, float *b)
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4340
FPoint RenderCoordinatesToWindow(RendererParam renderer, const FPointRaw &coord)
Get a point in window coordinates when given a point in render coordinates.
Definition: SDL3pp_render.h:5297
float GetTextureAlphaModFloat(TextureConstParam texture)
Get the additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4461
Texture GetRenderTarget(RendererParam renderer)
Get the current render target.
Definition: SDL3pp_render.h:5056
void RenderPoints(SpanRef< const FPointRaw > points)
Draw multiple points on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6048
void ResetTarget()
Set target texture back to window.
Definition: SDL3pp_render.h:5039
void RenderTextureAffine(RendererParam renderer, TextureParam texture, OptionalRef< const FRectRaw > srcrect, OptionalRef< const FPointRaw > origin, OptionalRef< const FPointRaw > right, OptionalRef< const FPointRaw > down)
Copy a portion of the source texture to the current rendering target, with affine transform,...
Definition: SDL3pp_render.h:6309
void RenderGeometryRaw(TextureParam texture, const float *xy, int xy_stride, const FColor *color, int color_stride, const float *uv, int uv_stride, int num_vertices, const void *indices, int num_indices, int size_indices)
Render a list of triangles, optionally using a texture and indices into the vertex arrays Color and a...
Definition: SDL3pp_render.h:6535
SDL_Vertex Vertex
Vertex structure.
Definition: SDL3pp_render.h:162
void RenderGeometryRaw(RendererParam renderer, TextureParam texture, const float *xy, int xy_stride, const FColor *color, int color_stride, const float *uv, int uv_stride, int num_vertices, const void *indices, int num_indices, int size_indices)
Render a list of triangles, optionally using a texture and indices into the vertex arrays Color and a...
Definition: SDL3pp_render.h:6508
void RenderLine(RendererParam renderer, const FPointRaw &p1, const FPointRaw &p2)
Draw a line on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6067
int GetHeight() const
Get the height in pixels.
Definition: SDL3pp_render.h:4202
PixelFormat GetTextureFormat(TextureConstParam texture)
Get the pixel format.
Definition: SDL3pp_render.h:4208
Texture CreateTextureFromSurface(RendererParam renderer, SurfaceParam surface)
Create a texture from an existing surface.
Definition: SDL3pp_render.h:3764
BlendMode GetTextureBlendMode(TextureConstParam texture)
Get the blend mode used for texture copy operations.
Definition: SDL3pp_render.h:4628
FPoint RenderCoordinatesFromWindow(RendererParam renderer, const FPointRaw &window_coord)
Get a point in render coordinates when given a point in window coordinates.
Definition: SDL3pp_render.h:5259
FColor GetDrawColorFloat() const
Get the color used for drawing operations (Rect, Line and Clear).
Definition: SDL3pp_render.h:5872
Uint8 GetAlphaMod() const
Get the additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4441
FPoint GetTextureSizeFloat(TextureConstParam texture)
Get the size of a texture, as floating point values.
Definition: SDL3pp_render.h:4179
void RenderLines(RendererParam renderer, SpanRef< const FPointRaw > points)
Draw a series of connected lines on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6093
void SetModFloat(FColor c)
Set an additional color and alpha values multiplied into render copy operations.
Definition: SDL3pp_render.h:4533
void DestroyRenderer(RendererRaw renderer)
Destroy the rendering context for a window and free all associated textures.
Definition: SDL3pp_render.h:6682
void UnlockTexture(TextureParam texture)
Unlock a texture, uploading the changes to video memory, if needed.
Definition: SDL3pp_render.h:4981
void SetColorScale(float scale)
Set the color scale used for render operations.
Definition: SDL3pp_render.h:5902
int GetVSync() const
Get VSync of the given renderer.
Definition: SDL3pp_render.h:6885
void ResetRenderViewport(RendererParam renderer)
Reset the drawing area for rendering to the entire target.
Definition: SDL3pp_render.h:5405
Surface RenderReadPixels(RendererParam renderer, OptionalRef< const RectRaw > rect={})
Read pixels from the current rendering target.
Definition: SDL3pp_render.h:6586
BlendMode GetRenderDrawBlendMode(RendererParam renderer)
Get the blend mode used for drawing operations.
Definition: SDL3pp_render.h:5970
Point GetOutputSize() const
Get the output size in pixels of a rendering context.
Definition: SDL3pp_render.h:3636
void GetColorModFloat(float *r, float *g, float *b) const
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4348
void SetColorMod(Uint8 r, Uint8 g, Uint8 b)
Set an additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4249
void RenderGeometry(RendererParam renderer, TextureParam texture, std::span< const Vertex > vertices, std::span< const int > indices={})
Render a list of triangles, optionally using a texture and indices into the vertex array Color and al...
Definition: SDL3pp_render.h:6462
void Update(OptionalRef< const RectRaw > rect, const void *pixels, int pitch)
Update the given texture rectangle with new pixel data.
Definition: SDL3pp_render.h:4768
void RenderRect(OptionalRef< const FRectRaw > rect)
Draw a rectangle on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6122
RendererRef GetRenderer() const
Get the renderer associated with a window.
Definition: SDL3pp_render.h:3437
void SetRenderTarget(RendererParam renderer, TextureParam texture)
Set a texture as the current rendering target.
Definition: SDL3pp_render.h:5009
void SetRenderDrawColorFloat(RendererParam renderer, const FColorRaw &c)
Set the color used for drawing operations (Rect, Line and Clear).
Definition: SDL3pp_render.h:5742
void Present()
Update the screen with any rendering performed since the previous call.
Definition: SDL3pp_render.h:6648
void ResetViewport()
Reset the drawing area for rendering to the entire target.
Definition: SDL3pp_render.h:5410
BlendMode GetDrawBlendMode() const
Get the blend mode used for drawing operations.
Definition: SDL3pp_render.h:5977
void RenderClear()
Clear the current rendering target with the drawing color.
Definition: SDL3pp_render.h:6004
SDL_TextureAccess TextureAccess
The access pattern allowed for a texture.
Definition: SDL3pp_render.h:169
void RenderTexture(TextureParam texture, OptionalRef< const FRectRaw > srcrect, OptionalRef< const FRectRaw > dstrect)
Copy a portion of the texture to the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6229
Renderer CreateSoftwareRenderer(SurfaceParam surface)
Create a 2D software rendering context for a surface.
Definition: SDL3pp_render.h:3432
Surface LockTextureToSurface(TextureParam texture, OptionalRef< const SDL_Rect > rect=std::nullopt)
Lock a portion of the texture for write-only pixel access, and expose it as a SDL surface.
Definition: SDL3pp_render.h:4948
void SetMod(Color c)
Set an additional color and alpha values multiplied into render copy operations.
Definition: SDL3pp_render.h:4502
void SetTextureModFloat(TextureParam texture, FColor c)
Set an additional color and alpha values multiplied into render copy operations.
Definition: SDL3pp_render.h:4527
void RenderLine(const FPointRaw &p1, const FPointRaw &p2)
Draw a line on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6074
Color GetMod() const
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4560
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_OVERSCAN
The rendered content is fit to the smallest dimension and the other dimension extends beyond the outp...
Definition: SDL3pp_render.h:205
PropertiesRef GetProperties() const
Get the properties associated with a texture.
Definition: SDL3pp_render.h:4117
void RenderDebugText(const FPointRaw &p, StringParam str)
Draw debug text to an Renderer.
Definition: SDL3pp_render.h:6946
Color GetTextureMod(TextureConstParam texture)
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4552
void SetAlphaModFloat(float alpha)
Set an additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4414
RendererRef GetRendererFromTexture(TextureConstParam texture)
Get the renderer that created an Texture.
Definition: SDL3pp_render.h:4133
PropertiesRef GetRendererProperties(RendererParam renderer)
Get the properties associated with a renderer.
Definition: SDL3pp_render.h:3570
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_DISABLED
There is no logical size in effect.
Definition: SDL3pp_render.h:187
void GetRenderDrawColorFloat(RendererParam renderer, float *r, float *g, float *b, float *a)
Get the color used for drawing operations (Rect, Line and Clear).
Definition: SDL3pp_render.h:5834
void UpdateYUVTexture(TextureParam texture, OptionalRef< const RectRaw > rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch)
Update a rectangle within a planar YV12 or IYUV texture with new pixel data.
Definition: SDL3pp_render.h:4806
void RenderRects(RendererParam renderer, SpanRef< const FRectRaw > rects)
Draw some number of rectangles on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6141
ScaleMode GetTextureScaleMode(TextureConstParam texture)
Get the scale mode used for texture scale operations.
Definition: SDL3pp_render.h:4680
void * GetRenderMetalCommandEncoder(RendererParam renderer)
Get the Metal command encoder for the current frame.
Definition: SDL3pp_render.h:6773
Rect GetClipRect() const
Get the clip rectangle for the current target.
Definition: SDL3pp_render.h:5578
void * GetRenderMetalLayer()
Get the CAMetalLayer associated with the given Metal renderer.
Definition: SDL3pp_render.h:6747
void GetRenderScale(RendererParam renderer, float *scaleX, float *scaleY)
Get the drawing scale for the current target.
Definition: SDL3pp_render.h:5661
void SetRenderColorScale(RendererParam renderer, float scale)
Set the color scale used for render operations.
Definition: SDL3pp_render.h:5897
SDL_RendererLogicalPresentation RendererLogicalPresentation
How the logical size is mapped to the output.
Definition: SDL3pp_render.h:185
constexpr TextureAccess TEXTUREACCESS_TARGET
Texture can be used as a render target.
Definition: SDL3pp_render.h:177
void GetRenderOutputSize(RendererParam renderer, int *w, int *h)
Get the output size in pixels of a rendering context.
Definition: SDL3pp_render.h:3600
FPoint RenderCoordinatesFromWindow(const FPointRaw &window_coord) const
Get a point in render coordinates when given a point in window coordinates.
Definition: SDL3pp_render.h:5268
void DestroyTexture(TextureRaw texture)
Destroy the specified texture.
Definition: SDL3pp_render.h:6665
void SetTextureAlphaModFloat(TextureParam texture, float alpha)
Set an additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4409
Rect GetSafeArea() const
Get the safe area for rendering within the current viewport.
Definition: SDL3pp_render.h:5496
Rect GetRenderViewport(RendererParam renderer)
Get the drawing area for the current target.
Definition: SDL3pp_render.h:5429
PropertiesRef GetTextureProperties(TextureConstParam texture)
Get the properties associated with a texture.
Definition: SDL3pp_render.h:4112
void ConvertEventToRenderCoordinates(RendererParam renderer, Event *event)
Convert the coordinates in an event to render coordinates.
Definition: SDL3pp_render.h:5343
void RenderFillRects(RendererParam renderer, SpanRef< const FRectRaw > rects)
Fill some number of rectangles on the current rendering target with the drawing color at subpixel pre...
Definition: SDL3pp_render.h:6191
int GetWidth() const
Get the width in pixels.
Definition: SDL3pp_render.h:4194
void RenderTexture(RendererParam renderer, TextureParam texture, OptionalRef< const FRectRaw > srcrect, OptionalRef< const FRectRaw > dstrect)
Copy a portion of the texture to the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6221
FColor GetModFloat() const
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4584
void RenderTextureAffine(TextureParam texture, OptionalRef< const FRectRaw > srcrect, OptionalRef< const FPointRaw > origin, OptionalRef< const FPointRaw > right, OptionalRef< const FPointRaw > down)
Copy a portion of the source texture to the current rendering target, with affine transform,...
Definition: SDL3pp_render.h:6320
constexpr TextureAccess TEXTUREACCESS_STATIC
Changes rarely, not lockable.
Definition: SDL3pp_render.h:171
SDL_Texture * TextureRaw
Alias to raw representation for Texture.
Definition: SDL3pp_render.h:82
bool RenderClipEnabled(RendererParam renderer)
Get whether clipping is enabled on the given render target.
Definition: SDL3pp_render.h:5600
void AddVulkanRenderSemaphores(RendererParam renderer, Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore)
Add a set of synchronization semaphores for the current frame.
Definition: SDL3pp_render.h:6809
void * GetRenderMetalCommandEncoder()
Get the Metal command encoder for the current frame.
Definition: SDL3pp_render.h:6778
void SetViewport(OptionalRef< const RectRaw > rect)
Set the drawing area for rendering on the current target.
Definition: SDL3pp_render.h:5384
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_INTEGER_SCALE
The rendered content is scaled up by integer multiples to fit the output resolution.
Definition: SDL3pp_render.h:212
WindowRef GetWindow()
Get the window associated with a renderer.
Definition: SDL3pp_render.h:3458
constexpr TextureAccess TEXTUREACCESS_STREAMING
Changes frequently, lockable.
Definition: SDL3pp_render.h:174
BlendMode GetBlendMode() const
Get the blend mode used for texture copy operations.
Definition: SDL3pp_render.h:4635
void UpdateYUV(OptionalRef< const RectRaw > rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch)
Update a rectangle within a planar YV12 or IYUV texture with new pixel data.
Definition: SDL3pp_render.h:4819
PropertiesRef GetProperties() const
Get the properties associated with a renderer.
Definition: SDL3pp_render.h:3575
void RenderTextureTiled(RendererParam renderer, TextureParam texture, OptionalRef< const FRectRaw > srcrect, float scale, OptionalRef< const FRectRaw > dstrect)
Tile a portion of the texture to the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6353
void Flush()
Force the rendering context to flush any pending commands and state.
Definition: SDL3pp_render.h:6724
Texture CreateTextureWithProperties(PropertiesParam props)
Create a texture for a rendering context with the specified properties.
Definition: SDL3pp_render.h:3889
void RenderTextureTiled(TextureParam texture, OptionalRef< const FRectRaw > srcrect, float scale, OptionalRef< const FRectRaw > dstrect)
Tile a portion of the texture to the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6363
void Lock(OptionalRef< const SDL_Rect > rect, void **pixels, int *pitch)
Lock a portion of the texture for write-only pixel access.
Definition: SDL3pp_render.h:4910
FRect GetLogicalPresentationRect() const
Get the final presentation rectangle for rendering.
Definition: SDL3pp_render.h:5232
void SetTextureColorMod(TextureParam texture, Uint8 r, Uint8 g, Uint8 b)
Set an additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4244
void SetClipRect(OptionalRef< const RectRaw > rect)
Set the clip rectangle for rendering on the specified target.
Definition: SDL3pp_render.h:5525
constexpr int DEBUG_TEXT_FONT_CHARACTER_SIZE
The size, in pixels, of a single Renderer.RenderDebugText() character.
Definition: SDL3pp_render.h:6899
Renderer CreateRenderer(WindowParam window, StringParam name)
Create a 2D rendering context for a window.
Definition: SDL3pp_render.h:3258
void ConvertEventToRenderCoordinates(Event *event) const
Convert the coordinates in an event to render coordinates.
Definition: SDL3pp_render.h:5349
Surface ReadPixels(OptionalRef< const RectRaw > rect={}) const
Read pixels from the current rendering target.
Definition: SDL3pp_render.h:6592
float GetRenderColorScale(RendererParam renderer)
Get the color scale used for render operations.
Definition: SDL3pp_render.h:5920
void SetScale(const FPointRaw &scale)
Set the drawing scale for rendering on the current target.
Definition: SDL3pp_render.h:5639
Texture CreateTextureFromSurface(SurfaceParam surface)
Create a texture from an existing surface.
Definition: SDL3pp_render.h:3770
Texture CreateTexture(RendererParam renderer, PixelFormat format, TextureAccess access, const PointRaw &size)
Create a texture for a rendering context.
Definition: SDL3pp_render.h:3724
float GetColorScale() const
Get the color scale used for render operations.
Definition: SDL3pp_render.h:5927
Rect GetRenderClipRect(RendererParam renderer)
Get the clip rectangle for the current target.
Definition: SDL3pp_render.h:5571
void UpdateNV(OptionalRef< const RectRaw > rect, const Uint8 *Yplane, int Ypitch, const Uint8 *UVplane, int UVpitch)
Update a rectangle within a planar NV12 or NV21 texture with new pixels.
Definition: SDL3pp_render.h:4866
void RenderFillRects(SpanRef< const FRectRaw > rects)
Fill some number of rectangles on the current rendering target with the drawing color at subpixel pre...
Definition: SDL3pp_render.h:6197
const char * GetRendererName(RendererParam renderer)
Get the name of a renderer.
Definition: SDL3pp_render.h:3477
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_LETTERBOX
The rendered content is fit to the largest dimension and the other dimension is letterboxed with blac...
Definition: SDL3pp_render.h:198
void RenderLines(SpanRef< const FPointRaw > points)
Draw a series of connected lines on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6098
void RenderTexture9Grid(RendererParam renderer, TextureParam texture, OptionalRef< const FRectRaw > srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, OptionalRef< const FRectRaw > dstrect)
Perform a scaled copy using the 9-grid algorithm to the current rendering target at subpixel precisio...
Definition: SDL3pp_render.h:6402
void SetLogicalPresentation(const PointRaw &size, RendererLogicalPresentation mode)
Set a device-independent resolution and presentation mode for rendering.
Definition: SDL3pp_render.h:5126
void GetLogicalPresentation(int *w, int *h, RendererLogicalPresentation *mode) const
Get device independent resolution and presentation mode for rendering.
Definition: SDL3pp_render.h:5191
void SetTarget(TextureParam texture)
Set a texture as the current rendering target.
Definition: SDL3pp_render.h:5014
ScaleMode GetScaleMode() const
Get the scale mode used for texture scale operations.
Definition: SDL3pp_render.h:4687
void SetTextureAlphaMod(TextureParam texture, Uint8 alpha)
Set an additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4376
void LockTexture(TextureParam texture, OptionalRef< const SDL_Rect > rect, void **pixels, int *pitch)
Lock a portion of the texture for write-only pixel access.
Definition: SDL3pp_render.h:4902
void * GetRenderMetalLayer(RendererParam renderer)
Get the CAMetalLayer associated with the given Metal renderer.
Definition: SDL3pp_render.h:6742
void RenderRects(SpanRef< const FRectRaw > rects)
Draw some number of rectangles on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6146
void RenderDebugTextFormat(const FPointRaw &p, std::string_view fmt, ARGS... args)
Draw debug text to an Renderer.
Definition: SDL3pp_render.h:6986
void GetRenderDrawColor(RendererParam renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
Get the color used for drawing operations (Rect, Line and Clear).
Definition: SDL3pp_render.h:5773
Texture CreateTextureWithProperties(RendererParam renderer, PropertiesParam props)
Create a texture for a rendering context with the specified properties.
Definition: SDL3pp_render.h:3883
void RenderDebugTextFormat(RendererParam renderer, const FPointRaw &p, std::string_view fmt, ARGS... args)
Draw debug text to an Renderer.
Definition: SDL3pp_render.h:6976
FRect GetRenderLogicalPresentationRect(RendererParam renderer)
Get the final presentation rectangle for rendering.
Definition: SDL3pp_render.h:5225
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_STRETCH
The rendered content is stretched to the output resolution.
Definition: SDL3pp_render.h:191
void GetRenderLogicalPresentation(RendererParam renderer, int *w, int *h, RendererLogicalPresentation *mode)
Get device independent resolution and presentation mode for rendering.
Definition: SDL3pp_render.h:5153
void RenderPoint(RendererParam renderer, const FPointRaw &p)
Draw a point on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6019
void RenderRect(RendererParam renderer, OptionalRef< const FRectRaw > rect)
Draw a rectangle on the current rendering target at subpixel precision.
Definition: SDL3pp_render.h:6117
void UpdateNVTexture(TextureParam texture, OptionalRef< const RectRaw > rect, const Uint8 *Yplane, int Ypitch, const Uint8 *UVplane, int UVpitch)
Update a rectangle within a planar NV12 or NV21 texture with new pixels.
Definition: SDL3pp_render.h:4855
void RenderFillRect(OptionalRef< const FRectRaw > rect)
Fill a rectangle on the current rendering target with the drawing color at subpixel precision.
Definition: SDL3pp_render.h:6172
int GetNumRenderDrivers()
Get the number of 2D rendering drivers available for the current display.
Definition: SDL3pp_render.h:3167
const char * GetRenderDriver(int index)
Use this function to get the name of a built in 2D rendering driver.
Definition: SDL3pp_render.h:3191
void SetRenderLogicalPresentation(RendererParam renderer, const PointRaw &size, RendererLogicalPresentation mode)
Set a device-independent resolution and presentation mode for rendering.
Definition: SDL3pp_render.h:5119
void Unlock()
Unlock a texture, uploading the changes to video memory, if needed.
Definition: SDL3pp_render.h:4983
RendererRef GetRenderer() const
Get the renderer that created an Texture.
Definition: SDL3pp_render.h:4138
void SetVSync(int vsync)
Toggle VSync of the given renderer.
Definition: SDL3pp_render.h:6853
void ResetClipRect()
Reset the clip rectangle for rendering to the entire render target.
Definition: SDL3pp_render.h:5551
float GetAlphaModFloat() const
Get the additional alpha value multiplied into render copy operations.
Definition: SDL3pp_render.h:4468
void AddVulkanRenderSemaphores(Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore)
Add a set of synchronization semaphores for the current frame.
Definition: SDL3pp_render.h:6818
void FlushRenderer(RendererParam renderer)
Force the rendering context to flush any pending commands and state.
Definition: SDL3pp_render.h:6719
void GetColorMod(Uint8 *r, Uint8 *g, Uint8 *b) const
Get the additional color value multiplied into render copy operations.
Definition: SDL3pp_render.h:4318
void RenderClear(RendererParam renderer)
Clear the current rendering target with the drawing color.
Definition: SDL3pp_render.h:5999
void SetRenderDrawBlendMode(RendererParam renderer, BlendMode blendMode)
Set the blend mode used for drawing operations (Fill and Line).
Definition: SDL3pp_render.h:5947
Texture CreateTexture(PixelFormat format, TextureAccess access, const PointRaw &size)
Create a texture for a rendering context.
Definition: SDL3pp_render.h:3732
WindowRef GetRenderWindow(RendererParam renderer)
Get the window associated with a renderer.
Definition: SDL3pp_render.h:3453
int GetRenderVSync(RendererParam renderer)
Get VSync of the given renderer.
Definition: SDL3pp_render.h:6878
void RenderGeometry(TextureParam texture, std::span< const Vertex > vertices, std::span< const int > indices={})
Render a list of triangles, optionally using a texture and indices into the vertex array Color and al...
Definition: SDL3pp_render.h:6475
Color GetDrawColor() const
Get the color used for drawing operations (Rect, Line and Clear).
Definition: SDL3pp_render.h:5808
void RenderTextureRotated(TextureParam texture, OptionalRef< const FRectRaw > srcrect, OptionalRef< const FRectRaw > dstrect, double angle, OptionalRef< const FPointRaw > center, FlipMode flip=FlipMode::SDL_FLIP_NONE)
Copy a portion of the source texture to the current rendering target, with rotation and flipping,...
Definition: SDL3pp_render.h:6273
void SetTextureScaleMode(TextureParam texture, ScaleMode scaleMode)
Set the scale mode used for texture scale operations.
Definition: SDL3pp_render.h:4657
void SetScaleMode(ScaleMode scaleMode)
Set the scale mode used for texture scale operations.
Definition: SDL3pp_render.h:4662
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition: SDL3pp_stdinc.h:341
::Uint8 Uint8
An unsigned 8-bit integer type.
Definition: SDL3pp_stdinc.h:289
::Sint64 Sint64
A signed 64-bit integer type.
Definition: SDL3pp_stdinc.h:356
SDL_Surface * SurfaceRaw
Alias to raw representation for Surface.
Definition: SDL3pp_surface.h:42
SDL_FlipMode FlipMode
The flip mode.
Definition: SDL3pp_surface.h:162
SDL_ScaleMode ScaleMode
The scaling mode.
Definition: SDL3pp_surface.h:143
Uint64 WindowFlags
The flags on a window.
Definition: SDL3pp_video.h:538
Main include header for the SDL3pp library.
A structure that represents a color as RGBA components.
Definition: SDL3pp_pixels.h:2189
The bits of this structure can be directly reinterpreted as a float-packed color which uses the PIXEL...
Definition: SDL3pp_pixels.h:2362
The structure that defines a point (using floating point values).
Definition: SDL3pp_rect.h:512
A rectangle, with the origin at the upper left (using floating point values).
Definition: SDL3pp_rect.h:1437
Safely wrap IOStream for non owning parameters.
Definition: SDL3pp_iostream.h:34
The structure that defines a point (using integers).
Definition: SDL3pp_rect.h:83
Safely wrap Properties for non owning parameters.
Definition: SDL3pp_properties.h:52
Semi-safe reference for Properties.
Definition: SDL3pp_properties.h:708
A rectangle, with the origin at the upper left (using integers).
Definition: SDL3pp_rect.h:845
Safely wrap Renderer for non owning parameters.
Definition: SDL3pp_render.h:53
constexpr RendererParam(std::nullptr_t _=nullptr)
Constructs null/invalid.
Definition: SDL3pp_render.h:63
constexpr auto operator<=>(const RendererParam &other) const =default
Comparison.
RendererRaw value
parameter's RendererRaw
Definition: SDL3pp_render.h:54
constexpr RendererParam(RendererRaw value)
Constructs from RendererRaw.
Definition: SDL3pp_render.h:57
Semi-safe reference for Renderer.
Definition: SDL3pp_render.h:2105
RendererRef(RendererRaw resource) noexcept
Constructs from RendererParam.
Definition: SDL3pp_render.h:2127
~RendererRef()
Destructor.
Definition: SDL3pp_render.h:2139
RendererRef(const RendererRef &other) noexcept
Copy constructor.
Definition: SDL3pp_render.h:2133
RendererRef(RendererParam resource) noexcept
Constructs from RendererParam.
Definition: SDL3pp_render.h:2115
Safely wrap Surface for non owning const parameters.
Definition: SDL3pp_surface.h:76
Safely wrap Surface for non owning parameters.
Definition: SDL3pp_surface.h:46
Safely wrap Texture for non owning const parameters.
Definition: SDL3pp_render.h:116
constexpr TextureConstParam(TextureParam value)
Constructs from TextureParam.
Definition: SDL3pp_render.h:126
const TextureRaw value
parameter's const TextureRaw
Definition: SDL3pp_render.h:117
constexpr auto operator->()
member access to underlying TextureRaw.
Definition: SDL3pp_render.h:147
constexpr TextureConstParam(std::nullptr_t _=nullptr)
Constructs null/invalid.
Definition: SDL3pp_render.h:132
constexpr auto operator<=>(const TextureConstParam &other) const =default
Comparison.
constexpr TextureConstParam(const TextureRaw value)
Constructs from const TextureRaw.
Definition: SDL3pp_render.h:120
Safely wrap Texture for non owning parameters.
Definition: SDL3pp_render.h:86
constexpr TextureParam(std::nullptr_t _=nullptr)
Constructs null/invalid.
Definition: SDL3pp_render.h:96
constexpr auto operator->()
member access to underlying TextureRaw.
Definition: SDL3pp_render.h:111
constexpr auto operator<=>(const TextureParam &other) const =default
Comparison.
constexpr TextureParam(TextureRaw value)
Constructs from TextureRaw.
Definition: SDL3pp_render.h:90
TextureRaw value
parameter's TextureRaw
Definition: SDL3pp_render.h:87
Safely wrap Window for non owning parameters.
Definition: SDL3pp_video.h:54
Semi-safe reference for Window.
Definition: SDL3pp_video.h:2962