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
1272 void SetDrawBlendMode(BlendMode blendMode);
1273
1287
1304 void RenderClear();
1305
1318 void RenderPoint(const FPointRaw& p);
1319
1333
1347 void RenderLine(const FPointRaw& p1, const FPointRaw& p2);
1348
1363
1378
1393
1409
1424
1443 void RenderTexture(TextureRef texture,
1446
1471 void RenderTextureRotated(TextureRef texture,
1474 double angle,
1476 FlipMode flip = FlipMode::SDL_FLIP_NONE);
1477
1502 void RenderTextureAffine(TextureRef texture,
1507
1531 void RenderTextureTiled(TextureRef texture,
1533 float scale,
1535
1567 void RenderTexture9Grid(TextureRef texture,
1569 float left_width,
1570 float right_width,
1571 float top_height,
1572 float bottom_height,
1573 float scale,
1575
1576#if SDL_VERSION_ATLEAST(3, 4, 0)
1577
1613 const FRectRaw& srcrect,
1614 float left_width,
1615 float right_width,
1616 float top_height,
1617 float bottom_height,
1618 float scale,
1619 const FRectRaw& dstrect,
1620 float tileScale);
1621
1622#endif // SDL_VERSION_ATLEAST(3, 4, 0)
1623
1643 void RenderGeometry(TextureRef texture,
1644 std::span<const Vertex> vertices,
1645 std::span<const int> indices = {});
1646
1674 void RenderGeometryRaw(TextureRef texture,
1675 const float* xy,
1676 int xy_stride,
1677 const FColor* color,
1678 int color_stride,
1679 const float* uv,
1680 int uv_stride,
1681 int num_vertices,
1682 const void* indices,
1683 int num_indices,
1684 int size_indices);
1685
1686#if SDL_VERSION_ATLEAST(3, 4, 0)
1687
1706 TextureAddressMode v_mode);
1707
1726 TextureAddressMode* v_mode);
1727
1728#endif // SDL_VERSION_ATLEAST(3, 4, 0)
1729
1752
1798 void Present();
1799
1829 void Flush();
1830
1846 void* GetRenderMetalLayer();
1847
1869
1896 void AddVulkanRenderSemaphores(Uint32 wait_stage_mask,
1897 Sint64 wait_semaphore,
1898 Sint64 signal_semaphore);
1899
1921 void SetVSync(int vsync);
1922
1935 int GetVSync() const;
1936
1974 void RenderDebugText(const FPointRaw& p, StringParam str);
1975
2001 template<class... ARGS>
2002 void RenderDebugTextFormat(const FPointRaw& p,
2003 std::string_view fmt,
2004 ARGS... args);
2005
2006#if SDL_VERSION_ATLEAST(3, 4, 0)
2007
2022 void SetDefaultTextureScaleMode(ScaleMode scale_mode);
2023
2038 void GetDefaultTextureScaleMode(ScaleMode* scale_mode);
2039
2057 const GPURenderStateCreateInfo& createinfo);
2058
2075
2076#endif // SDL_VERSION_ATLEAST(3, 4, 0)
2077};
2078
2087{
2088 using RendererBase::RendererBase;
2089
2097 constexpr explicit Renderer(RendererRaw resource) noexcept
2098 : RendererBase(resource)
2099 {
2100 }
2101
2103 constexpr Renderer(Renderer&& other) noexcept
2104 : Renderer(other.release())
2105 {
2106 }
2107
2140 Renderer(WindowRef window, StringParam name = nullptr);
2141
2203 Renderer(PropertiesRef props);
2204
2223 Renderer(SurfaceRef surface);
2224
2226 ~Renderer() { SDL_DestroyRenderer(get()); }
2227
2229 constexpr Renderer& operator=(Renderer&& other) noexcept
2230 {
2231 swap(*this, other);
2232 return *this;
2233 }
2234};
2235
2241struct TextureBase : ResourceBaseT<TextureRaw, TextureRawConst>
2242{
2244
2246 constexpr operator TextureConstRef() const noexcept { return get(); }
2247
2261 void Destroy();
2262
2359
2370 RendererRef GetRenderer() const;
2371
2385 void GetSize(float* w, float* h) const;
2386
2388 Point GetSize() const;
2389
2391 FPoint GetSizeFloat() const;
2392
2394 int GetWidth() const;
2395
2397 int GetHeight() const;
2398
2400 PixelFormat GetFormat() const;
2401
2402#if SDL_VERSION_ATLEAST(3, 4, 0)
2403
2422 void SetPalette(PaletteRef palette);
2423
2437
2438#endif // SDL_VERSION_ATLEAST(3, 4, 0)
2439
2465 void SetColorMod(Uint8 r, Uint8 g, Uint8 b);
2466
2492 void SetColorModFloat(float r, float g, float b);
2493
2510 void GetColorMod(Uint8* r, Uint8* g, Uint8* b) const;
2511
2528 void GetColorModFloat(float* r, float* g, float* b) const;
2529
2552 void SetAlphaMod(Uint8 alpha);
2553
2576 void SetAlphaModFloat(float alpha);
2577
2592 Uint8 GetAlphaMod() const;
2593
2608 float GetAlphaModFloat() const;
2609
2632 void SetMod(Color c);
2633
2656 void SetModFloat(FColor c);
2657
2671 Color GetMod() const;
2672
2686 FColor GetModFloat() const;
2687
2703 void SetBlendMode(BlendMode blendMode);
2704
2717 BlendMode GetBlendMode() const;
2718
2735 void SetScaleMode(ScaleMode scaleMode);
2736
2749 ScaleMode GetScaleMode() const;
2750
2781 void Update(OptionalRef<const RectRaw> rect, const void* pixels, int pitch);
2782
2812 void Update(SurfaceConstRef surface,
2813 OptionalRef<const RectRaw> rect = std::nullopt);
2814
2844 const Uint8* Yplane,
2845 int Ypitch,
2846 const Uint8* Uplane,
2847 int Upitch,
2848 const Uint8* Vplane,
2849 int Vpitch);
2850
2876 const Uint8* Yplane,
2877 int Ypitch,
2878 const Uint8* UVplane,
2879 int UVpitch);
2880
2906 TextureLock Lock(OptionalRef<const RectRaw> rect, void** pixels, int* pitch);
2907
2939 OptionalRef<const RectRaw> rect = std::nullopt);
2940
2958 void Unlock(TextureLock&& lock);
2959
2977 void Unlock(TextureSurfaceLock&& lock);
2978};
2979
2993{
2994 using TextureBase::TextureBase;
2995
3003 constexpr explicit Texture(TextureRaw resource) noexcept
3004 : TextureBase(resource)
3005 {
3006 }
3007
3009 constexpr Texture(const Texture& other)
3010 : Texture(borrow(other.get()))
3011 {
3012 }
3013
3015 constexpr Texture(Texture&& other) noexcept
3016 : Texture(other.release())
3017 {
3018 }
3019
3041 Texture(RendererRef renderer,
3042 PixelFormat format,
3043 TextureAccess access,
3044 const PointRaw& size);
3045
3070 Texture(RendererRef renderer, SurfaceRef surface);
3071
3194 Texture(RendererRef renderer, PropertiesRef props);
3195
3225 Texture(RendererRef renderer, StringParam file);
3226
3267 Texture(RendererRef renderer, IOStreamRef src, bool closeio = false);
3268
3276 static Texture borrow(TextureRaw resource)
3277 {
3278 if (resource) {
3279 ++resource->refcount;
3280 return Texture(resource);
3281 }
3282 return {};
3283 }
3284
3286 ~Texture() { SDL_DestroyTexture(get()); }
3287
3289 constexpr Texture& operator=(Texture&& other) noexcept
3290 {
3291 swap(*this, other);
3292 return *this;
3293 }
3294
3297 {
3298 if (get() != other.get()) {
3299 Texture tmp(other);
3300 swap(*this, tmp);
3301 }
3302 return *this;
3303 }
3304};
3305
3323{
3324 TextureRef m_lock;
3325
3326public:
3358 void** pixels,
3359 int* pitch);
3360
3362 TextureLock(const TextureLock& other) = delete;
3363
3365 TextureLock(TextureLock&& other) noexcept
3366 : m_lock(std::move(other.m_lock))
3367 {
3368 }
3369
3388
3389 TextureLock& operator=(const TextureLock& other) = delete;
3390
3393 {
3394 std::swap(m_lock, other.m_lock);
3395 return *this;
3396 }
3397
3399 constexpr operator bool() const { return bool(m_lock); }
3400
3418 void reset();
3419
3421 TextureRef resource() const { return m_lock; }
3422
3424 void release() { m_lock.release(); }
3425};
3426
3450{
3451 TextureRef m_lock;
3452
3453public:
3487 OptionalRef<const RectRaw> rect = std::nullopt);
3488
3491
3494 : Surface(std::move(other))
3495 , m_lock(std::move(other.m_lock))
3496 {
3497 }
3498
3517
3518 TextureSurfaceLock& operator=(const TextureSurfaceLock& other) = delete;
3519
3522 {
3523 std::swap(m_lock, other.m_lock);
3524 Surface::operator=(std::move(other));
3525 return *this;
3526 }
3527
3545 void reset();
3546
3548 TextureRef resource() const { return m_lock; }
3549};
3550
3569inline int GetNumRenderDrivers() { return SDL_GetNumRenderDrivers(); }
3570
3593inline const char* GetRenderDriver(int index)
3594{
3595 return SDL_GetRenderDriver(index);
3596}
3597
3617 const PointRaw& size,
3618 WindowFlags window_flags,
3619 WindowRaw* window,
3620 RendererRaw* renderer)
3621{
3622 CheckError(SDL_CreateWindowAndRenderer(
3623 title, size.x, size.y, window_flags, window, renderer));
3624}
3625
3644 const PointRaw& size,
3645 WindowFlags window_flags,
3646 Window* window,
3647 Renderer* renderer)
3648{
3649 SDL_Window* windowRaw = nullptr;
3650 SDL_Renderer* rendererRaw = nullptr;
3652 title, size, window_flags, &windowRaw, &rendererRaw);
3653 if (window) *window = Window{windowRaw};
3654 if (renderer) *renderer = Renderer{rendererRaw};
3655}
3656
3675 const PointRaw& size,
3676 WindowFlags window_flags,
3677 Renderer* renderer = nullptr)
3678{
3679 Window window;
3680 CreateWindowAndRenderer(title, size, window_flags, &window, renderer);
3681 return window;
3682}
3683
3717inline Renderer CreateRenderer(WindowRef window, StringParam name = nullptr)
3718{
3719 return Renderer(window, name);
3720}
3721
3723 : Renderer(SDL_CreateRenderer(window, name))
3724{
3725}
3726
3728 : Renderer(SDL_CreateRendererWithProperties(props))
3729{
3730}
3731
3733 : Renderer(SDL_CreateSoftwareRenderer(surface))
3734{
3735}
3736
3800{
3801 return Renderer(props);
3802}
3803
3810
3811constexpr auto NAME_STRING =
3812 SDL_PROP_RENDERER_CREATE_NAME_STRING;
3813
3814constexpr auto WINDOW_POINTER =
3815 SDL_PROP_RENDERER_CREATE_WINDOW_POINTER;
3816
3817constexpr auto SURFACE_POINTER =
3818 SDL_PROP_RENDERER_CREATE_SURFACE_POINTER;
3819
3821 SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER;
3823
3824constexpr auto PRESENT_VSYNC_NUMBER =
3825 SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER;
3826
3827#if SDL_VERSION_ATLEAST(3, 4, 0)
3828
3829constexpr auto GPU_DEVICE_POINTER =
3830 SDL_PROP_RENDERER_CREATE_GPU_DEVICE_POINTER;
3831
3833 SDL_PROP_RENDERER_CREATE_GPU_SHADERS_SPIRV_BOOLEAN;
3835
3837 SDL_PROP_RENDERER_CREATE_GPU_SHADERS_DXIL_BOOLEAN;
3839
3841 SDL_PROP_RENDERER_CREATE_GPU_SHADERS_MSL_BOOLEAN;
3842
3843#endif // SDL_VERSION_ATLEAST(3, 4, 0)
3844
3846 SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER;
3848
3850 SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER;
3851
3853 SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER;
3856
3858 SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER;
3859
3861 SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER;
3867
3869 SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER;
3875
3876} // namespace prop::Renderer::Create
3877
3878#if SDL_VERSION_ATLEAST(3, 4, 0)
3879
3913{
3914 return SDL_CreateGPURenderer(device, window);
3915}
3916
3929{
3930 return SDL_GetGPURendererDevice(renderer);
3931}
3932
3937
3938#endif // SDL_VERSION_ATLEAST(3, 4, 0)
3939
3960{
3961 return Renderer(surface);
3962}
3963
3976{
3977 return CheckError(SDL_GetRenderer(window));
3978}
3979
3981{
3982 return SDL::GetRenderer(get());
3983}
3984
3997{
3998 return CheckError(SDL_GetRenderWindow(renderer));
3999}
4000
4002{
4003 return SDL::GetRenderWindow(get());
4004}
4005
4020inline const char* GetRendererName(RendererRef renderer)
4021{
4022 return CheckError(SDL_GetRendererName(renderer));
4023}
4024
4025inline const char* RendererBase::GetName() const
4026{
4027 return SDL::GetRendererName(get());
4028}
4029
4116{
4117 return CheckError(SDL_GetRendererProperties(renderer));
4118}
4119
4124
4135namespace prop::Renderer {
4136
4137constexpr auto NAME_STRING =
4138 SDL_PROP_RENDERER_NAME_STRING;
4139
4140constexpr auto WINDOW_POINTER =
4141 SDL_PROP_RENDERER_WINDOW_POINTER;
4142
4143constexpr auto SURFACE_POINTER =
4144 SDL_PROP_RENDERER_SURFACE_POINTER;
4145
4146constexpr auto VSYNC_NUMBER =
4147 SDL_PROP_RENDERER_VSYNC_NUMBER;
4148
4150 SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER;
4151
4153 SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER;
4154
4155#if SDL_VERSION_ATLEAST(3, 4, 0)
4156
4158 SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN;
4159
4160#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4161
4163 SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER;
4164
4165constexpr auto HDR_ENABLED_BOOLEAN =
4166 SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN;
4167
4169 SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT;
4170
4171constexpr auto HDR_HEADROOM_FLOAT =
4172 SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT;
4173
4174constexpr auto D3D9_DEVICE_POINTER =
4175 SDL_PROP_RENDERER_D3D9_DEVICE_POINTER;
4176
4177constexpr auto D3D11_DEVICE_POINTER =
4178 SDL_PROP_RENDERER_D3D11_DEVICE_POINTER;
4179
4181 SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER;
4182
4183constexpr auto D3D12_DEVICE_POINTER =
4184 SDL_PROP_RENDERER_D3D12_DEVICE_POINTER;
4185
4187 SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER;
4188
4190 SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER;
4192
4194 SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER;
4195
4197 SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER;
4198
4200 SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER;
4202
4204 SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER;
4205
4207 SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER;
4212
4214 SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER;
4218
4220 SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER;
4222
4223constexpr auto GPU_DEVICE_POINTER =
4224 SDL_PROP_RENDERER_GPU_DEVICE_POINTER;
4225
4226} // namespace prop::Renderer
4227
4248inline void GetRenderOutputSize(RendererRef renderer, int* w, int* h)
4249{
4250 CheckError(SDL_GetRenderOutputSize(renderer, w, h));
4251}
4252
4273{
4274 Point p;
4275 GetRenderOutputSize(renderer, &p.x, &p.y);
4276 return p;
4277}
4278
4279inline void RendererBase::GetOutputSize(int* w, int* h) const
4280{
4282}
4283
4285{
4286 return SDL::GetRenderOutputSize(get());
4287}
4288
4309inline void GetCurrentRenderOutputSize(RendererRef renderer, int* w, int* h)
4310{
4311 CheckError(SDL_GetCurrentRenderOutputSize(renderer, w, h));
4312}
4313
4334{
4335 Point p;
4336 GetCurrentRenderOutputSize(renderer, &p.x, &p.y);
4337 return p;
4338}
4339
4340inline void RendererBase::GetCurrentOutputSize(int* w, int* h) const
4341{
4343}
4344
4349
4373 PixelFormat format,
4374 TextureAccess access,
4375 const PointRaw& size)
4376{
4377 return Texture(renderer, format, access, size);
4378}
4379
4381 TextureAccess access,
4382 const PointRaw& size)
4383{
4384 return Texture(get(), format, access, size);
4385}
4386
4388 PixelFormat format,
4389 TextureAccess access,
4390 const PointRaw& size)
4391 : Texture(SDL_CreateTexture(renderer, format, access, size.x, size.y))
4392{
4393}
4394
4395inline Texture::Texture(RendererRef renderer, SurfaceRef surface)
4396 : Texture(SDL_CreateTextureFromSurface(renderer, surface))
4397{
4398}
4399
4401 : Texture(SDL_CreateTextureWithProperties(renderer, props))
4402{
4403}
4404
4431 SurfaceRef surface)
4432{
4433 return Texture(renderer, surface);
4434}
4435
4437{
4438 return Texture(get(), surface);
4439}
4440
4563 PropertiesRef props)
4564{
4565 return Texture(renderer, props);
4566}
4567
4569{
4570 return Texture(get(), props);
4571}
4572
4579
4580constexpr auto COLORSPACE_NUMBER =
4581 SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER;
4582
4583constexpr auto FORMAT_NUMBER =
4584 SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER;
4585
4586constexpr auto ACCESS_NUMBER =
4587 SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER;
4588
4589constexpr auto WIDTH_NUMBER =
4590 SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER;
4591
4592constexpr auto HEIGHT_NUMBER =
4593 SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER;
4594
4595#if SDL_VERSION_ATLEAST(3, 4, 0)
4596
4597constexpr auto PALETTE_POINTER =
4598 SDL_PROP_TEXTURE_CREATE_PALETTE_POINTER;
4599
4600#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4601
4603 SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT;
4604
4605constexpr auto HDR_HEADROOM_FLOAT =
4606 SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT;
4607
4609 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER;
4610
4612 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER;
4614
4616 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER;
4618
4620 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER;
4621
4623 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER;
4625
4627 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER;
4629
4631 SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER;
4633
4635 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER;
4636
4638 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER;
4640
4642 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER;
4644
4646 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER;
4648
4650 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER;
4652
4654 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER;
4656
4658 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER;
4660
4662 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER;
4664
4666 SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER;
4668
4669#if SDL_VERSION_ATLEAST(3, 4, 0)
4670
4671constexpr auto VULKAN_LAYOUT_NUMBER =
4672 SDL_PROP_TEXTURE_CREATE_VULKAN_LAYOUT_NUMBER;
4673
4674constexpr auto GPU_TEXTURE_POINTER =
4675 SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_POINTER;
4676
4678 SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_UV_POINTER;
4680
4682 SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_U_POINTER;
4683
4685 SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_V_POINTER;
4686
4687#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4688
4689} // namespace prop::Texture::Create
4690
4787{
4788 return CheckError(SDL_GetTextureProperties(texture));
4789}
4790
4795
4806namespace prop::Texture {
4807
4808constexpr auto COLORSPACE_NUMBER =
4809 SDL_PROP_TEXTURE_COLORSPACE_NUMBER;
4810
4811constexpr auto FORMAT_NUMBER =
4812 SDL_PROP_TEXTURE_FORMAT_NUMBER;
4813
4814constexpr auto ACCESS_NUMBER =
4815 SDL_PROP_TEXTURE_ACCESS_NUMBER;
4816
4817constexpr auto WIDTH_NUMBER =
4818 SDL_PROP_TEXTURE_WIDTH_NUMBER;
4819
4820constexpr auto HEIGHT_NUMBER =
4821 SDL_PROP_TEXTURE_HEIGHT_NUMBER;
4822
4824 SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT;
4825
4826constexpr auto HDR_HEADROOM_FLOAT =
4827 SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT;
4828
4830 SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER;
4831
4833 SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER;
4834
4836 SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER;
4837
4839 SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER;
4840
4842 SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER;
4843
4845 SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER;
4846
4848 SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER;
4849
4851 SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER;
4852
4854 SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER;
4855
4857 SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER;
4858
4860 SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER;
4862
4863constexpr auto OPENGL_TEX_W_FLOAT =
4864 SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT;
4865
4866constexpr auto OPENGL_TEX_H_FLOAT =
4867 SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT;
4868
4870 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER;
4871
4873 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER;
4875
4877 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER;
4879
4881 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER;
4883
4885 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER;
4887
4889 SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER;
4890
4891#if SDL_VERSION_ATLEAST(3, 4, 0)
4892
4893constexpr auto GPU_TEXTURE_POINTER =
4894 SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER;
4895
4897 SDL_PROP_TEXTURE_GPU_TEXTURE_UV_POINTER;
4898
4900 SDL_PROP_TEXTURE_GPU_TEXTURE_U_POINTER;
4901
4903 SDL_PROP_TEXTURE_GPU_TEXTURE_V_POINTER;
4904
4905#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4906
4907} // namespace prop::Texture
4908
4921{
4922 return CheckError(SDL_GetRendererFromTexture(texture));
4923}
4924
4926{
4928}
4929
4944inline void GetTextureSize(TextureConstRef texture, float* w, float* h)
4945{
4946 CheckError(SDL_GetTextureSize(texture, w, h));
4947}
4948
4951{
4952 return Point(texture->w, texture->h);
4953}
4954
4955inline void TextureBase::GetSize(float* w, float* h) const
4956{
4957 SDL::GetTextureSize(get(), w, h);
4958}
4959
4961
4964{
4965 FPoint p;
4966 GetTextureSize(texture, &p.x, &p.y);
4967 return p;
4968}
4969
4971{
4972 return SDL::GetTextureSizeFloat(get());
4973}
4974
4976inline int GetTextureWidth(TextureConstRef texture) { return texture->w; }
4977
4978inline int TextureBase::GetWidth() const { return SDL::GetTextureWidth(get()); }
4979
4981inline int GetTextureHeight(TextureConstRef texture) { return texture->h; }
4982
4983inline int TextureBase::GetHeight() const { return GetTextureHeight(get()); }
4984
4987{
4988 return texture->format;
4989}
4990
4992{
4993 return SDL::GetTextureFormat(get());
4994}
4995
4996#if SDL_VERSION_ATLEAST(3, 4, 0)
4997
5017inline void SetTexturePalette(TextureRef texture, PaletteRef palette)
5018{
5019 CheckError(SDL_SetTexturePalette(texture, palette));
5020}
5021
5023{
5024 SDL::SetTexturePalette(get(), palette);
5025}
5026
5041{
5042 return Palette::borrow(SDL_GetTexturePalette(texture));
5043}
5044
5046
5047#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5048
5075inline void SetTextureColorMod(TextureRef texture, Uint8 r, Uint8 g, Uint8 b)
5076{
5077 CheckError(SDL_SetTextureColorMod(texture, r, g, b));
5078}
5079
5081{
5082 SDL::SetTextureColorMod(get(), r, g, b);
5083}
5084
5112 float r,
5113 float g,
5114 float b)
5115{
5116 CheckError(SDL_SetTextureColorModFloat(texture, r, g, b));
5117}
5118
5119inline void TextureBase::SetColorModFloat(float r, float g, float b)
5120{
5122}
5123
5142 Uint8* r,
5143 Uint8* g,
5144 Uint8* b)
5145{
5146 CheckError(SDL_GetTextureColorMod(texture, r, g, b));
5147}
5148
5149inline void TextureBase::GetColorMod(Uint8* r, Uint8* g, Uint8* b) const
5150{
5151 SDL::GetTextureColorMod(get(), r, g, b);
5152}
5153
5172 float* r,
5173 float* g,
5174 float* b)
5175{
5176 CheckError(SDL_GetTextureColorModFloat(texture, r, g, b));
5177}
5178
5179inline void TextureBase::GetColorModFloat(float* r, float* g, float* b) const
5180{
5182}
5183
5207inline void SetTextureAlphaMod(TextureRef texture, Uint8 alpha)
5208{
5209 CheckError(SDL_SetTextureAlphaMod(texture, alpha));
5210}
5211
5213{
5214 SDL::SetTextureAlphaMod(get(), alpha);
5215}
5216
5240inline void SetTextureAlphaModFloat(TextureRef texture, float alpha)
5241{
5242 CheckError(SDL_SetTextureAlphaModFloat(texture, alpha));
5243}
5244
5245inline void TextureBase::SetAlphaModFloat(float alpha)
5246{
5248}
5249
5266{
5267 Uint8 alpha;
5268 CheckError(SDL_GetTextureAlphaMod(texture, &alpha));
5269 return alpha;
5270}
5271
5273{
5274 return SDL::GetTextureAlphaMod(get());
5275}
5276
5293{
5294 float alpha;
5295 CheckError(SDL_GetTextureAlphaModFloat(texture, &alpha));
5296 return alpha;
5297}
5298
5300{
5302}
5303
5327inline void SetTextureMod(TextureRef texture, Color c)
5328{
5329 SetTextureColorMod(texture, c.r, c.g, c.b);
5330 SetTextureAlphaMod(texture, c.a);
5331}
5332
5334
5358inline void SetTextureModFloat(TextureRef texture, FColor c)
5359{
5360 SetTextureColorModFloat(texture, c.r, c.g, c.b);
5361 SetTextureAlphaModFloat(texture, c.a);
5362}
5363
5365{
5367}
5368
5384{
5385 Color c;
5386 GetTextureColorMod(texture, &c.r, &c.g, &c.b);
5387 c.a = GetTextureAlphaMod(texture);
5388 return c;
5389}
5390
5392
5408{
5409 FColor c;
5410 GetTextureColorModFloat(texture, &c.r, &c.g, &c.b);
5411 c.a = GetTextureAlphaModFloat(texture);
5412 return c;
5413}
5414
5416{
5417 return SDL::GetTextureModFloat(get());
5418}
5419
5436inline void SetTextureBlendMode(TextureRef texture, BlendMode blendMode)
5437{
5438 CheckError(SDL_SetTextureBlendMode(texture, blendMode));
5439}
5440
5442{
5443 SDL::SetTextureBlendMode(get(), blendMode);
5444}
5445
5460{
5461 BlendMode blendMode;
5462 CheckError(SDL_GetTextureBlendMode(texture, &blendMode));
5463 return blendMode;
5464}
5465
5467{
5468 return SDL::GetTextureBlendMode(get());
5469}
5470
5488inline void SetTextureScaleMode(TextureRef texture, ScaleMode scaleMode)
5489{
5490 CheckError(SDL_SetTextureScaleMode(texture, scaleMode));
5491}
5492
5494{
5495 SDL::SetTextureScaleMode(get(), scaleMode);
5496}
5497
5512{
5513 ScaleMode scaleMode;
5514 CheckError(SDL_GetTextureScaleMode(texture, &scaleMode));
5515 return scaleMode;
5516}
5517
5519{
5520 return SDL::GetTextureScaleMode(get());
5521}
5522
5554inline void UpdateTexture(TextureRef texture,
5556 const void* pixels,
5557 int pitch)
5558{
5559 CheckError(SDL_UpdateTexture(texture, rect, pixels, pitch));
5560}
5561
5592inline void UpdateTexture(TextureRef texture,
5593 SurfaceConstRef surface,
5594 OptionalRef<const RectRaw> rect = std::nullopt)
5595{
5596 UpdateTexture(texture, rect, surface->pixels, surface->pitch);
5597}
5598
5600 const void* pixels,
5601 int pitch)
5602{
5603 SDL::UpdateTexture(get(), rect, pixels, pitch);
5604}
5605
5608{
5609 SDL::UpdateTexture(get(), surface, rect);
5610}
5611
5637inline void UpdateYUVTexture(TextureRef texture,
5639 const Uint8* Yplane,
5640 int Ypitch,
5641 const Uint8* Uplane,
5642 int Upitch,
5643 const Uint8* Vplane,
5644 int Vpitch)
5645{
5646 CheckError(SDL_UpdateYUVTexture(
5647 texture, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch));
5648}
5649
5651 const Uint8* Yplane,
5652 int Ypitch,
5653 const Uint8* Uplane,
5654 int Upitch,
5655 const Uint8* Vplane,
5656 int Vpitch)
5657{
5659 get(), rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch);
5660}
5661
5686inline void UpdateNVTexture(TextureRef texture,
5688 const Uint8* Yplane,
5689 int Ypitch,
5690 const Uint8* UVplane,
5691 int UVpitch)
5692{
5693 CheckError(
5694 SDL_UpdateNVTexture(texture, rect, Yplane, Ypitch, UVplane, UVpitch));
5695}
5696
5698 const Uint8* Yplane,
5699 int Ypitch,
5700 const Uint8* UVplane,
5701 int UVpitch)
5702{
5703 SDL::UpdateNVTexture(get(), rect, Yplane, Ypitch, UVplane, UVpitch);
5704}
5705
5733inline void LockTexture(TextureRef texture,
5735 void** pixels,
5736 int* pitch)
5737{
5738 CheckError(SDL_LockTexture(texture, rect, pixels, pitch));
5739}
5740
5742 void** pixels,
5743 int* pitch)
5744{
5745 return {TextureRef(*this), rect, pixels, pitch};
5746}
5747
5750 void** pixels,
5751 int* pitch)
5752 : m_lock(resource)
5753{
5754 LockTexture(m_lock, rect, pixels, pitch);
5755}
5756
5789 TextureRef texture,
5790 OptionalRef<const RectRaw> rect = std::nullopt)
5791{
5792 SurfaceRaw surface = nullptr;
5793 CheckError(SDL_LockTextureToSurface(texture, rect, &surface));
5794 return Surface::borrow(surface);
5795}
5796
5799{
5800 return {TextureRef(*this), rect};
5801}
5802
5809
5829inline void UnlockTexture(TextureRef texture) { SDL_UnlockTexture(texture); }
5830
5832{
5833 SDL_assert_paranoid(lock.resource() == *this);
5834 std::move(lock).reset();
5835}
5836
5838{
5839 SDL_assert_paranoid(lock.resource() == *this);
5840 std::move(lock).reset();
5841}
5842
5844{
5845 if (!m_lock) return;
5846 UnlockTexture(m_lock);
5847 m_lock = {};
5848}
5849
5851{
5852 if (!m_lock) return;
5853 UnlockTexture(m_lock);
5854 m_lock = {};
5855}
5856
5881inline void SetRenderTarget(RendererRef renderer, TextureRef texture)
5882{
5883 CheckError(SDL_SetRenderTarget(renderer, texture));
5884}
5885
5887{
5888 SDL::SetRenderTarget(get(), texture);
5889}
5890
5906inline void ResetRenderTarget(RendererRef renderer)
5907{
5908 SetRenderTarget(renderer, nullptr);
5909}
5910
5912
5929{
5930 if (auto texture = SDL_GetRenderTarget(renderer))
5931 return Texture::borrow(texture);
5932 return {};
5933}
5934
5936{
5937 return SDL::GetRenderTarget(get());
5938}
5939
5984 const PointRaw& size,
5986{
5987 CheckError(SDL_SetRenderLogicalPresentation(renderer, size.x, size.y, mode));
5988}
5989
5991 const PointRaw& size,
5993{
5995}
5996
6019 int* w,
6020 int* h,
6022{
6023 CheckError(SDL_GetRenderLogicalPresentation(renderer, w, h, mode));
6024}
6025
6048 PointRaw* size,
6050{
6051 if (size) {
6052 return GetRenderLogicalPresentation(renderer, &size->x, &size->y, mode);
6053 }
6054 return GetRenderLogicalPresentation(renderer, nullptr, nullptr, mode);
6055}
6056
6058 int* w,
6059 int* h,
6060 RendererLogicalPresentation* mode) const
6061{
6063}
6064
6066 PointRaw* size,
6068{
6070}
6071
6093{
6094 FRect rect;
6095 CheckError(SDL_GetRenderLogicalPresentationRect(renderer, &rect));
6096 return rect;
6097}
6098
6103
6127 const FPointRaw& window_coord)
6128{
6129 FPoint p;
6130 CheckError(SDL_RenderCoordinatesFromWindow(
6131 renderer, window_coord.x, window_coord.y, &p.x, &p.y));
6132 return p;
6133}
6134
6136 const FPointRaw& window_coord) const
6137{
6138 return SDL::RenderCoordinatesFromWindow(get(), window_coord);
6139}
6140
6165 const FPointRaw& coord)
6166{
6167 FPoint p;
6168 CheckError(
6169 SDL_RenderCoordinatesToWindow(renderer, coord.x, coord.y, &p.x, &p.y));
6170 return p;
6171}
6172
6174 const FPointRaw& coord) const
6175{
6176 return SDL::RenderCoordinatesToWindow(get(), coord);
6177}
6178
6212{
6213 CheckError(SDL_ConvertEventToRenderCoordinates(renderer, event));
6214}
6215
6220
6245inline void SetRenderViewport(RendererRef renderer,
6247{
6248 CheckError(SDL_SetRenderViewport(renderer, rect));
6249}
6250
6255
6273{
6274 SetRenderViewport(renderer, std::nullopt);
6275}
6276
6278
6297{
6298 Rect rect;
6299 CheckError(SDL_GetRenderViewport(renderer, &rect));
6300 return rect;
6301}
6302
6304{
6305 return SDL::GetRenderViewport(get());
6306}
6307
6328inline bool RenderViewportSet(RendererRef renderer)
6329{
6330 return SDL_RenderViewportSet(renderer);
6331}
6332
6333inline bool RendererBase::ViewportSet() const
6334{
6335 return SDL::RenderViewportSet(get());
6336}
6337
6357{
6358 Rect rect;
6359 CheckError(SDL_GetRenderSafeArea(renderer, &rect));
6360 return rect;
6361}
6362
6364{
6365 return SDL::GetRenderSafeArea(get());
6366}
6367
6387inline void SetRenderClipRect(RendererRef renderer,
6389{
6390 CheckError(SDL_SetRenderClipRect(renderer, rect));
6391}
6392
6397
6415{
6416 SetRenderClipRect(renderer, std::nullopt);
6417}
6418
6420
6440{
6441 Rect rect;
6442 CheckError(SDL_GetRenderClipRect(renderer, &rect));
6443 return rect;
6444}
6445
6447{
6448 return SDL::GetRenderClipRect(get());
6449}
6450
6468inline bool RenderClipEnabled(RendererRef renderer)
6469{
6470 return SDL_RenderClipEnabled(renderer);
6471}
6472
6474{
6475 return SDL::RenderClipEnabled(get());
6476}
6477
6502inline void SetRenderScale(RendererRef renderer, const FPointRaw& scale)
6503{
6504 CheckError(SDL_SetRenderScale(renderer, scale.x, scale.y));
6505}
6506
6507inline void RendererBase::SetScale(const FPointRaw& scale)
6508{
6509 SDL::SetRenderScale(get(), scale);
6510}
6511
6529inline void GetRenderScale(RendererRef renderer, float* scaleX, float* scaleY)
6530{
6531 CheckError(SDL_GetRenderScale(renderer, scaleX, scaleY));
6532}
6533
6550{
6551 FPoint p;
6552 GetRenderScale(renderer, &p.x, &p.y);
6553 return p;
6554}
6555
6556inline void RendererBase::GetScale(float* scaleX, float* scaleY) const
6557{
6558 SDL::GetRenderScale(get(), scaleX, scaleY);
6559}
6560
6562{
6563 return SDL::GetRenderScale(get());
6564}
6565
6584{
6585 CheckError(SDL_SetRenderDrawColor(renderer, c.r, c.g, c.b, c.a));
6586}
6587
6592
6610inline void SetRenderDrawColorFloat(RendererRef renderer, const FColorRaw& c)
6611{
6612 CheckError(SDL_SetRenderDrawColorFloat(renderer, c.r, c.g, c.b, c.a));
6613}
6614
6619
6641inline void GetRenderDrawColor(RendererRef renderer,
6642 Uint8* r,
6643 Uint8* g,
6644 Uint8* b,
6645 Uint8* a)
6646{
6647 CheckError(SDL_GetRenderDrawColor(renderer, r, g, b, a));
6648}
6649
6665{
6666 Color c;
6667 GetRenderDrawColor(renderer, &c.r, &c.g, &c.b, &c.a);
6668 return c;
6669}
6670
6672 Uint8* g,
6673 Uint8* b,
6674 Uint8* a) const
6675{
6676 SDL::GetRenderDrawColor(get(), r, g, b, a);
6677}
6678
6680{
6681 return SDL::GetRenderDrawColor(get());
6682}
6683
6706 float* r,
6707 float* g,
6708 float* b,
6709 float* a)
6710{
6711 CheckError(SDL_GetRenderDrawColorFloat(renderer, r, g, b, a));
6712}
6713
6729{
6730 FColor c;
6731 GetRenderDrawColorFloat(renderer, &c.r, &c.g, &c.b, &c.a);
6732 return c;
6733}
6734
6736 float* g,
6737 float* b,
6738 float* a) const
6739{
6740 SDL::GetRenderDrawColorFloat(get(), r, g, b, a);
6741}
6742
6747
6768inline void SetRenderColorScale(RendererRef renderer, float scale)
6769{
6770 CheckError(SDL_SetRenderColorScale(renderer, scale));
6771}
6772
6773inline void RendererBase::SetColorScale(float scale)
6774{
6775 SDL::SetRenderColorScale(get(), scale);
6776}
6777
6791inline float GetRenderColorScale(RendererRef renderer)
6792{
6793 float scale;
6794 CheckError(SDL_GetRenderColorScale(renderer, &scale));
6795 return scale;
6796}
6797
6799{
6800 return SDL::GetRenderColorScale(get());
6801}
6802
6818inline void SetRenderDrawBlendMode(RendererRef renderer, BlendMode blendMode)
6819{
6820 CheckError(SDL_SetRenderDrawBlendMode(renderer, blendMode));
6821}
6822
6824{
6825 SDL::SetRenderDrawBlendMode(get(), blendMode);
6826}
6827
6842{
6843 BlendMode blendMode;
6844 CheckError(SDL_GetRenderDrawBlendMode(renderer, &blendMode));
6845 return blendMode;
6846}
6847
6852
6870inline void RenderClear(RendererRef renderer)
6871{
6872 CheckError(SDL_RenderClear(renderer));
6873}
6874
6876
6890inline void RenderPoint(RendererRef renderer, const FPointRaw& p)
6891{
6892 CheckError(SDL_RenderPoint(renderer, p.x, p.y));
6893}
6894
6896{
6897 SDL::RenderPoint(get(), p);
6898}
6899
6914{
6915 CheckError(
6916 SDL_RenderPoints(renderer, points.data(), narrowS32(points.size())));
6917}
6918
6920{
6921 SDL::RenderPoints(get(), points);
6922}
6923
6938inline void RenderLine(RendererRef renderer,
6939 const FPointRaw& p1,
6940 const FPointRaw& p2)
6941{
6942 CheckError(SDL_RenderLine(renderer, p1.x, p1.y, p2.x, p2.y));
6943}
6944
6945inline void RendererBase::RenderLine(const FPointRaw& p1, const FPointRaw& p2)
6946{
6947 SDL::RenderLine(get(), p1, p2);
6948}
6949
6965{
6966 CheckError(
6967 SDL_RenderLines(renderer, points.data(), narrowS32(points.size())));
6968}
6969
6971{
6972 SDL::RenderLines(get(), points);
6973}
6974
6990{
6991 CheckError(SDL_RenderRect(renderer, rect));
6992}
6993
6998
7014{
7015 CheckError(SDL_RenderRects(renderer, rects.data(), narrowS32(rects.size())));
7016}
7017
7019{
7020 SDL::RenderRects(get(), rects);
7021}
7022
7038inline void RenderFillRect(RendererRef renderer,
7040{
7041 CheckError(SDL_RenderFillRect(renderer, rect));
7042}
7043
7048
7064{
7065 CheckError(
7066 SDL_RenderFillRects(renderer, rects.data(), narrowS32(rects.size())));
7067}
7068
7073
7093inline void RenderTexture(RendererRef renderer,
7094 TextureRef texture,
7097{
7098 CheckError(SDL_RenderTexture(renderer, texture, srcrect, dstrect));
7099}
7100
7104{
7105 SDL::RenderTexture(get(), texture, srcrect, dstrect);
7106}
7107
7134 TextureRef texture,
7137 double angle,
7139 FlipMode flip = FlipMode::SDL_FLIP_NONE)
7140{
7141 CheckError(SDL_RenderTextureRotated(
7142 renderer, texture, srcrect, dstrect, angle, center, flip));
7143}
7144
7146 TextureRef texture,
7149 double angle,
7151 FlipMode flip)
7152{
7154 get(), texture, srcrect, dstrect, angle, center, flip);
7155}
7156
7183 TextureRef texture,
7188{
7189 CheckError(
7190 SDL_RenderTextureAffine(renderer, texture, srcrect, origin, right, down));
7191}
7192
7194 TextureRef texture,
7199{
7200 SDL::RenderTextureAffine(get(), texture, srcrect, origin, right, down);
7201}
7202
7227inline void RenderTextureTiled(RendererRef renderer,
7228 TextureRef texture,
7230 float scale,
7232{
7233 CheckError(
7234 SDL_RenderTextureTiled(renderer, texture, srcrect, scale, dstrect));
7235}
7236
7238 TextureRef texture,
7240 float scale,
7242{
7243 SDL::RenderTextureTiled(get(), texture, srcrect, scale, dstrect);
7244}
7245
7278inline void RenderTexture9Grid(RendererRef renderer,
7279 TextureRef texture,
7281 float left_width,
7282 float right_width,
7283 float top_height,
7284 float bottom_height,
7285 float scale,
7287{
7288 CheckError(SDL_RenderTexture9Grid(renderer,
7289 texture,
7290 srcrect,
7291 left_width,
7292 right_width,
7293 top_height,
7294 bottom_height,
7295 scale,
7296 dstrect));
7297}
7298
7300 TextureRef texture,
7302 float left_width,
7303 float right_width,
7304 float top_height,
7305 float bottom_height,
7306 float scale,
7308{
7310 texture,
7311 srcrect,
7312 left_width,
7313 right_width,
7314 top_height,
7315 bottom_height,
7316 scale,
7317 dstrect);
7318}
7319
7320#if SDL_VERSION_ATLEAST(3, 4, 0)
7321
7358 TextureRef texture,
7359 const FRectRaw& srcrect,
7360 float left_width,
7361 float right_width,
7362 float top_height,
7363 float bottom_height,
7364 float scale,
7365 const FRectRaw& dstrect,
7366 float tileScale)
7367{
7368 CheckError(SDL_RenderTexture9GridTiled(renderer,
7369 texture,
7370 &srcrect,
7371 left_width,
7372 right_width,
7373 top_height,
7374 bottom_height,
7375 scale,
7376 &dstrect,
7377 tileScale));
7378}
7379
7381 const FRectRaw& srcrect,
7382 float left_width,
7383 float right_width,
7384 float top_height,
7385 float bottom_height,
7386 float scale,
7387 const FRectRaw& dstrect,
7388 float tileScale)
7389{
7391 texture,
7392 srcrect,
7393 left_width,
7394 right_width,
7395 top_height,
7396 bottom_height,
7397 scale,
7398 dstrect,
7399 tileScale);
7400}
7401
7402#endif // SDL_VERSION_ATLEAST(3, 4, 0)
7403
7424inline void RenderGeometry(RendererRef renderer,
7425 TextureRef texture,
7426 std::span<const Vertex> vertices,
7427 std::span<const int> indices = {})
7428{
7429 CheckError(SDL_RenderGeometry(renderer,
7430 texture,
7431 vertices.data(),
7432 narrowS32(vertices.size()),
7433 indices.data(),
7434 narrowS32(indices.size())));
7435}
7436
7438 std::span<const Vertex> vertices,
7439 std::span<const int> indices)
7440{
7441 SDL::RenderGeometry(get(), texture, vertices, indices);
7442}
7443
7471inline void RenderGeometryRaw(RendererRef renderer,
7472 TextureRef texture,
7473 const float* xy,
7474 int xy_stride,
7475 const FColor* color,
7476 int color_stride,
7477 const float* uv,
7478 int uv_stride,
7479 int num_vertices,
7480 const void* indices,
7481 int num_indices,
7482 int size_indices)
7483{
7484 CheckError(SDL_RenderGeometryRaw(renderer,
7485 texture,
7486 xy,
7487 xy_stride,
7488 color,
7489 color_stride,
7490 uv,
7491 uv_stride,
7492 num_vertices,
7493 indices,
7494 num_indices,
7495 size_indices));
7496}
7497
7499 const float* xy,
7500 int xy_stride,
7501 const FColor* color,
7502 int color_stride,
7503 const float* uv,
7504 int uv_stride,
7505 int num_vertices,
7506 const void* indices,
7507 int num_indices,
7508 int size_indices)
7509{
7511 texture,
7512 xy,
7513 xy_stride,
7514 color,
7515 color_stride,
7516 uv,
7517 uv_stride,
7518 num_vertices,
7519 indices,
7520 num_indices,
7521 size_indices);
7522}
7523
7524#if SDL_VERSION_ATLEAST(3, 4, 0)
7525
7545 TextureAddressMode u_mode,
7546 TextureAddressMode v_mode)
7547{
7548 CheckError(SDL_SetRenderTextureAddressMode(renderer, u_mode, v_mode));
7549}
7550
7556
7576 TextureAddressMode* u_mode,
7577 TextureAddressMode* v_mode)
7578{
7579 CheckError(SDL_GetRenderTextureAddressMode(renderer, u_mode, v_mode));
7580}
7581
7583 TextureAddressMode* u_mode,
7584 TextureAddressMode* v_mode)
7585{
7586 SDL::GetRenderTextureAddressMode(get(), u_mode, v_mode);
7587}
7588
7589#endif // SDL_VERSION_ATLEAST(3, 4, 0)
7590
7615{
7616 return Surface{CheckError(SDL_RenderReadPixels(renderer, rect))};
7617}
7618
7620{
7621 return SDL::RenderReadPixels(get(), rect);
7622}
7623
7669inline void RenderPresent(RendererRef renderer)
7670{
7671 CheckError(SDL_RenderPresent(renderer));
7672}
7673
7675
7691inline void DestroyTexture(TextureRaw texture) { SDL_DestroyTexture(texture); }
7692
7694
7708inline void DestroyRenderer(RendererRaw renderer)
7709{
7710 SDL_DestroyRenderer(renderer);
7711}
7712
7714
7745inline void FlushRenderer(RendererRef renderer)
7746{
7747 CheckError(SDL_FlushRenderer(renderer));
7748}
7749
7751
7768inline void* GetRenderMetalLayer(RendererRef renderer)
7769{
7770 return SDL_GetRenderMetalLayer(renderer);
7771}
7772
7774{
7775 return SDL::GetRenderMetalLayer(get());
7776}
7777
7800{
7801 return SDL_GetRenderMetalCommandEncoder(renderer);
7802}
7803
7808
7836 Uint32 wait_stage_mask,
7837 Sint64 wait_semaphore,
7838 Sint64 signal_semaphore)
7839{
7840 CheckError(SDL_AddVulkanRenderSemaphores(
7841 renderer, wait_stage_mask, wait_semaphore, signal_semaphore));
7842}
7843
7845 Sint64 wait_semaphore,
7846 Sint64 signal_semaphore)
7847{
7849 get(), wait_stage_mask, wait_semaphore, signal_semaphore);
7850}
7851
7874inline void SetRenderVSync(RendererRef renderer, int vsync)
7875{
7876 CheckError(SDL_SetRenderVSync(renderer, vsync));
7877}
7878
7879inline void RendererBase::SetVSync(int vsync)
7880{
7881 SDL::SetRenderVSync(get(), vsync);
7882}
7883
7885constexpr int RENDERER_VSYNC_DISABLED = SDL_RENDERER_VSYNC_DISABLED;
7886
7888constexpr int RENDERER_VSYNC_ADAPTIVE = SDL_RENDERER_VSYNC_ADAPTIVE;
7889
7904inline int GetRenderVSync(RendererRef renderer)
7905{
7906 int vsync;
7907 CheckError(SDL_GetRenderVSync(renderer, &vsync));
7908 return vsync;
7909}
7910
7911inline int RendererBase::GetVSync() const { return SDL::GetRenderVSync(get()); }
7912
7923 SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE;
7924
7962inline void RenderDebugText(RendererRef renderer,
7963 const FPointRaw& p,
7964 StringParam str)
7965{
7966 CheckError(SDL_RenderDebugText(renderer, p.x, p.y, str));
7967}
7968
7970{
7971 SDL::RenderDebugText(get(), p, str);
7972}
7973
7998template<class... ARGS>
8000 const FPointRaw& p,
8001 std::string_view fmt,
8002 ARGS... args)
8003{
8005 renderer, p, std::vformat(fmt, std::make_format_args(args...)));
8006}
8007
8008template<class... ARGS>
8010 std::string_view fmt,
8011 ARGS... args)
8012{
8013 SDL::RenderDebugTextFormat(get(), p, fmt, args...);
8014}
8015
8016#if SDL_VERSION_ATLEAST(3, 4, 0)
8017
8034 ScaleMode scale_mode)
8035{
8036 CheckError(SDL_SetDefaultTextureScaleMode(renderer, scale_mode));
8037}
8038
8040{
8041 SDL::SetDefaultTextureScaleMode(get(), scale_mode);
8042}
8043
8059 ScaleMode* scale_mode)
8060{
8061 CheckError(SDL_GetDefaultTextureScaleMode(renderer, scale_mode));
8062}
8063
8065{
8066 SDL::GetDefaultTextureScaleMode(get(), scale_mode);
8067}
8068
8074struct GPURenderStateBase : ResourceBaseT<GPURenderStateRaw>
8075{
8077
8088 void Destroy();
8089
8106 void SetFragmentUniforms(Uint32 slot_index, const void* data, Uint32 length);
8107};
8108
8122{
8123 using GPURenderStateBase::GPURenderStateBase;
8124
8132 constexpr explicit GPURenderState(GPURenderStateRaw resource) noexcept
8133 : GPURenderStateBase(resource)
8134 {
8135 }
8136
8138 constexpr GPURenderState(GPURenderState&& other) noexcept
8139 : GPURenderState(other.release())
8140 {
8141 }
8142
8160 GPURenderState(RendererRef renderer,
8161 const GPURenderStateCreateInfo& createinfo);
8162
8164 ~GPURenderState() { SDL_DestroyGPURenderState(get()); }
8165
8167 constexpr GPURenderState& operator=(GPURenderState&& other) noexcept
8168 {
8169 swap(*this, other);
8170 return *this;
8171 }
8172};
8173
8192 RendererRef renderer,
8193 const GPURenderStateCreateInfo& createinfo)
8194{
8195 return GPURenderState(renderer, createinfo);
8196}
8197
8199 const GPURenderStateCreateInfo& createinfo)
8200{
8201 return GPURenderState(get(), createinfo);
8202}
8203
8205 RendererRef renderer,
8206 const GPURenderStateCreateInfo& createinfo)
8207 : GPURenderState(SDL_CreateGPURenderState(renderer, &createinfo))
8208{
8209}
8210
8229 Uint32 slot_index,
8230 const void* data,
8231 Uint32 length)
8232{
8233 CheckError(
8234 SDL_SetGPURenderStateFragmentUniforms(state, slot_index, data, length));
8235}
8236
8238 const void* data,
8239 Uint32 length)
8240{
8241 SDL::SetGPURenderStateFragmentUniforms(get(), slot_index, data, length);
8242}
8243
8261{
8262 CheckError(SDL_SetGPURenderState(renderer, state));
8263}
8264
8269
8283{
8284 SDL_DestroyGPURenderState(state);
8285}
8286
8288
8289#endif // SDL_VERSION_ATLEAST(3, 4, 0)
8290
8292
8293} // namespace SDL
8294
8295#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:3323
TextureRef resource() const
Get the reference to locked resource.
Definition SDL3pp_render.h:3421
~TextureLock()
Unlock a texture, uploading the changes to video memory, if needed.
Definition SDL3pp_render.h:3387
TextureLock & operator=(TextureLock &&other) noexcept
Assignment operator.
Definition SDL3pp_render.h:3392
TextureLock(const TextureLock &other)=delete
Copy constructor.
TextureLock(TextureLock &&other) noexcept
Move constructor.
Definition SDL3pp_render.h:3365
void release()
Releases the lock without unlocking.
Definition SDL3pp_render.h:3424
Lock a portion of the texture for write-only pixel access, and expose it as a SDL surface.
Definition SDL3pp_render.h:3450
~TextureSurfaceLock()
Unlock a texture, uploading the changes to video memory, if needed.
Definition SDL3pp_render.h:3516
TextureSurfaceLock(TextureSurfaceLock &&other) noexcept
Move constructor.
Definition SDL3pp_render.h:3493
TextureRef resource() const
Get the reference to locked resource.
Definition SDL3pp_render.h:3548
TextureSurfaceLock(const TextureSurfaceLock &other)=delete
Copy constructor.
TextureSurfaceLock & operator=(TextureSurfaceLock &&other) noexcept
Assignment operator.
Definition SDL3pp_render.h:3521
#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:5179
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:6126
void reset()
Unlock a texture, uploading the changes to video memory, if needed.
Definition SDL3pp_render.h:5850
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:5554
RendererRef GetRenderer() const
Get the renderer associated with a window.
Definition SDL3pp_render.h:3980
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:5212
void SetDrawBlendMode(BlendMode blendMode)
Set the blend mode used for drawing operations (Fill and Line).
Definition SDL3pp_render.h:6823
void ResetTarget()
Set target texture back to window.
Definition SDL3pp_render.h:5911
void GetRenderScale(RendererRef renderer, float *scaleX, float *scaleY)
Get the drawing scale for the current target.
Definition SDL3pp_render.h:6529
constexpr int RENDERER_VSYNC_DISABLED
Constant for disabling renderer vsync.
Definition SDL3pp_render.h:7885
SDL_Vertex Vertex
Vertex structure.
Definition SDL3pp_render.h:117
FRect GetLogicalPresentationRect() const
Get the final presentation rectangle for rendering.
Definition SDL3pp_render.h:6099
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:7278
void GetRenderTextureAddressMode(TextureAddressMode *u_mode, TextureAddressMode *v_mode)
Get the texture addressing mode used in RenderGeometry().
Definition SDL3pp_render.h:7582
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:7013
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:7101
void ResetRenderViewport(RendererRef renderer)
Reset the drawing area for rendering to the entire target.
Definition SDL3pp_render.h:6272
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:7498
PropertiesRef GetProperties() const
Get the properties associated with a texture.
Definition SDL3pp_render.h:4791
Texture GetRenderTarget(RendererRef renderer)
Get the current render target.
Definition SDL3pp_render.h:5928
void SetColorModFloat(float r, float g, float b)
Set an additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5119
RendererRef CreateGPURenderer(GPUDeviceRef device, WindowRef window)
Create a 2D GPU rendering context.
Definition SDL3pp_render.h:3912
void Destroy()
Destroy custom GPU render state.
Definition SDL3pp_render.h:8287
Texture CreateTextureWithProperties(PropertiesRef props)
Create a texture for a rendering context with the specified properties.
Definition SDL3pp_render.h:4568
void FlushRenderer(RendererRef renderer)
Force the rendering context to flush any pending commands and state.
Definition SDL3pp_render.h:7745
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:7069
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:7044
GPURenderState CreateGPURenderState(RendererRef renderer, const GPURenderStateCreateInfo &createinfo)
Create custom GPU render state.
Definition SDL3pp_render.h:8191
void SetDefaultTextureScaleMode(RendererRef renderer, ScaleMode scale_mode)
Set default scale mode for new textures for given renderer.
Definition SDL3pp_render.h:8033
Rect GetSafeArea() const
Get the safe area for rendering within the current viewport.
Definition SDL3pp_render.h:6363
void CreateWindowAndRenderer(StringParam title, const PointRaw &size, WindowFlags window_flags, Window *window, Renderer *renderer)
Create a window and default renderer.
Definition SDL3pp_render.h:3643
ScaleMode GetTextureScaleMode(TextureConstRef texture)
Get the scale mode used for texture scale operations.
Definition SDL3pp_render.h:5511
void * GetRenderMetalLayer(RendererRef renderer)
Get the CAMetalLayer associated with the given Metal renderer.
Definition SDL3pp_render.h:7768
void SetClipRect(OptionalRef< const RectRaw > rect)
Set the clip rectangle for rendering on the specified target.
Definition SDL3pp_render.h:6393
void GetRenderOutputSize(RendererRef renderer, int *w, int *h)
Get the output size in pixels of a rendering context.
Definition SDL3pp_render.h:4248
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:5741
BlendMode GetTextureBlendMode(TextureConstRef texture)
Get the blend mode used for texture copy operations.
Definition SDL3pp_render.h:5459
void SetRenderTextureAddressMode(RendererRef renderer, TextureAddressMode u_mode, TextureAddressMode v_mode)
Set the texture addressing mode used in RenderGeometry().
Definition SDL3pp_render.h:7544
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:7299
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:8237
void CreateWindowAndRendererRaw(StringParam title, const PointRaw &size, WindowFlags window_flags, WindowRaw *window, RendererRaw *renderer)
Create a window and default renderer.
Definition SDL3pp_render.h:3616
void RenderDebugText(RendererRef renderer, const FPointRaw &p, StringParam str)
Draw debug text to an Renderer.
Definition SDL3pp_render.h:7962
void SetColorMod(Uint8 r, Uint8 g, Uint8 b)
Set an additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5080
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:7063
void RenderDebugTextFormat(const FPointRaw &p, std::string_view fmt, ARGS... args)
Draw debug text to an Renderer.
Definition SDL3pp_render.h:8009
FColor GetModFloat() const
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5415
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:5333
void SetVSync(int vsync)
Toggle VSync of the given renderer.
Definition SDL3pp_render.h:7879
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:6641
void SetGPURenderState(RendererRef renderer, GPURenderStateRef state)
Set custom GPU render state.
Definition SDL3pp_render.h:8260
void RenderPoint(RendererRef renderer, const FPointRaw &p)
Draw a point on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:6890
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:6989
Palette GetTexturePalette(TextureRef texture)
Get the palette used by a texture.
Definition SDL3pp_render.h:5040
void GetDefaultTextureScaleMode(ScaleMode *scale_mode)
Get default texture scale mode of the given renderer.
Definition SDL3pp_render.h:8064
void Flush()
Force the rendering context to flush any pending commands and state.
Definition SDL3pp_render.h:7750
Texture CreateTextureWithProperties(RendererRef renderer, PropertiesRef props)
Create a texture for a rendering context with the specified properties.
Definition SDL3pp_render.h:4562
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:6356
void SetViewport(OptionalRef< const RectRaw > rect)
Set the drawing area for rendering on the current target.
Definition SDL3pp_render.h:6251
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:5697
constexpr int RENDERER_VSYNC_ADAPTIVE
Constant for enabling asaptive renderer vsync.
Definition SDL3pp_render.h:7888
Point GetCurrentOutputSize() const
Get the current output size in pixels of a rendering context.
Definition SDL3pp_render.h:4345
int GetTextureWidth(TextureConstRef texture)
Get the width in pixels.
Definition SDL3pp_render.h:4976
PropertiesRef GetRendererProperties(RendererRef renderer)
Get the properties associated with a renderer.
Definition SDL3pp_render.h:4115
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:6768
void GetTextureColorMod(TextureConstRef texture, Uint8 *r, Uint8 *g, Uint8 *b)
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5141
void ConvertEventToRenderCoordinates(Event *event) const
Convert the coordinates in an event to render coordinates.
Definition SDL3pp_render.h:6216
void SetRenderVSync(RendererRef renderer, int vsync)
Toggle VSync of the given renderer.
Definition SDL3pp_render.h:7874
GPUDeviceRef GetGPURendererDevice(RendererRef renderer)
Return the GPU device used by a renderer.
Definition SDL3pp_render.h:3928
bool IsClipEnabled() const
Get whether clipping is enabled on the given render target.
Definition SDL3pp_render.h:6473
void GetRenderLogicalPresentation(RendererRef renderer, int *w, int *h, RendererLogicalPresentation *mode)
Get device independent resolution and presentation mode for rendering.
Definition SDL3pp_render.h:6018
Texture CreateTextureFromSurface(SurfaceRef surface)
Create a texture from an existing surface.
Definition SDL3pp_render.h:4436
void SetTextureModFloat(TextureRef texture, FColor c)
Set an additional color and alpha values multiplied into render copy operations.
Definition SDL3pp_render.h:5358
void RenderLine(const FPointRaw &p1, const FPointRaw &p2)
Draw a line on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:6945
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:5650
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:7380
void SetRenderTextureAddressMode(TextureAddressMode u_mode, TextureAddressMode v_mode)
Set the texture addressing mode used in RenderGeometry().
Definition SDL3pp_render.h:7551
void ResetClipRect()
Reset the clip rectangle for rendering to the entire render target.
Definition SDL3pp_render.h:6419
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:6507
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:7708
void GetTextureSize(TextureConstRef texture, float *w, float *h)
Get the size of a texture, as floating point values.
Definition SDL3pp_render.h:4944
void RenderClear()
Clear the current rendering target with the drawing color.
Definition SDL3pp_render.h:6875
Texture CreateTexture(RendererRef renderer, PixelFormat format, TextureAccess access, const PointRaw &size)
Create a texture for a rendering context.
Definition SDL3pp_render.h:4372
void Destroy()
Destroy the specified texture.
Definition SDL3pp_render.h:7693
Surface RenderReadPixels(RendererRef renderer, OptionalRef< const RectRaw > rect={})
Read pixels from the current rendering target.
Definition SDL3pp_render.h:7613
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:5803
Texture GetTarget() const
Get the current render target.
Definition SDL3pp_render.h:5935
void SetTextureScaleMode(TextureRef texture, ScaleMode scaleMode)
Set the scale mode used for texture scale operations.
Definition SDL3pp_render.h:5488
bool RenderClipEnabled(RendererRef renderer)
Get whether clipping is enabled on the given render target.
Definition SDL3pp_render.h:6468
Color GetDrawColor() const
Get the color used for drawing operations (Rect, Line and Clear).
Definition SDL3pp_render.h:6679
void SetRenderDrawColorFloat(RendererRef renderer, const FColorRaw &c)
Set the color used for drawing operations (Rect, Line and Clear).
Definition SDL3pp_render.h:6610
FColor GetDrawColorFloat() const
Get the color used for drawing operations (Rect, Line and Clear).
Definition SDL3pp_render.h:6743
float GetRenderColorScale(RendererRef renderer)
Get the color scale used for render operations.
Definition SDL3pp_render.h:6791
void RenderRects(SpanRef< const FRectRaw > rects)
Draw some number of rectangles on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:7018
Rect GetClipRect() const
Get the clip rectangle for the current target.
Definition SDL3pp_render.h:6446
Rect GetViewport() const
Get the drawing area for the current target.
Definition SDL3pp_render.h:6303
FRect GetRenderLogicalPresentationRect(RendererRef renderer)
Get the final presentation rectangle for rendering.
Definition SDL3pp_render.h:6092
FPoint GetTextureSizeFloat(TextureConstRef texture)
Get the size of a texture, as floating point values.
Definition SDL3pp_render.h:4963
RendererRef GetRendererFromTexture(TextureConstRef texture)
Get the renderer that created an Texture.
Definition SDL3pp_render.h:4920
void SetRenderDrawBlendMode(RendererRef renderer, BlendMode blendMode)
Set the blend mode used for drawing operations (Fill and Line).
Definition SDL3pp_render.h:6818
ResourceRefT< TextureBase > TextureRef
Reference for Texture.
Definition SDL3pp_render.h:63
Palette GetPalette()
Get the palette used by a texture.
Definition SDL3pp_render.h:5045
void RenderRect(OptionalRef< const FRectRaw > rect)
Draw a rectangle on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:6994
GPUDeviceRef GetGPUDevice()
Return the GPU device used by a renderer.
Definition SDL3pp_render.h:3933
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:7133
FPoint GetSizeFloat() const
Get the size of a texture, as floating point values.
Definition SDL3pp_render.h:4970
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:5797
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:7227
void RenderPoints(SpanRef< const FPointRaw > points)
Draw multiple points on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:6919
void SetTarget(TextureRef texture)
Set a texture as the current rendering target.
Definition SDL3pp_render.h:5886
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:6705
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:5022
void ResetRenderClipRect(RendererRef renderer)
Reset the clip rectangle for rendering to the entire render target.
Definition SDL3pp_render.h:6414
Texture CreateTexture(PixelFormat format, TextureAccess access, const PointRaw &size)
Create a texture for a rendering context.
Definition SDL3pp_render.h:4380
RendererRef GetRenderer(WindowRef window)
Get the renderer associated with a window.
Definition SDL3pp_render.h:3975
void * GetRenderMetalCommandEncoder(RendererRef renderer)
Get the Metal command encoder for the current frame.
Definition SDL3pp_render.h:7799
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:4001
void RenderDebugText(const FPointRaw &p, StringParam str)
Draw debug text to an Renderer.
Definition SDL3pp_render.h:7969
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:5686
FPoint RenderCoordinatesToWindow(const FPointRaw &coord) const
Get a point in window coordinates when given a point in render coordinates.
Definition SDL3pp_render.h:6173
void RenderDebugTextFormat(RendererRef renderer, const FPointRaw &p, std::string_view fmt, ARGS... args)
Draw debug text to an Renderer.
Definition SDL3pp_render.h:7999
int GetVSync() const
Get VSync of the given renderer.
Definition SDL3pp_render.h:7911
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:6913
void DestroyTexture(TextureRaw texture)
Destroy the specified texture.
Definition SDL3pp_render.h:7691
void GetLogicalPresentation(int *w, int *h, RendererLogicalPresentation *mode) const
Get device independent resolution and presentation mode for rendering.
Definition SDL3pp_render.h:6057
FColor GetTextureModFloat(TextureConstRef texture)
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5407
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:7038
void ResetViewport()
Reset the drawing area for rendering to the entire target.
Definition SDL3pp_render.h:6277
void RenderClear(RendererRef renderer)
Clear the current rendering target with the drawing color.
Definition SDL3pp_render.h:6870
int GetWidth() const
Get the width in pixels.
Definition SDL3pp_render.h:4978
Renderer CreateRenderer(WindowRef window, StringParam name=nullptr)
Create a 2D rendering context for a window.
Definition SDL3pp_render.h:3717
void DestroyGPURenderState(GPURenderStateRaw state)
Destroy custom GPU render state.
Definition SDL3pp_render.h:8282
void SetModFloat(FColor c)
Set an additional color and alpha values multiplied into render copy operations.
Definition SDL3pp_render.h:5364
PixelFormat GetTextureFormat(TextureConstRef texture)
Get the pixel format.
Definition SDL3pp_render.h:4986
float GetAlphaModFloat() const
Get the additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5299
void RenderPoint(const FPointRaw &p)
Draw a point on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:6895
Uint8 GetAlphaMod() const
Get the additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5272
ResourceRefT< GPURenderStateBase > GPURenderStateRef
Reference for GPURenderState.
Definition SDL3pp_render.h:84
void SetGPURenderState(GPURenderStateRef state)
Set custom GPU render state.
Definition SDL3pp_render.h:8265
void Present()
Update the screen with any rendering performed since the previous call.
Definition SDL3pp_render.h:7674
BlendMode GetDrawBlendMode() const
Get the blend mode used for drawing operations.
Definition SDL3pp_render.h:6848
void SetDrawColor(ColorRaw c)
Set the color used for drawing operations.
Definition SDL3pp_render.h:6588
Renderer CreateRendererWithProperties(PropertiesRef props)
Create a 2D rendering context for a window, with the specified properties.
Definition SDL3pp_render.h:3799
void GetColorMod(Uint8 *r, Uint8 *g, Uint8 *b) const
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5149
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:5637
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:5518
Rect GetRenderViewport(RendererRef renderer)
Get the drawing area for the current target.
Definition SDL3pp_render.h:6296
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:5466
void * GetRenderMetalCommandEncoder()
Get the Metal command encoder for the current frame.
Definition SDL3pp_render.h:7804
void SetDrawColorFloat(const FColorRaw &c)
Set the color used for drawing operations (Rect, Line and Clear).
Definition SDL3pp_render.h:6615
Point GetSize() const
Get the size of a texture.
Definition SDL3pp_render.h:4960
Rect GetRenderClipRect(RendererRef renderer)
Get the clip rectangle for the current target.
Definition SDL3pp_render.h:6439
void SetAlphaModFloat(float alpha)
Set an additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5245
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:6938
void SetRenderLogicalPresentation(RendererRef renderer, const PointRaw &size, RendererLogicalPresentation mode)
Set a device-independent resolution and presentation mode for rendering.
Definition SDL3pp_render.h:5983
Color GetMod() const
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5391
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:7437
void reset()
Unlock a texture, uploading the changes to video memory, if needed.
Definition SDL3pp_render.h:5843
void SetTextureColorMod(TextureRef texture, Uint8 r, Uint8 g, Uint8 b)
Set an additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5075
void GetDefaultTextureScaleMode(RendererRef renderer, ScaleMode *scale_mode)
Get default texture scale mode of the given renderer.
Definition SDL3pp_render.h:8058
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:6798
void SetRenderTarget(RendererRef renderer, TextureRef texture)
Set a texture as the current rendering target.
Definition SDL3pp_render.h:5881
int GetRenderVSync(RendererRef renderer)
Get VSync of the given renderer.
Definition SDL3pp_render.h:7904
constexpr int DEBUG_TEXT_FONT_CHARACTER_SIZE
The size, in pixels, of a single RenderDebugText() character.
Definition SDL3pp_render.h:7922
BlendMode GetRenderDrawBlendMode(RendererRef renderer)
Get the blend mode used for drawing operations.
Definition SDL3pp_render.h:6841
PixelFormat GetFormat() const
Get the pixel format.
Definition SDL3pp_render.h:4991
int GetHeight() const
Get the height in pixels.
Definition SDL3pp_render.h:4983
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:7713
PropertiesRef GetTextureProperties(TextureConstRef texture)
Get the properties associated with a texture.
Definition SDL3pp_render.h:4786
void SetBlendMode(BlendMode blendMode)
Set the blend mode for a texture, used by RenderTexture().
Definition SDL3pp_render.h:5441
void SetRenderDrawColor(RendererRef renderer, ColorRaw c)
Set the color used for drawing operations.
Definition SDL3pp_render.h:6583
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:5748
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:7237
FPoint RenderCoordinatesToWindow(RendererRef renderer, const FPointRaw &coord)
Get a point in window coordinates when given a point in render coordinates.
Definition SDL3pp_render.h:6164
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:7424
Point GetOutputSize() const
Get the output size in pixels of a rendering context.
Definition SDL3pp_render.h:4284
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:5111
Texture CreateTextureFromSurface(RendererRef renderer, SurfaceRef surface)
Create a texture from an existing surface.
Definition SDL3pp_render.h:4430
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:6970
void SetTextureAlphaModFloat(TextureRef texture, float alpha)
Set an additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5240
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:7093
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:7844
void GetRenderTextureAddressMode(RendererRef renderer, TextureAddressMode *u_mode, TextureAddressMode *v_mode)
Get the texture addressing mode used in RenderGeometry().
Definition SDL3pp_render.h:7575
Renderer CreateSoftwareRenderer(SurfaceRef surface)
Create a 2D software rendering context for a surface.
Definition SDL3pp_render.h:3959
const char * GetName() const
Get the name of a renderer.
Definition SDL3pp_render.h:4025
void ConvertEventToRenderCoordinates(RendererRef renderer, Event *event)
Convert the coordinates in an event to render coordinates.
Definition SDL3pp_render.h:6211
Color GetTextureMod(TextureConstRef texture)
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5383
FPoint RenderCoordinatesFromWindow(const FPointRaw &window_coord) const
Get a point in render coordinates when given a point in window coordinates.
Definition SDL3pp_render.h:6135
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:7471
void SetLogicalPresentation(const PointRaw &size, RendererLogicalPresentation mode)
Set a device-independent resolution and presentation mode for rendering.
Definition SDL3pp_render.h:5990
GPURenderState CreateGPURenderState(const GPURenderStateCreateInfo &createinfo)
Create custom GPU render state.
Definition SDL3pp_render.h:8198
void SetRenderScale(RendererRef renderer, const FPointRaw &scale)
Set the drawing scale for rendering on the current target.
Definition SDL3pp_render.h:6502
void SetRenderViewport(RendererRef renderer, OptionalRef< const RectRaw > rect)
Set the drawing area for rendering on the current target.
Definition SDL3pp_render.h:6245
void RenderPresent(RendererRef renderer)
Update the screen with any rendering performed since the previous call.
Definition SDL3pp_render.h:7669
void SetDefaultTextureScaleMode(ScaleMode scale_mode)
Set default scale mode for new textures for given renderer.
Definition SDL3pp_render.h:8039
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:7182
void UnlockTexture(TextureRef texture)
Unlock a texture, uploading the changes to video memory, if needed.
Definition SDL3pp_render.h:5829
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:7835
void SetScaleMode(ScaleMode scaleMode)
Set the scale mode used for texture scale operations.
Definition SDL3pp_render.h:5493
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:4020
FPoint GetScale() const
Get the drawing scale for the current target.
Definition SDL3pp_render.h:6561
void GetCurrentRenderOutputSize(RendererRef renderer, int *w, int *h)
Get the current output size in pixels of a rendering context.
Definition SDL3pp_render.h:4309
float GetTextureAlphaModFloat(TextureConstRef texture)
Get the additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5292
void SetColorScale(float scale)
Set the color scale used for render operations.
Definition SDL3pp_render.h:6773
int GetNumRenderDrivers()
Get the number of 2D rendering drivers available for the current display.
Definition SDL3pp_render.h:3569
const char * GetRenderDriver(int index)
Use this function to get the name of a built in 2D rendering driver.
Definition SDL3pp_render.h:3593
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:6964
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:7193
WindowRef GetRenderWindow(RendererRef renderer)
Get the window associated with a renderer.
Definition SDL3pp_render.h:3996
void * GetRenderMetalLayer()
Get the CAMetalLayer associated with the given Metal renderer.
Definition SDL3pp_render.h:7773
RendererRef GetRenderer() const
Get the renderer that created an Texture.
Definition SDL3pp_render.h:4925
void Update(OptionalRef< const RectRaw > rect, const void *pixels, int pitch)
Update the given texture rectangle with new pixel data.
Definition SDL3pp_render.h:5599
bool RenderViewportSet(RendererRef renderer)
Return whether an explicit rectangle was set as the viewport.
Definition SDL3pp_render.h:6328
void GetTextureColorModFloat(TextureConstRef texture, float *r, float *g, float *b)
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5171
PropertiesRef GetProperties() const
Get the properties associated with a renderer.
Definition SDL3pp_render.h:4120
void SetTextureBlendMode(TextureRef texture, BlendMode blendMode)
Set the blend mode for a texture, used by RenderTexture().
Definition SDL3pp_render.h:5436
bool ViewportSet() const
Return whether an explicit rectangle was set as the viewport.
Definition SDL3pp_render.h:6333
Uint8 GetTextureAlphaMod(TextureConstRef texture)
Get the additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5265
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:5733
void Unlock(TextureLock &&lock)
Unlock a texture, uploading the changes to video memory, if needed.
Definition SDL3pp_render.h:5831
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:7357
void SetTextureAlphaMod(TextureRef texture, Uint8 alpha)
Set an additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5207
void SetTexturePalette(TextureRef texture, PaletteRef palette)
Set the palette used by a texture.
Definition SDL3pp_render.h:5017
Surface ReadPixels(OptionalRef< const RectRaw > rect={}) const
Read pixels from the current rendering target.
Definition SDL3pp_render.h:7619
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:5788
void ResetRenderTarget(RendererRef renderer)
Set target texture back to window.
Definition SDL3pp_render.h:5906
void SetTextureMod(TextureRef texture, Color c)
Set an additional color and alpha values multiplied into render copy operations.
Definition SDL3pp_render.h:5327
void SetRenderClipRect(RendererRef renderer, OptionalRef< const RectRaw > rect)
Set the clip rectangle for rendering on the specified target.
Definition SDL3pp_render.h:6387
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:8228
int GetTextureHeight(TextureConstRef texture)
Get the height in pixels.
Definition SDL3pp_render.h:4981
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:7145
::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:3809
constexpr auto SURFACE_POINTER
Pointer to surface.
Definition SDL3pp_render.h:3817
constexpr auto PRESENT_VSYNC_NUMBER
Number for present vsync.
Definition SDL3pp_render.h:3824
constexpr auto VULKAN_PHYSICAL_DEVICE_POINTER
Pointer to vulkan physical device.
Definition SDL3pp_render.h:3852
constexpr auto VULKAN_INSTANCE_POINTER
Pointer to vulkan instance.
Definition SDL3pp_render.h:3845
constexpr auto VULKAN_SURFACE_NUMBER
Vulkan surface number.
Definition SDL3pp_render.h:3849
constexpr auto GPU_SHADERS_SPIRV_BOOLEAN
Enable gpu shaders spirv.
Definition SDL3pp_render.h:3832
constexpr auto GPU_SHADERS_DXIL_BOOLEAN
Enable gpu shaders dxil.
Definition SDL3pp_render.h:3836
constexpr auto OUTPUT_COLORSPACE_NUMBER
Number for output colorspace.
Definition SDL3pp_render.h:3820
constexpr auto VULKAN_DEVICE_POINTER
Pointer to vulkan device.
Definition SDL3pp_render.h:3857
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_render.h:3811
constexpr auto VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER
Vulkan graphics queue family index number.
Definition SDL3pp_render.h:3860
constexpr auto VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER
Vulkan present queue family index number.
Definition SDL3pp_render.h:3868
constexpr auto GPU_DEVICE_POINTER
Pointer to gpu device.
Definition SDL3pp_render.h:3829
constexpr auto GPU_SHADERS_MSL_BOOLEAN
Enable gpu shaders msl.
Definition SDL3pp_render.h:3840
constexpr auto WINDOW_POINTER
Pointer to window.
Definition SDL3pp_render.h:3814
Properties for Renderer.
Definition SDL3pp_render.h:3809
constexpr auto WINDOW_POINTER
Pointer to window.
Definition SDL3pp_render.h:4140
constexpr auto VULKAN_PHYSICAL_DEVICE_POINTER
Pointer to vulkan physical device.
Definition SDL3pp_render.h:4199
constexpr auto TEXTURE_FORMATS_POINTER
Pointer to texture formats.
Definition SDL3pp_render.h:4152
constexpr auto MAX_TEXTURE_SIZE_NUMBER
Number for max texture size.
Definition SDL3pp_render.h:4149
constexpr auto D3D12_DEVICE_POINTER
Pointer to d3d12 device.
Definition SDL3pp_render.h:4183
constexpr auto VULKAN_SURFACE_NUMBER
Vulkan surface number.
Definition SDL3pp_render.h:4196
constexpr auto D3D11_DEVICE_POINTER
Pointer to d3d11 device.
Definition SDL3pp_render.h:4177
constexpr auto VULKAN_DEVICE_POINTER
Pointer to vulkan device.
Definition SDL3pp_render.h:4203
constexpr auto GPU_DEVICE_POINTER
Pointer to gpu device.
Definition SDL3pp_render.h:4223
constexpr auto SURFACE_POINTER
Pointer to surface.
Definition SDL3pp_render.h:4143
constexpr auto D3D12_SWAPCHAIN_POINTER
Pointer to d3d12 swapchain.
Definition SDL3pp_render.h:4186
constexpr auto D3D12_COMMAND_QUEUE_POINTER
Pointer to d3d12 command queue.
Definition SDL3pp_render.h:4189
constexpr auto SDR_WHITE_POINT_FLOAT
Float for sdr white point.
Definition SDL3pp_render.h:4168
constexpr auto VULKAN_INSTANCE_POINTER
Pointer to vulkan instance.
Definition SDL3pp_render.h:4193
constexpr auto HDR_ENABLED_BOOLEAN
Hdr enabled enabled.
Definition SDL3pp_render.h:4165
constexpr auto TEXTURE_WRAPPING_BOOLEAN
Texture wrapping enabled.
Definition SDL3pp_render.h:4157
constexpr auto VSYNC_NUMBER
Number for vsync.
Definition SDL3pp_render.h:4146
constexpr auto VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER
Number for vulkan graphics queue family index.
Definition SDL3pp_render.h:4206
constexpr auto D3D11_SWAPCHAIN_POINTER
Pointer to d3d11 swapchain.
Definition SDL3pp_render.h:4180
constexpr auto VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER
Number for vulkan present queue family index.
Definition SDL3pp_render.h:4213
constexpr auto VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER
Vulkan swapchain image count.
Definition SDL3pp_render.h:4219
constexpr auto HDR_HEADROOM_FLOAT
Float for hdr headroom.
Definition SDL3pp_render.h:4171
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_render.h:4137
constexpr auto D3D9_DEVICE_POINTER
Pointer to d3d9 device.
Definition SDL3pp_render.h:4174
constexpr auto OUTPUT_COLORSPACE_NUMBER
Number for output colorspace.
Definition SDL3pp_render.h:4162
Properties for Texture creation.
Definition SDL3pp_render.h:4578
constexpr auto PALETTE_POINTER
Pointer to palette.
Definition SDL3pp_render.h:4597
constexpr auto METAL_PIXELBUFFER_POINTER
Pointer to metal pixelbuffer.
Definition SDL3pp_render.h:4630
constexpr auto FORMAT_NUMBER
Number for format.
Definition SDL3pp_render.h:4583
constexpr auto WIDTH_NUMBER
Number for width.
Definition SDL3pp_render.h:4589
constexpr auto HEIGHT_NUMBER
Number for height.
Definition SDL3pp_render.h:4592
constexpr auto D3D12_TEXTURE_U_POINTER
Pointer to d3d12 texture u.
Definition SDL3pp_render.h:4622
constexpr auto OPENGLES2_TEXTURE_V_NUMBER
Opengles2 texture v number.
Definition SDL3pp_render.h:4661
constexpr auto SDR_WHITE_POINT_FLOAT
Float for sdr white point.
Definition SDL3pp_render.h:4602
constexpr auto D3D11_TEXTURE_POINTER
Pointer to d3d11 texture.
Definition SDL3pp_render.h:4608
constexpr auto OPENGL_TEXTURE_V_NUMBER
Opengl texture v number.
Definition SDL3pp_render.h:4645
constexpr auto COLORSPACE_NUMBER
Number for colorspace.
Definition SDL3pp_render.h:4580
constexpr auto GPU_TEXTURE_V_POINTER
Pointer to gpu texture v.
Definition SDL3pp_render.h:4684
constexpr auto D3D12_TEXTURE_POINTER
Pointer to d3d12 texture.
Definition SDL3pp_render.h:4619
constexpr auto OPENGL_TEXTURE_NUMBER
Opengl texture number.
Definition SDL3pp_render.h:4634
constexpr auto GPU_TEXTURE_POINTER
Pointer to gpu texture.
Definition SDL3pp_render.h:4674
constexpr auto GPU_TEXTURE_U_POINTER
Pointer to gpu texture u.
Definition SDL3pp_render.h:4681
constexpr auto OPENGLES2_TEXTURE_UV_NUMBER
Opengles2 texture uv number.
Definition SDL3pp_render.h:4653
constexpr auto D3D11_TEXTURE_U_POINTER
Pointer to d3d11 texture u.
Definition SDL3pp_render.h:4611
constexpr auto OPENGL_TEXTURE_U_NUMBER
Opengl texture u number.
Definition SDL3pp_render.h:4641
constexpr auto GPU_TEXTURE_UV_POINTER
Pointer to gpu texture uv.
Definition SDL3pp_render.h:4677
constexpr auto OPENGLES2_TEXTURE_NUMBER
Opengles2 texture number.
Definition SDL3pp_render.h:4649
constexpr auto HDR_HEADROOM_FLOAT
Float for hdr headroom.
Definition SDL3pp_render.h:4605
constexpr auto D3D11_TEXTURE_V_POINTER
Pointer to d3d11 texture v.
Definition SDL3pp_render.h:4615
constexpr auto OPENGLES2_TEXTURE_U_NUMBER
Opengles2 texture u number.
Definition SDL3pp_render.h:4657
constexpr auto D3D12_TEXTURE_V_POINTER
Pointer to d3d12 texture v.
Definition SDL3pp_render.h:4626
constexpr auto ACCESS_NUMBER
Number for access.
Definition SDL3pp_render.h:4586
constexpr auto OPENGL_TEXTURE_UV_NUMBER
Opengl texture uv number.
Definition SDL3pp_render.h:4637
constexpr auto VULKAN_TEXTURE_NUMBER
Vulkans texture number.
Definition SDL3pp_render.h:4665
constexpr auto VULKAN_LAYOUT_NUMBER
Number for vulkan layout.
Definition SDL3pp_render.h:4671
Properties for Texture.
Definition SDL3pp_render.h:4578
constexpr auto OPENGL_TEX_W_FLOAT
Float for opengl tex w.
Definition SDL3pp_render.h:4863
constexpr auto D3D11_TEXTURE_U_POINTER
Pointer to d3d11 texture u.
Definition SDL3pp_render.h:4832
constexpr auto SDR_WHITE_POINT_FLOAT
Float for sdr white point.
Definition SDL3pp_render.h:4823
constexpr auto WIDTH_NUMBER
Number for width.
Definition SDL3pp_render.h:4817
constexpr auto VULKAN_TEXTURE_NUMBER
Vulkan texture number.
Definition SDL3pp_render.h:4888
constexpr auto D3D11_TEXTURE_V_POINTER
Pointer to d3d11 texture v.
Definition SDL3pp_render.h:4835
constexpr auto OPENGLES2_TEXTURE_NUMBER
Opengles2 texture number.
Definition SDL3pp_render.h:4869
constexpr auto D3D12_TEXTURE_U_POINTER
Pointer to d3d12 texture u.
Definition SDL3pp_render.h:4841
constexpr auto D3D12_TEXTURE_POINTER
Pointer to d3d12 texture.
Definition SDL3pp_render.h:4838
constexpr auto OPENGL_TEXTURE_TARGET_NUMBER
Opengl texture target number.
Definition SDL3pp_render.h:4859
constexpr auto OPENGLES2_TEXTURE_TARGET_NUMBER
Opengles2 texture target number.
Definition SDL3pp_render.h:4884
constexpr auto OPENGLES2_TEXTURE_V_NUMBER
Opengles2 texture v number.
Definition SDL3pp_render.h:4880
constexpr auto COLORSPACE_NUMBER
Number for colorspace.
Definition SDL3pp_render.h:4808
constexpr auto OPENGL_TEXTURE_NUMBER
Opengl texture number.
Definition SDL3pp_render.h:4847
constexpr auto OPENGL_TEXTURE_V_NUMBER
Opengl texture v number.
Definition SDL3pp_render.h:4856
constexpr auto GPU_TEXTURE_V_POINTER
Pointer to gpu texture v.
Definition SDL3pp_render.h:4902
constexpr auto OPENGL_TEXTURE_UV_NUMBER
Opengl texture uv number.
Definition SDL3pp_render.h:4850
constexpr auto FORMAT_NUMBER
Number for format.
Definition SDL3pp_render.h:4811
constexpr auto OPENGL_TEX_H_FLOAT
Float for opengl tex h.
Definition SDL3pp_render.h:4866
constexpr auto OPENGLES2_TEXTURE_UV_NUMBER
Opengles2 texture uv number.
Definition SDL3pp_render.h:4872
constexpr auto OPENGL_TEXTURE_U_NUMBER
Opengl texture u number.
Definition SDL3pp_render.h:4853
constexpr auto GPU_TEXTURE_U_POINTER
Pointer to gpu texture u.
Definition SDL3pp_render.h:4899
constexpr auto HDR_HEADROOM_FLOAT
Float for hdr headroom.
Definition SDL3pp_render.h:4826
constexpr auto ACCESS_NUMBER
Number for access.
Definition SDL3pp_render.h:4814
constexpr auto GPU_TEXTURE_UV_POINTER
Pointer to gpu texture uv.
Definition SDL3pp_render.h:4896
constexpr auto OPENGLES2_TEXTURE_U_NUMBER
Opengles2 texture u number.
Definition SDL3pp_render.h:4876
constexpr auto D3D12_TEXTURE_V_POINTER
Pointer to d3d12 texture v.
Definition SDL3pp_render.h:4844
constexpr auto HEIGHT_NUMBER
Number for height.
Definition SDL3pp_render.h:4820
constexpr auto GPU_TEXTURE_POINTER
Pointer to gpu texture.
Definition SDL3pp_render.h:4893
constexpr auto D3D11_TEXTURE_POINTER
Pointer to d3d11 texture.
Definition SDL3pp_render.h:4829
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:8075
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
A custom GPU render state.
Definition SDL3pp_render.h:8122
constexpr GPURenderState & operator=(GPURenderState &&other) noexcept
Assignment operator.
Definition SDL3pp_render.h:8167
~GPURenderState()
Destructor.
Definition SDL3pp_render.h:8164
constexpr GPURenderState(GPURenderState &&other) noexcept
Move constructor.
Definition SDL3pp_render.h:8138
constexpr GPURenderState(GPURenderStateRaw resource) noexcept
Constructs from raw GPURenderState.
Definition SDL3pp_render.h:8132
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:2087
constexpr Renderer(Renderer &&other) noexcept
Move constructor.
Definition SDL3pp_render.h:2103
constexpr Renderer(RendererRaw resource) noexcept
Constructs from raw Renderer.
Definition SDL3pp_render.h:2097
constexpr Renderer & operator=(Renderer &&other) noexcept
Assignment operator.
Definition SDL3pp_render.h:2229
~Renderer()
Destructor.
Definition SDL3pp_render.h:2226
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:2242
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
An efficient driver-specific representation of pixel data.
Definition SDL3pp_render.h:2993
constexpr Texture & operator=(Texture &&other) noexcept
Assignment operator.
Definition SDL3pp_render.h:3289
constexpr Texture(const Texture &other)
Copy constructor.
Definition SDL3pp_render.h:3009
Texture & operator=(const Texture &other)
Assignment operator.
Definition SDL3pp_render.h:3296
~Texture()
Destructor.
Definition SDL3pp_render.h:3286
static Texture borrow(TextureRaw resource)
Safely borrows the from TextureRaw.
Definition SDL3pp_render.h:3276
constexpr Texture(TextureRaw resource) noexcept
Constructs from raw Texture.
Definition SDL3pp_render.h:3003
constexpr Texture(Texture &&other) noexcept
Move constructor.
Definition SDL3pp_render.h:3015
The struct used as an opaque handle to a window.
Definition SDL3pp_video.h:2724