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
43// Forward decl
44struct Renderer;
45
47using RendererRaw = SDL_Renderer*;
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
71struct GPURenderState;
72
74using GPURenderStateRaw = SDL_GPURenderState*;
75
82
83#endif // SDL_VERSION_ATLEAST(3, 3, 6)
84
85// Forward decl
87
88// Forward decl
89struct TextureLock;
90
96constexpr auto SOFTWARE_RENDERER = SDL_SOFTWARE_RENDERER;
97
98#if SDL_VERSION_ATLEAST(3, 4, 0)
99
105constexpr auto GPU_RENDERER = SDL_GPU_RENDERER;
106
107#endif // SDL_VERSION_ATLEAST(3, 4, 0)
108
114using Vertex = SDL_Vertex;
115
121using TextureAccess = SDL_TextureAccess;
122
124 SDL_TEXTUREACCESS_STATIC;
125
127 SDL_TEXTUREACCESS_STREAMING;
128
130 SDL_TEXTUREACCESS_TARGET;
131
132#if SDL_VERSION_ATLEAST(3, 4, 0)
133
145using TextureAddressMode = SDL_TextureAddressMode;
146
148 SDL_TEXTURE_ADDRESS_INVALID;
149
154constexpr TextureAddressMode TEXTURE_ADDRESS_AUTO = SDL_TEXTURE_ADDRESS_AUTO;
155
157constexpr TextureAddressMode TEXTURE_ADDRESS_CLAMP = SDL_TEXTURE_ADDRESS_CLAMP;
158
160 SDL_TEXTURE_ADDRESS_WRAP;
161
162#endif // SDL_VERSION_ATLEAST(3, 4, 0)
163
169using RendererLogicalPresentation = SDL_RendererLogicalPresentation;
170
172 SDL_LOGICAL_PRESENTATION_DISABLED;
173
176 SDL_LOGICAL_PRESENTATION_STRETCH;
177
183 SDL_LOGICAL_PRESENTATION_LETTERBOX;
184
190 SDL_LOGICAL_PRESENTATION_OVERSCAN;
191
197 SDL_LOGICAL_PRESENTATION_INTEGER_SCALE;
198
199#if SDL_VERSION_ATLEAST(3, 4, 0)
200
208using GPURenderStateCreateInfo = SDL_GPURenderStateCreateInfo;
209
210#endif // SDL_VERSION_ATLEAST(3, 4, 0)
211
219struct Renderer : ResourceBase<RendererRaw>
220{
222
230 constexpr explicit Renderer(RendererRaw resource) noexcept
231 : ResourceBase(resource)
232 {
233 }
234
236 constexpr Renderer(const Renderer& other) = delete;
237
239 constexpr Renderer(Renderer&& other) noexcept
240 : Renderer(other.release())
241 {
242 }
243
244 constexpr Renderer(const RendererRef& other) = delete;
245
246 constexpr Renderer(RendererRef&& other) = delete;
247
280 Renderer(WindowRef window, StringParam name = nullptr);
281
343 Renderer(PropertiesRef props);
344
363 Renderer(SurfaceRef surface);
364
366 ~Renderer() { SDL_DestroyRenderer(get()); }
367
369 constexpr Renderer& operator=(Renderer&& other) noexcept
370 {
371 swap(*this, other);
372 return *this;
373 }
374
376 Renderer& operator=(const Renderer& other) = delete;
377
390 void Destroy();
391
392#if SDL_VERSION_ATLEAST(3, 4, 0)
393
405
406#endif // SDL_VERSION_ATLEAST(3, 4, 0)
407
419
433 const char* GetName() const;
434
520
540 void GetOutputSize(int* w, int* h) const;
541
560 Point GetOutputSize() const;
561
581 void GetCurrentOutputSize(int* w, int* h) const;
582
602
625 TextureAccess access,
626 const PointRaw& size);
627
653
777
801 void SetTarget(TextureRef texture);
802
817 void ResetTarget();
818
834 Texture GetTarget() const;
835
878 void SetLogicalPresentation(const PointRaw& size,
880
902 void GetLogicalPresentation(int* w,
903 int* h,
904 RendererLogicalPresentation* mode) const;
905
928
950
972 FPoint RenderCoordinatesFromWindow(const FPointRaw& window_coord) const;
973
996 FPoint RenderCoordinatesToWindow(const FPointRaw& coord) const;
997
1030 void ConvertEventToRenderCoordinates(Event* event) const;
1031
1056
1072 void ResetViewport();
1073
1090 Rect GetViewport() const;
1091
1111 bool ViewportSet() const;
1112
1130 Rect GetSafeArea() const;
1131
1151
1167 void ResetClipRect();
1168
1186 Rect GetClipRect() const;
1187
1204 bool IsClipEnabled() const;
1205
1229 void SetScale(const FPointRaw& scale);
1230
1247 void GetScale(float* scaleX, float* scaleY) const;
1248
1264 FPoint GetScale() const;
1265
1282 void SetDrawColor(ColorRaw c);
1283
1300 void SetDrawColorFloat(const FColorRaw& c);
1301
1322 void GetDrawColor(Uint8* r, Uint8* g, Uint8* b, Uint8* a) const;
1323
1337 Color GetDrawColor() const;
1338
1359 void GetDrawColorFloat(float* r, float* g, float* b, float* a) const;
1360
1374 FColor GetDrawColorFloat() const;
1375
1396 void SetColorScale(float scale);
1397
1410 float GetColorScale() const;
1411
1426 void SetDrawBlendMode(BlendMode blendMode);
1427
1441
1458 void RenderClear();
1459
1472 void RenderPoint(const FPointRaw& p);
1473
1487
1501 void RenderLine(const FPointRaw& p1, const FPointRaw& p2);
1502
1517
1532
1547
1563
1578
1597 void RenderTexture(TextureRef texture,
1600
1625 void RenderTextureRotated(TextureRef texture,
1628 double angle,
1630 FlipMode flip = FlipMode::SDL_FLIP_NONE);
1631
1656 void RenderTextureAffine(TextureRef texture,
1661
1685 void RenderTextureTiled(TextureRef texture,
1687 float scale,
1689
1721 void RenderTexture9Grid(TextureRef texture,
1723 float left_width,
1724 float right_width,
1725 float top_height,
1726 float bottom_height,
1727 float scale,
1729
1730#if SDL_VERSION_ATLEAST(3, 4, 0)
1731
1767 const FRectRaw& srcrect,
1768 float left_width,
1769 float right_width,
1770 float top_height,
1771 float bottom_height,
1772 float scale,
1773 const FRectRaw& dstrect,
1774 float tileScale);
1775
1776#endif // SDL_VERSION_ATLEAST(3, 4, 0)
1777
1797 void RenderGeometry(TextureRef texture,
1798 std::span<const Vertex> vertices,
1799 std::span<const int> indices = {});
1800
1828 void RenderGeometryRaw(TextureRef texture,
1829 const float* xy,
1830 int xy_stride,
1831 const FColor* color,
1832 int color_stride,
1833 const float* uv,
1834 int uv_stride,
1835 int num_vertices,
1836 const void* indices,
1837 int num_indices,
1838 int size_indices);
1839
1840#if SDL_VERSION_ATLEAST(3, 4, 0)
1841
1860 TextureAddressMode v_mode);
1861
1880 TextureAddressMode* v_mode);
1881
1882#endif // SDL_VERSION_ATLEAST(3, 4, 0)
1883
1909
1955 void Present();
1956
1986 void Flush();
1987
2003 void* GetRenderMetalLayer();
2004
2026
2053 void AddVulkanRenderSemaphores(Uint32 wait_stage_mask,
2054 Sint64 wait_semaphore,
2055 Sint64 signal_semaphore);
2056
2078 void SetVSync(int vsync);
2079
2092 int GetVSync() const;
2093
2131 void RenderDebugText(const FPointRaw& p, StringParam str);
2132
2158 template<class... ARGS>
2159 void RenderDebugTextFormat(const FPointRaw& p,
2160 std::string_view fmt,
2161 ARGS... args);
2162
2163#if SDL_VERSION_ATLEAST(3, 4, 0)
2164
2179 void SetDefaultTextureScaleMode(ScaleMode scale_mode);
2180
2195 void GetDefaultTextureScaleMode(ScaleMode* scale_mode);
2196
2213 GPURenderState CreateGPURenderState(
2214 const GPURenderStateCreateInfo& createinfo);
2215
2232
2233#endif // SDL_VERSION_ATLEAST(3, 4, 0)
2234};
2235
2248struct Texture : ResourceBase<TextureRaw, TextureRawConst>
2249{
2251
2259 constexpr explicit Texture(TextureRaw resource) noexcept
2260 : ResourceBase(resource)
2261 {
2262 }
2263
2265 constexpr Texture(const Texture& other)
2266 : Texture(other.get())
2267 {
2268 if (auto res = get()) ++res->refcount;
2269 }
2270
2272 constexpr Texture(Texture&& other) noexcept
2273 : Texture(other.release())
2274 {
2275 }
2276
2298 Texture(RendererRef renderer,
2299 PixelFormat format,
2300 TextureAccess access,
2301 const PointRaw& size);
2302
2327 Texture(RendererRef renderer, SurfaceRef surface);
2328
2451 Texture(RendererRef renderer, PropertiesRef props);
2452
2482 Texture(RendererRef renderer, StringParam file);
2483
2524 Texture(RendererRef renderer, IOStreamRef src, bool closeio = false);
2525
2533 static Texture Borrow(TextureRaw resource)
2534 {
2535 if (resource) {
2536 ++resource->refcount;
2537 return Texture(resource);
2538 }
2539 return {};
2540 }
2541
2543 constexpr operator TextureConstRef() const noexcept { return get(); }
2544
2546 ~Texture() { SDL_DestroyTexture(get()); }
2547
2549 constexpr Texture& operator=(Texture&& other) noexcept
2550 {
2551 swap(*this, other);
2552 return *this;
2553 }
2554
2557 {
2558 if (get() != other.get()) {
2559 Texture tmp(other);
2560 swap(*this, tmp);
2561 }
2562 return *this;
2563 }
2564
2578 void Destroy();
2579
2676
2687 RendererRef GetRenderer() const;
2688
2702 void GetSize(float* w, float* h) const;
2703
2705 Point GetSize() const;
2706
2708 FPoint GetSizeFloat() const;
2709
2711 int GetWidth() const;
2712
2714 int GetHeight() const;
2715
2717 PixelFormat GetFormat() const;
2718
2719#if SDL_VERSION_ATLEAST(3, 4, 0)
2720
2739 void SetPalette(PaletteRef palette);
2740
2754
2755#endif // SDL_VERSION_ATLEAST(3, 4, 0)
2756
2782 void SetColorMod(Uint8 r, Uint8 g, Uint8 b);
2783
2809 void SetColorModFloat(float r, float g, float b);
2810
2827 void GetColorMod(Uint8* r, Uint8* g, Uint8* b) const;
2828
2845 void GetColorModFloat(float* r, float* g, float* b) const;
2846
2869 void SetAlphaMod(Uint8 alpha);
2870
2893 void SetAlphaModFloat(float alpha);
2894
2909 Uint8 GetAlphaMod() const;
2910
2925 float GetAlphaModFloat() const;
2926
2949 void SetMod(Color c);
2950
2973 void SetModFloat(FColor c);
2974
2988 Color GetMod() const;
2989
3003 FColor GetModFloat() const;
3004
3020 void SetBlendMode(BlendMode blendMode);
3021
3034 BlendMode GetBlendMode() const;
3035
3052 void SetScaleMode(ScaleMode scaleMode);
3053
3066 ScaleMode GetScaleMode() const;
3067
3098 void Update(OptionalRef<const RectRaw> rect, const void* pixels, int pitch);
3099
3129 void Update(SurfaceConstRef surface,
3130 OptionalRef<const RectRaw> rect = std::nullopt);
3131
3161 const Uint8* Yplane,
3162 int Ypitch,
3163 const Uint8* Uplane,
3164 int Upitch,
3165 const Uint8* Vplane,
3166 int Vpitch);
3167
3193 const Uint8* Yplane,
3194 int Ypitch,
3195 const Uint8* UVplane,
3196 int UVpitch);
3197
3223 TextureLock Lock(OptionalRef<const RectRaw> rect, void** pixels, int* pitch);
3224
3256 OptionalRef<const RectRaw> rect = std::nullopt);
3257
3275 void Unlock(TextureLock&& lock);
3276
3294 void Unlock(TextureSurfaceLock&& lock);
3295};
3296
3327{
3328 TextureRef m_lock;
3329
3330public:
3362 void** pixels,
3363 int* pitch);
3364
3366 TextureLock(const TextureLock& other) = delete;
3367
3369 TextureLock(TextureLock&& other) noexcept
3370 : m_lock(std::move(other.m_lock))
3371 {
3372 }
3373
3392
3393 TextureLock& operator=(const TextureLock& other) = delete;
3394
3397 {
3398 std::swap(m_lock, other.m_lock);
3399 return *this;
3400 }
3401
3403 constexpr operator bool() const { return bool(m_lock); }
3404
3422 void reset();
3423
3425 TextureRef resource() const { return m_lock; }
3426
3428 void release() { m_lock.release(); }
3429};
3430
3454{
3455 TextureRef m_lock;
3456
3457public:
3491 OptionalRef<const RectRaw> rect = std::nullopt);
3492
3495
3498 : Surface(std::move(other))
3499 , m_lock(std::move(other.m_lock))
3500 {
3501 }
3502
3521
3522 TextureSurfaceLock& operator=(const TextureSurfaceLock& other) = delete;
3523
3526 {
3527 std::swap(m_lock, other.m_lock);
3528 Surface::operator=(std::move(other));
3529 return *this;
3530 }
3531
3549 void reset();
3550
3552 TextureRef resource() const { return m_lock; }
3553};
3554
3573inline int GetNumRenderDrivers() { return SDL_GetNumRenderDrivers(); }
3574
3597inline const char* GetRenderDriver(int index)
3598{
3599 return SDL_GetRenderDriver(index);
3600}
3601
3621 const PointRaw& size,
3622 WindowFlags window_flags,
3623 WindowRaw* window,
3624 RendererRaw* renderer)
3625{
3626 CheckError(SDL_CreateWindowAndRenderer(
3627 title, size.x, size.y, window_flags, window, renderer));
3628}
3629
3648 const PointRaw& size,
3649 WindowFlags window_flags,
3650 Window* window,
3651 Renderer* renderer)
3652{
3653 SDL_Window* windowRaw = nullptr;
3654 SDL_Renderer* rendererRaw = nullptr;
3656 std::move(title), size, window_flags, &windowRaw, &rendererRaw);
3657 if (window) *window = Window{windowRaw};
3658 if (renderer) *renderer = Renderer{rendererRaw};
3659}
3660
3677inline std::pair<Window, Renderer> CreateWindowAndRenderer(
3678 StringParam title,
3679 const PointRaw& size,
3680 WindowFlags window_flags = 0)
3681{
3682 SDL_Window* window = nullptr;
3683 SDL_Renderer* renderer = nullptr;
3685 std::move(title), size, window_flags, &window, &renderer);
3686 return {Window{window}, Renderer(renderer)};
3687}
3688
3707 const PointRaw& size,
3708 WindowFlags window_flags,
3709 Renderer* renderer)
3710{
3711 Window window;
3713 std::move(title), size, window_flags, &window, renderer);
3714 return window;
3715}
3716
3718 const PointRaw& size,
3719 WindowFlags window_flags,
3720 RendererRef* renderer)
3721 : Window(
3722 CreateWindowAndRenderer(std::move(title), size, window_flags, renderer))
3723{
3724}
3725
3759inline Renderer CreateRenderer(WindowRef window, StringParam name = nullptr)
3760{
3761 return Renderer(window, std::move(name));
3762}
3763
3765 : Renderer(SDL_CreateRenderer(window, name))
3766{
3767}
3768
3770 : Renderer(SDL_CreateRendererWithProperties(props))
3771{
3772}
3773
3775 : Renderer(SDL_CreateSoftwareRenderer(surface))
3776{
3777}
3778
3842{
3843 return Renderer(props);
3844}
3845
3852
3853constexpr auto NAME_STRING =
3854 SDL_PROP_RENDERER_CREATE_NAME_STRING;
3855
3856constexpr auto WINDOW_POINTER =
3857 SDL_PROP_RENDERER_CREATE_WINDOW_POINTER;
3858
3859constexpr auto SURFACE_POINTER =
3860 SDL_PROP_RENDERER_CREATE_SURFACE_POINTER;
3861
3863 SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER;
3865
3866constexpr auto PRESENT_VSYNC_NUMBER =
3867 SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER;
3868
3869#if SDL_VERSION_ATLEAST(3, 4, 0)
3870
3871constexpr auto GPU_DEVICE_POINTER =
3872 SDL_PROP_RENDERER_CREATE_GPU_DEVICE_POINTER;
3873
3875 SDL_PROP_RENDERER_CREATE_GPU_SHADERS_SPIRV_BOOLEAN;
3877
3879 SDL_PROP_RENDERER_CREATE_GPU_SHADERS_DXIL_BOOLEAN;
3881
3883 SDL_PROP_RENDERER_CREATE_GPU_SHADERS_MSL_BOOLEAN;
3884
3885#endif // SDL_VERSION_ATLEAST(3, 4, 0)
3886
3888 SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER;
3890
3892 SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER;
3893
3895 SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER;
3898
3900 SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER;
3901
3903 SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER;
3909
3911 SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER;
3917
3918} // namespace prop::Renderer::Create
3919
3920#if SDL_VERSION_ATLEAST(3, 4, 0)
3921
3955{
3956 return SDL_CreateGPURenderer(device, window);
3957}
3958
3971{
3972 return SDL_GetGPURendererDevice(renderer);
3973}
3974
3979
3980#endif // SDL_VERSION_ATLEAST(3, 4, 0)
3981
4002{
4003 return Renderer(surface);
4004}
4005
4007{
4008 return CheckError(SDL_GetRenderer(get()));
4009}
4010
4023{
4024 return CheckError(SDL_GetRenderWindow(renderer));
4025}
4026
4028
4043inline const char* GetRendererName(RendererRef renderer)
4044{
4045 return CheckError(SDL_GetRendererName(renderer));
4046}
4047
4048inline const char* Renderer::GetName() const
4049{
4050 return SDL::GetRendererName(get());
4051}
4052
4139{
4140 return CheckError(SDL_GetRendererProperties(renderer));
4141}
4142
4144{
4146}
4147
4158namespace prop::Renderer {
4159
4160constexpr auto NAME_STRING =
4161 SDL_PROP_RENDERER_NAME_STRING;
4162
4163constexpr auto WINDOW_POINTER =
4164 SDL_PROP_RENDERER_WINDOW_POINTER;
4165
4166constexpr auto SURFACE_POINTER =
4167 SDL_PROP_RENDERER_SURFACE_POINTER;
4168
4169constexpr auto VSYNC_NUMBER =
4170 SDL_PROP_RENDERER_VSYNC_NUMBER;
4171
4173 SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER;
4174
4176 SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER;
4177
4178#if SDL_VERSION_ATLEAST(3, 4, 0)
4179
4181 SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN;
4182
4183#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4184
4186 SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER;
4187
4188constexpr auto HDR_ENABLED_BOOLEAN =
4189 SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN;
4190
4192 SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT;
4193
4194constexpr auto HDR_HEADROOM_FLOAT =
4195 SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT;
4196
4197constexpr auto D3D9_DEVICE_POINTER =
4198 SDL_PROP_RENDERER_D3D9_DEVICE_POINTER;
4199
4200constexpr auto D3D11_DEVICE_POINTER =
4201 SDL_PROP_RENDERER_D3D11_DEVICE_POINTER;
4202
4204 SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER;
4205
4206constexpr auto D3D12_DEVICE_POINTER =
4207 SDL_PROP_RENDERER_D3D12_DEVICE_POINTER;
4208
4210 SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER;
4211
4213 SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER;
4215
4217 SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER;
4218
4220 SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER;
4221
4223 SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER;
4225
4227 SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER;
4228
4230 SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER;
4235
4237 SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER;
4241
4243 SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER;
4245
4246constexpr auto GPU_DEVICE_POINTER =
4247 SDL_PROP_RENDERER_GPU_DEVICE_POINTER;
4248
4249} // namespace prop::Renderer
4250
4271inline void GetRenderOutputSize(RendererRef renderer, int* w, int* h)
4272{
4273 CheckError(SDL_GetRenderOutputSize(renderer, w, h));
4274}
4275
4296{
4297 Point p;
4298 GetRenderOutputSize(renderer, &p.x, &p.y);
4299 return p;
4300}
4301
4302inline void Renderer::GetOutputSize(int* w, int* h) const
4303{
4305}
4306
4308{
4309 return SDL::GetRenderOutputSize(get());
4310}
4311
4332inline void GetCurrentRenderOutputSize(RendererRef renderer, int* w, int* h)
4333{
4334 CheckError(SDL_GetCurrentRenderOutputSize(renderer, w, h));
4335}
4336
4357{
4358 Point p;
4359 GetCurrentRenderOutputSize(renderer, &p.x, &p.y);
4360 return p;
4361}
4362
4363inline void Renderer::GetCurrentOutputSize(int* w, int* h) const
4364{
4366}
4367
4372
4396 PixelFormat format,
4397 TextureAccess access,
4398 const PointRaw& size)
4399{
4400 return Texture(renderer, format, access, size);
4401}
4402
4404 TextureAccess access,
4405 const PointRaw& size)
4406{
4407 return Texture(get(), format, access, size);
4408}
4409
4411 PixelFormat format,
4412 TextureAccess access,
4413 const PointRaw& size)
4414 : Texture(SDL_CreateTexture(renderer, format, access, size.x, size.y))
4415{
4416}
4417
4418inline Texture::Texture(RendererRef renderer, SurfaceRef surface)
4419 : Texture(SDL_CreateTextureFromSurface(renderer, surface))
4420{
4421}
4422
4424 : Texture(SDL_CreateTextureWithProperties(renderer, props))
4425{
4426}
4427
4454 SurfaceRef surface)
4455{
4456 return Texture(renderer, surface);
4457}
4458
4460{
4461 return Texture(get(), surface);
4462}
4463
4586 PropertiesRef props)
4587{
4588 return Texture(renderer, props);
4589}
4590
4592{
4593 return Texture(get(), props);
4594}
4595
4602
4603constexpr auto COLORSPACE_NUMBER =
4604 SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER;
4605
4606constexpr auto FORMAT_NUMBER =
4607 SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER;
4608
4609constexpr auto ACCESS_NUMBER =
4610 SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER;
4611
4612constexpr auto WIDTH_NUMBER =
4613 SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER;
4614
4615constexpr auto HEIGHT_NUMBER =
4616 SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER;
4617
4618#if SDL_VERSION_ATLEAST(3, 4, 0)
4619
4620constexpr auto PALETTE_POINTER =
4621 SDL_PROP_TEXTURE_CREATE_PALETTE_POINTER;
4622
4623#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4624
4626 SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT;
4627
4628constexpr auto HDR_HEADROOM_FLOAT =
4629 SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT;
4630
4632 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER;
4633
4635 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER;
4637
4639 SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER;
4641
4643 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER;
4644
4646 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER;
4648
4650 SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER;
4652
4654 SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER;
4656
4658 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER;
4659
4661 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER;
4663
4665 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER;
4667
4669 SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER;
4671
4673 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER;
4675
4677 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER;
4679
4681 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER;
4683
4685 SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER;
4687
4689 SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER;
4691
4692#if SDL_VERSION_ATLEAST(3, 4, 0)
4693
4694constexpr auto VULKAN_LAYOUT_NUMBER =
4695 SDL_PROP_TEXTURE_CREATE_VULKAN_LAYOUT_NUMBER;
4696
4697constexpr auto GPU_TEXTURE_POINTER =
4698 SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_POINTER;
4699
4701 SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_UV_POINTER;
4703
4705 SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_U_POINTER;
4706
4708 SDL_PROP_TEXTURE_CREATE_GPU_TEXTURE_V_POINTER;
4709
4710#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4711
4712} // namespace prop::Texture::Create
4713
4810{
4811 return CheckError(SDL_GetTextureProperties(texture));
4812}
4813
4815{
4817}
4818
4829namespace prop::Texture {
4830
4831constexpr auto COLORSPACE_NUMBER =
4832 SDL_PROP_TEXTURE_COLORSPACE_NUMBER;
4833
4834constexpr auto FORMAT_NUMBER =
4835 SDL_PROP_TEXTURE_FORMAT_NUMBER;
4836
4837constexpr auto ACCESS_NUMBER =
4838 SDL_PROP_TEXTURE_ACCESS_NUMBER;
4839
4840constexpr auto WIDTH_NUMBER =
4841 SDL_PROP_TEXTURE_WIDTH_NUMBER;
4842
4843constexpr auto HEIGHT_NUMBER =
4844 SDL_PROP_TEXTURE_HEIGHT_NUMBER;
4845
4847 SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT;
4848
4849constexpr auto HDR_HEADROOM_FLOAT =
4850 SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT;
4851
4853 SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER;
4854
4856 SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER;
4857
4859 SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER;
4860
4862 SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER;
4863
4865 SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER;
4866
4868 SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER;
4869
4871 SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER;
4872
4874 SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER;
4875
4877 SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER;
4878
4880 SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER;
4881
4883 SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER;
4885
4886constexpr auto OPENGL_TEX_W_FLOAT =
4887 SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT;
4888
4889constexpr auto OPENGL_TEX_H_FLOAT =
4890 SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT;
4891
4893 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER;
4894
4896 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER;
4898
4900 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER;
4902
4904 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER;
4906
4908 SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER;
4910
4912 SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER;
4913
4914#if SDL_VERSION_ATLEAST(3, 4, 0)
4915
4916constexpr auto GPU_TEXTURE_POINTER =
4917 SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER;
4918
4920 SDL_PROP_TEXTURE_GPU_TEXTURE_UV_POINTER;
4921
4923 SDL_PROP_TEXTURE_GPU_TEXTURE_U_POINTER;
4924
4926 SDL_PROP_TEXTURE_GPU_TEXTURE_V_POINTER;
4927
4928#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4929
4930} // namespace prop::Texture
4931
4944{
4945 return CheckError(SDL_GetRendererFromTexture(texture));
4946}
4947
4949{
4951}
4952
4967inline void GetTextureSize(TextureConstRef texture, float* w, float* h)
4968{
4969 CheckError(SDL_GetTextureSize(texture, w, h));
4970}
4971
4974{
4975 return Point(texture->w, texture->h);
4976}
4977
4978inline void Texture::GetSize(float* w, float* h) const
4979{
4980 SDL::GetTextureSize(get(), w, h);
4981}
4982
4983inline Point Texture::GetSize() const { return SDL::GetTextureSize(get()); }
4984
4987{
4988 FPoint p;
4989 GetTextureSize(texture, &p.x, &p.y);
4990 return p;
4991}
4992
4994{
4995 return SDL::GetTextureSizeFloat(get());
4996}
4997
4999inline int GetTextureWidth(TextureConstRef texture) { return texture->w; }
5000
5001inline int Texture::GetWidth() const { return SDL::GetTextureWidth(get()); }
5002
5004inline int GetTextureHeight(TextureConstRef texture) { return texture->h; }
5005
5006inline int Texture::GetHeight() const { return SDL::GetTextureHeight(get()); }
5007
5010{
5011 return texture->format;
5012}
5013
5015{
5016 return SDL::GetTextureFormat(get());
5017}
5018
5019#if SDL_VERSION_ATLEAST(3, 4, 0)
5020
5040inline void SetTexturePalette(TextureRef texture, PaletteRef palette)
5041{
5042 CheckError(SDL_SetTexturePalette(texture, palette));
5043}
5044
5046{
5047 SDL::SetTexturePalette(get(), palette);
5048}
5049
5064{
5065 return Palette::Borrow(SDL_GetTexturePalette(texture));
5066}
5067
5069
5070#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5071
5098inline void SetTextureColorMod(TextureRef texture, Uint8 r, Uint8 g, Uint8 b)
5099{
5100 CheckError(SDL_SetTextureColorMod(texture, r, g, b));
5101}
5102
5104{
5105 SDL::SetTextureColorMod(get(), r, g, b);
5106}
5107
5135 float r,
5136 float g,
5137 float b)
5138{
5139 CheckError(SDL_SetTextureColorModFloat(texture, r, g, b));
5140}
5141
5142inline void Texture::SetColorModFloat(float r, float g, float b)
5143{
5145}
5146
5165 Uint8* r,
5166 Uint8* g,
5167 Uint8* b)
5168{
5169 CheckError(SDL_GetTextureColorMod(texture, r, g, b));
5170}
5171
5172inline void Texture::GetColorMod(Uint8* r, Uint8* g, Uint8* b) const
5173{
5174 SDL::GetTextureColorMod(get(), r, g, b);
5175}
5176
5195 float* r,
5196 float* g,
5197 float* b)
5198{
5199 CheckError(SDL_GetTextureColorModFloat(texture, r, g, b));
5200}
5201
5202inline void Texture::GetColorModFloat(float* r, float* g, float* b) const
5203{
5205}
5206
5230inline void SetTextureAlphaMod(TextureRef texture, Uint8 alpha)
5231{
5232 CheckError(SDL_SetTextureAlphaMod(texture, alpha));
5233}
5234
5235inline void Texture::SetAlphaMod(Uint8 alpha)
5236{
5237 SDL::SetTextureAlphaMod(get(), alpha);
5238}
5239
5263inline void SetTextureAlphaModFloat(TextureRef texture, float alpha)
5264{
5265 CheckError(SDL_SetTextureAlphaModFloat(texture, alpha));
5266}
5267
5268inline void Texture::SetAlphaModFloat(float alpha)
5269{
5271}
5272
5289{
5290 Uint8 alpha;
5291 CheckError(SDL_GetTextureAlphaMod(texture, &alpha));
5292 return alpha;
5293}
5294
5296{
5297 return SDL::GetTextureAlphaMod(get());
5298}
5299
5316{
5317 float alpha;
5318 CheckError(SDL_GetTextureAlphaModFloat(texture, &alpha));
5319 return alpha;
5320}
5321
5322inline float Texture::GetAlphaModFloat() const
5323{
5325}
5326
5350inline void SetTextureMod(TextureRef texture, Color c)
5351{
5352 SetTextureColorMod(texture, c.r, c.g, c.b);
5353 SetTextureAlphaMod(texture, c.a);
5354}
5355
5357
5381inline void SetTextureModFloat(TextureRef texture, FColor c)
5382{
5383 SetTextureColorModFloat(texture, c.r, c.g, c.b);
5384 SetTextureAlphaModFloat(texture, c.a);
5385}
5386
5388{
5390}
5391
5407{
5408 Color c;
5409 GetTextureColorMod(texture, &c.r, &c.g, &c.b);
5410 c.a = GetTextureAlphaMod(texture);
5411 return c;
5412}
5413
5414inline Color Texture::GetMod() const { return SDL::GetTextureMod(get()); }
5415
5431{
5432 FColor c;
5433 GetTextureColorModFloat(texture, &c.r, &c.g, &c.b);
5434 c.a = GetTextureAlphaModFloat(texture);
5435 return c;
5436}
5437
5439{
5440 return SDL::GetTextureModFloat(get());
5441}
5442
5459inline void SetTextureBlendMode(TextureRef texture, BlendMode blendMode)
5460{
5461 CheckError(SDL_SetTextureBlendMode(texture, blendMode));
5462}
5463
5464inline void Texture::SetBlendMode(BlendMode blendMode)
5465{
5466 SDL::SetTextureBlendMode(get(), blendMode);
5467}
5468
5483{
5484 BlendMode blendMode;
5485 CheckError(SDL_GetTextureBlendMode(texture, &blendMode));
5486 return blendMode;
5487}
5488
5490{
5491 return SDL::GetTextureBlendMode(get());
5492}
5493
5511inline void SetTextureScaleMode(TextureRef texture, ScaleMode scaleMode)
5512{
5513 CheckError(SDL_SetTextureScaleMode(texture, scaleMode));
5514}
5515
5516inline void Texture::SetScaleMode(ScaleMode scaleMode)
5517{
5518 SDL::SetTextureScaleMode(get(), scaleMode);
5519}
5520
5535{
5536 ScaleMode scaleMode;
5537 CheckError(SDL_GetTextureScaleMode(texture, &scaleMode));
5538 return scaleMode;
5539}
5540
5542{
5543 return SDL::GetTextureScaleMode(get());
5544}
5545
5577inline void UpdateTexture(TextureRef texture,
5579 const void* pixels,
5580 int pitch)
5581{
5582 CheckError(SDL_UpdateTexture(texture, rect, pixels, pitch));
5583}
5584
5615inline void UpdateTexture(TextureRef texture,
5616 SurfaceConstRef surface,
5617 OptionalRef<const RectRaw> rect = std::nullopt)
5618{
5619 UpdateTexture(texture, rect, surface->pixels, surface->pitch);
5620}
5621
5623 const void* pixels,
5624 int pitch)
5625{
5626 SDL::UpdateTexture(get(), rect, pixels, pitch);
5627}
5628
5631{
5632 SDL::UpdateTexture(get(), surface, rect);
5633}
5634
5660inline void UpdateYUVTexture(TextureRef texture,
5662 const Uint8* Yplane,
5663 int Ypitch,
5664 const Uint8* Uplane,
5665 int Upitch,
5666 const Uint8* Vplane,
5667 int Vpitch)
5668{
5669 CheckError(SDL_UpdateYUVTexture(
5670 texture, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch));
5671}
5672
5674 const Uint8* Yplane,
5675 int Ypitch,
5676 const Uint8* Uplane,
5677 int Upitch,
5678 const Uint8* Vplane,
5679 int Vpitch)
5680{
5682 get(), rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch);
5683}
5684
5709inline void UpdateNVTexture(TextureRef texture,
5711 const Uint8* Yplane,
5712 int Ypitch,
5713 const Uint8* UVplane,
5714 int UVpitch)
5715{
5716 CheckError(
5717 SDL_UpdateNVTexture(texture, rect, Yplane, Ypitch, UVplane, UVpitch));
5718}
5719
5721 const Uint8* Yplane,
5722 int Ypitch,
5723 const Uint8* UVplane,
5724 int UVpitch)
5725{
5726 SDL::UpdateNVTexture(get(), rect, Yplane, Ypitch, UVplane, UVpitch);
5727}
5728
5756inline void LockTexture(TextureRef texture,
5758 void** pixels,
5759 int* pitch)
5760{
5761 CheckError(SDL_LockTexture(texture, rect, pixels, pitch));
5762}
5763
5765 void** pixels,
5766 int* pitch)
5767{
5768 return {TextureRef(*this), rect, pixels, pitch};
5769}
5770
5773 void** pixels,
5774 int* pitch)
5775 : m_lock(std::move(resource))
5776{
5777 LockTexture(m_lock, rect, pixels, pitch);
5778}
5779
5812 TextureRef texture,
5813 OptionalRef<const RectRaw> rect = std::nullopt)
5814{
5815 SurfaceRaw surface = nullptr;
5816 CheckError(SDL_LockTextureToSurface(texture, rect, &surface));
5817 return Surface::Borrow(surface);
5818}
5819
5822{
5823 return {TextureRef(*this), rect};
5824}
5825
5832
5852inline void UnlockTexture(TextureRef texture) { SDL_UnlockTexture(texture); }
5853
5854inline void Texture::Unlock(TextureLock&& lock)
5855{
5856 SDL_assert_paranoid(lock.resource() == *this);
5857 std::move(lock).reset();
5858}
5859
5861{
5862 SDL_assert_paranoid(lock.resource() == *this);
5863 std::move(lock).reset();
5864}
5865
5867{
5868 if (!m_lock) return;
5869 UnlockTexture(m_lock);
5870 m_lock = {};
5871}
5872
5874{
5875 if (!m_lock) return;
5876 UnlockTexture(m_lock);
5877 m_lock = {};
5878}
5879
5904inline void SetRenderTarget(RendererRef renderer, TextureRef texture)
5905{
5906 CheckError(SDL_SetRenderTarget(renderer, texture));
5907}
5908
5910{
5911 SDL::SetRenderTarget(get(), texture);
5912}
5913
5929inline void ResetRenderTarget(RendererRef renderer)
5930{
5931 SetRenderTarget(renderer, nullptr);
5932}
5933
5935
5952{
5953 if (auto texture = SDL_GetRenderTarget(renderer))
5954 return Texture::Borrow(texture);
5955 return {};
5956}
5957
5959{
5960 return SDL::GetRenderTarget(get());
5961}
5962
6007 const PointRaw& size,
6009{
6010 CheckError(SDL_SetRenderLogicalPresentation(renderer, size.x, size.y, mode));
6011}
6012
6015{
6017}
6018
6041 int* w,
6042 int* h,
6044{
6045 CheckError(SDL_GetRenderLogicalPresentation(renderer, w, h, mode));
6046}
6047
6070 PointRaw* size,
6072{
6073 if (size) {
6074 return GetRenderLogicalPresentation(renderer, &size->x, &size->y, mode);
6075 }
6076 return GetRenderLogicalPresentation(renderer, nullptr, nullptr, mode);
6077}
6078
6080 int* w,
6081 int* h,
6082 RendererLogicalPresentation* mode) const
6083{
6085}
6086
6092
6114{
6115 FRect rect;
6116 CheckError(SDL_GetRenderLogicalPresentationRect(renderer, &rect));
6117 return rect;
6118}
6119
6124
6148 const FPointRaw& window_coord)
6149{
6150 FPoint p;
6151 CheckError(SDL_RenderCoordinatesFromWindow(
6152 renderer, window_coord.x, window_coord.y, &p.x, &p.y));
6153 return p;
6154}
6155
6157 const FPointRaw& window_coord) const
6158{
6159 return SDL::RenderCoordinatesFromWindow(get(), window_coord);
6160}
6161
6186 const FPointRaw& coord)
6187{
6188 FPoint p;
6189 CheckError(
6190 SDL_RenderCoordinatesToWindow(renderer, coord.x, coord.y, &p.x, &p.y));
6191 return p;
6192}
6193
6195{
6196 return SDL::RenderCoordinatesToWindow(get(), coord);
6197}
6198
6232{
6233 CheckError(SDL_ConvertEventToRenderCoordinates(renderer, event));
6234}
6235
6240
6265inline void SetRenderViewport(RendererRef renderer,
6267{
6268 CheckError(SDL_SetRenderViewport(renderer, rect));
6269}
6270
6275
6293{
6294 SetRenderViewport(renderer, std::nullopt);
6295}
6296
6298
6317{
6318 Rect rect;
6319 CheckError(SDL_GetRenderViewport(renderer, &rect));
6320 return rect;
6321}
6322
6324{
6325 return SDL::GetRenderViewport(get());
6326}
6327
6348inline bool RenderViewportSet(RendererRef renderer)
6349{
6350 return SDL_RenderViewportSet(renderer);
6351}
6352
6353inline bool Renderer::ViewportSet() const
6354{
6355 return SDL::RenderViewportSet(get());
6356}
6357
6377{
6378 Rect rect;
6379 CheckError(SDL_GetRenderSafeArea(renderer, &rect));
6380 return rect;
6381}
6382
6384{
6385 return SDL::GetRenderSafeArea(get());
6386}
6387
6406inline void SetRenderClipRect(RendererRef renderer,
6408{
6409 CheckError(SDL_SetRenderClipRect(renderer, rect));
6410}
6411
6416
6434{
6435 SetRenderClipRect(renderer, std::nullopt);
6436}
6437
6439
6459{
6460 Rect rect;
6461 CheckError(SDL_GetRenderClipRect(renderer, &rect));
6462 return rect;
6463}
6464
6466{
6467 return SDL::GetRenderClipRect(get());
6468}
6469
6487inline bool RenderClipEnabled(RendererRef renderer)
6488{
6489 return SDL_RenderClipEnabled(renderer);
6490}
6491
6492inline bool Renderer::IsClipEnabled() const
6493{
6494 return SDL::RenderClipEnabled(get());
6495}
6496
6521inline void SetRenderScale(RendererRef renderer, const FPointRaw& scale)
6522{
6523 CheckError(SDL_SetRenderScale(renderer, scale.x, scale.y));
6524}
6525
6526inline void Renderer::SetScale(const FPointRaw& scale)
6527{
6528 SDL::SetRenderScale(get(), scale);
6529}
6530
6548inline void GetRenderScale(RendererRef renderer, float* scaleX, float* scaleY)
6549{
6550 CheckError(SDL_GetRenderScale(renderer, scaleX, scaleY));
6551}
6552
6569{
6570 FPoint p;
6571 GetRenderScale(renderer, &p.x, &p.y);
6572 return p;
6573}
6574
6575inline void Renderer::GetScale(float* scaleX, float* scaleY) const
6576{
6577 SDL::GetRenderScale(get(), scaleX, scaleY);
6578}
6579
6581
6600{
6601 CheckError(SDL_SetRenderDrawColor(renderer, c.r, c.g, c.b, c.a));
6602}
6603
6605{
6607}
6608
6626inline void SetRenderDrawColorFloat(RendererRef renderer, const FColorRaw& c)
6627{
6628 CheckError(SDL_SetRenderDrawColorFloat(renderer, c.r, c.g, c.b, c.a));
6629}
6630
6632{
6634}
6635
6657inline void GetRenderDrawColor(RendererRef renderer,
6658 Uint8* r,
6659 Uint8* g,
6660 Uint8* b,
6661 Uint8* a)
6662{
6663 CheckError(SDL_GetRenderDrawColor(renderer, r, g, b, a));
6664}
6665
6681{
6682 Color c;
6683 GetRenderDrawColor(renderer, &c.r, &c.g, &c.b, &c.a);
6684 return c;
6685}
6686
6687inline void Renderer::GetDrawColor(Uint8* r, Uint8* g, Uint8* b, Uint8* a) const
6688{
6689 SDL::GetRenderDrawColor(get(), r, g, b, a);
6690}
6691
6693{
6694 return SDL::GetRenderDrawColor(get());
6695}
6696
6719 float* r,
6720 float* g,
6721 float* b,
6722 float* a)
6723{
6724 CheckError(SDL_GetRenderDrawColorFloat(renderer, r, g, b, a));
6725}
6726
6742{
6743 FColor c;
6744 GetRenderDrawColorFloat(renderer, &c.r, &c.g, &c.b, &c.a);
6745 return c;
6746}
6747
6748inline void Renderer::GetDrawColorFloat(float* r,
6749 float* g,
6750 float* b,
6751 float* a) const
6752{
6753 SDL::GetRenderDrawColorFloat(get(), r, g, b, a);
6754}
6755
6757{
6759}
6760
6781inline void SetRenderColorScale(RendererRef renderer, float scale)
6782{
6783 CheckError(SDL_SetRenderColorScale(renderer, scale));
6784}
6785
6786inline void Renderer::SetColorScale(float scale)
6787{
6788 SDL::SetRenderColorScale(get(), scale);
6789}
6790
6804inline float GetRenderColorScale(RendererRef renderer)
6805{
6806 float scale;
6807 CheckError(SDL_GetRenderColorScale(renderer, &scale));
6808 return scale;
6809}
6810
6811inline float Renderer::GetColorScale() const
6812{
6813 return SDL::GetRenderColorScale(get());
6814}
6815
6831inline void SetRenderDrawBlendMode(RendererRef renderer, BlendMode blendMode)
6832{
6833 CheckError(SDL_SetRenderDrawBlendMode(renderer, blendMode));
6834}
6835
6837{
6838 SDL::SetRenderDrawBlendMode(get(), blendMode);
6839}
6840
6855{
6856 BlendMode blendMode;
6857 CheckError(SDL_GetRenderDrawBlendMode(renderer, &blendMode));
6858 return blendMode;
6859}
6860
6862{
6864}
6865
6883inline void RenderClear(RendererRef renderer)
6884{
6885 CheckError(SDL_RenderClear(renderer));
6886}
6887
6889
6903inline void RenderPoint(RendererRef renderer, const FPointRaw& p)
6904{
6905 CheckError(SDL_RenderPoint(renderer, p.x, p.y));
6906}
6907
6909{
6910 SDL::RenderPoint(get(), p);
6911}
6912
6927{
6928 CheckError(
6929 SDL_RenderPoints(renderer, points.data(), narrowS32(points.size())));
6930}
6931
6933{
6934 SDL::RenderPoints(get(), points);
6935}
6936
6951inline void RenderLine(RendererRef renderer,
6952 const FPointRaw& p1,
6953 const FPointRaw& p2)
6954{
6955 CheckError(SDL_RenderLine(renderer, p1.x, p1.y, p2.x, p2.y));
6956}
6957
6958inline void Renderer::RenderLine(const FPointRaw& p1, const FPointRaw& p2)
6959{
6960 SDL::RenderLine(get(), p1, p2);
6961}
6962
6978{
6979 CheckError(
6980 SDL_RenderLines(renderer, points.data(), narrowS32(points.size())));
6981}
6982
6984{
6985 SDL::RenderLines(get(), points);
6986}
6987
7003{
7004 CheckError(SDL_RenderRect(renderer, rect));
7005}
7006
7008{
7009 SDL::RenderRect(get(), rect);
7010}
7011
7027{
7028 CheckError(SDL_RenderRects(renderer, rects.data(), narrowS32(rects.size())));
7029}
7030
7032{
7033 SDL::RenderRects(get(), rects);
7034}
7035
7051inline void RenderFillRect(RendererRef renderer,
7053{
7054 CheckError(SDL_RenderFillRect(renderer, rect));
7055}
7056
7061
7077{
7078 CheckError(
7079 SDL_RenderFillRects(renderer, rects.data(), narrowS32(rects.size())));
7080}
7081
7083{
7084 SDL::RenderFillRects(get(), rects);
7085}
7086
7106inline void RenderTexture(RendererRef renderer,
7107 TextureRef texture,
7110{
7111 CheckError(SDL_RenderTexture(renderer, texture, srcrect, dstrect));
7112}
7113
7117{
7118 SDL::RenderTexture(get(), texture, srcrect, dstrect);
7119}
7120
7147 TextureRef texture,
7150 double angle,
7152 FlipMode flip = FlipMode::SDL_FLIP_NONE)
7153{
7154 CheckError(SDL_RenderTextureRotated(
7155 renderer, texture, srcrect, dstrect, angle, center, flip));
7156}
7157
7161 double angle,
7163 FlipMode flip)
7164{
7166 get(), texture, srcrect, dstrect, angle, center, flip);
7167}
7168
7195 TextureRef texture,
7200{
7201 CheckError(
7202 SDL_RenderTextureAffine(renderer, texture, srcrect, origin, right, down));
7203}
7204
7210{
7211 SDL::RenderTextureAffine(get(), texture, srcrect, origin, right, down);
7212}
7213
7238inline void RenderTextureTiled(RendererRef renderer,
7239 TextureRef texture,
7241 float scale,
7243{
7244 CheckError(
7245 SDL_RenderTextureTiled(renderer, texture, srcrect, scale, dstrect));
7246}
7247
7250 float scale,
7252{
7253 SDL::RenderTextureTiled(get(), texture, srcrect, scale, dstrect);
7254}
7255
7288inline void RenderTexture9Grid(RendererRef renderer,
7289 TextureRef texture,
7291 float left_width,
7292 float right_width,
7293 float top_height,
7294 float bottom_height,
7295 float scale,
7297{
7298 CheckError(SDL_RenderTexture9Grid(renderer,
7299 texture,
7300 srcrect,
7301 left_width,
7302 right_width,
7303 top_height,
7304 bottom_height,
7305 scale,
7306 dstrect));
7307}
7308
7311 float left_width,
7312 float right_width,
7313 float top_height,
7314 float bottom_height,
7315 float scale,
7317{
7319 texture,
7320 srcrect,
7321 left_width,
7322 right_width,
7323 top_height,
7324 bottom_height,
7325 scale,
7326 dstrect);
7327}
7328
7329#if SDL_VERSION_ATLEAST(3, 4, 0)
7330
7367 TextureRef texture,
7368 const FRectRaw& srcrect,
7369 float left_width,
7370 float right_width,
7371 float top_height,
7372 float bottom_height,
7373 float scale,
7374 const FRectRaw& dstrect,
7375 float tileScale)
7376{
7377 CheckError(SDL_RenderTexture9GridTiled(renderer,
7378 texture,
7379 &srcrect,
7380 left_width,
7381 right_width,
7382 top_height,
7383 bottom_height,
7384 scale,
7385 &dstrect,
7386 tileScale));
7387}
7388
7390 const FRectRaw& srcrect,
7391 float left_width,
7392 float right_width,
7393 float top_height,
7394 float bottom_height,
7395 float scale,
7396 const FRectRaw& dstrect,
7397 float tileScale)
7398{
7400 texture,
7401 srcrect,
7402 left_width,
7403 right_width,
7404 top_height,
7405 bottom_height,
7406 scale,
7407 dstrect,
7408 tileScale);
7409}
7410
7411#endif // SDL_VERSION_ATLEAST(3, 4, 0)
7412
7433inline void RenderGeometry(RendererRef renderer,
7434 TextureRef texture,
7435 std::span<const Vertex> vertices,
7436 std::span<const int> indices = {})
7437{
7438 CheckError(SDL_RenderGeometry(renderer,
7439 texture,
7440 vertices.data(),
7441 narrowS32(vertices.size()),
7442 indices.data(),
7443 narrowS32(indices.size())));
7444}
7445
7447 std::span<const Vertex> vertices,
7448 std::span<const int> indices)
7449{
7450 SDL::RenderGeometry(get(), texture, vertices, indices);
7451}
7452
7480inline void RenderGeometryRaw(RendererRef renderer,
7481 TextureRef texture,
7482 const float* xy,
7483 int xy_stride,
7484 const FColor* color,
7485 int color_stride,
7486 const float* uv,
7487 int uv_stride,
7488 int num_vertices,
7489 const void* indices,
7490 int num_indices,
7491 int size_indices)
7492{
7493 CheckError(SDL_RenderGeometryRaw(renderer,
7494 texture,
7495 xy,
7496 xy_stride,
7497 color,
7498 color_stride,
7499 uv,
7500 uv_stride,
7501 num_vertices,
7502 indices,
7503 num_indices,
7504 size_indices));
7505}
7506
7508 const float* xy,
7509 int xy_stride,
7510 const FColor* color,
7511 int color_stride,
7512 const float* uv,
7513 int uv_stride,
7514 int num_vertices,
7515 const void* indices,
7516 int num_indices,
7517 int size_indices)
7518{
7520 texture,
7521 xy,
7522 xy_stride,
7523 color,
7524 color_stride,
7525 uv,
7526 uv_stride,
7527 num_vertices,
7528 indices,
7529 num_indices,
7530 size_indices);
7531}
7532
7533#if SDL_VERSION_ATLEAST(3, 4, 0)
7534
7554 TextureAddressMode u_mode,
7555 TextureAddressMode v_mode)
7556{
7557 CheckError(SDL_SetRenderTextureAddressMode(renderer, u_mode, v_mode));
7558}
7559
7565
7585 TextureAddressMode* u_mode,
7586 TextureAddressMode* v_mode)
7587{
7588 CheckError(SDL_GetRenderTextureAddressMode(renderer, u_mode, v_mode));
7589}
7590
7592 TextureAddressMode* v_mode)
7593{
7594 SDL::GetRenderTextureAddressMode(get(), u_mode, v_mode);
7595}
7596
7597#endif // SDL_VERSION_ATLEAST(3, 4, 0)
7598
7626{
7627 return Surface{CheckError(SDL_RenderReadPixels(renderer, rect))};
7628}
7629
7631{
7632 return SDL::RenderReadPixels(get(), rect);
7633}
7634
7680inline void RenderPresent(RendererRef renderer)
7681{
7682 CheckError(SDL_RenderPresent(renderer));
7683}
7684
7686
7702inline void DestroyTexture(TextureRaw texture) { SDL_DestroyTexture(texture); }
7703
7705
7719inline void DestroyRenderer(RendererRaw renderer)
7720{
7721 SDL_DestroyRenderer(renderer);
7722}
7723
7725
7756inline void FlushRenderer(RendererRef renderer)
7757{
7758 CheckError(SDL_FlushRenderer(renderer));
7759}
7760
7762
7779inline void* GetRenderMetalLayer(RendererRef renderer)
7780{
7781 return SDL_GetRenderMetalLayer(renderer);
7782}
7783
7785{
7786 return SDL::GetRenderMetalLayer(get());
7787}
7788
7811{
7812 return SDL_GetRenderMetalCommandEncoder(renderer);
7813}
7814
7819
7847 Uint32 wait_stage_mask,
7848 Sint64 wait_semaphore,
7849 Sint64 signal_semaphore)
7850{
7851 CheckError(SDL_AddVulkanRenderSemaphores(
7852 renderer, wait_stage_mask, wait_semaphore, signal_semaphore));
7853}
7854
7856 Sint64 wait_semaphore,
7857 Sint64 signal_semaphore)
7858{
7860 get(), wait_stage_mask, wait_semaphore, signal_semaphore);
7861}
7862
7885inline void SetRenderVSync(RendererRef renderer, int vsync)
7886{
7887 CheckError(SDL_SetRenderVSync(renderer, vsync));
7888}
7889
7890inline void Renderer::SetVSync(int vsync) { SDL::SetRenderVSync(get(), vsync); }
7891
7893constexpr int RENDERER_VSYNC_DISABLED = SDL_RENDERER_VSYNC_DISABLED;
7894
7896constexpr int RENDERER_VSYNC_ADAPTIVE = SDL_RENDERER_VSYNC_ADAPTIVE;
7897
7912inline int GetRenderVSync(RendererRef renderer)
7913{
7914 int vsync;
7915 CheckError(SDL_GetRenderVSync(renderer, &vsync));
7916 return vsync;
7917}
7918
7919inline int Renderer::GetVSync() const { return SDL::GetRenderVSync(get()); }
7920
7931 SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE;
7932
7970inline void RenderDebugText(RendererRef renderer,
7971 const FPointRaw& p,
7972 StringParam str)
7973{
7974 CheckError(SDL_RenderDebugText(renderer, p.x, p.y, str));
7975}
7976
7978{
7979 SDL::RenderDebugText(get(), p, std::move(str));
7980}
7981
8006template<class... ARGS>
8008 const FPointRaw& p,
8009 std::string_view fmt,
8010 ARGS... args)
8011{
8013 renderer, p, std::vformat(fmt, std::make_format_args(args...)));
8014}
8015
8016template<class... ARGS>
8018 std::string_view fmt,
8019 ARGS... args)
8020{
8021 SDL::RenderDebugTextFormat(get(), p, fmt, args...);
8022}
8023
8024#if SDL_VERSION_ATLEAST(3, 4, 0)
8025
8042 ScaleMode scale_mode)
8043{
8044 CheckError(SDL_SetDefaultTextureScaleMode(renderer, scale_mode));
8045}
8046
8048{
8049 SDL::SetDefaultTextureScaleMode(get(), scale_mode);
8050}
8051
8068 ScaleMode* scale_mode)
8069{
8070 CheckError(SDL_GetDefaultTextureScaleMode(renderer, scale_mode));
8071}
8072
8074{
8075 SDL::GetDefaultTextureScaleMode(get(), scale_mode);
8076}
8077
8090struct GPURenderState : ResourceBase<GPURenderStateRaw>
8091{
8093
8101 constexpr explicit GPURenderState(GPURenderStateRaw resource) noexcept
8102 : ResourceBase(resource)
8103 {
8104 }
8105
8107 constexpr GPURenderState(const GPURenderState& other) = delete;
8108
8110 constexpr GPURenderState(GPURenderState&& other) noexcept
8111 : GPURenderState(other.release())
8112 {
8113 }
8114
8115 constexpr GPURenderState(const GPURenderStateRef& other) = delete;
8116
8117 constexpr GPURenderState(GPURenderStateRef&& other) = delete;
8118
8136 GPURenderState(RendererRef renderer,
8137 const GPURenderStateCreateInfo& createinfo);
8138
8140 ~GPURenderState() { SDL_DestroyGPURenderState(get()); }
8141
8143 constexpr GPURenderState& operator=(GPURenderState&& other) noexcept
8144 {
8145 swap(*this, other);
8146 return *this;
8147 }
8148
8150 GPURenderState& operator=(const GPURenderState& other) = delete;
8151
8163 void Destroy();
8164
8181 void SetFragmentUniforms(Uint32 slot_index, const void* data, Uint32 length);
8182};
8183
8202 RendererRef renderer,
8203 const GPURenderStateCreateInfo& createinfo)
8204{
8205 return GPURenderState(renderer, createinfo);
8206}
8207
8209 const GPURenderStateCreateInfo& createinfo)
8210{
8211 return GPURenderState(get(), createinfo);
8212}
8213
8215 RendererRef renderer,
8216 const GPURenderStateCreateInfo& createinfo)
8217 : GPURenderState(SDL_CreateGPURenderState(renderer, &createinfo))
8218{
8219}
8220
8239 Uint32 slot_index,
8240 const void* data,
8241 Uint32 length)
8242{
8243 CheckError(
8244 SDL_SetGPURenderStateFragmentUniforms(state, slot_index, data, length));
8245}
8246
8248 const void* data,
8249 Uint32 length)
8250{
8251 SDL::SetGPURenderStateFragmentUniforms(get(), slot_index, data, length);
8252}
8253
8271{
8272 CheckError(SDL_SetGPURenderState(renderer, state));
8273}
8274
8276{
8277 SDL::SetGPURenderState(get(), state);
8278}
8279
8293{
8294 SDL_DestroyGPURenderState(state);
8295}
8296
8298
8299#endif // SDL_VERSION_ATLEAST(3, 4, 0)
8300
8302
8303} // namespace SDL
8304
8305#endif /* SDL3PP_RENDER_H_ */
Optional-like shim for references.
Definition SDL3pp_optionalRef.h:20
Pixel format.
Definition SDL3pp_pixels.h:358
constexpr RawPointer get() const noexcept
Definition SDL3pp_resource.h:53
constexpr RawPointer release() noexcept
Definition SDL3pp_resource.h:56
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
Const reference wrapper for a given resource,.
Definition SDL3pp_resource.h:111
span-like for empty-derived structs
Definition SDL3pp_spanRef.h:24
constexpr T * data() const
Retrieves contained data.
Definition SDL3pp_spanRef.h:75
constexpr size_t size() const
Retrieves contained size.
Definition SDL3pp_spanRef.h:69
Helpers to use C++ strings parameters.
Definition SDL3pp_strings.h:43
Lock a portion of the texture for write-only pixel access.
Definition SDL3pp_render.h:3327
TextureRef resource() const
Get the reference to locked resource.
Definition SDL3pp_render.h:3425
~TextureLock()
Unlock a texture, uploading the changes to video memory, if needed.
Definition SDL3pp_render.h:3391
TextureLock & operator=(TextureLock &&other) noexcept
Assignment operator.
Definition SDL3pp_render.h:3396
TextureLock(const TextureLock &other)=delete
Copy constructor.
TextureLock(TextureLock &&other) noexcept
Move constructor.
Definition SDL3pp_render.h:3369
void release()
Releases the lock without unlocking.
Definition SDL3pp_render.h:3428
Lock a portion of the texture for write-only pixel access, and expose it as a SDL surface.
Definition SDL3pp_render.h:3454
~TextureSurfaceLock()
Unlock a texture, uploading the changes to video memory, if needed.
Definition SDL3pp_render.h:3520
TextureSurfaceLock(TextureSurfaceLock &&other) noexcept
Move constructor.
Definition SDL3pp_render.h:3497
TextureRef resource() const
Get the reference to locked resource.
Definition SDL3pp_render.h:3552
TextureSurfaceLock(const TextureSurfaceLock &other)=delete
Copy constructor.
TextureSurfaceLock & operator=(TextureSurfaceLock &&other) noexcept
Assignment operator.
Definition SDL3pp_render.h:3525
#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
ResourceRef< GPUDevice > GPUDeviceRef
Reference for GPUDevice.
Definition SDL3pp_gpu.h:386
ResourceRef< IOStream > IOStreamRef
Reference for IOStream.
Definition SDL3pp_iostream.h:34
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
ResourceRef< Palette > PaletteRef
Reference for Palette.
Definition SDL3pp_pixels.h:108
ResourceRef< Properties > PropertiesRef
Reference for Properties.
Definition SDL3pp_properties.h:54
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
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:6147
void reset()
Unlock a texture, uploading the changes to video memory, if needed.
Definition SDL3pp_render.h:5873
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:5577
constexpr TextureAddressMode TEXTURE_ADDRESS_AUTO
Wrapping is enabled if texture coordinates are outside [0, 1], this is the default.
Definition SDL3pp_render.h:154
void GetRenderScale(RendererRef renderer, float *scaleX, float *scaleY)
Get the drawing scale for the current target.
Definition SDL3pp_render.h:6548
void SetDrawColorFloat(const FColorRaw &c)
Set the color used for drawing operations (Rect, Line and Clear).
Definition SDL3pp_render.h:6631
constexpr int RENDERER_VSYNC_DISABLED
Constant for disabling renderer vsync.
Definition SDL3pp_render.h:7893
SDL_Vertex Vertex
Vertex structure.
Definition SDL3pp_render.h:114
void SetDrawColor(ColorRaw c)
Set the color used for drawing operations.
Definition SDL3pp_render.h:6604
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:7288
Texture GetTarget() const
Get the current render target.
Definition SDL3pp_render.h:5958
void Destroy()
Destroy the rendering context for a window and free all associated textures.
Definition SDL3pp_render.h:7724
const char * GetName() const
Get the name of a renderer.
Definition SDL3pp_render.h:4048
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:7026
void ResetRenderViewport(RendererRef renderer)
Reset the drawing area for rendering to the entire target.
Definition SDL3pp_render.h:6292
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:7507
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:8247
GPURenderState CreateGPURenderState(const GPURenderStateCreateInfo &createinfo)
Create custom GPU render state.
Definition SDL3pp_render.h:8208
void SetPalette(PaletteRef palette)
Set the palette used by a texture.
Definition SDL3pp_render.h:5045
Texture GetRenderTarget(RendererRef renderer)
Get the current render target.
Definition SDL3pp_render.h:5951
RendererRef CreateGPURenderer(GPUDeviceRef device, WindowRef window)
Create a 2D GPU rendering context.
Definition SDL3pp_render.h:3954
void FlushRenderer(RendererRef renderer)
Force the rendering context to flush any pending commands and state.
Definition SDL3pp_render.h:7756
Point GetCurrentOutputSize() const
Get the current output size in pixels of a rendering context.
Definition SDL3pp_render.h:4368
void SetColorModFloat(float r, float g, float b)
Set an additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5142
GPURenderState CreateGPURenderState(RendererRef renderer, const GPURenderStateCreateInfo &createinfo)
Create custom GPU render state.
Definition SDL3pp_render.h:8201
void SetDefaultTextureScaleMode(RendererRef renderer, ScaleMode scale_mode)
Set default scale mode for new textures for given renderer.
Definition SDL3pp_render.h:8041
void RenderPoint(const FPointRaw &p)
Draw a point on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:6908
void CreateWindowAndRenderer(StringParam title, const PointRaw &size, WindowFlags window_flags, Window *window, Renderer *renderer)
Create a window and default renderer.
Definition SDL3pp_render.h:3647
ScaleMode GetTextureScaleMode(TextureConstRef texture)
Get the scale mode used for texture scale operations.
Definition SDL3pp_render.h:5534
void * GetRenderMetalLayer(RendererRef renderer)
Get the CAMetalLayer associated with the given Metal renderer.
Definition SDL3pp_render.h:7779
void GetRenderOutputSize(RendererRef renderer, int *w, int *h)
Get the output size in pixels of a rendering context.
Definition SDL3pp_render.h:4271
BlendMode GetTextureBlendMode(TextureConstRef texture)
Get the blend mode used for texture copy operations.
Definition SDL3pp_render.h:5482
void SetRenderTextureAddressMode(RendererRef renderer, TextureAddressMode u_mode, TextureAddressMode v_mode)
Set the texture addressing mode used in Renderer.RenderGeometry().
Definition SDL3pp_render.h:7553
void CreateWindowAndRendererRaw(StringParam title, const PointRaw &size, WindowFlags window_flags, WindowRaw *window, RendererRaw *renderer)
Create a window and default renderer.
Definition SDL3pp_render.h:3620
void GetRenderTextureAddressMode(TextureAddressMode *u_mode, TextureAddressMode *v_mode)
Get the texture addressing mode used in Renderer.RenderGeometry().
Definition SDL3pp_render.h:7591
void RenderDebugText(RendererRef renderer, const FPointRaw &p, StringParam str)
Draw debug text to an Renderer.
Definition SDL3pp_render.h:7970
void SetBlendMode(BlendMode blendMode)
Set the blend mode for a texture, used by Renderer.RenderTexture().
Definition SDL3pp_render.h:5464
Palette GetPalette()
Get the palette used by a texture.
Definition SDL3pp_render.h:5068
Rect GetViewport() const
Get the drawing area for the current target.
Definition SDL3pp_render.h:6323
Point GetSize() const
Get the size of a texture.
Definition SDL3pp_render.h:4983
bool ViewportSet() const
Return whether an explicit rectangle was set as the viewport.
Definition SDL3pp_render.h:6353
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:7076
void SetDrawBlendMode(BlendMode blendMode)
Set the blend mode used for drawing operations (Fill and Line).
Definition SDL3pp_render.h:6836
Texture CreateTextureFromSurface(SurfaceRef surface)
Create a texture from an existing surface.
Definition SDL3pp_render.h:4459
FPoint GetSizeFloat() const
Get the size of a texture, as floating point values.
Definition SDL3pp_render.h:4993
ResourceConstRef< TextureRaw, TextureRawConst > TextureConstRef
Safely wrap Texture for non owning const parameters.
Definition SDL3pp_render.h:66
void SetDefaultTextureScaleMode(ScaleMode scale_mode)
Set default scale mode for new textures for given renderer.
Definition SDL3pp_render.h:8047
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:6657
void SetGPURenderState(RendererRef renderer, GPURenderStateRef state)
Set custom GPU render state.
Definition SDL3pp_render.h:8270
void SetGPURenderState(GPURenderStateRef state)
Set custom GPU render state.
Definition SDL3pp_render.h:8275
void RenderPoint(RendererRef renderer, const FPointRaw &p)
Draw a point on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:6903
void SetAlphaMod(Uint8 alpha)
Set an additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5235
constexpr TextureAddressMode TEXTURE_ADDRESS_WRAP
The texture is repeated (tiled).
Definition SDL3pp_render.h:159
void RenderRect(RendererRef renderer, OptionalRef< const FRectRaw > rect)
Draw a rectangle on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:7002
Palette GetTexturePalette(TextureRef texture)
Get the palette used by a texture.
Definition SDL3pp_render.h:5063
Texture CreateTextureWithProperties(RendererRef renderer, PropertiesRef props)
Create a texture for a rendering context with the specified properties.
Definition SDL3pp_render.h:4585
FPoint GetScale() const
Get the drawing scale for the current target.
Definition SDL3pp_render.h:6580
SDL_TextureAccess TextureAccess
The access pattern allowed for a texture.
Definition SDL3pp_render.h:121
PixelFormat GetFormat() const
Get the pixel format.
Definition SDL3pp_render.h:5014
void Destroy()
Destroy the specified texture.
Definition SDL3pp_render.h:7704
Rect GetRenderSafeArea(RendererRef renderer)
Get the safe area for rendering within the current viewport.
Definition SDL3pp_render.h:6376
bool IsClipEnabled() const
Get whether clipping is enabled on the given render target.
Definition SDL3pp_render.h:6492
constexpr int RENDERER_VSYNC_ADAPTIVE
Constant for enabling asaptive renderer vsync.
Definition SDL3pp_render.h:7896
ResourceRef< GPURenderState > GPURenderStateRef
Reference for GPURenderState.
Definition SDL3pp_render.h:81
int GetTextureWidth(TextureConstRef texture)
Get the width in pixels.
Definition SDL3pp_render.h:4999
FPoint RenderCoordinatesToWindow(const FPointRaw &coord) const
Get a point in window coordinates when given a point in render coordinates.
Definition SDL3pp_render.h:6194
PropertiesRef GetRendererProperties(RendererRef renderer)
Get the properties associated with a renderer.
Definition SDL3pp_render.h:4138
constexpr auto SOFTWARE_RENDERER
The name of the software renderer.
Definition SDL3pp_render.h:96
void SetRenderColorScale(RendererRef renderer, float scale)
Set the color scale used for render operations.
Definition SDL3pp_render.h:6781
void RenderTextureAffine(TextureRef texture, OptionalRef< const FRectRaw > srcrect, OptionalRef< const FPointRaw > origin, OptionalRef< const FPointRaw > right, OptionalRef< const FPointRaw > down)
Copy a portion of the source texture to the current rendering target, with affine transform,...
Definition SDL3pp_render.h:7205
void RenderPoints(SpanRef< const FPointRaw > points)
Draw multiple points on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:6932
void GetTextureColorMod(TextureConstRef texture, Uint8 *r, Uint8 *g, Uint8 *b)
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5164
void ResetTarget()
Set target texture back to window.
Definition SDL3pp_render.h:5934
void SetRenderVSync(RendererRef renderer, int vsync)
Toggle VSync of the given renderer.
Definition SDL3pp_render.h:7885
GPUDeviceRef GetGPURendererDevice(RendererRef renderer)
Return the GPU device used by a renderer.
Definition SDL3pp_render.h:3970
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:5820
void GetRenderLogicalPresentation(RendererRef renderer, int *w, int *h, RendererLogicalPresentation *mode)
Get device independent resolution and presentation mode for rendering.
Definition SDL3pp_render.h:6040
void SetTextureModFloat(TextureRef texture, FColor c)
Set an additional color and alpha values multiplied into render copy operations.
Definition SDL3pp_render.h:5381
int GetHeight() const
Get the height in pixels.
Definition SDL3pp_render.h:5006
FColor GetDrawColorFloat() const
Get the color used for drawing operations (Rect, Line and Clear).
Definition SDL3pp_render.h:6756
Uint8 GetAlphaMod() const
Get the additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5295
SDL_GPURenderState * GPURenderStateRaw
Alias to raw representation for GPURenderState.
Definition SDL3pp_render.h:74
constexpr TextureAddressMode TEXTURE_ADDRESS_INVALID
TEXTURE_ADDRESS_INVALID.
Definition SDL3pp_render.h:147
void SetModFloat(FColor c)
Set an additional color and alpha values multiplied into render copy operations.
Definition SDL3pp_render.h:5387
void DestroyRenderer(RendererRaw renderer)
Destroy the rendering context for a window and free all associated textures.
Definition SDL3pp_render.h:7719
void Destroy()
Destroy custom GPU render state.
Definition SDL3pp_render.h:8297
void SetColorScale(float scale)
Set the color scale used for render operations.
Definition SDL3pp_render.h:6786
int GetVSync() const
Get VSync of the given renderer.
Definition SDL3pp_render.h:7919
void GetTextureSize(TextureConstRef texture, float *w, float *h)
Get the size of a texture, as floating point values.
Definition SDL3pp_render.h:4967
void SetTarget(TextureRef texture)
Set a texture as the current rendering target.
Definition SDL3pp_render.h:5909
Texture CreateTexture(RendererRef renderer, PixelFormat format, TextureAccess access, const PointRaw &size)
Create a texture for a rendering context.
Definition SDL3pp_render.h:4395
Texture CreateTextureWithProperties(PropertiesRef props)
Create a texture for a rendering context with the specified properties.
Definition SDL3pp_render.h:4591
Surface RenderReadPixels(RendererRef renderer, OptionalRef< const RectRaw > rect={})
Read pixels from the current rendering target.
Definition SDL3pp_render.h:7624
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:5826
void SetTextureScaleMode(TextureRef texture, ScaleMode scaleMode)
Set the scale mode used for texture scale operations.
Definition SDL3pp_render.h:5511
bool RenderClipEnabled(RendererRef renderer)
Get whether clipping is enabled on the given render target.
Definition SDL3pp_render.h:6487
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:7309
Point GetOutputSize() const
Get the output size in pixels of a rendering context.
Definition SDL3pp_render.h:4307
void GetColorModFloat(float *r, float *g, float *b) const
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5202
void SetColorMod(Uint8 r, Uint8 g, Uint8 b)
Set an additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5103
void SetRenderDrawColorFloat(RendererRef renderer, const FColorRaw &c)
Set the color used for drawing operations (Rect, Line and Clear).
Definition SDL3pp_render.h:6626
void Update(OptionalRef< const RectRaw > rect, const void *pixels, int pitch)
Update the given texture rectangle with new pixel data.
Definition SDL3pp_render.h:5622
void RenderRect(OptionalRef< const FRectRaw > rect)
Draw a rectangle on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:7007
RendererRef GetRenderer() const
Get the renderer associated with a window.
Definition SDL3pp_render.h:4006
void Present()
Update the screen with any rendering performed since the previous call.
Definition SDL3pp_render.h:7685
void ResetViewport()
Reset the drawing area for rendering to the entire target.
Definition SDL3pp_render.h:6297
float GetRenderColorScale(RendererRef renderer)
Get the color scale used for render operations.
Definition SDL3pp_render.h:6804
BlendMode GetDrawBlendMode() const
Get the blend mode used for drawing operations.
Definition SDL3pp_render.h:6861
void RenderClear()
Clear the current rendering target with the drawing color.
Definition SDL3pp_render.h:6888
FRect GetRenderLogicalPresentationRect(RendererRef renderer)
Get the final presentation rectangle for rendering.
Definition SDL3pp_render.h:6113
FPoint GetTextureSizeFloat(TextureConstRef texture)
Get the size of a texture, as floating point values.
Definition SDL3pp_render.h:4986
RendererRef GetRendererFromTexture(TextureConstRef texture)
Get the renderer that created an Texture.
Definition SDL3pp_render.h:4943
void SetRenderDrawBlendMode(RendererRef renderer, BlendMode blendMode)
Set the blend mode used for drawing operations (Fill and Line).
Definition SDL3pp_render.h:6831
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:7146
void SetMod(Color c)
Set an additional color and alpha values multiplied into render copy operations.
Definition SDL3pp_render.h:5356
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:7238
void RenderLine(const FPointRaw &p1, const FPointRaw &p2)
Draw a line on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:6958
Color GetMod() const
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5414
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:189
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:6718
constexpr auto GPU_RENDERER
The name of the GPU renderer.
Definition SDL3pp_render.h:105
void ResetRenderClipRect(RendererRef renderer)
Reset the clip rectangle for rendering to the entire render target.
Definition SDL3pp_render.h:6433
PropertiesRef GetProperties() const
Get the properties associated with a texture.
Definition SDL3pp_render.h:4814
void RenderDebugText(const FPointRaw &p, StringParam str)
Draw debug text to an Renderer.
Definition SDL3pp_render.h:7977
void SetAlphaModFloat(float alpha)
Set an additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5268
void * GetRenderMetalCommandEncoder(RendererRef renderer)
Get the Metal command encoder for the current frame.
Definition SDL3pp_render.h:7810
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_DISABLED
There is no logical size in effect.
Definition SDL3pp_render.h:171
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:7446
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:5709
Rect GetClipRect() const
Get the clip rectangle for the current target.
Definition SDL3pp_render.h:6465
void * GetRenderMetalLayer()
Get the CAMetalLayer associated with the given Metal renderer.
Definition SDL3pp_render.h:7784
void RenderDebugTextFormat(RendererRef renderer, const FPointRaw &p, std::string_view fmt, ARGS... args)
Draw debug text to an Renderer.
Definition SDL3pp_render.h:8007
constexpr TextureAccess TEXTUREACCESS_TARGET
Texture can be used as a render target.
Definition SDL3pp_render.h:129
void RenderPoints(RendererRef renderer, SpanRef< const FPointRaw > points)
Draw multiple points on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:6926
FPoint RenderCoordinatesFromWindow(const FPointRaw &window_coord) const
Get a point in render coordinates when given a point in window coordinates.
Definition SDL3pp_render.h:6156
void DestroyTexture(TextureRaw texture)
Destroy the specified texture.
Definition SDL3pp_render.h:7702
FColor GetTextureModFloat(TextureConstRef texture)
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5430
Rect GetSafeArea() const
Get the safe area for rendering within the current viewport.
Definition SDL3pp_render.h:6383
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:7051
void RenderClear(RendererRef renderer)
Clear the current rendering target with the drawing color.
Definition SDL3pp_render.h:6883
Renderer CreateRenderer(WindowRef window, StringParam name=nullptr)
Create a 2D rendering context for a window.
Definition SDL3pp_render.h:3759
void DestroyGPURenderState(GPURenderStateRaw state)
Destroy custom GPU render state.
Definition SDL3pp_render.h:8292
PixelFormat GetTextureFormat(TextureConstRef texture)
Get the pixel format.
Definition SDL3pp_render.h:5009
int GetWidth() const
Get the width in pixels.
Definition SDL3pp_render.h:5001
FColor GetModFloat() const
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5438
ResourceRef< Texture > TextureRef
Reference for Texture.
Definition SDL3pp_render.h:63
Renderer CreateRendererWithProperties(PropertiesRef props)
Create a 2D rendering context for a window, with the specified properties.
Definition SDL3pp_render.h:3841
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:5660
constexpr TextureAccess TEXTUREACCESS_STATIC
Changes rarely, not lockable.
Definition SDL3pp_render.h:123
void * GetRenderMetalCommandEncoder()
Get the Metal command encoder for the current frame.
Definition SDL3pp_render.h:7815
Rect GetRenderViewport(RendererRef renderer)
Get the drawing area for the current target.
Definition SDL3pp_render.h:6316
void SetViewport(OptionalRef< const RectRaw > rect)
Set the drawing area for rendering on the current target.
Definition SDL3pp_render.h:6271
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_INTEGER_SCALE
The rendered content is scaled up by integer multiples to fit the output resolution.
Definition SDL3pp_render.h:196
WindowRef GetWindow()
Get the window associated with a renderer.
Definition SDL3pp_render.h:4027
SDL_GPURenderStateCreateInfo GPURenderStateCreateInfo
A structure specifying the parameters of a GPU render state.
Definition SDL3pp_render.h:208
constexpr TextureAccess TEXTUREACCESS_STREAMING
Changes frequently, lockable.
Definition SDL3pp_render.h:126
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:7114
BlendMode GetBlendMode() const
Get the blend mode used for texture copy operations.
Definition SDL3pp_render.h:5489
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:5673
PropertiesRef GetProperties() const
Get the properties associated with a renderer.
Definition SDL3pp_render.h:4143
Rect GetRenderClipRect(RendererRef renderer)
Get the clip rectangle for the current target.
Definition SDL3pp_render.h:6458
void Flush()
Force the rendering context to flush any pending commands and state.
Definition SDL3pp_render.h:7761
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:6951
void SetRenderLogicalPresentation(RendererRef renderer, const PointRaw &size, RendererLogicalPresentation mode)
Set a device-independent resolution and presentation mode for rendering.
Definition SDL3pp_render.h:6006
GPUDeviceRef GetGPUDevice()
Return the GPU device used by a renderer.
Definition SDL3pp_render.h:3975
void reset()
Unlock a texture, uploading the changes to video memory, if needed.
Definition SDL3pp_render.h:5866
void SetTextureColorMod(TextureRef texture, Uint8 r, Uint8 g, Uint8 b)
Set an additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5098
void GetDefaultTextureScaleMode(RendererRef renderer, ScaleMode *scale_mode)
Get default texture scale mode of the given renderer.
Definition SDL3pp_render.h:8067
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:7158
SDL_RendererLogicalPresentation RendererLogicalPresentation
How the logical size is mapped to the output.
Definition SDL3pp_render.h:169
SDL_TextureAddressMode TextureAddressMode
The addressing mode for a texture when used in Renderer.RenderGeometry().
Definition SDL3pp_render.h:145
FRect GetLogicalPresentationRect() const
Get the final presentation rectangle for rendering.
Definition SDL3pp_render.h:6120
void SetRenderTarget(RendererRef renderer, TextureRef texture)
Set a texture as the current rendering target.
Definition SDL3pp_render.h:5904
int GetRenderVSync(RendererRef renderer)
Get VSync of the given renderer.
Definition SDL3pp_render.h:7912
void SetClipRect(OptionalRef< const RectRaw > rect)
Set the clip rectangle for rendering on the specified target.
Definition SDL3pp_render.h:6412
constexpr int DEBUG_TEXT_FONT_CHARACTER_SIZE
The size, in pixels, of a single Renderer.RenderDebugText() character.
Definition SDL3pp_render.h:7930
BlendMode GetRenderDrawBlendMode(RendererRef renderer)
Get the blend mode used for drawing operations.
Definition SDL3pp_render.h:6854
constexpr TextureAddressMode TEXTURE_ADDRESS_CLAMP
Texture coordinates are clamped to the [0, 1] range.
Definition SDL3pp_render.h:157
PropertiesRef GetTextureProperties(TextureConstRef texture)
Get the properties associated with a texture.
Definition SDL3pp_render.h:4809
void SetRenderDrawColor(RendererRef renderer, ColorRaw c)
Set the color used for drawing operations.
Definition SDL3pp_render.h:6599
void ConvertEventToRenderCoordinates(Event *event) const
Convert the coordinates in an event to render coordinates.
Definition SDL3pp_render.h:6236
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:5771
Surface ReadPixels(OptionalRef< const RectRaw > rect={}) const
Read pixels from the current rendering target.
Definition SDL3pp_render.h:7630
void SetScale(const FPointRaw &scale)
Set the drawing scale for rendering on the current target.
Definition SDL3pp_render.h:6526
FPoint RenderCoordinatesToWindow(RendererRef renderer, const FPointRaw &coord)
Get a point in window coordinates when given a point in render coordinates.
Definition SDL3pp_render.h:6185
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:7433
float GetColorScale() const
Get the color scale used for render operations.
Definition SDL3pp_render.h:6811
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:7389
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:5720
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:7082
SDL_Renderer * RendererRaw
Alias to raw representation for Renderer.
Definition SDL3pp_render.h:47
void SetTextureColorModFloat(TextureRef texture, float r, float g, float b)
Set an additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5134
Texture CreateTextureFromSurface(RendererRef renderer, SurfaceRef surface)
Create a texture from an existing surface.
Definition SDL3pp_render.h:4453
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:182
void RenderLines(SpanRef< const FPointRaw > points)
Draw a series of connected lines on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:6983
void SetLogicalPresentation(const PointRaw &size, RendererLogicalPresentation mode)
Set a device-independent resolution and presentation mode for rendering.
Definition SDL3pp_render.h:6013
void SetTextureAlphaModFloat(TextureRef texture, float alpha)
Set an additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5263
void GetLogicalPresentation(int *w, int *h, RendererLogicalPresentation *mode) const
Get device independent resolution and presentation mode for rendering.
Definition SDL3pp_render.h:6079
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:7106
void GetRenderTextureAddressMode(RendererRef renderer, TextureAddressMode *u_mode, TextureAddressMode *v_mode)
Get the texture addressing mode used in Renderer.RenderGeometry().
Definition SDL3pp_render.h:7584
Renderer CreateSoftwareRenderer(SurfaceRef surface)
Create a 2D software rendering context for a surface.
Definition SDL3pp_render.h:4001
void ConvertEventToRenderCoordinates(RendererRef renderer, Event *event)
Convert the coordinates in an event to render coordinates.
Definition SDL3pp_render.h:6231
Color GetTextureMod(TextureConstRef texture)
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5406
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:7480
ScaleMode GetScaleMode() const
Get the scale mode used for texture scale operations.
Definition SDL3pp_render.h:5541
void RenderRects(SpanRef< const FRectRaw > rects)
Draw some number of rectangles on the current rendering target at subpixel precision.
Definition SDL3pp_render.h:7031
void RenderDebugTextFormat(const FPointRaw &p, std::string_view fmt, ARGS... args)
Draw debug text to an Renderer.
Definition SDL3pp_render.h:8017
void SetRenderScale(RendererRef renderer, const FPointRaw &scale)
Set the drawing scale for rendering on the current target.
Definition SDL3pp_render.h:6521
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:5764
void SetRenderViewport(RendererRef renderer, OptionalRef< const RectRaw > rect)
Set the drawing area for rendering on the current target.
Definition SDL3pp_render.h:6265
void RenderPresent(RendererRef renderer)
Update the screen with any rendering performed since the previous call.
Definition SDL3pp_render.h:7680
void RenderTextureAffine(RendererRef renderer, TextureRef texture, OptionalRef< const FRectRaw > srcrect, OptionalRef< const FPointRaw > origin, OptionalRef< const FPointRaw > right, OptionalRef< const FPointRaw > down)
Copy a portion of the source texture to the current rendering target, with affine transform,...
Definition SDL3pp_render.h:7194
void UnlockTexture(TextureRef texture)
Unlock a texture, uploading the changes to video memory, if needed.
Definition SDL3pp_render.h:5852
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:7846
void SetRenderTextureAddressMode(TextureAddressMode u_mode, TextureAddressMode v_mode)
Set the texture addressing mode used in Renderer.RenderGeometry().
Definition SDL3pp_render.h:7560
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:7248
constexpr RendererLogicalPresentation LOGICAL_PRESENTATION_STRETCH
The rendered content is stretched to the output resolution.
Definition SDL3pp_render.h:175
const char * GetRendererName(RendererRef renderer)
Get the name of a renderer.
Definition SDL3pp_render.h:4043
void GetDefaultTextureScaleMode(ScaleMode *scale_mode)
Get default texture scale mode of the given renderer.
Definition SDL3pp_render.h:8073
void GetCurrentRenderOutputSize(RendererRef renderer, int *w, int *h)
Get the current output size in pixels of a rendering context.
Definition SDL3pp_render.h:4332
float GetTextureAlphaModFloat(TextureConstRef texture)
Get the additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5315
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:7057
int GetNumRenderDrivers()
Get the number of 2D rendering drivers available for the current display.
Definition SDL3pp_render.h:3573
const char * GetRenderDriver(int index)
Use this function to get the name of a built in 2D rendering driver.
Definition SDL3pp_render.h:3597
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:6977
WindowRef GetRenderWindow(RendererRef renderer)
Get the window associated with a renderer.
Definition SDL3pp_render.h:4022
void Unlock(TextureLock &&lock)
Unlock a texture, uploading the changes to video memory, if needed.
Definition SDL3pp_render.h:5854
RendererRef GetRenderer() const
Get the renderer that created an Texture.
Definition SDL3pp_render.h:4948
void SetVSync(int vsync)
Toggle VSync of the given renderer.
Definition SDL3pp_render.h:7890
bool RenderViewportSet(RendererRef renderer)
Return whether an explicit rectangle was set as the viewport.
Definition SDL3pp_render.h:6348
void GetTextureColorModFloat(TextureConstRef texture, float *r, float *g, float *b)
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5194
void ResetClipRect()
Reset the clip rectangle for rendering to the entire render target.
Definition SDL3pp_render.h:6438
float GetAlphaModFloat() const
Get the additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5322
void SetTextureBlendMode(TextureRef texture, BlendMode blendMode)
Set the blend mode for a texture, used by Renderer.RenderTexture().
Definition SDL3pp_render.h:5459
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:7855
Uint8 GetTextureAlphaMod(TextureConstRef texture)
Get the additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5288
void GetColorMod(Uint8 *r, Uint8 *g, Uint8 *b) const
Get the additional color value multiplied into render copy operations.
Definition SDL3pp_render.h:5172
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:5756
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:7366
Texture CreateTexture(PixelFormat format, TextureAccess access, const PointRaw &size)
Create a texture for a rendering context.
Definition SDL3pp_render.h:4403
void SetTextureAlphaMod(TextureRef texture, Uint8 alpha)
Set an additional alpha value multiplied into render copy operations.
Definition SDL3pp_render.h:5230
void SetTexturePalette(TextureRef texture, PaletteRef palette)
Set the palette used by a texture.
Definition SDL3pp_render.h:5040
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:5811
void ResetRenderTarget(RendererRef renderer)
Set target texture back to window.
Definition SDL3pp_render.h:5929
void SetTextureMod(TextureRef texture, Color c)
Set an additional color and alpha values multiplied into render copy operations.
Definition SDL3pp_render.h:5350
void SetRenderClipRect(RendererRef renderer, OptionalRef< const RectRaw > rect)
Set the clip rectangle for rendering on the specified target.
Definition SDL3pp_render.h:6406
Color GetDrawColor() const
Get the color used for drawing operations (Rect, Line and Clear).
Definition SDL3pp_render.h:6692
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:8238
int GetTextureHeight(TextureConstRef texture)
Get the height in pixels.
Definition SDL3pp_render.h:5004
void SetScaleMode(ScaleMode scaleMode)
Set the scale mode used for texture scale operations.
Definition SDL3pp_render.h:5516
::Sint64 Sint64
A signed 64-bit integer type.
Definition SDL3pp_stdinc.h:305
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition SDL3pp_stdinc.h:290
::Uint8 Uint8
An unsigned 8-bit integer type.
Definition SDL3pp_stdinc.h:238
SDL_FlipMode FlipMode
The flip mode.
Definition SDL3pp_surface.h:127
SDL_ScaleMode ScaleMode
The scaling mode.
Definition SDL3pp_surface.h:98
SDL_Surface * SurfaceRaw
Alias to raw representation for Surface.
Definition SDL3pp_surface.h:44
ResourceConstRef< SurfaceRaw, SurfaceRawConst > SurfaceConstRef
Safely wrap Surface for non owning const parameters.
Definition SDL3pp_surface.h:57
ResourceRef< Surface > SurfaceRef
Reference for Surface.
Definition SDL3pp_surface.h:54
ResourceRef< Window > WindowRef
Reference for Window.
Definition SDL3pp_video.h:54
Uint64 WindowFlags
The flags on a window.
Definition SDL3pp_video.h:515
SDL_Window * WindowRaw
Alias to raw representation for Window.
Definition SDL3pp_video.h:47
ResourceRef< Renderer > RendererRef
Reference for Renderer.
Definition SDL3pp_video.h:75
Properties for Renderer creation.
Definition SDL3pp_render.h:3851
constexpr auto SURFACE_POINTER
Pointer to surface.
Definition SDL3pp_render.h:3859
constexpr auto PRESENT_VSYNC_NUMBER
Number for present vsync.
Definition SDL3pp_render.h:3866
constexpr auto VULKAN_PHYSICAL_DEVICE_POINTER
Pointer to vulkan physical device.
Definition SDL3pp_render.h:3894
constexpr auto VULKAN_INSTANCE_POINTER
Pointer to vulkan instance.
Definition SDL3pp_render.h:3887
constexpr auto VULKAN_SURFACE_NUMBER
Vulkan surface number.
Definition SDL3pp_render.h:3891
constexpr auto GPU_SHADERS_SPIRV_BOOLEAN
Enable gpu shaders spirv.
Definition SDL3pp_render.h:3874
constexpr auto GPU_SHADERS_DXIL_BOOLEAN
Enable gpu shaders dxil.
Definition SDL3pp_render.h:3878
constexpr auto OUTPUT_COLORSPACE_NUMBER
Number for output colorspace.
Definition SDL3pp_render.h:3862
constexpr auto VULKAN_DEVICE_POINTER
Pointer to vulkan device.
Definition SDL3pp_render.h:3899
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_render.h:3853
constexpr auto VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER
Vulkan graphics queue family index number.
Definition SDL3pp_render.h:3902
constexpr auto VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER
Vulkan present queue family index number.
Definition SDL3pp_render.h:3910
constexpr auto GPU_DEVICE_POINTER
Pointer to gpu device.
Definition SDL3pp_render.h:3871
constexpr auto GPU_SHADERS_MSL_BOOLEAN
Enable gpu shaders msl.
Definition SDL3pp_render.h:3882
constexpr auto WINDOW_POINTER
Pointer to window.
Definition SDL3pp_render.h:3856
Properties for Renderer.
Definition SDL3pp_render.h:3851
constexpr auto WINDOW_POINTER
Pointer to window.
Definition SDL3pp_render.h:4163
constexpr auto VULKAN_PHYSICAL_DEVICE_POINTER
Pointer to vulkan physical device.
Definition SDL3pp_render.h:4222
constexpr auto TEXTURE_FORMATS_POINTER
Pointer to texture formats.
Definition SDL3pp_render.h:4175
constexpr auto MAX_TEXTURE_SIZE_NUMBER
Number for max texture size.
Definition SDL3pp_render.h:4172
constexpr auto D3D12_DEVICE_POINTER
Pointer to d3d12 device.
Definition SDL3pp_render.h:4206
constexpr auto VULKAN_SURFACE_NUMBER
Vulkan surface number.
Definition SDL3pp_render.h:4219
constexpr auto D3D11_DEVICE_POINTER
Pointer to d3d11 device.
Definition SDL3pp_render.h:4200
constexpr auto VULKAN_DEVICE_POINTER
Pointer to vulkan device.
Definition SDL3pp_render.h:4226
constexpr auto GPU_DEVICE_POINTER
Pointer to gpu device.
Definition SDL3pp_render.h:4246
constexpr auto SURFACE_POINTER
Pointer to surface.
Definition SDL3pp_render.h:4166
constexpr auto D3D12_SWAPCHAIN_POINTER
Pointer to d3d12 swapchain.
Definition SDL3pp_render.h:4209
constexpr auto D3D12_COMMAND_QUEUE_POINTER
Pointer to d3d12 command queue.
Definition SDL3pp_render.h:4212
constexpr auto SDR_WHITE_POINT_FLOAT
Float for sdr white point.
Definition SDL3pp_render.h:4191
constexpr auto VULKAN_INSTANCE_POINTER
Pointer to vulkan instance.
Definition SDL3pp_render.h:4216
constexpr auto HDR_ENABLED_BOOLEAN
Hdr enabled enabled.
Definition SDL3pp_render.h:4188
constexpr auto TEXTURE_WRAPPING_BOOLEAN
Texture wrapping enabled.
Definition SDL3pp_render.h:4180
constexpr auto VSYNC_NUMBER
Number for vsync.
Definition SDL3pp_render.h:4169
constexpr auto VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER
Number for vulkan graphics queue family index.
Definition SDL3pp_render.h:4229
constexpr auto D3D11_SWAPCHAIN_POINTER
Pointer to d3d11 swapchain.
Definition SDL3pp_render.h:4203
constexpr auto VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER
Number for vulkan present queue family index.
Definition SDL3pp_render.h:4236
constexpr auto VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER
Vulkan swapchain image count.
Definition SDL3pp_render.h:4242
constexpr auto HDR_HEADROOM_FLOAT
Float for hdr headroom.
Definition SDL3pp_render.h:4194
constexpr auto NAME_STRING
String for name.
Definition SDL3pp_render.h:4160
constexpr auto D3D9_DEVICE_POINTER
Pointer to d3d9 device.
Definition SDL3pp_render.h:4197
constexpr auto OUTPUT_COLORSPACE_NUMBER
Number for output colorspace.
Definition SDL3pp_render.h:4185
Properties for Texture creation.
Definition SDL3pp_render.h:4601
constexpr auto PALETTE_POINTER
Pointer to palette.
Definition SDL3pp_render.h:4620
constexpr auto METAL_PIXELBUFFER_POINTER
Pointer to metal pixelbuffer.
Definition SDL3pp_render.h:4653
constexpr auto FORMAT_NUMBER
Number for format.
Definition SDL3pp_render.h:4606
constexpr auto WIDTH_NUMBER
Number for width.
Definition SDL3pp_render.h:4612
constexpr auto HEIGHT_NUMBER
Number for height.
Definition SDL3pp_render.h:4615
constexpr auto D3D12_TEXTURE_U_POINTER
Pointer to d3d12 texture u.
Definition SDL3pp_render.h:4645
constexpr auto OPENGLES2_TEXTURE_V_NUMBER
Opengles2 texture v number.
Definition SDL3pp_render.h:4684
constexpr auto SDR_WHITE_POINT_FLOAT
Float for sdr white point.
Definition SDL3pp_render.h:4625
constexpr auto D3D11_TEXTURE_POINTER
Pointer to d3d11 texture.
Definition SDL3pp_render.h:4631
constexpr auto OPENGL_TEXTURE_V_NUMBER
Opengl texture v number.
Definition SDL3pp_render.h:4668
constexpr auto COLORSPACE_NUMBER
Number for colorspace.
Definition SDL3pp_render.h:4603
constexpr auto GPU_TEXTURE_V_POINTER
Pointer to gpu texture v.
Definition SDL3pp_render.h:4707
constexpr auto D3D12_TEXTURE_POINTER
Pointer to d3d12 texture.
Definition SDL3pp_render.h:4642
constexpr auto OPENGL_TEXTURE_NUMBER
Opengl texture number.
Definition SDL3pp_render.h:4657
constexpr auto GPU_TEXTURE_POINTER
Pointer to gpu texture.
Definition SDL3pp_render.h:4697
constexpr auto GPU_TEXTURE_U_POINTER
Pointer to gpu texture u.
Definition SDL3pp_render.h:4704
constexpr auto OPENGLES2_TEXTURE_UV_NUMBER
Opengles2 texture uv number.
Definition SDL3pp_render.h:4676
constexpr auto D3D11_TEXTURE_U_POINTER
Pointer to d3d11 texture u.
Definition SDL3pp_render.h:4634
constexpr auto OPENGL_TEXTURE_U_NUMBER
Opengl texture u number.
Definition SDL3pp_render.h:4664
constexpr auto GPU_TEXTURE_UV_POINTER
Pointer to gpu texture uv.
Definition SDL3pp_render.h:4700
constexpr auto OPENGLES2_TEXTURE_NUMBER
Opengles2 texture number.
Definition SDL3pp_render.h:4672
constexpr auto HDR_HEADROOM_FLOAT
Float for hdr headroom.
Definition SDL3pp_render.h:4628
constexpr auto D3D11_TEXTURE_V_POINTER
Pointer to d3d11 texture v.
Definition SDL3pp_render.h:4638
constexpr auto OPENGLES2_TEXTURE_U_NUMBER
Opengles2 texture u number.
Definition SDL3pp_render.h:4680
constexpr auto D3D12_TEXTURE_V_POINTER
Pointer to d3d12 texture v.
Definition SDL3pp_render.h:4649
constexpr auto ACCESS_NUMBER
Number for access.
Definition SDL3pp_render.h:4609
constexpr auto OPENGL_TEXTURE_UV_NUMBER
Opengl texture uv number.
Definition SDL3pp_render.h:4660
constexpr auto VULKAN_TEXTURE_NUMBER
Vulkans texture number.
Definition SDL3pp_render.h:4688
constexpr auto VULKAN_LAYOUT_NUMBER
Number for vulkan layout.
Definition SDL3pp_render.h:4694
Properties for Texture.
Definition SDL3pp_render.h:4601
constexpr auto OPENGL_TEX_W_FLOAT
Float for opengl tex w.
Definition SDL3pp_render.h:4886
constexpr auto D3D11_TEXTURE_U_POINTER
Pointer to d3d11 texture u.
Definition SDL3pp_render.h:4855
constexpr auto SDR_WHITE_POINT_FLOAT
Float for sdr white point.
Definition SDL3pp_render.h:4846
constexpr auto WIDTH_NUMBER
Number for width.
Definition SDL3pp_render.h:4840
constexpr auto VULKAN_TEXTURE_NUMBER
Vulkan texture number.
Definition SDL3pp_render.h:4911
constexpr auto D3D11_TEXTURE_V_POINTER
Pointer to d3d11 texture v.
Definition SDL3pp_render.h:4858
constexpr auto OPENGLES2_TEXTURE_NUMBER
Opengles2 texture number.
Definition SDL3pp_render.h:4892
constexpr auto D3D12_TEXTURE_U_POINTER
Pointer to d3d12 texture u.
Definition SDL3pp_render.h:4864
constexpr auto D3D12_TEXTURE_POINTER
Pointer to d3d12 texture.
Definition SDL3pp_render.h:4861
constexpr auto OPENGL_TEXTURE_TARGET_NUMBER
Opengl texture target number.
Definition SDL3pp_render.h:4882
constexpr auto OPENGLES2_TEXTURE_TARGET_NUMBER
Opengles2 texture target number.
Definition SDL3pp_render.h:4907
constexpr auto OPENGLES2_TEXTURE_V_NUMBER
Opengles2 texture v number.
Definition SDL3pp_render.h:4903
constexpr auto COLORSPACE_NUMBER
Number for colorspace.
Definition SDL3pp_render.h:4831
constexpr auto OPENGL_TEXTURE_NUMBER
Opengl texture number.
Definition SDL3pp_render.h:4870
constexpr auto OPENGL_TEXTURE_V_NUMBER
Opengl texture v number.
Definition SDL3pp_render.h:4879
constexpr auto GPU_TEXTURE_V_POINTER
Pointer to gpu texture v.
Definition SDL3pp_render.h:4925
constexpr auto OPENGL_TEXTURE_UV_NUMBER
Opengl texture uv number.
Definition SDL3pp_render.h:4873
constexpr auto FORMAT_NUMBER
Number for format.
Definition SDL3pp_render.h:4834
constexpr auto OPENGL_TEX_H_FLOAT
Float for opengl tex h.
Definition SDL3pp_render.h:4889
constexpr auto OPENGLES2_TEXTURE_UV_NUMBER
Opengles2 texture uv number.
Definition SDL3pp_render.h:4895
constexpr auto OPENGL_TEXTURE_U_NUMBER
Opengl texture u number.
Definition SDL3pp_render.h:4876
constexpr auto GPU_TEXTURE_U_POINTER
Pointer to gpu texture u.
Definition SDL3pp_render.h:4922
constexpr auto HDR_HEADROOM_FLOAT
Float for hdr headroom.
Definition SDL3pp_render.h:4849
constexpr auto ACCESS_NUMBER
Number for access.
Definition SDL3pp_render.h:4837
constexpr auto GPU_TEXTURE_UV_POINTER
Pointer to gpu texture uv.
Definition SDL3pp_render.h:4919
constexpr auto OPENGLES2_TEXTURE_U_NUMBER
Opengles2 texture u number.
Definition SDL3pp_render.h:4899
constexpr auto D3D12_TEXTURE_V_POINTER
Pointer to d3d12 texture v.
Definition SDL3pp_render.h:4867
constexpr auto HEIGHT_NUMBER
Number for height.
Definition SDL3pp_render.h:4843
constexpr auto GPU_TEXTURE_POINTER
Pointer to gpu texture.
Definition SDL3pp_render.h:4916
constexpr auto D3D11_TEXTURE_POINTER
Pointer to d3d11 texture.
Definition SDL3pp_render.h:4852
Main include header for the SDL3pp library.
Sint32 narrowS32(T value)
Narrows to Sint32.
Definition SDL3pp_stdinc.h:6257
A structure that represents a color as RGBA components.
Definition SDL3pp_pixels.h:2145
The bits of this structure can be directly reinterpreted as a float-packed color which uses the PIXEL...
Definition SDL3pp_pixels.h:2318
The structure that defines a point (using floating point values).
Definition SDL3pp_rect.h:526
A rectangle stored using floating point values.
Definition SDL3pp_rect.h:1457
A custom GPU render state.
Definition SDL3pp_render.h:8091
constexpr GPURenderState & operator=(GPURenderState &&other) noexcept
Assignment operator.
Definition SDL3pp_render.h:8143
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
~GPURenderState()
Destructor.
Definition SDL3pp_render.h:8140
constexpr GPURenderState(const GPURenderState &other)=delete
Copy constructor.
constexpr GPURenderState(GPURenderState &&other) noexcept
Move constructor.
Definition SDL3pp_render.h:8110
constexpr GPURenderState(GPURenderStateRaw resource) noexcept
Constructs from raw GPURenderState.
Definition SDL3pp_render.h:8101
GPURenderState & operator=(const GPURenderState &other)=delete
Assignment operator.
A set of indexed colors representing a palette.
Definition SDL3pp_pixels.h:2463
static Palette Borrow(PaletteRaw resource)
Safely borrows the from PaletteRaw.
Definition SDL3pp_pixels.h:2517
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:859
A structure representing rendering state.
Definition SDL3pp_render.h:220
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
constexpr Renderer(Renderer &&other) noexcept
Move constructor.
Definition SDL3pp_render.h:239
constexpr Renderer(RendererRaw resource) noexcept
Constructs from raw Renderer.
Definition SDL3pp_render.h:230
Renderer & operator=(const Renderer &other)=delete
Assignment operator.
constexpr Renderer & operator=(Renderer &&other) noexcept
Assignment operator.
Definition SDL3pp_render.h:369
~Renderer()
Destructor.
Definition SDL3pp_render.h:366
constexpr Renderer(const Renderer &other)=delete
Copy constructor.
A non-owning reference wrapper for a given resource.
Definition SDL3pp_resource.h:156
A collection of pixels used in software blitting.
Definition SDL3pp_surface.h:172
constexpr Surface & operator=(Surface &&other) noexcept
Assignment operator.
Definition SDL3pp_surface.h:356
constexpr Surface(SurfaceRaw resource) noexcept
Constructs from raw Surface.
Definition SDL3pp_surface.h:182
static Surface Borrow(SurfaceRaw resource)
Safely borrows the from SurfaceRaw.
Definition SDL3pp_surface.h:340
An efficient driver-specific representation of pixel data.
Definition SDL3pp_render.h:2249
constexpr Texture & operator=(Texture &&other) noexcept
Assignment operator.
Definition SDL3pp_render.h:2549
static Texture Borrow(TextureRaw resource)
Safely borrows the from TextureRaw.
Definition SDL3pp_render.h:2533
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
constexpr Texture(const Texture &other)
Copy constructor.
Definition SDL3pp_render.h:2265
Texture & operator=(const Texture &other)
Assignment operator.
Definition SDL3pp_render.h:2556
~Texture()
Destructor.
Definition SDL3pp_render.h:2546
constexpr Texture(TextureRaw resource) noexcept
Constructs from raw Texture.
Definition SDL3pp_render.h:2259
constexpr Texture(Texture &&other) noexcept
Move constructor.
Definition SDL3pp_render.h:2272
The struct used as an opaque handle to a window.
Definition SDL3pp_video.h:748
constexpr Window(WindowRaw resource) noexcept
Constructs from raw Window.
Definition SDL3pp_video.h:758