SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL3pp_video.h
1#ifndef SDL3PP_VIDEO_H_
2#define SDL3PP_VIDEO_H_
3
4#include <SDL3/SDL_video.h>
5#include "SDL3pp_properties.h"
6#include "SDL3pp_rect.h"
7#include "SDL3pp_surface.h"
8
9namespace SDL {
10
38using DisplayID = SDL_DisplayID;
39
40// Forward decl
41struct Display;
42
43// Forward decl
44struct Window;
45
47using WindowRaw = SDL_Window*;
48
49// Forward decl
50struct WindowRef;
51
54{
56
59 : value(value)
60 {
61 }
62
64 constexpr WindowParam(std::nullptr_t = nullptr)
65 : value(nullptr)
66 {
67 }
68
70 constexpr explicit operator bool() const { return !!value; }
71
73 constexpr auto operator<=>(const WindowParam& other) const = default;
74
76 constexpr operator WindowRaw() const { return value; }
77};
78
79// Forward decl
80struct GLContext;
81
83using GLContextRaw = SDL_GLContext;
84
85// Forward decl
86struct GLContextScoped;
87
90{
92
95 : value(value)
96 {
97 }
98
100 constexpr GLContextParam(std::nullptr_t = nullptr)
101 : value(nullptr)
102 {
103 }
104
106 constexpr explicit operator bool() const { return !!value; }
107
109 constexpr auto operator<=>(const GLContextParam& other) const = default;
110
112 constexpr operator GLContextRaw() const { return value; }
113};
114
115// Forward decl
116struct RendererRef;
117
123using DisplayOrientation = SDL_DisplayOrientation;
124
126 SDL_ORIENTATION_UNKNOWN;
127
132constexpr DisplayOrientation ORIENTATION_LANDSCAPE = SDL_ORIENTATION_LANDSCAPE;
133
139 SDL_ORIENTATION_LANDSCAPE_FLIPPED;
140
142 SDL_ORIENTATION_PORTRAIT;
143
145 SDL_ORIENTATION_PORTRAIT_FLIPPED;
147
159using DisplayMode = SDL_DisplayMode;
160
172{
173 DisplayID m_displayID;
174
175public:
181 constexpr Display(DisplayID displayID = {}) noexcept
182 : m_displayID(displayID)
183 {
184 }
185
191 constexpr operator DisplayID() const noexcept { return m_displayID; }
192
206 static Display GetPrimary();
207
222 static Display GetForPoint(const PointRaw& point);
223
239 static Display GetForRect(const RectRaw& rect);
240
277
290 const char* GetName() const;
291
308 Rect GetBounds() const;
309
332 Rect GetUsableBounds() const;
333
347
361
386 float GetContentScale() const;
387
410
437 float refresh_rate,
438 bool include_high_density_modes) const;
439
458 const DisplayMode& GetDesktopMode() const;
459
478 const DisplayMode& GetCurrentMode() const;
479};
480
488using WindowID = SDL_WindowID;
489
490namespace prop::Global {
491
506constexpr auto VIDEO_WAYLAND_WL_DISPLAY_POINTER =
507 SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER;
508
509} // namespace prop::Global
510
516using SystemTheme = SDL_SystemTheme;
517
519 SDL_SYSTEM_THEME_UNKNOWN;
520
522 SDL_SYSTEM_THEME_LIGHT;
523
525 SDL_SYSTEM_THEME_DARK;
526
536using DisplayModeData = SDL_DisplayModeData;
537
557
559 SDL_WINDOW_FULLSCREEN;
560
562 SDL_WINDOW_OPENGL;
563
565 SDL_WINDOW_OCCLUDED;
566
571constexpr WindowFlags WINDOW_HIDDEN = SDL_WINDOW_HIDDEN;
572
574 SDL_WINDOW_BORDERLESS;
575
577 SDL_WINDOW_RESIZABLE;
578
580 SDL_WINDOW_MINIMIZED;
581
583 SDL_WINDOW_MAXIMIZED;
584
586 SDL_WINDOW_MOUSE_GRABBED;
587
589 SDL_WINDOW_INPUT_FOCUS;
590
592 SDL_WINDOW_MOUSE_FOCUS;
593
595 SDL_WINDOW_EXTERNAL;
596
597constexpr WindowFlags WINDOW_MODAL = SDL_WINDOW_MODAL;
598
600constexpr WindowFlags WINDOW_HIGH_PIXEL_DENSITY = SDL_WINDOW_HIGH_PIXEL_DENSITY;
601
603constexpr WindowFlags WINDOW_MOUSE_CAPTURE = SDL_WINDOW_MOUSE_CAPTURE;
604
606 SDL_WINDOW_MOUSE_RELATIVE_MODE;
607
609 SDL_WINDOW_ALWAYS_ON_TOP;
610
615constexpr WindowFlags WINDOW_UTILITY = SDL_WINDOW_UTILITY;
616
621constexpr WindowFlags WINDOW_TOOLTIP = SDL_WINDOW_TOOLTIP;
622
624constexpr WindowFlags WINDOW_POPUP_MENU = SDL_WINDOW_POPUP_MENU;
625
627 SDL_WINDOW_KEYBOARD_GRABBED;
628
629#if SDL_VERSION_ATLEAST(3, 4, 0)
630
632constexpr WindowFlags WINDOW_FILL_DOCUMENT = SDL_WINDOW_FILL_DOCUMENT;
633
634#endif // SDL_VERSION_ATLEAST(3, 4, 0)
635
637 SDL_WINDOW_VULKAN;
638
640 SDL_WINDOW_METAL;
641
643 SDL_WINDOW_TRANSPARENT;
644
646 SDL_WINDOW_NOT_FOCUSABLE;
647
653using FlashOperation = SDL_FlashOperation;
654
656 SDL_FLASH_CANCEL;
657
659 SDL_FLASH_BRIEFLY;
660
662 SDL_FLASH_UNTIL_FOCUSED;
663
674using HitTestResult = SDL_HitTestResult;
675
677 SDL_HITTEST_NORMAL;
678
680 SDL_HITTEST_DRAGGABLE;
681
683 SDL_HITTEST_RESIZE_TOPLEFT;
685
687 SDL_HITTEST_RESIZE_TOP;
688
690 SDL_HITTEST_RESIZE_TOPRIGHT;
692
694 SDL_HITTEST_RESIZE_RIGHT;
695
698 SDL_HITTEST_RESIZE_BOTTOMRIGHT;
699
701 SDL_HITTEST_RESIZE_BOTTOM;
702
704 SDL_HITTEST_RESIZE_BOTTOMLEFT;
706
708 SDL_HITTEST_RESIZE_LEFT;
709
720using HitTest = HitTestResult(SDLCALL*)(WindowRaw win,
721 const PointRaw* area,
722 void* data);
723
738
744using EGLSurface = SDL_EGLSurface;
745
746#if SDL_VERSION_ATLEAST(3, 4, 0)
747
753using ProgressState = SDL_ProgressState;
754
756constexpr ProgressState PROGRESS_STATE_INVALID = SDL_PROGRESS_STATE_INVALID;
757
759 SDL_PROGRESS_STATE_NONE;
760
763 SDL_PROGRESS_STATE_INDETERMINATE;
765
767 SDL_PROGRESS_STATE_NORMAL;
768
770 SDL_PROGRESS_STATE_PAUSED;
771
775constexpr ProgressState PROGRESS_STATE_ERROR = SDL_PROGRESS_STATE_ERROR;
776
777#endif // SDL_VERSION_ATLEAST(3, 4, 0)
778
789{
790 WindowRaw m_resource = nullptr;
791
792public:
794 constexpr Window(std::nullptr_t = nullptr) noexcept
795 : m_resource(0)
796 {
797 }
798
806 constexpr explicit Window(const WindowRaw resource) noexcept
807 : m_resource(resource)
808 {
809 }
810
811protected:
813 constexpr Window(const Window& other) noexcept = default;
814
815public:
817 constexpr Window(Window&& other) noexcept
818 : Window(other.release())
819 {
820 }
821
822 constexpr Window(const WindowRef& other) = delete;
823
824 constexpr Window(WindowRef&& other) = delete;
825
844 Window(StringParam title,
845 const PointRaw& size,
846 WindowFlags window_flags,
847 RendererRef* renderer);
848
934 Window(StringParam title, const PointRaw& size, WindowFlags flags = 0)
935 : m_resource(SDL_CreateWindow(title, size.x, size.y, flags))
936 {
937 }
938
1011 const PointRaw& offset,
1012 const PointRaw& size,
1013 WindowFlags flags = 0)
1014 : m_resource(SDL_CreatePopupWindow(parent,
1015 offset.x,
1016 offset.y,
1017 size.x,
1018 size.y,
1019 flags))
1020 {
1021 }
1022
1168 : m_resource(SDL_CreateWindowWithProperties(props))
1169 {
1170 }
1171
1173 ~Window() { SDL_DestroyWindow(m_resource); }
1174
1176 constexpr Window& operator=(Window&& other) noexcept
1177 {
1178 std::swap(m_resource, other.m_resource);
1179 return *this;
1180 }
1181
1182protected:
1184 constexpr Window& operator=(const Window& other) noexcept = default;
1185
1186public:
1188 constexpr WindowRaw get() const noexcept { return m_resource; }
1189
1191 constexpr WindowRaw release() noexcept
1192 {
1193 auto r = m_resource;
1194 m_resource = nullptr;
1195 return r;
1196 }
1197
1199 constexpr auto operator<=>(const Window& other) const noexcept = default;
1200
1202 constexpr explicit operator bool() const noexcept { return !!m_resource; }
1203
1205 constexpr operator WindowParam() const noexcept { return {m_resource}; }
1206
1225 void Destroy();
1226
1243 static WindowRef FromID(WindowID id);
1244
1257 static WindowRef GetGrabbed();
1258
1273 Display GetDisplay() const;
1274
1291 float GetPixelDensity() const;
1292
1314 float GetDisplayScale() const;
1315
1348
1362 const DisplayMode& GetFullscreenMode() const;
1363
1375
1387
1403 WindowID GetID() const;
1404
1417 WindowRef GetParent() const;
1418
1545
1564 WindowFlags GetFlags() const;
1565
1580 void SetTitle(StringParam title);
1581
1594 const char* GetTitle() const;
1595
1619 void SetIcon(SurfaceParam icon);
1620
1656 void SetPosition(const PointRaw& p);
1657
1679 void GetPosition(int* x, int* y) const;
1680
1700 Point GetPosition() const;
1701
1734 void SetSize(const PointRaw& size);
1735
1756 void GetSize(int* w, int* h) const;
1757
1778 Point GetSize() const;
1779
1791 void SetRect(Rect rect);
1792
1806 Rect GetRect() const;
1807
1824 Rect GetSafeArea() const;
1825
1862 void SetAspectRatio(float min_aspect, float max_aspect);
1863
1879 void GetAspectRatio(float* min_aspect, float* max_aspect) const;
1880
1913 void GetBordersSize(int* top, int* left, int* bottom, int* right) const;
1914
1932 void GetSizeInPixels(int* w, int* h) const;
1933
1949 Point GetSizeInPixels() const;
1950
1964 void SetMinimumSize(const PointRaw& p);
1965
1982 void GetMinimumSize(int* w, int* h) const;
1983
1997 void SetMaximumSize(const PointRaw& p);
1998
2015 void GetMaximumSize(int* w, int* h) const;
2016
2035 void SetBordered(bool bordered);
2036
2055 void SetResizable(bool resizable);
2056
2072 void SetAlwaysOnTop(bool on_top);
2073
2074#if SDL_VERSION_ATLEAST(3, 4, 0)
2075
2103 void SetFillDocument(bool fill);
2104
2105#endif // SDL_VERSION_ATLEAST(3, 4, 0)
2106
2119 void Show();
2120
2133 void Hide();
2134
2151 void Raise();
2152
2183 void Maximize();
2184
2210 void Minimize();
2211
2238 void Restore();
2239
2268 void SetFullscreen(bool fullscreen);
2269
2296 void Sync();
2297
2310 bool HasSurface() const;
2311
2339
2362 void SetSurfaceVSync(int vsync);
2363
2377 int GetSurfaceVSync() const;
2378
2396 void UpdateSurface();
2397
2423
2436 void DestroySurface();
2437
2467 void SetKeyboardGrab(bool grabbed);
2468
2485 void SetMouseGrab(bool grabbed);
2486
2498 bool GetKeyboardGrab() const;
2499
2514 bool GetMouseGrab() const;
2515
2534 void SetMouseRect(const RectRaw& rect);
2535
2550 const RectRaw* GetMouseRect() const;
2551
2569 void SetOpacity(float opacity);
2570
2586 float GetOpacity() const;
2587
2618 void SetParent(WindowParam parent);
2619
2636 void SetModal(bool modal);
2637
2648 void SetFocusable(bool focusable);
2649
2669 void ShowSystemMenu(const PointRaw& p);
2670
2711 void SetHitTest(HitTest callback, void* callback_data);
2712
2754 void SetHitTest(HitTestCB callback);
2755
2780 void SetShape(SurfaceParam shape);
2781
2792 void Flash(FlashOperation operation);
2793
2794#if SDL_VERSION_ATLEAST(3, 4, 0)
2795
2807 void SetProgressState(ProgressState state);
2808
2820
2832 void SetProgressValue(float value);
2833
2844 float GetProgressValue();
2845
2846#endif // SDL_VERSION_ATLEAST(3, 4, 0)
2847
2876
2891 void MakeCurrent(GLContext context);
2892
2904
2921 void GL_Swap();
2922
2947 void StartTextInput();
2948
2997 void StartTextInput(PropertiesParam props);
2998
3010 bool IsTextInputActive() const;
3011
3026 void StopTextInput();
3027
3040 void ClearComposition();
3041
3061 void SetTextInputArea(const RectRaw& rect, int cursor);
3062
3080 void GetTextInputArea(RectRaw* rect, int* cursor);
3081
3093 bool IsScreenKeyboardShown() const;
3094
3113 void WarpMouse(const FPointRaw& p);
3114
3139 void SetRelativeMouseMode(bool enabled);
3140
3152 bool GetRelativeMouseMode() const;
3153
3164 RendererRef GetRenderer() const;
3165};
3166
3169{
3170 using Window::Window;
3171
3179 WindowRef(WindowParam resource) noexcept
3180 : Window(resource.value)
3181 {
3182 }
3183
3191 WindowRef(WindowRaw resource) noexcept
3192 : Window(resource)
3193 {
3194 }
3195
3197 constexpr WindowRef(const WindowRef& other) noexcept = default;
3198
3201};
3202
3213constexpr int WINDOWPOS_UNDEFINED_MASK = SDL_WINDOWPOS_UNDEFINED_MASK;
3214
3228{
3229 return SDL_WINDOWPOS_UNDEFINED_DISPLAY(X);
3230}
3231
3241constexpr int WINDOWPOS_UNDEFINED = SDL_WINDOWPOS_UNDEFINED;
3242
3252constexpr bool WINDOWPOS_ISUNDEFINED(int X)
3253{
3254 return SDL_WINDOWPOS_ISUNDEFINED(X);
3255}
3256
3267constexpr int WINDOWPOS_CENTERED_MASK = SDL_WINDOWPOS_CENTERED_MASK;
3268
3281constexpr int WINDOWPOS_CENTERED_DISPLAY(int X)
3282{
3283 return SDL_WINDOWPOS_CENTERED_DISPLAY(X);
3284}
3285
3295constexpr int WINDOWPOS_CENTERED = SDL_WINDOWPOS_CENTERED;
3296
3306constexpr bool WINDOWPOS_ISCENTERED(int X)
3307{
3308 return SDL_WINDOWPOS_ISCENTERED(X);
3309}
3310
3324{
3325 GLContextRaw m_resource = nullptr;
3326
3327public:
3329 constexpr GLContext(std::nullptr_t = nullptr) noexcept
3330 : m_resource(0)
3331 {
3332 }
3333
3339 constexpr GLContext(const GLContextRaw resource) noexcept
3340 : m_resource(resource)
3341 {
3342 }
3343
3345 constexpr GLContext(const GLContext& other) noexcept = default;
3346
3348 constexpr GLContext(GLContext&& other) noexcept
3349 : GLContext(other.release())
3350 {
3351 }
3352
3382 : m_resource(SDL_GL_CreateContext(window))
3383 {
3384 }
3385
3388
3390 constexpr GLContext& operator=(GLContext&& other) noexcept
3391 {
3392 std::swap(m_resource, other.m_resource);
3393 return *this;
3394 }
3395
3397 constexpr GLContext& operator=(const GLContext& other) noexcept = default;
3398
3400 constexpr GLContextRaw get() const noexcept { return m_resource; }
3401
3403 constexpr GLContextRaw release() noexcept
3404 {
3405 auto r = m_resource;
3406 m_resource = nullptr;
3407 return r;
3408 }
3409
3411 constexpr auto operator<=>(const GLContext& other) const noexcept = default;
3412
3414 constexpr explicit operator bool() const noexcept { return !!m_resource; }
3415
3417 constexpr operator GLContextParam() const noexcept { return {m_resource}; }
3418
3428 void Destroy();
3429
3444 void MakeCurrent(WindowParam window);
3445};
3446
3449{
3451
3452 constexpr GLContextScoped(const GLContext& other) = delete;
3453
3455 constexpr GLContextScoped(GLContext&& other) noexcept
3456 : GLContext(other.release())
3457 {
3458 }
3459
3462};
3463
3469using EGLDisplay = SDL_EGLDisplay;
3470
3476using EGLConfig = SDL_EGLConfig;
3477
3483using EGLAttrib = SDL_EGLAttrib;
3484
3490using EGLint = SDL_EGLint;
3491
3515using EGLAttribArrayCallback = EGLAttrib*(SDLCALL*)(void* userdata);
3516
3546using EGLIntArrayCallback = EGLint*(SDLCALL*)(void* userdata,
3547 EGLDisplay display,
3548 EGLConfig config);
3549
3567using GLAttr = SDL_GLAttr;
3568
3573constexpr GLAttr GL_RED_SIZE = SDL_GL_RED_SIZE;
3574
3579constexpr GLAttr GL_GREEN_SIZE = SDL_GL_GREEN_SIZE;
3580
3585constexpr GLAttr GL_BLUE_SIZE = SDL_GL_BLUE_SIZE;
3586
3591constexpr GLAttr GL_ALPHA_SIZE = SDL_GL_ALPHA_SIZE;
3592
3594constexpr GLAttr GL_BUFFER_SIZE = SDL_GL_BUFFER_SIZE;
3595
3600constexpr GLAttr GL_DOUBLEBUFFER = SDL_GL_DOUBLEBUFFER;
3601
3603constexpr GLAttr GL_DEPTH_SIZE = SDL_GL_DEPTH_SIZE;
3604
3606constexpr GLAttr GL_STENCIL_SIZE = SDL_GL_STENCIL_SIZE;
3607
3612constexpr GLAttr GL_ACCUM_RED_SIZE = SDL_GL_ACCUM_RED_SIZE;
3613
3618constexpr GLAttr GL_ACCUM_GREEN_SIZE = SDL_GL_ACCUM_GREEN_SIZE;
3619
3624constexpr GLAttr GL_ACCUM_BLUE_SIZE = SDL_GL_ACCUM_BLUE_SIZE;
3625
3630constexpr GLAttr GL_ACCUM_ALPHA_SIZE = SDL_GL_ACCUM_ALPHA_SIZE;
3631
3633 SDL_GL_STEREO;
3634
3636constexpr GLAttr GL_MULTISAMPLEBUFFERS = SDL_GL_MULTISAMPLEBUFFERS;
3637
3642constexpr GLAttr GL_MULTISAMPLESAMPLES = SDL_GL_MULTISAMPLESAMPLES;
3643
3648constexpr GLAttr GL_ACCELERATED_VISUAL = SDL_GL_ACCELERATED_VISUAL;
3649
3651 SDL_GL_RETAINED_BACKING;
3652
3654 SDL_GL_CONTEXT_MAJOR_VERSION;
3655
3657 SDL_GL_CONTEXT_MINOR_VERSION;
3658
3663constexpr GLAttr GL_CONTEXT_FLAGS = SDL_GL_CONTEXT_FLAGS;
3664
3669constexpr GLAttr GL_CONTEXT_PROFILE_MASK = SDL_GL_CONTEXT_PROFILE_MASK;
3670
3672 SDL_GL_SHARE_WITH_CURRENT_CONTEXT;
3673
3678constexpr GLAttr GL_FRAMEBUFFER_SRGB_CAPABLE = SDL_GL_FRAMEBUFFER_SRGB_CAPABLE;
3679
3684constexpr GLAttr GL_CONTEXT_RELEASE_BEHAVIOR = SDL_GL_CONTEXT_RELEASE_BEHAVIOR;
3685
3691 SDL_GL_CONTEXT_RESET_NOTIFICATION;
3692
3694 SDL_GL_CONTEXT_NO_ERROR;
3695
3696constexpr GLAttr GL_FLOATBUFFERS = SDL_GL_FLOATBUFFERS;
3697
3698constexpr GLAttr GL_EGL_PLATFORM = SDL_GL_EGL_PLATFORM;
3699
3706
3708 SDL_GL_CONTEXT_PROFILE_CORE;
3709
3711 SDL_GL_CONTEXT_PROFILE_COMPATIBILITY;
3713
3715 SDL_GL_CONTEXT_PROFILE_ES;
3716
3723
3725 SDL_GL_CONTEXT_DEBUG_FLAG;
3726
3728 SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG;
3729
3731 SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG;
3732
3734 SDL_GL_CONTEXT_RESET_ISOLATION_FLAG;
3735
3742
3744 SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE;
3745
3747 SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH;
3748
3755
3757 SDL_GL_CONTEXT_RESET_NO_NOTIFICATION;
3758
3760 SDL_GL_CONTEXT_RESET_LOSE_CONTEXT;
3761
3773inline int GetNumVideoDrivers() { return SDL_GetNumVideoDrivers(); }
3774
3795inline const char* GetVideoDriver(int index)
3796{
3797 return SDL_GetVideoDriver(index);
3798}
3799
3817inline const char* GetCurrentVideoDriver()
3818{
3819 return SDL_GetCurrentVideoDriver();
3820}
3821
3831inline SystemTheme GetSystemTheme() { return SDL_GetSystemTheme(); }
3832
3844{
3845 int count = 0;
3846 auto data = reinterpret_cast<DisplayID*>(SDL_GetDisplays(&count));
3847 return OwnArray<DisplayID>{data, size_t(count)};
3848}
3849
3864{
3865 return CheckError(SDL_GetPrimaryDisplay());
3866}
3867
3869
3907{
3908 return {CheckError(SDL_GetDisplayProperties(displayID))};
3909}
3910
3912{
3913 return SDL::GetDisplayProperties(m_displayID);
3914}
3915
3916namespace prop::Display {
3917
3918constexpr auto HDR_ENABLED_BOOLEAN = SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN;
3919
3920constexpr auto KMSDRM_PANEL_ORIENTATION_NUMBER =
3921 SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER;
3922
3923#if SDL_VERSION_ATLEAST(3, 4, 0)
3924
3925constexpr auto WAYLAND_WL_OUTPUT_POINTER =
3926 SDL_PROP_DISPLAY_WAYLAND_WL_OUTPUT_POINTER;
3927
3928constexpr auto WINDOWS_HMONITOR_POINTER =
3929 SDL_PROP_DISPLAY_WINDOWS_HMONITOR_POINTER;
3930
3931#endif // SDL_VERSION_ATLEAST(3, 4, 0)
3932
3933} // namespace prop::Display
3934
3948inline const char* GetDisplayName(DisplayID displayID)
3949{
3950 return SDL_GetDisplayName(displayID);
3951}
3952
3953inline const char* Display::GetName() const
3954{
3955 return SDL::GetDisplayName(m_displayID);
3956}
3957
3976{
3977 Rect bounds;
3978 SDL_GetDisplayBounds(displayID, &bounds);
3979 return bounds;
3980}
3981
3983{
3984 return SDL::GetDisplayBounds(m_displayID);
3985}
3986
4010{
4011 Rect bounds;
4012 SDL_GetDisplayUsableBounds(displayID, &bounds);
4013 return bounds;
4014}
4015
4017{
4018 return SDL::GetDisplayUsableBounds(m_displayID);
4019}
4020
4035{
4036 return SDL_GetNaturalDisplayOrientation(displayID);
4037}
4038
4040{
4041 return SDL::GetNaturalDisplayOrientation(m_displayID);
4042}
4043
4058{
4059 return SDL_GetCurrentDisplayOrientation(displayID);
4060}
4061
4063{
4064 return SDL::GetCurrentDisplayOrientation(m_displayID);
4065}
4066
4092inline float GetDisplayContentScale(DisplayID displayID)
4093{
4094 return SDL_GetDisplayContentScale(displayID);
4095}
4096
4097inline float Display::GetContentScale() const
4098{
4099 return SDL::GetDisplayContentScale(m_displayID);
4100}
4101
4125{
4126 int count = 0;
4127 auto data = CheckError(SDL_GetFullscreenDisplayModes(displayID, &count));
4128 return OwnArray<DisplayMode*>{data, size_t(count)};
4129}
4130
4132{
4133 return SDL::GetFullscreenDisplayModes(m_displayID);
4134}
4135
4163 Display displayID,
4164 const PointRaw& size,
4165 float refresh_rate,
4166 bool include_high_density_modes)
4167{
4168 DisplayMode mode;
4169 CheckError(SDL_GetClosestFullscreenDisplayMode(displayID,
4170 size.x,
4171 size.y,
4172 refresh_rate,
4173 include_high_density_modes,
4174 &mode));
4175 return mode;
4176}
4177
4179 const PointRaw& size,
4180 float refresh_rate,
4181 bool include_high_density_modes) const
4182{
4184 m_displayID, size, refresh_rate, include_high_density_modes);
4185}
4186
4207{
4208 return *SDL_GetDesktopDisplayMode(displayID);
4209}
4210
4212{
4213 return SDL::GetDesktopDisplayMode(m_displayID);
4214}
4215
4236{
4237 return *SDL_GetCurrentDisplayMode(displayID);
4238}
4239
4241{
4242 return SDL::GetCurrentDisplayMode(m_displayID);
4243}
4244
4260{
4261 return SDL_GetDisplayForPoint(&point);
4262}
4263
4265{
4266 return SDL::GetDisplayForPoint(point);
4267}
4268
4285{
4286 return CheckError(SDL_GetDisplayForRect(&rect));
4287}
4288
4290{
4291 return SDL::GetDisplayForRect(rect);
4292}
4293
4310{
4311 return CheckError(SDL_GetDisplayForWindow(window));
4312}
4313
4315{
4316 return SDL::GetDisplayForWindow(m_resource);
4317}
4318
4337{
4338 return SDL_GetWindowPixelDensity(window);
4339}
4340
4341inline float Window::GetPixelDensity() const
4342{
4343 return SDL::GetWindowPixelDensity(m_resource);
4344}
4345
4368{
4369 return SDL_GetWindowDisplayScale(window);
4370}
4371
4372inline float Window::GetDisplayScale() const
4373{
4374 return SDL::GetWindowDisplayScale(m_resource);
4375}
4376
4410{
4411 CheckError(SDL_SetWindowFullscreenMode(window, mode));
4412}
4413
4415{
4416 SDL::SetWindowFullscreenMode(m_resource, mode);
4417}
4418
4434{
4435 return *SDL_GetWindowFullscreenMode(window);
4436}
4437
4439{
4440 return SDL::GetWindowFullscreenMode(m_resource);
4441}
4442
4455{
4456 size_t size;
4457 return OwnPtr<void>{CheckError(SDL_GetWindowICCProfile(window, &size))};
4458}
4459
4461{
4462 return SDL::GetWindowICCProfile(m_resource);
4463}
4464
4477{
4478 return CheckError(SDL_GetWindowPixelFormat(window));
4479}
4480
4482{
4483 return SDL::GetWindowPixelFormat(m_resource);
4484}
4485
4497{
4498 int count = 0;
4499 auto data = CheckError(SDL_GetWindows(&count));
4500 return OwnArray<WindowRef>{reinterpret_cast<WindowRef*>(data), size_t(count)};
4501}
4502
4588 const PointRaw& size,
4589 WindowFlags flags)
4590{
4591 return Window(std::move(title), size, flags);
4592}
4593
4666 const PointRaw& offset,
4667 const PointRaw& size,
4668 WindowFlags flags)
4669{
4670 return Window(parent, offset, size, flags);
4671}
4672
4818{
4819 return Window(props);
4820}
4821
4822namespace prop::Window {
4823
4824constexpr auto CREATE_ALWAYS_ON_TOP_BOOLEAN =
4825 SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN;
4826
4827constexpr auto CREATE_BORDERLESS_BOOLEAN =
4828 SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN;
4829
4830#if SDL_VERSION_ATLEAST(3, 2, 18)
4831
4832constexpr auto CREATE_CONSTRAIN_POPUP_BOOLEAN =
4833 SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN;
4834
4835#endif // SDL_VERSION_ATLEAST(3, 2, 18)
4836
4837constexpr auto CREATE_FOCUSABLE_BOOLEAN =
4838 SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN;
4839
4840constexpr auto CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN =
4841 SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN;
4842
4843constexpr auto CREATE_FLAGS_NUMBER = SDL_PROP_WINDOW_CREATE_FLAGS_NUMBER;
4844
4845constexpr auto CREATE_FULLSCREEN_BOOLEAN =
4846 SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN;
4847
4848constexpr auto CREATE_HEIGHT_NUMBER = SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER;
4849
4850constexpr auto CREATE_HIDDEN_BOOLEAN = SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN;
4851
4852constexpr auto CREATE_HIGH_PIXEL_DENSITY_BOOLEAN =
4853 SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN;
4854
4855constexpr auto CREATE_MAXIMIZED_BOOLEAN =
4856 SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN;
4857
4858constexpr auto CREATE_MENU_BOOLEAN = SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN;
4859
4860constexpr auto CREATE_METAL_BOOLEAN = SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN;
4861
4862constexpr auto CREATE_MINIMIZED_BOOLEAN =
4863 SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN;
4864
4865constexpr auto CREATE_MODAL_BOOLEAN = SDL_PROP_WINDOW_CREATE_MODAL_BOOLEAN;
4866
4867constexpr auto CREATE_MOUSE_GRABBED_BOOLEAN =
4868 SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN;
4869
4870constexpr auto CREATE_OPENGL_BOOLEAN = SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN;
4871
4872constexpr auto CREATE_PARENT_POINTER = SDL_PROP_WINDOW_CREATE_PARENT_POINTER;
4873
4874constexpr auto CREATE_RESIZABLE_BOOLEAN =
4875 SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN;
4876
4877constexpr auto CREATE_TITLE_STRING = SDL_PROP_WINDOW_CREATE_TITLE_STRING;
4878
4879constexpr auto CREATE_TRANSPARENT_BOOLEAN =
4880 SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN;
4881
4882constexpr auto CREATE_TOOLTIP_BOOLEAN = SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN;
4883
4884constexpr auto CREATE_UTILITY_BOOLEAN = SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN;
4885
4886constexpr auto CREATE_VULKAN_BOOLEAN = SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN;
4887
4888constexpr auto CREATE_WIDTH_NUMBER = SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER;
4889
4890constexpr auto CREATE_X_NUMBER = SDL_PROP_WINDOW_CREATE_X_NUMBER;
4891
4892constexpr auto CREATE_Y_NUMBER = SDL_PROP_WINDOW_CREATE_Y_NUMBER;
4893
4894constexpr auto CREATE_COCOA_WINDOW_POINTER =
4895 SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER;
4896
4897constexpr auto CREATE_COCOA_VIEW_POINTER =
4898 SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER;
4899
4900#if SDL_VERSION_ATLEAST(3, 4, 0)
4901
4902constexpr auto CREATE_WINDOWSCENE_POINTER =
4903 SDL_PROP_WINDOW_CREATE_WINDOWSCENE_POINTER;
4904
4905#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4906
4907constexpr auto CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN =
4908 SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN;
4909
4910constexpr auto CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN =
4911 SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN;
4912
4913constexpr auto CREATE_WAYLAND_WL_SURFACE_POINTER =
4914 SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER;
4915
4916constexpr auto CREATE_WIN32_HWND_POINTER =
4917 SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER;
4918
4919constexpr auto CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER =
4920 SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER;
4921
4922constexpr auto CREATE_X11_WINDOW_NUMBER =
4923 SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER;
4924
4925#if SDL_VERSION_ATLEAST(3, 4, 0)
4926
4927constexpr auto CREATE_EMSCRIPTEN_CANVAS_ID_STRING =
4928 SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_CANVAS_ID_STRING;
4929
4930constexpr auto CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING =
4931 SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING;
4932
4933#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4934
4935constexpr auto SHAPE_POINTER = SDL_PROP_WINDOW_SHAPE_POINTER;
4936
4937constexpr auto HDR_ENABLED_BOOLEAN = SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN;
4938
4939constexpr auto SDR_WHITE_LEVEL_FLOAT = SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT;
4940
4941constexpr auto HDR_HEADROOM_FLOAT = SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT;
4942
4943constexpr auto ANDROID_WINDOW_POINTER = SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER;
4944
4945constexpr auto ANDROID_SURFACE_POINTER =
4946 SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER;
4947
4948constexpr auto UIKIT_WINDOW_POINTER = SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER;
4949
4950constexpr auto UIKIT_METAL_VIEW_TAG_NUMBER =
4951 SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER;
4952
4953constexpr auto UIKIT_OPENGL_FRAMEBUFFER_NUMBER =
4954 SDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER;
4955
4956constexpr auto UIKIT_OPENGL_RENDERBUFFER_NUMBER =
4957 SDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER;
4958
4959constexpr auto UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER =
4960 SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER;
4961
4962constexpr auto KMSDRM_DEVICE_INDEX_NUMBER =
4963 SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER;
4964
4965constexpr auto KMSDRM_DRM_FD_NUMBER = SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER;
4966
4967constexpr auto KMSDRM_GBM_DEVICE_POINTER =
4968 SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER;
4969
4970constexpr auto COCOA_WINDOW_POINTER = SDL_PROP_WINDOW_COCOA_WINDOW_POINTER;
4971
4972constexpr auto COCOA_METAL_VIEW_TAG_NUMBER =
4973 SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER;
4974
4975#if SDL_VERSION_ATLEAST(3, 4, 0)
4976
4977constexpr auto OPENVR_OVERLAY_ID_NUMBER =
4978 SDL_PROP_WINDOW_OPENVR_OVERLAY_ID_NUMBER;
4979
4980#else
4981
4982constexpr auto OPENVR_OVERLAY_ID_NUMBER = SDL_PROP_WINDOW_OPENVR_OVERLAY_ID;
4983
4984#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4985
4986constexpr auto VIVANTE_DISPLAY_POINTER =
4987 SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER;
4988
4989constexpr auto VIVANTE_WINDOW_POINTER = SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER;
4990
4991constexpr auto VIVANTE_SURFACE_POINTER =
4992 SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER;
4993
4994constexpr auto WIN32_HWND_POINTER = SDL_PROP_WINDOW_WIN32_HWND_POINTER;
4995
4996constexpr auto WIN32_HDC_POINTER = SDL_PROP_WINDOW_WIN32_HDC_POINTER;
4997
4998constexpr auto WIN32_INSTANCE_POINTER = SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER;
4999
5000constexpr auto WAYLAND_DISPLAY_POINTER =
5001 SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER;
5002
5003constexpr auto WAYLAND_SURFACE_POINTER =
5004 SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER;
5005
5006constexpr auto WAYLAND_VIEWPORT_POINTER =
5007 SDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTER;
5008
5009constexpr auto WAYLAND_EGL_WINDOW_POINTER =
5010 SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER;
5011
5012constexpr auto WAYLAND_XDG_SURFACE_POINTER =
5013 SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER;
5014
5015constexpr auto WAYLAND_XDG_TOPLEVEL_POINTER =
5016 SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER;
5017
5018constexpr auto WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING =
5019 SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING;
5020
5021constexpr auto WAYLAND_XDG_POPUP_POINTER =
5022 SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER;
5023
5024constexpr auto WAYLAND_XDG_POSITIONER_POINTER =
5025 SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER;
5026
5027constexpr auto X11_DISPLAY_POINTER = SDL_PROP_WINDOW_X11_DISPLAY_POINTER;
5028
5029constexpr auto X11_SCREEN_NUMBER = SDL_PROP_WINDOW_X11_SCREEN_NUMBER;
5030
5031constexpr auto X11_WINDOW_NUMBER = SDL_PROP_WINDOW_X11_WINDOW_NUMBER;
5032
5033#if SDL_VERSION_ATLEAST(3, 4, 0)
5034
5035constexpr auto EMSCRIPTEN_CANVAS_ID_STRING =
5036 SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING;
5037
5038constexpr auto EMSCRIPTEN_KEYBOARD_ELEMENT_STRING =
5039 SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING;
5040
5041#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5042
5043} // namespace prop::Window
5044
5062{
5063 return CheckError(SDL_GetWindowID(window));
5064}
5065
5066inline WindowID Window::GetID() const { return SDL::GetWindowID(m_resource); }
5067
5085{
5086 return {SDL_GetWindowFromID(id)};
5087}
5088
5090{
5091 return SDL::GetWindowFromID(id);
5092}
5093
5108{
5109 return {CheckError(SDL_GetWindowParent(window))};
5110}
5111
5113{
5114 return SDL::GetWindowParent(m_resource);
5115}
5116
5242{
5243 return {CheckError(SDL_GetWindowProperties(window))};
5244}
5245
5247{
5248 return SDL::GetWindowProperties(m_resource);
5249}
5250
5271{
5272 return SDL_GetWindowFlags(window);
5273}
5274
5276{
5277 return SDL::GetWindowFlags(m_resource);
5278}
5279
5295inline void SetWindowTitle(WindowParam window, StringParam title)
5296{
5297 CheckError(SDL_SetWindowTitle(window, title));
5298}
5299
5301{
5302 SDL::SetWindowTitle(m_resource, std::move(title));
5303}
5304
5317inline const char* GetWindowTitle(WindowParam window)
5318{
5319 return SDL_GetWindowTitle(window);
5320}
5321
5322inline const char* Window::GetTitle() const
5323{
5324 return SDL::GetWindowTitle(m_resource);
5325}
5326
5350inline void SetWindowIcon(WindowParam window, SurfaceParam icon)
5351{
5352 CheckError(SDL_SetWindowIcon(window, icon));
5353}
5354
5356{
5357 SDL::SetWindowIcon(m_resource, icon);
5358}
5359
5395inline void SetWindowPosition(WindowParam window, const PointRaw& p)
5396{
5397 CheckError(SDL_SetWindowPosition(window, p.x, p.y));
5398}
5399
5400inline void Window::SetPosition(const PointRaw& p)
5401{
5402 SDL::SetWindowPosition(m_resource, p);
5403}
5404
5427inline void GetWindowPosition(WindowParam window, int* x, int* y)
5428{
5429 CheckError(SDL_GetWindowPosition(window, x, y));
5430}
5431
5452{
5453 Point p;
5454 GetWindowPosition(window, &p.x, &p.y);
5455 return p;
5456}
5457
5458inline void Window::GetPosition(int* x, int* y) const
5459{
5460 SDL::GetWindowPosition(m_resource, x, y);
5461}
5462
5464{
5465 return SDL::GetWindowPosition(m_resource);
5466}
5467
5501inline void SetWindowSize(WindowParam window, const PointRaw& size)
5502{
5503 CheckError(SDL_SetWindowSize(window, size.x, size.y));
5504}
5505
5506inline void Window::SetSize(const PointRaw& size)
5507{
5508 SDL::SetWindowSize(m_resource, size);
5509}
5510
5532inline void GetWindowSize(WindowParam window, int* w, int* h)
5533{
5534 CheckError(SDL_GetWindowSize(window, w, h));
5535}
5536
5558{
5559 Point p;
5560 GetWindowSize(window, &p.x, &p.y);
5561 return p;
5562}
5563
5564inline void Window::GetSize(int* w, int* h) const
5565{
5566 SDL::GetWindowSize(m_resource, w, h);
5567}
5568
5569inline Point Window::GetSize() const { return SDL::GetWindowSize(m_resource); }
5570
5583inline void SetWindowRect(WindowParam window, Rect rect)
5584{
5585 SetWindowPosition(window, rect.GetTopLeft());
5586 SetWindowSize(window, rect.GetSize());
5587}
5588
5589inline void Window::SetRect(Rect rect) { SDL::SetWindowRect(m_resource, rect); }
5590
5606{
5607 return Rect{GetWindowPosition(window), GetWindowSize(window)};
5608}
5609
5610inline Rect Window::GetRect() const { return SDL::GetWindowRect(m_resource); }
5611
5630{
5631 Rect rect;
5632 CheckError(SDL_GetWindowSafeArea(window, &rect));
5633 return rect;
5634}
5635
5637{
5638 return SDL::GetWindowSafeArea(m_resource);
5639}
5640
5679 float min_aspect,
5680 float max_aspect)
5681{
5682 CheckError(SDL_SetWindowAspectRatio(window, min_aspect, max_aspect));
5683}
5684
5685inline void Window::SetAspectRatio(float min_aspect, float max_aspect)
5686{
5687 SDL::SetWindowAspectRatio(m_resource, min_aspect, max_aspect);
5688}
5689
5707 float* min_aspect,
5708 float* max_aspect)
5709{
5710 CheckError(SDL_GetWindowAspectRatio(window, min_aspect, max_aspect));
5711}
5712
5713inline void Window::GetAspectRatio(float* min_aspect, float* max_aspect) const
5714{
5715 SDL::GetWindowAspectRatio(m_resource, min_aspect, max_aspect);
5716}
5717
5752 int* top,
5753 int* left,
5754 int* bottom,
5755 int* right)
5756{
5757 CheckError(SDL_GetWindowBordersSize(window, top, left, bottom, right));
5758}
5759
5760inline void Window::GetBordersSize(int* top,
5761 int* left,
5762 int* bottom,
5763 int* right) const
5764{
5765 SDL::GetWindowBordersSize(m_resource, top, left, bottom, right);
5766}
5767
5785inline void GetWindowSizeInPixels(WindowParam window, int* w, int* h)
5786{
5787 CheckError(SDL_GetWindowSizeInPixels(window, w, h));
5788}
5789
5806{
5807 Point p;
5808 GetWindowSizeInPixels(window, &p.x, &p.y);
5809 return p;
5810}
5811
5812inline void Window::GetSizeInPixels(int* w, int* h) const
5813{
5814 SDL::GetWindowSizeInPixels(m_resource, w, h);
5815}
5816
5818{
5819 return SDL::GetWindowSizeInPixels(m_resource);
5820}
5821
5836inline void SetWindowMinimumSize(WindowParam window, const PointRaw& p)
5837{
5838 CheckError(SDL_SetWindowMinimumSize(window, p.x, p.y));
5839}
5840
5842{
5843 SDL::SetWindowMinimumSize(m_resource, p);
5844}
5845
5863inline void GetWindowMinimumSize(WindowParam window, int* w, int* h)
5864{
5865 CheckError(SDL_GetWindowMinimumSize(window, w, h));
5866}
5867
5868inline void Window::GetMinimumSize(int* w, int* h) const
5869{
5870 SDL::GetWindowMinimumSize(m_resource, w, h);
5871}
5872
5887inline void SetWindowMaximumSize(WindowParam window, const PointRaw& p)
5888{
5889 CheckError(SDL_SetWindowMaximumSize(window, p.x, p.y));
5890}
5891
5893{
5894 SDL::SetWindowMaximumSize(m_resource, p);
5895}
5896
5914inline void GetWindowMaximumSize(WindowParam window, int* w, int* h)
5915{
5916 CheckError(SDL_GetWindowMaximumSize(window, w, h));
5917}
5918
5919inline void Window::GetMaximumSize(int* w, int* h) const
5920{
5921 SDL::GetWindowMaximumSize(m_resource, w, h);
5922}
5923
5943inline void SetWindowBordered(WindowParam window, bool bordered)
5944{
5945 CheckError(SDL_SetWindowBordered(window, bordered));
5946}
5947
5948inline void Window::SetBordered(bool bordered)
5949{
5950 SDL::SetWindowBordered(m_resource, bordered);
5951}
5952
5972inline void SetWindowResizable(WindowParam window, bool resizable)
5973{
5974 CheckError(SDL_SetWindowResizable(window, resizable));
5975}
5976
5977inline void Window::SetResizable(bool resizable)
5978{
5979 SDL::SetWindowResizable(m_resource, resizable);
5980}
5981
5998inline void SetWindowAlwaysOnTop(WindowParam window, bool on_top)
5999{
6000 CheckError(SDL_SetWindowAlwaysOnTop(window, on_top));
6001}
6002
6003inline void Window::SetAlwaysOnTop(bool on_top)
6004{
6005 SDL::SetWindowAlwaysOnTop(m_resource, on_top);
6006}
6007
6008#if SDL_VERSION_ATLEAST(3, 4, 0)
6009
6038inline void SetWindowFillDocument(WindowParam window, bool fill)
6039{
6040 CheckError(SDL_SetWindowFillDocument(window, fill));
6041}
6042
6043inline void Window::SetFillDocument(bool fill)
6044{
6045 SDL::SetWindowFillDocument(m_resource, fill);
6046}
6047
6048#endif // SDL_VERSION_ATLEAST(3, 4, 0)
6049
6063inline void ShowWindow(WindowParam window)
6064{
6065 CheckError(SDL_ShowWindow(window));
6066}
6067
6068inline void Window::Show() { SDL::ShowWindow(m_resource); }
6069
6083inline void HideWindow(WindowParam window)
6084{
6085 CheckError(SDL_HideWindow(window));
6086}
6087
6088inline void Window::Hide() { SDL::HideWindow(m_resource); }
6089
6106inline void RaiseWindow(WindowParam window)
6107{
6108 CheckError(SDL_RaiseWindow(window));
6109}
6110
6111inline void Window::Raise() { SDL::RaiseWindow(m_resource); }
6112
6144inline void MaximizeWindow(WindowParam window)
6145{
6146 CheckError(SDL_MaximizeWindow(window));
6147}
6148
6149inline void Window::Maximize() { SDL::MaximizeWindow(m_resource); }
6150
6177inline void MinimizeWindow(WindowParam window)
6178{
6179 CheckError(SDL_MinimizeWindow(window));
6180}
6181
6182inline void Window::Minimize() { SDL::MinimizeWindow(m_resource); }
6183
6211inline void RestoreWindow(WindowParam window)
6212{
6213 CheckError(SDL_RestoreWindow(window));
6214}
6215
6216inline void Window::Restore() { SDL::RestoreWindow(m_resource); }
6217
6247inline void SetWindowFullscreen(WindowParam window, bool fullscreen)
6248{
6249 CheckError(SDL_SetWindowFullscreen(window, fullscreen));
6250}
6251
6252inline void Window::SetFullscreen(bool fullscreen)
6253{
6254 SDL::SetWindowFullscreen(m_resource, fullscreen);
6255}
6256
6285inline void SyncWindow(WindowParam window)
6286{
6287 CheckError(SDL_SyncWindow(window));
6288}
6289
6290inline void Window::Sync() { SDL::SyncWindow(m_resource); }
6291
6306{
6307 return SDL_WindowHasSurface(window);
6308}
6309
6310inline bool Window::HasSurface() const
6311{
6312 return SDL::WindowHasSurface(m_resource);
6313}
6314
6343{
6344 return Surface::Borrow(SDL_GetWindowSurface(window));
6345}
6346
6348{
6349 return SDL::GetWindowSurface(m_resource);
6350}
6351
6375inline void SetWindowSurfaceVSync(WindowParam window, int vsync)
6376{
6377 CheckError(SDL_SetWindowSurfaceVSync(window, vsync));
6378}
6379
6380inline void Window::SetSurfaceVSync(int vsync)
6381{
6382 SDL::SetWindowSurfaceVSync(m_resource, vsync);
6383}
6384
6386constexpr int WINDOW_SURFACE_VSYNC_DISABLED = SDL_WINDOW_SURFACE_VSYNC_DISABLED;
6387
6389constexpr int WINDOW_SURFACE_VSYNC_ADAPTIVE = SDL_WINDOW_SURFACE_VSYNC_ADAPTIVE;
6390
6404{
6405 int vsync;
6406 CheckError(SDL_GetWindowSurfaceVSync(window, &vsync));
6407 return vsync;
6408}
6409
6410inline int Window::GetSurfaceVSync() const
6411{
6412 return SDL::GetWindowSurfaceVSync(m_resource);
6413}
6414
6434{
6435 CheckError(SDL_UpdateWindowSurface(window));
6436}
6437
6439
6467{
6468 CheckError(SDL_UpdateWindowSurfaceRects(window, rects.data(), rects.size()));
6469}
6470
6472{
6473 SDL::UpdateWindowSurfaceRects(m_resource, rects);
6474}
6475
6490{
6491 CheckError(SDL_DestroyWindowSurface(window));
6492}
6493
6495
6525inline void SetWindowKeyboardGrab(WindowParam window, bool grabbed)
6526{
6527 CheckError(SDL_SetWindowKeyboardGrab(window, grabbed));
6528}
6529
6530inline void Window::SetKeyboardGrab(bool grabbed)
6531{
6532 SDL::SetWindowKeyboardGrab(m_resource, grabbed);
6533}
6534
6552inline void SetWindowMouseGrab(WindowParam window, bool grabbed)
6553{
6554 CheckError(SDL_SetWindowMouseGrab(window, grabbed));
6555}
6556
6557inline void Window::SetMouseGrab(bool grabbed)
6558{
6559 SDL::SetWindowMouseGrab(m_resource, grabbed);
6560}
6561
6575{
6576 return SDL_GetWindowKeyboardGrab(window);
6577}
6578
6579inline bool Window::GetKeyboardGrab() const
6580{
6581 return SDL::GetWindowKeyboardGrab(m_resource);
6582}
6583
6600{
6601 return SDL_GetWindowMouseGrab(window);
6602}
6603
6604inline bool Window::GetMouseGrab() const
6605{
6606 return SDL::GetWindowMouseGrab(m_resource);
6607}
6608
6621inline WindowRef GetGrabbedWindow() { return {SDL_GetGrabbedWindow()}; }
6622
6624
6644inline void SetWindowMouseRect(WindowParam window, const RectRaw& rect)
6645{
6646 CheckError(SDL_SetWindowMouseRect(window, &rect));
6647}
6648
6649inline void Window::SetMouseRect(const RectRaw& rect)
6650{
6651 SDL::SetWindowMouseRect(m_resource, rect);
6652}
6653
6670{
6671 return SDL_GetWindowMouseRect(window);
6672}
6673
6674inline const RectRaw* Window::GetMouseRect() const
6675{
6676 return SDL::GetWindowMouseRect(m_resource);
6677}
6678
6697inline void SetWindowOpacity(WindowParam window, float opacity)
6698{
6699 CheckError(SDL_SetWindowOpacity(window, opacity));
6700}
6701
6702inline void Window::SetOpacity(float opacity)
6703{
6704 SDL::SetWindowOpacity(m_resource, opacity);
6705}
6706
6723inline float GetWindowOpacity(WindowParam window)
6724{
6725 return SDL_GetWindowOpacity(window);
6726}
6727
6728inline float Window::GetOpacity() const
6729{
6730 return SDL::GetWindowOpacity(m_resource);
6731}
6732
6764inline void SetWindowParent(WindowParam window, WindowParam parent)
6765{
6766 CheckError(SDL_SetWindowParent(window, parent));
6767}
6768
6770{
6771 SDL::SetWindowParent(m_resource, parent);
6772}
6773
6791inline void SetWindowModal(WindowParam window, bool modal)
6792{
6793 CheckError(SDL_SetWindowModal(window, modal));
6794}
6795
6796inline void Window::SetModal(bool modal)
6797{
6798 SDL::SetWindowModal(m_resource, modal);
6799}
6800
6812inline void SetWindowFocusable(WindowParam window, bool focusable)
6813{
6814 CheckError(SDL_SetWindowFocusable(window, focusable));
6815}
6816
6817inline void Window::SetFocusable(bool focusable)
6818{
6819 SDL::SetWindowFocusable(m_resource, focusable);
6820}
6821
6842inline void ShowWindowSystemMenu(WindowParam window, const PointRaw& p)
6843{
6844 CheckError(SDL_ShowWindowSystemMenu(window, p.x, p.y));
6845}
6846
6848{
6849 SDL::ShowWindowSystemMenu(m_resource, p);
6850}
6851
6894 HitTest callback,
6895 void* callback_data)
6896{
6897 CheckError(SDL_SetWindowHitTest(window, callback, callback_data));
6898}
6899
6940inline void SetWindowHitTest(WindowParam window, HitTestCB callback)
6941{
6942 SetWindowHitTest(window, callback.wrapper, callback.data);
6943}
6944
6945inline void Window::SetHitTest(HitTest callback, void* callback_data)
6946{
6947 SDL::SetWindowHitTest(m_resource, callback, callback_data);
6948}
6949
6950inline void Window::SetHitTest(HitTestCB callback)
6951{
6952 SDL::SetWindowHitTest(m_resource, callback);
6953}
6954
6979inline void SetWindowShape(WindowParam window, SurfaceParam shape)
6980{
6981 CheckError(SDL_SetWindowShape(window, shape));
6982}
6983
6985{
6986 SDL::SetWindowShape(m_resource, shape);
6987}
6988
7000inline void FlashWindow(WindowParam window, FlashOperation operation)
7001{
7002 CheckError(SDL_FlashWindow(window, operation));
7003}
7004
7005inline void Window::Flash(FlashOperation operation)
7006{
7007 SDL::FlashWindow(m_resource, operation);
7008}
7009
7010#if SDL_VERSION_ATLEAST(3, 4, 0)
7011
7025{
7026 CheckError(SDL_SetWindowProgressState(window, state));
7027}
7028
7030{
7031 SDL::SetWindowProgressState(m_resource, state);
7032}
7033
7046{
7047 return SDL_GetWindowProgressState(window);
7048}
7049
7051{
7052 return SDL::GetWindowProgressState(m_resource);
7053}
7054
7067inline void SetWindowProgressValue(WindowParam window, float value)
7068{
7069 CheckError(SDL_SetWindowProgressValue(window, value));
7070}
7071
7072inline void Window::SetProgressValue(float value)
7073{
7074 SDL::SetWindowProgressValue(m_resource, value);
7075}
7076
7089{
7090 return SDL_GetWindowProgressValue(window);
7091}
7092
7094{
7095 return SDL::GetWindowProgressValue(m_resource);
7096}
7097
7098#endif // SDL_VERSION_ATLEAST(3, 4, 0)
7099
7119inline void DestroyWindow(WindowRaw window) { SDL_DestroyWindow(window); }
7120
7122
7139inline bool ScreenSaverEnabled() { return SDL_ScreenSaverEnabled(); }
7140
7153inline void EnableScreenSaver() { CheckError(SDL_EnableScreenSaver()); }
7154
7173inline void DisableScreenSaver() { CheckError(SDL_DisableScreenSaver()); }
7174
7197{
7198 CheckError(SDL_GL_LoadLibrary(path));
7199}
7200
7255{
7256 return SDL_GL_GetProcAddress(proc);
7257}
7258
7277{
7278 return SDL_EGL_GetProcAddress(proc);
7279}
7280
7290inline void GL_UnloadLibrary() { SDL_GL_UnloadLibrary(); }
7291
7313{
7314 return SDL_GL_ExtensionSupported(extension);
7315}
7316
7327inline void GL_ResetAttributes() { SDL_GL_ResetAttributes(); }
7328
7349inline void GL_SetAttribute(GLAttr attr, int value)
7350{
7351 CheckError(SDL_GL_SetAttribute(attr, value));
7352}
7353
7368inline void GL_GetAttribute(GLAttr attr, int* value)
7369{
7370 CheckError(SDL_GL_GetAttribute(attr, value));
7371}
7372
7402{
7403 return GLContext(window);
7404}
7405
7406inline GLContext Window::CreateGLContext() { return GLContext(m_resource); }
7407
7423inline void GL_MakeCurrent(WindowParam window, GLContext context)
7424{
7425 CheckError(SDL_GL_MakeCurrent(window, context.get()));
7426}
7427
7428inline void Window::MakeCurrent(GLContext context)
7429{
7430 SDL::GL_MakeCurrent(m_resource, context);
7431}
7432
7434{
7435 SDL::GL_MakeCurrent(window, m_resource);
7436}
7437
7450{
7451 return {CheckError(SDL_GL_GetCurrentWindow())};
7452}
7453
7466inline GLContext GL_GetCurrentContext() { return SDL_GL_GetCurrentContext(); }
7467
7479{
7480 return SDL_EGL_GetCurrentDisplay();
7481}
7482
7493inline EGLConfig EGL_GetCurrentConfig() { return SDL_EGL_GetCurrentConfig(); }
7494
7507{
7508 return SDL_EGL_GetWindowSurface(window);
7509}
7510
7512{
7513 return SDL::EGL_GetWindowSurface(m_resource);
7514}
7515
7537 EGLAttribArrayCallback platformAttribCallback,
7538 EGLIntArrayCallback surfaceAttribCallback,
7539 EGLIntArrayCallback contextAttribCallback,
7540 void* userdata)
7541{
7542 SDL_EGL_SetAttributeCallbacks(platformAttribCallback,
7543 surfaceAttribCallback,
7544 contextAttribCallback,
7545 userdata);
7546}
7547
7576inline void GL_SetSwapInterval(int interval)
7577{
7578 CheckError(SDL_GL_SetSwapInterval(interval));
7579}
7580
7599inline void GL_GetSwapInterval(int* interval)
7600{
7601 CheckError(SDL_GL_GetSwapInterval(interval));
7602}
7603
7621inline void GL_SwapWindow(WindowParam window)
7622{
7623 CheckError(SDL_GL_SwapWindow(window));
7624}
7625
7626inline void Window::GL_Swap() { SDL::GL_SwapWindow(m_resource); }
7627
7641{
7642 CheckError(SDL_GL_DestroyContext(context));
7643}
7644
7646
7648
7649} // namespace SDL
7650
7651#endif /* SDL3PP_VIDEO_H_ */
This is a unique ID for a display for the time it is connected to the system, and is never reused for...
Definition: SDL3pp_video.h:172
constexpr Display(DisplayID displayID={}) noexcept
Wraps Display.
Definition: SDL3pp_video.h:181
An opaque handle to an OpenGL context.
Definition: SDL3pp_video.h:3324
constexpr auto operator<=>(const GLContext &other) const noexcept=default
Comparison.
constexpr GLContextRaw get() const noexcept
Retrieves underlying GLContextRaw.
Definition: SDL3pp_video.h:3400
constexpr GLContext(const GLContext &other) noexcept=default
Copy constructor.
constexpr GLContext & operator=(const GLContext &other) noexcept=default
Assignment operator.
GLContext(WindowParam window)
Create an OpenGL context for an OpenGL window, and make it current.
Definition: SDL3pp_video.h:3381
~GLContext()
Destructor.
Definition: SDL3pp_video.h:3387
constexpr GLContext(GLContext &&other) noexcept
Move constructor.
Definition: SDL3pp_video.h:3348
constexpr GLContextRaw release() noexcept
Retrieves underlying GLContextRaw and clear this.
Definition: SDL3pp_video.h:3403
constexpr GLContext & operator=(GLContext &&other) noexcept
Assignment operator.
Definition: SDL3pp_video.h:3390
constexpr GLContext(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_video.h:3329
constexpr GLContext(const GLContextRaw resource) noexcept
Constructs from GLContextParam.
Definition: SDL3pp_video.h:3339
Optional-like shim for references.
Definition: SDL3pp_optionalRef.h:20
Base class for SDL memory allocated array wrap.
Definition: SDL3pp_ownPtr.h:44
Pixel format.
Definition: SDL3pp_pixels.h:414
span-like for empty-derived structs
Definition: SDL3pp_spanRef.h:24
constexpr T * data() const
Retrieves contained data.
Definition: SDL3pp_spanRef.h:75
constexpr size_t size() const
Retrieves contained size.
Definition: SDL3pp_spanRef.h:69
Helpers to use C++ strings parameters.
Definition: SDL3pp_strings.h:43
A collection of pixels used in software blitting.
Definition: SDL3pp_surface.h:227
static constexpr Surface Borrow(SurfaceParam resource)
Safely borrows the from SurfaceParam.
Definition: SDL3pp_surface.h:411
The struct used as an opaque handle to a window.
Definition: SDL3pp_video.h:789
constexpr Window & operator=(Window &&other) noexcept
Assignment operator.
Definition: SDL3pp_video.h:1176
constexpr Window & operator=(const Window &other) noexcept=default
Assignment operator.
Window(WindowParam parent, const PointRaw &offset, const PointRaw &size, WindowFlags flags=0)
Create a child popup window of the specified parent window.
Definition: SDL3pp_video.h:1010
constexpr auto operator<=>(const Window &other) const noexcept=default
Comparison.
constexpr WindowRaw get() const noexcept
Retrieves underlying WindowRaw.
Definition: SDL3pp_video.h:1188
constexpr Window(const WindowRaw resource) noexcept
Constructs from WindowParam.
Definition: SDL3pp_video.h:806
Window(StringParam title, const PointRaw &size, WindowFlags flags=0)
Create a window with the specified dimensions and flags.
Definition: SDL3pp_video.h:934
~Window()
Destructor.
Definition: SDL3pp_video.h:1173
constexpr WindowRaw release() noexcept
Retrieves underlying WindowRaw and clear this.
Definition: SDL3pp_video.h:1191
constexpr Window(std::nullptr_t=nullptr) noexcept
Default ctor.
Definition: SDL3pp_video.h:794
Window(PropertiesParam props)
Create a window with the specified properties.
Definition: SDL3pp_video.h:1167
constexpr Window(const Window &other) noexcept=default
Copy constructor.
constexpr Window(Window &&other) noexcept
Move constructor.
Definition: SDL3pp_video.h:817
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition: SDL3pp_error.h:197
void GetTextInputArea(RectRaw *rect, int *cursor)
Get the area used to type Unicode text input.
Definition: SDL3pp_keyboard.h:341
void ClearComposition()
Dismiss the composition window/IME without disabling the subsystem.
Definition: SDL3pp_keyboard.h:331
void StartTextInput()
Start accepting Unicode text input events in a window.
Definition: SDL3pp_keyboard.h:226
bool IsTextInputActive() const
Check whether or not Unicode text input events are enabled for a window.
Definition: SDL3pp_keyboard.h:321
void StopTextInput()
Stop receiving any text input events in a window.
Definition: SDL3pp_keyboard.h:326
bool IsScreenKeyboardShown() const
Check whether the screen keyboard is shown for given window.
Definition: SDL3pp_keyboard.h:364
void SetTextInputArea(const RectRaw &rect, int cursor)
Set the area used to type Unicode text input.
Definition: SDL3pp_keyboard.h:336
bool GetRelativeMouseMode() const
Query whether relative mouse mode is enabled for a window.
Definition: SDL3pp_mouse.h:843
void SetRelativeMouseMode(bool enabled)
Set relative mouse mode for a window.
Definition: SDL3pp_mouse.h:838
void WarpMouse(const FPointRaw &p)
Move the mouse cursor to the given position within the window.
Definition: SDL3pp_mouse.h:764
std::unique_ptr< T, PtrDeleter > OwnPtr
Handle to an owned SDL memory allocated pointer.
Definition: SDL3pp_ownPtr.h:33
SDL_FPoint FPointRaw
Alias to raw representation for FPoint.
Definition: SDL3pp_rect.h:28
SDL_Rect RectRaw
Alias to raw representation for Rect.
Definition: SDL3pp_rect.h:34
SDL_Point PointRaw
Alias to raw representation for Point.
Definition: SDL3pp_rect.h:22
RendererRef GetRenderer() const
Get the renderer associated with a window.
Definition: SDL3pp_render.h:4326
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition: SDL3pp_stdinc.h:341
::Uint64 Uint64
An unsigned 64-bit integer type.
Definition: SDL3pp_stdinc.h:371
void(SDLCALL *)() FunctionPointer
A generic function pointer.
Definition: SDL3pp_stdinc.h:6388
void SetProgressState(ProgressState state)
Sets the state of the progress bar for the given window’s taskbar icon.
Definition: SDL3pp_video.h:7029
void DisableScreenSaver()
Prevent the screen from being blanked by a screen saver.
Definition: SDL3pp_video.h:7173
constexpr GLContextFlag GL_CONTEXT_RESET_ISOLATION_FLAG
RESET_ISOLATION_FLAG.
Definition: SDL3pp_video.h:3733
Rect GetBounds() const
Get the desktop area represented by a display.
Definition: SDL3pp_video.h:3982
void SetWindowSurfaceVSync(WindowParam window, int vsync)
Toggle VSync for the window surface.
Definition: SDL3pp_video.h:6375
void GetMaximumSize(int *w, int *h) const
Get the maximum size of a window's client area.
Definition: SDL3pp_video.h:5919
float GetPixelDensity() const
Get the pixel density of a window.
Definition: SDL3pp_video.h:4341
void SetHitTest(HitTest callback, void *callback_data)
Provide a callback that decides if a window region has special properties.
Definition: SDL3pp_video.h:6945
Rect GetWindowSafeArea(WindowParam window)
Get the safe area for this window.
Definition: SDL3pp_video.h:5629
constexpr int WINDOWPOS_CENTERED
Used to indicate that the window position should be centered.
Definition: SDL3pp_video.h:3295
SDL_DisplayOrientation DisplayOrientation
Display orientation values; the way a display is rotated.
Definition: SDL3pp_video.h:123
constexpr GLAttr GL_CONTEXT_RELEASE_BEHAVIOR
sets context the release behavior.
Definition: SDL3pp_video.h:3684
void GetMinimumSize(int *w, int *h) const
Get the minimum size of a window's client area.
Definition: SDL3pp_video.h:5868
Rect GetWindowRect(WindowParam window)
Get the position and client size of a window.
Definition: SDL3pp_video.h:5605
void SetFocusable(bool focusable)
Set whether the window may have input focus.
Definition: SDL3pp_video.h:6817
void GL_SetSwapInterval(int interval)
Set the swap interval for the current OpenGL context.
Definition: SDL3pp_video.h:7576
constexpr HitTestResult HITTEST_DRAGGABLE
Region can drag entire window.
Definition: SDL3pp_video.h:679
constexpr HitTestResult HITTEST_RESIZE_BOTTOMLEFT
Region is the resizable bottom-left corner border.
Definition: SDL3pp_video.h:703
SDL_GLAttr GLAttr
An enumeration of OpenGL configuration attributes.
Definition: SDL3pp_video.h:3567
DisplayOrientation GetNaturalDisplayOrientation(DisplayID displayID)
Get the orientation of a display when it is unrotated.
Definition: SDL3pp_video.h:4034
void GL_DestroyContext(GLContextRaw context)
Delete an OpenGL context.
Definition: SDL3pp_video.h:7640
constexpr FlashOperation FLASH_CANCEL
Cancel any window flash state.
Definition: SDL3pp_video.h:655
int GetWindowSurfaceVSync(WindowParam window)
Get VSync for the window surface.
Definition: SDL3pp_video.h:6403
DisplayMode GetClosestFullscreenDisplayMode(Display displayID, const PointRaw &size, float refresh_rate, bool include_high_density_modes)
Get the closest match to the requested display mode.
Definition: SDL3pp_video.h:4162
void UpdateSurface()
Copy the window surface to the screen.
Definition: SDL3pp_video.h:6438
OwnArray< DisplayMode * > GetFullscreenModes() const
Get a list of fullscreen display modes available on a display.
Definition: SDL3pp_video.h:4131
constexpr bool WINDOWPOS_ISUNDEFINED(int X)
A macro to test if the window position is marked as "undefined.".
Definition: SDL3pp_video.h:3252
constexpr SystemTheme SYSTEM_THEME_LIGHT
Light colored system theme.
Definition: SDL3pp_video.h:521
constexpr WindowFlags WINDOW_MAXIMIZED
window is maximized
Definition: SDL3pp_video.h:582
void EnableScreenSaver()
Allow the screen to be blanked by a screen saver.
Definition: SDL3pp_video.h:7153
void SetRect(Rect rect)
Request the window's position and size to be set.
Definition: SDL3pp_video.h:5589
void GL_GetSwapInterval(int *interval)
Get the swap interval for the current OpenGL context.
Definition: SDL3pp_video.h:7599
void SetAspectRatio(float min_aspect, float max_aspect)
Request that the aspect ratio of a window's client area be set.
Definition: SDL3pp_video.h:5685
void UpdateWindowSurfaceRects(WindowParam window, SpanRef< const RectRaw > rects)
Copy areas of the window surface to the screen.
Definition: SDL3pp_video.h:6465
void SetMinimumSize(const PointRaw &p)
Set the minimum size of a window's client area.
Definition: SDL3pp_video.h:5841
void SetWindowIcon(WindowParam window, SurfaceParam icon)
Set the icon for a window.
Definition: SDL3pp_video.h:5350
Window CreateWindowWithProperties(PropertiesParam props)
Create a window with the specified properties.
Definition: SDL3pp_video.h:4817
constexpr GLAttr GL_FRAMEBUFFER_SRGB_CAPABLE
requests sRGB-capable visual if 1.
Definition: SDL3pp_video.h:3678
constexpr GLAttr GL_MULTISAMPLESAMPLES
the number of samples used around the current pixel used for multisample anti-aliasing.
Definition: SDL3pp_video.h:3642
constexpr SystemTheme SYSTEM_THEME_DARK
Dark colored system theme.
Definition: SDL3pp_video.h:524
WindowID GetID() const
Get the numeric ID of a window.
Definition: SDL3pp_video.h:5066
float GetDisplayScale() const
Get the content display scale relative to a window's pixel size.
Definition: SDL3pp_video.h:4372
Uint64 WindowFlags
The flags on a window.
Definition: SDL3pp_video.h:556
bool GetWindowMouseGrab(WindowParam window)
Get a window's mouse grab mode.
Definition: SDL3pp_video.h:6599
constexpr WindowFlags WINDOW_UTILITY
window should be treated as a utility window, not showing in the task bar and window list
Definition: SDL3pp_video.h:615
constexpr WindowFlags WINDOW_MOUSE_FOCUS
window has mouse focus
Definition: SDL3pp_video.h:591
constexpr GLAttr GL_STENCIL_SIZE
the minimum number of bits in the stencil buffer; defaults to 0.
Definition: SDL3pp_video.h:3606
void SetWindowPosition(WindowParam window, const PointRaw &p)
Request that the window's position be set.
Definition: SDL3pp_video.h:5395
void Restore()
Request that the size and position of a minimized or maximized window be restored.
Definition: SDL3pp_video.h:6216
void GetWindowPosition(WindowParam window, int *x, int *y)
Get the position of a window.
Definition: SDL3pp_video.h:5427
SDL_Window * WindowRaw
Alias to raw representation for Window.
Definition: SDL3pp_video.h:47
void SetWindowFullscreenMode(WindowParam window, OptionalRef< const DisplayMode > mode)
Set the display mode to use when a window is visible and fullscreen.
Definition: SDL3pp_video.h:4408
WindowRef GetWindowParent(WindowParam window)
Get parent of a window.
Definition: SDL3pp_video.h:5107
EGLSurface GetEGLSurface()
Get the EGL surface associated with the window.
Definition: SDL3pp_video.h:7511
void SetWindowSize(WindowParam window, const PointRaw &size)
Request that the size of a window's client area be set.
Definition: SDL3pp_video.h:5501
PropertiesRef GetProperties() const
Get the properties associated with a display.
Definition: SDL3pp_video.h:3911
Uint32 GLContextReleaseFlag
Possible values to be set for the GL_CONTEXT_RELEASE_BEHAVIOR attribute.
Definition: SDL3pp_video.h:3741
constexpr WindowFlags WINDOW_TRANSPARENT
window with transparent buffer
Definition: SDL3pp_video.h:642
void DestroySurface()
Destroy the surface associated with the window.
Definition: SDL3pp_video.h:6494
Point GetSize() const
Get the size of a window's client area.
Definition: SDL3pp_video.h:5569
SDL_ProgressState ProgressState
Window progress state.
Definition: SDL3pp_video.h:753
DisplayMode GetClosestFullscreenMode(const PointRaw &size, float refresh_rate, bool include_high_density_modes) const
Get the closest match to the requested display mode.
Definition: SDL3pp_video.h:4178
const DisplayMode & GetDesktopDisplayMode(DisplayID displayID)
Get information about the desktop's display mode.
Definition: SDL3pp_video.h:4206
FunctionPointer EGL_GetProcAddress(StringParam proc)
Get an EGL library function by name.
Definition: SDL3pp_video.h:7276
constexpr GLProfile GL_CONTEXT_PROFILE_CORE
OpenGL Core Profile context.
Definition: SDL3pp_video.h:3707
constexpr DisplayOrientation ORIENTATION_UNKNOWN
The display orientation can't be determined.
Definition: SDL3pp_video.h:125
constexpr int WINDOWPOS_UNDEFINED_MASK
A magic value used with WINDOWPOS_UNDEFINED.
Definition: SDL3pp_video.h:3213
void FlashWindow(WindowParam window, FlashOperation operation)
Request a window to demand attention from the user.
Definition: SDL3pp_video.h:7000
static WindowRef GetGrabbed()
Get the window that currently has an input grab enabled.
Definition: SDL3pp_video.h:6623
void GL_SwapWindow(WindowParam window)
Update a window with OpenGL rendering.
Definition: SDL3pp_video.h:7621
constexpr int WINDOW_SURFACE_VSYNC_ADAPTIVE
Constant to enable adaptive vsync.
Definition: SDL3pp_video.h:6389
void GetWindowAspectRatio(WindowParam window, float *min_aspect, float *max_aspect)
Get the aspect ratio of a window's client area.
Definition: SDL3pp_video.h:5706
constexpr HitTestResult HITTEST_RESIZE_TOPRIGHT
Region is the resizable top-right corner border.
Definition: SDL3pp_video.h:689
constexpr GLAttr GL_CONTEXT_MAJOR_VERSION
OpenGL context major version.
Definition: SDL3pp_video.h:3653
constexpr HitTestResult HITTEST_NORMAL
Region is normal. No special properties.
Definition: SDL3pp_video.h:676
void GL_Swap()
Update a window with OpenGL rendering.
Definition: SDL3pp_video.h:7626
void SetPosition(const PointRaw &p)
Request that the window's position be set.
Definition: SDL3pp_video.h:5400
constexpr ProgressState PROGRESS_STATE_PAUSED
The progress bar is shown in a paused state.
Definition: SDL3pp_video.h:769
Surface GetSurface()
Get the SDL surface associated with the window.
Definition: SDL3pp_video.h:6347
constexpr GLContextFlag GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
FORWARD_COMPATIBLE_FLAG.
Definition: SDL3pp_video.h:3727
constexpr int WINDOWPOS_UNDEFINED_DISPLAY(int X)
Used to indicate that you don't care what the window position is.
Definition: SDL3pp_video.h:3227
WindowRef GL_GetCurrentWindow()
Get the currently active OpenGL window.
Definition: SDL3pp_video.h:7449
constexpr GLAttr GL_RETAINED_BACKING
not used (deprecated).
Definition: SDL3pp_video.h:3650
Rect GetDisplayUsableBounds(Display displayID)
Get the usable desktop area represented by a display, in screen coordinates.
Definition: SDL3pp_video.h:4009
Display GetDisplay() const
Get the display associated with a window.
Definition: SDL3pp_video.h:4314
constexpr HitTestResult HITTEST_RESIZE_RIGHT
Region is the resizable right border.
Definition: SDL3pp_video.h:693
float GetContentScale() const
Get the content scale of a display.
Definition: SDL3pp_video.h:4097
float GetOpacity() const
Get the opacity of a window.
Definition: SDL3pp_video.h:6728
constexpr FlashOperation FLASH_BRIEFLY
Flash the window briefly to get attention.
Definition: SDL3pp_video.h:658
void DestroyWindowSurface(WindowParam window)
Destroy the surface associated with the window.
Definition: SDL3pp_video.h:6489
void SetFillDocument(bool fill)
Set the window to fill the current document space (Emscripten only).
Definition: SDL3pp_video.h:6043
void GL_UnloadLibrary()
Unload the OpenGL library previously loaded by GL_LoadLibrary().
Definition: SDL3pp_video.h:7290
bool GetWindowKeyboardGrab(WindowParam window)
Get a window's keyboard grab mode.
Definition: SDL3pp_video.h:6574
constexpr GLAttr GL_STEREO
whether the output is stereo 3D; defaults to off.
Definition: SDL3pp_video.h:3632
constexpr GLAttr GL_CONTEXT_MINOR_VERSION
OpenGL context minor version.
Definition: SDL3pp_video.h:3656
constexpr GLAttr GL_CONTEXT_PROFILE_MASK
type of GL context (Core, Compatibility, ES).
Definition: SDL3pp_video.h:3669
DisplayOrientation GetCurrentDisplayOrientation(DisplayID displayID)
Get the orientation of a display.
Definition: SDL3pp_video.h:4057
constexpr GLAttr GL_RED_SIZE
the minimum number of bits for the red channel of the color buffer; defaults to 8.
Definition: SDL3pp_video.h:3573
Display GetDisplayForRect(const RectRaw &rect)
Get the display primarily containing a rect.
Definition: SDL3pp_video.h:4284
constexpr WindowFlags WINDOW_MOUSE_GRABBED
window has grabbed mouse input
Definition: SDL3pp_video.h:585
bool ScreenSaverEnabled()
Check whether the screensaver is currently enabled.
Definition: SDL3pp_video.h:7139
EGLint *(SDLCALL *)(void *userdata, EGLDisplay display, EGLConfig config) EGLIntArrayCallback
EGL surface/context attribute initialization callback types.
Definition: SDL3pp_video.h:3548
Display GetDisplayForPoint(const PointRaw &point)
Get the display containing a point.
Definition: SDL3pp_video.h:4259
constexpr GLAttr GL_GREEN_SIZE
the minimum number of bits for the green channel of the color buffer; defaults to 8.
Definition: SDL3pp_video.h:3579
FunctionPointer GL_GetProcAddress(StringParam proc)
Get an OpenGL function by name.
Definition: SDL3pp_video.h:7254
constexpr GLAttr GL_CONTEXT_RESET_NOTIFICATION
set context reset notification.
Definition: SDL3pp_video.h:3690
Window CreateWindow(StringParam title, const PointRaw &size, WindowFlags flags)
Create a window with the specified dimensions and flags.
Definition: SDL3pp_video.h:4587
SDL_DisplayID DisplayID
Alias to raw representation for Display.
Definition: SDL3pp_video.h:38
constexpr GLProfile GL_CONTEXT_PROFILE_COMPATIBILITY
OpenGL Compatibility Profile context.
Definition: SDL3pp_video.h:3710
float GetDisplayContentScale(DisplayID displayID)
Get the content scale of a display.
Definition: SDL3pp_video.h:4092
GLContext GL_CreateContext(WindowParam window)
Create an OpenGL context for an OpenGL window, and make it current.
Definition: SDL3pp_video.h:7401
void SetWindowMinimumSize(WindowParam window, const PointRaw &p)
Set the minimum size of a window's client area.
Definition: SDL3pp_video.h:5836
SDL_DisplayMode DisplayMode
The structure that defines a display mode.
Definition: SDL3pp_video.h:159
void EGL_SetAttributeCallbacks(EGLAttribArrayCallback platformAttribCallback, EGLIntArrayCallback surfaceAttribCallback, EGLIntArrayCallback contextAttribCallback, void *userdata)
Sets the callbacks for defining custom EGLAttrib arrays for EGL initialization.
Definition: SDL3pp_video.h:7536
GLContext CreateGLContext()
Create an OpenGL context for an OpenGL window, and make it current.
Definition: SDL3pp_video.h:7406
const DisplayMode & GetCurrentDisplayMode(DisplayID displayID)
Get information about the current display mode.
Definition: SDL3pp_video.h:4235
void Flash(FlashOperation operation)
Request a window to demand attention from the user.
Definition: SDL3pp_video.h:7005
SDL_HitTestResult HitTestResult
Possible return values from the HitTest callback.
Definition: SDL3pp_video.h:674
Rect GetDisplayBounds(Display displayID)
Get the desktop area represented by a display.
Definition: SDL3pp_video.h:3975
void SetWindowAspectRatio(WindowParam window, float min_aspect, float max_aspect)
Request that the aspect ratio of a window's client area be set.
Definition: SDL3pp_video.h:5678
constexpr WindowFlags WINDOW_METAL
window usable for Metal view
Definition: SDL3pp_video.h:639
constexpr WindowFlags WINDOW_MINIMIZED
window is minimized
Definition: SDL3pp_video.h:579
constexpr GLAttr GL_ACCUM_ALPHA_SIZE
the minimum number of bits for the alpha channel of the accumulation buffer; defaults to 0.
Definition: SDL3pp_video.h:3630
constexpr int WINDOW_SURFACE_VSYNC_DISABLED
Constant to disable vsync.
Definition: SDL3pp_video.h:6386
bool GetMouseGrab() const
Get a window's mouse grab mode.
Definition: SDL3pp_video.h:6604
constexpr DisplayOrientation ORIENTATION_PORTRAIT
The display is in portrait mode.
Definition: SDL3pp_video.h:141
float GetWindowPixelDensity(WindowParam window)
Get the pixel density of a window.
Definition: SDL3pp_video.h:4336
constexpr GLAttr GL_ACCUM_RED_SIZE
the minimum number of bits for the red channel of the accumulation buffer; defaults to 0.
Definition: SDL3pp_video.h:3612
OwnArray< DisplayMode * > GetFullscreenDisplayModes(Display displayID)
Get a list of fullscreen display modes available on a display.
Definition: SDL3pp_video.h:4124
const DisplayMode & GetWindowFullscreenMode(WindowParam window)
Query the display mode to use when a window is visible at fullscreen.
Definition: SDL3pp_video.h:4433
void SetWindowFullscreen(WindowParam window, bool fullscreen)
Request that the window's fullscreen state be changed.
Definition: SDL3pp_video.h:6247
void SetKeyboardGrab(bool grabbed)
Set a window's keyboard grab mode.
Definition: SDL3pp_video.h:6530
SDL_SystemTheme SystemTheme
System theme.
Definition: SDL3pp_video.h:516
void RestoreWindow(WindowParam window)
Request that the size and position of a minimized or maximized window be restored.
Definition: SDL3pp_video.h:6211
ProgressState GetProgressState()
Get the state of the progress bar for the given window’s taskbar icon.
Definition: SDL3pp_video.h:7050
constexpr WindowFlags WINDOW_HIGH_PIXEL_DENSITY
window uses high pixel density back buffer if possible
Definition: SDL3pp_video.h:600
float GetProgressValue()
Get the value of the progress bar for the given window’s taskbar icon.
Definition: SDL3pp_video.h:7093
constexpr ProgressState PROGRESS_STATE_INVALID
An invalid progress state indicating an error; check GetError()
Definition: SDL3pp_video.h:756
constexpr GLAttr GL_CONTEXT_FLAGS
some combination of 0 or more of elements of the GLContextFlag enumeration; defaults to 0.
Definition: SDL3pp_video.h:3663
void SetAlwaysOnTop(bool on_top)
Set the window to always be above the others.
Definition: SDL3pp_video.h:6003
void SetWindowShape(WindowParam window, SurfaceParam shape)
Set the shape of a transparent window.
Definition: SDL3pp_video.h:6979
constexpr GLProfile GL_CONTEXT_PROFILE_ES
GLX_CONTEXT_ES2_PROFILE_BIT_EXT.
Definition: SDL3pp_video.h:3714
constexpr GLAttr GL_DOUBLEBUFFER
whether the output is single or double buffered; defaults to double buffering on.
Definition: SDL3pp_video.h:3600
float GetWindowDisplayScale(WindowParam window)
Get the content display scale relative to a window's pixel size.
Definition: SDL3pp_video.h:4367
Display GetPrimaryDisplay()
Return the primary display.
Definition: SDL3pp_video.h:3863
SDL_DisplayModeData DisplayModeData
Internal display mode data.
Definition: SDL3pp_video.h:536
constexpr HitTestResult HITTEST_RESIZE_LEFT
Region is the resizable left border.
Definition: SDL3pp_video.h:707
Point GetPosition() const
Get the position of a window.
Definition: SDL3pp_video.h:5463
void SetWindowBordered(WindowParam window, bool bordered)
Set the border state of a window.
Definition: SDL3pp_video.h:5943
float GetWindowOpacity(WindowParam window)
Get the opacity of a window.
Definition: SDL3pp_video.h:6723
PixelFormat GetWindowPixelFormat(WindowParam window)
Get the pixel format associated with the window.
Definition: SDL3pp_video.h:4476
void GL_GetAttribute(GLAttr attr, int *value)
Get the actual value for an attribute from the current context.
Definition: SDL3pp_video.h:7368
void Show()
Show a window.
Definition: SDL3pp_video.h:6068
HitTestResult(SDLCALL *)(WindowRaw win, const PointRaw *area, void *data) HitTest
Callback used for hit-testing.
Definition: SDL3pp_video.h:722
void MakeCurrent(GLContext context)
Set up an OpenGL context for rendering into an OpenGL window.
Definition: SDL3pp_video.h:7428
PropertiesRef GetDisplayProperties(DisplayID displayID)
Get the properties associated with a display.
Definition: SDL3pp_video.h:3906
void SetWindowHitTest(WindowParam window, HitTest callback, void *callback_data)
Provide a callback that decides if a window region has special properties.
Definition: SDL3pp_video.h:6893
void Minimize()
Request that the window be minimized to an iconic representation.
Definition: SDL3pp_video.h:6182
void MaximizeWindow(WindowParam window)
Request that the window be made as large as possible.
Definition: SDL3pp_video.h:6144
constexpr WindowFlags WINDOW_FILL_DOCUMENT
window is in fill-document mode (Emscripten only), since SDL 3.4.0
Definition: SDL3pp_video.h:632
void GL_SetAttribute(GLAttr attr, int value)
Set an OpenGL window attribute before window creation.
Definition: SDL3pp_video.h:7349
void SetSize(const PointRaw &size)
Request that the size of a window's client area be set.
Definition: SDL3pp_video.h:5506
const char * GetCurrentVideoDriver()
Get the name of the currently initialized video driver.
Definition: SDL3pp_video.h:3817
Point GetSizeInPixels() const
Get the size of a window's client area, in pixels.
Definition: SDL3pp_video.h:5817
constexpr GLAttr GL_MULTISAMPLEBUFFERS
the number of buffers used for multisample anti-aliasing; defaults to 0.
Definition: SDL3pp_video.h:3636
PropertiesRef GetProperties() const
Get the properties associated with a window.
Definition: SDL3pp_video.h:5246
void ShowSystemMenu(const PointRaw &p)
Display the system-level window menu.
Definition: SDL3pp_video.h:6847
const DisplayMode & GetCurrentMode() const
Get information about the current display mode.
Definition: SDL3pp_video.h:4240
constexpr GLAttr GL_ALPHA_SIZE
the minimum number of bits for the alpha channel of the color buffer; defaults to 8.
Definition: SDL3pp_video.h:3591
constexpr WindowFlags WINDOW_MODAL
window is modal
Definition: SDL3pp_video.h:597
int GetNumVideoDrivers()
Get the number of video drivers compiled into SDL.
Definition: SDL3pp_video.h:3773
void SetWindowMouseRect(WindowParam window, const RectRaw &rect)
Confines the cursor to the specified area of a window.
Definition: SDL3pp_video.h:6644
bool GL_ExtensionSupported(StringParam extension)
Check if an OpenGL extension is supported for the current context.
Definition: SDL3pp_video.h:7312
constexpr WindowFlags WINDOW_INPUT_FOCUS
window has input focus
Definition: SDL3pp_video.h:588
void SetWindowRect(WindowParam window, Rect rect)
Request the window's position and size to be set.
Definition: SDL3pp_video.h:5583
int GetSurfaceVSync() const
Get VSync for the window surface.
Definition: SDL3pp_video.h:6410
void SetOpacity(float opacity)
Set the opacity for a window.
Definition: SDL3pp_video.h:6702
constexpr GLAttr GL_ACCUM_GREEN_SIZE
the minimum number of bits for the green channel of the accumulation buffer; defaults to 0.
Definition: SDL3pp_video.h:3618
constexpr GLContextFlag GL_CONTEXT_DEBUG_FLAG
DEBUG_FLAG.
Definition: SDL3pp_video.h:3724
Uint32 GLContextFlag
Possible flags to be set for the GL_CONTEXT_FLAGS attribute.
Definition: SDL3pp_video.h:3722
SDL_WindowID WindowID
This is a unique ID for a window.
Definition: SDL3pp_video.h:488
const char * GetName() const
Get the name of a display in UTF-8 encoding.
Definition: SDL3pp_video.h:3953
void SetWindowResizable(WindowParam window, bool resizable)
Set the user-resizable state of a window.
Definition: SDL3pp_video.h:5972
float GetWindowProgressValue(WindowParam window)
Get the value of the progress bar for the given window’s taskbar icon.
Definition: SDL3pp_video.h:7088
void SetBordered(bool bordered)
Set the border state of a window.
Definition: SDL3pp_video.h:5948
DisplayOrientation GetNaturalOrientation() const
Get the orientation of a display when it is unrotated.
Definition: SDL3pp_video.h:4039
void ShowWindow(WindowParam window)
Show a window.
Definition: SDL3pp_video.h:6063
void SetTitle(StringParam title)
Set the title of a window.
Definition: SDL3pp_video.h:5300
void SetWindowParent(WindowParam window, WindowParam parent)
Set the window as a child of a parent window.
Definition: SDL3pp_video.h:6764
constexpr HitTestResult HITTEST_RESIZE_TOP
Region is the resizable top border.
Definition: SDL3pp_video.h:686
void ShowWindowSystemMenu(WindowParam window, const PointRaw &p)
Display the system-level window menu.
Definition: SDL3pp_video.h:6842
const char * GetVideoDriver(int index)
Get the name of a built in video driver.
Definition: SDL3pp_video.h:3795
void GetWindowMaximumSize(WindowParam window, int *w, int *h)
Get the maximum size of a window's client area.
Definition: SDL3pp_video.h:5914
EGLSurface EGL_GetWindowSurface(WindowParam window)
Get the EGL surface associated with the window.
Definition: SDL3pp_video.h:7506
constexpr int WINDOWPOS_CENTERED_DISPLAY(int X)
Used to indicate that the window position should be centered.
Definition: SDL3pp_video.h:3281
void Maximize()
Request that the window be made as large as possible.
Definition: SDL3pp_video.h:6149
SDL_EGLSurface EGLSurface
Opaque type for an EGL surface.
Definition: SDL3pp_video.h:744
const char * GetDisplayName(DisplayID displayID)
Get the name of a display in UTF-8 encoding.
Definition: SDL3pp_video.h:3948
SDL_FlashOperation FlashOperation
Window flash operation.
Definition: SDL3pp_video.h:653
constexpr WindowFlags WINDOW_VULKAN
window usable for Vulkan surface
Definition: SDL3pp_video.h:636
Rect GetRect() const
Get the position and client size of a window.
Definition: SDL3pp_video.h:5610
ProgressState GetWindowProgressState(WindowParam window)
Get the state of the progress bar for the given window’s taskbar icon.
Definition: SDL3pp_video.h:7045
bool WindowHasSurface(WindowParam window)
Return whether the window has a surface associated with it.
Definition: SDL3pp_video.h:6305
constexpr HitTestResult HITTEST_RESIZE_TOPLEFT
Region is the resizable top-left corner border.
Definition: SDL3pp_video.h:682
constexpr HitTestResult HITTEST_RESIZE_BOTTOMRIGHT
Region is the resizable bottom-right corner border.
Definition: SDL3pp_video.h:697
SDL_EGLConfig EGLConfig
Opaque type for an EGL config.
Definition: SDL3pp_video.h:3476
constexpr SystemTheme SYSTEM_THEME_UNKNOWN
Unknown system theme.
Definition: SDL3pp_video.h:518
constexpr WindowFlags WINDOW_KEYBOARD_GRABBED
window has grabbed keyboard input
Definition: SDL3pp_video.h:626
constexpr GLAttr GL_BLUE_SIZE
the minimum number of bits for the blue channel of the color buffer; defaults to 8.
Definition: SDL3pp_video.h:3585
constexpr GLAttr GL_EGL_PLATFORM
GL_EGL_PLATFORM.
Definition: SDL3pp_video.h:3698
constexpr WindowFlags WINDOW_BORDERLESS
no window decoration
Definition: SDL3pp_video.h:573
const DisplayMode & GetDesktopMode() const
Get information about the desktop's display mode.
Definition: SDL3pp_video.h:4211
void SetWindowFocusable(WindowParam window, bool focusable)
Set whether the window may have input focus.
Definition: SDL3pp_video.h:6812
SDL_EGLDisplay EGLDisplay
Opaque type for an EGL display.
Definition: SDL3pp_video.h:3469
void GetWindowSizeInPixels(WindowParam window, int *w, int *h)
Get the size of a window's client area, in pixels.
Definition: SDL3pp_video.h:5785
constexpr WindowFlags WINDOW_TOOLTIP
window should be treated as a tooltip and does not get mouse or keyboard focus, requires a parent win...
Definition: SDL3pp_video.h:621
constexpr WindowFlags WINDOW_MOUSE_CAPTURE
window has mouse captured (unrelated to MOUSE_GRABBED)
Definition: SDL3pp_video.h:603
Window CreatePopupWindow(WindowParam parent, const PointRaw &offset, const PointRaw &size, WindowFlags flags)
Create a child popup window of the specified parent window.
Definition: SDL3pp_video.h:4665
void GetWindowBordersSize(WindowParam window, int *top, int *left, int *bottom, int *right)
Get the size of a window's borders (decorations) around the client area.
Definition: SDL3pp_video.h:5751
WindowRef GetGrabbedWindow()
Get the window that currently has an input grab enabled.
Definition: SDL3pp_video.h:6621
void UpdateWindowSurface(WindowParam window)
Copy the window surface to the screen.
Definition: SDL3pp_video.h:6433
constexpr GLAttr GL_BUFFER_SIZE
the minimum number of bits for frame buffer size; defaults to 0.
Definition: SDL3pp_video.h:3594
constexpr DisplayOrientation ORIENTATION_LANDSCAPE
The display is in landscape mode, with the right side up, relative to portrait mode.
Definition: SDL3pp_video.h:132
constexpr DisplayOrientation ORIENTATION_PORTRAIT_FLIPPED
The display is in portrait mode, upside down.
Definition: SDL3pp_video.h:144
constexpr WindowFlags WINDOW_OPENGL
window usable with OpenGL context
Definition: SDL3pp_video.h:561
bool GetKeyboardGrab() const
Get a window's keyboard grab mode.
Definition: SDL3pp_video.h:6579
constexpr ProgressState PROGRESS_STATE_NONE
No progress bar is shown.
Definition: SDL3pp_video.h:758
constexpr GLAttr GL_CONTEXT_NO_ERROR
GL_CONTEXT_NO_ERROR.
Definition: SDL3pp_video.h:3693
const char * GetWindowTitle(WindowParam window)
Get the title of a window.
Definition: SDL3pp_video.h:5317
void SetWindowAlwaysOnTop(WindowParam window, bool on_top)
Set the window to always be above the others.
Definition: SDL3pp_video.h:5998
void GetWindowSize(WindowParam window, int *w, int *h)
Get the size of a window's client area.
Definition: SDL3pp_video.h:5532
SDL_EGLint EGLint
An EGL integer attribute, used when creating an EGL surface.
Definition: SDL3pp_video.h:3490
WindowFlags GetWindowFlags(WindowParam window)
Get the window flags.
Definition: SDL3pp_video.h:5270
constexpr GLContextFlag GL_CONTEXT_ROBUST_ACCESS_FLAG
ROBUST_ACCESS_FLAG.
Definition: SDL3pp_video.h:3730
void SetWindowProgressValue(WindowParam window, float value)
Sets the value of the progress bar for the given window’s taskbar icon.
Definition: SDL3pp_video.h:7067
constexpr DisplayOrientation ORIENTATION_LANDSCAPE_FLIPPED
The display is in landscape mode, with the left side up, relative to portrait mode.
Definition: SDL3pp_video.h:138
Surface GetWindowSurface(WindowParam window)
Get the SDL surface associated with the window.
Definition: SDL3pp_video.h:6342
constexpr int WINDOWPOS_UNDEFINED
Used to indicate that you don't care what the window position/display is.
Definition: SDL3pp_video.h:3241
const char * GetTitle() const
Get the title of a window.
Definition: SDL3pp_video.h:5322
constexpr WindowFlags WINDOW_MOUSE_RELATIVE_MODE
window has relative mode enabled
Definition: SDL3pp_video.h:605
constexpr ProgressState PROGRESS_STATE_NORMAL
The progress bar is shown in a normal state.
Definition: SDL3pp_video.h:766
constexpr WindowFlags WINDOW_OCCLUDED
window is occluded
Definition: SDL3pp_video.h:564
constexpr FlashOperation FLASH_UNTIL_FOCUSED
Flash the window until it gets focus.
Definition: SDL3pp_video.h:661
static Display GetForPoint(const PointRaw &point)
Get the display containing a point.
Definition: SDL3pp_video.h:4264
void SetWindowOpacity(WindowParam window, float opacity)
Set the opacity for a window.
Definition: SDL3pp_video.h:6697
SDL_GLContext GLContextRaw
Alias to raw representation for GLContext.
Definition: SDL3pp_video.h:83
Uint32 GLProfile
Possible values to be set for the GL_CONTEXT_PROFILE_MASK attribute.
Definition: SDL3pp_video.h:3705
void SetMouseRect(const RectRaw &rect)
Confines the cursor to the specified area of a window.
Definition: SDL3pp_video.h:6649
void SetWindowFillDocument(WindowParam window, bool fill)
Set the window to fill the current document space (Emscripten only).
Definition: SDL3pp_video.h:6038
void SetWindowModal(WindowParam window, bool modal)
Toggle the state of the window as modal.
Definition: SDL3pp_video.h:6791
void Destroy()
Destroy a window.
Definition: SDL3pp_video.h:7121
SystemTheme GetSystemTheme()
Get the current system theme.
Definition: SDL3pp_video.h:3831
static Display GetForRect(const RectRaw &rect)
Get the display primarily containing a rect.
Definition: SDL3pp_video.h:4289
DisplayOrientation GetCurrentOrientation() const
Get the orientation of a display.
Definition: SDL3pp_video.h:4062
OwnPtr< void > GetICCProfile() const
Get the raw ICC profile data for the screen the window is currently on.
Definition: SDL3pp_video.h:4460
static WindowRef FromID(WindowID id)
Get a window from a stored ID.
Definition: SDL3pp_video.h:5089
PropertiesRef GetWindowProperties(WindowParam window)
Get the properties associated with a window.
Definition: SDL3pp_video.h:5241
void GetAspectRatio(float *min_aspect, float *max_aspect) const
Get the aspect ratio of a window's client area.
Definition: SDL3pp_video.h:5713
void GetWindowMinimumSize(WindowParam window, int *w, int *h)
Get the minimum size of a window's client area.
Definition: SDL3pp_video.h:5863
constexpr WindowFlags WINDOW_NOT_FOCUSABLE
window should not be focusable
Definition: SDL3pp_video.h:645
constexpr ProgressState PROGRESS_STATE_ERROR
The progress bar is shown in a state indicating the application had an error.
Definition: SDL3pp_video.h:775
void SetWindowKeyboardGrab(WindowParam window, bool grabbed)
Set a window's keyboard grab mode.
Definition: SDL3pp_video.h:6525
constexpr GLContextResetNotification GL_CONTEXT_RESET_NO_NOTIFICATION
NO_NOTIFICATION.
Definition: SDL3pp_video.h:3756
constexpr GLAttr GL_FLOATBUFFERS
GL_FLOATBUFFERS.
Definition: SDL3pp_video.h:3696
void GL_MakeCurrent(WindowParam window, GLContext context)
Set up an OpenGL context for rendering into an OpenGL window.
Definition: SDL3pp_video.h:7423
void Raise()
Request that a window be raised above other windows and gain the input focus.
Definition: SDL3pp_video.h:6111
void SetMaximumSize(const PointRaw &p)
Set the maximum size of a window's client area.
Definition: SDL3pp_video.h:5892
GLContext GL_GetCurrentContext()
Get the currently active OpenGL context.
Definition: SDL3pp_video.h:7466
constexpr WindowFlags WINDOW_RESIZABLE
window can be resized
Definition: SDL3pp_video.h:576
OwnArray< WindowRef > GetWindows()
Get a list of valid windows.
Definition: SDL3pp_video.h:4496
PixelFormat GetPixelFormat() const
Get the pixel format associated with the window.
Definition: SDL3pp_video.h:4481
constexpr WindowFlags WINDOW_POPUP_MENU
window should be treated as a popup menu, requires a parent window
Definition: SDL3pp_video.h:624
void Hide()
Hide a window.
Definition: SDL3pp_video.h:6088
void SetParent(WindowParam parent)
Set the window as a child of a parent window.
Definition: SDL3pp_video.h:6769
constexpr GLContextResetNotification GL_CONTEXT_RESET_LOSE_CONTEXT
LOSE_CONTEXT.
Definition: SDL3pp_video.h:3759
Display GetDisplayForWindow(WindowParam window)
Get the display associated with a window.
Definition: SDL3pp_video.h:4309
void SetModal(bool modal)
Toggle the state of the window as modal.
Definition: SDL3pp_video.h:6796
void GL_ResetAttributes()
Reset all previously set OpenGL context attributes to their default values.
Definition: SDL3pp_video.h:7327
Uint32 GLContextResetNotification
Possible values to be set GL_CONTEXT_RESET_NOTIFICATION attribute.
Definition: SDL3pp_video.h:3754
void Destroy()
Delete an OpenGL context.
Definition: SDL3pp_video.h:7645
constexpr WindowFlags WINDOW_EXTERNAL
window not created by SDL
Definition: SDL3pp_video.h:594
Rect GetSafeArea() const
Get the safe area for this window.
Definition: SDL3pp_video.h:5636
void SetWindowMaximumSize(WindowParam window, const PointRaw &p)
Set the maximum size of a window's client area.
Definition: SDL3pp_video.h:5887
WindowFlags GetFlags() const
Get the window flags.
Definition: SDL3pp_video.h:5275
void SyncWindow(WindowParam window)
Block until any pending window state is finalized.
Definition: SDL3pp_video.h:6285
OwnArray< DisplayID > GetDisplays()
Get a list of currently connected displays.
Definition: SDL3pp_video.h:3843
const RectRaw * GetMouseRect() const
Get the mouse confinement rectangle of a window.
Definition: SDL3pp_video.h:6674
constexpr WindowFlags WINDOW_ALWAYS_ON_TOP
window should always be above others
Definition: SDL3pp_video.h:608
const DisplayMode & GetFullscreenMode() const
Query the display mode to use when a window is visible at fullscreen.
Definition: SDL3pp_video.h:4438
constexpr WindowFlags WINDOW_HIDDEN
window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; Window....
Definition: SDL3pp_video.h:571
constexpr GLAttr GL_SHARE_WITH_CURRENT_CONTEXT
OpenGL context sharing; defaults to 0.
Definition: SDL3pp_video.h:3671
void SetWindowTitle(WindowParam window, StringParam title)
Set the title of a window.
Definition: SDL3pp_video.h:5295
void Sync()
Block until any pending window state is finalized.
Definition: SDL3pp_video.h:6290
WindowID GetWindowID(WindowParam window)
Get the numeric ID of a window.
Definition: SDL3pp_video.h:5061
EGLConfig EGL_GetCurrentConfig()
Get the currently active EGL config.
Definition: SDL3pp_video.h:7493
void HideWindow(WindowParam window)
Hide a window.
Definition: SDL3pp_video.h:6083
static Display GetPrimary()
Return the primary display.
Definition: SDL3pp_video.h:3868
constexpr HitTestResult HITTEST_RESIZE_BOTTOM
Region is the resizable bottom border.
Definition: SDL3pp_video.h:700
OwnPtr< void > GetWindowICCProfile(WindowParam window)
Get the raw ICC profile data for the screen the window is currently on.
Definition: SDL3pp_video.h:4454
void RaiseWindow(WindowParam window)
Request that a window be raised above other windows and gain the input focus.
Definition: SDL3pp_video.h:6106
bool HasSurface() const
Return whether the window has a surface associated with it.
Definition: SDL3pp_video.h:6310
Rect GetUsableBounds() const
Get the usable desktop area represented by a display, in screen coordinates.
Definition: SDL3pp_video.h:4016
void SetResizable(bool resizable)
Set the user-resizable state of a window.
Definition: SDL3pp_video.h:5977
void DestroyWindow(WindowRaw window)
Destroy a window.
Definition: SDL3pp_video.h:7119
constexpr GLAttr GL_ACCUM_BLUE_SIZE
the minimum number of bits for the blue channel of the accumulation buffer; defaults to 0.
Definition: SDL3pp_video.h:3624
const RectRaw * GetWindowMouseRect(WindowParam window)
Get the mouse confinement rectangle of a window.
Definition: SDL3pp_video.h:6669
WindowRef GetWindowFromID(WindowID id)
Get a window from a stored ID.
Definition: SDL3pp_video.h:5084
void GetBordersSize(int *top, int *left, int *bottom, int *right) const
Get the size of a window's borders (decorations) around the client area.
Definition: SDL3pp_video.h:5760
constexpr WindowFlags WINDOW_FULLSCREEN
window is in fullscreen mode
Definition: SDL3pp_video.h:558
void UpdateSurfaceRects(SpanRef< const RectRaw > rects)
Copy areas of the window surface to the screen.
Definition: SDL3pp_video.h:6471
constexpr GLContextReleaseFlag GL_CONTEXT_RELEASE_BEHAVIOR_NONE
BEHAVIOR_NONE.
Definition: SDL3pp_video.h:3743
void SetShape(SurfaceParam shape)
Set the shape of a transparent window.
Definition: SDL3pp_video.h:6984
WindowRef GetParent() const
Get parent of a window.
Definition: SDL3pp_video.h:5112
SDL_EGLAttrib EGLAttrib
An EGL attribute, used when creating an EGL context.
Definition: SDL3pp_video.h:3483
void GL_LoadLibrary(StringParam path)
Dynamically load an OpenGL library.
Definition: SDL3pp_video.h:7196
void SetFullscreen(bool fullscreen)
Request that the window's fullscreen state be changed.
Definition: SDL3pp_video.h:6252
void MakeCurrent(WindowParam window)
Set up an OpenGL context for rendering into an OpenGL window.
Definition: SDL3pp_video.h:7433
void SetFullscreenMode(OptionalRef< const DisplayMode > mode)
Set the display mode to use when a window is visible and fullscreen.
Definition: SDL3pp_video.h:4414
constexpr GLAttr GL_DEPTH_SIZE
the minimum number of bits in the depth buffer; defaults to 16.
Definition: SDL3pp_video.h:3603
void SetWindowProgressState(WindowParam window, ProgressState state)
Sets the state of the progress bar for the given window’s taskbar icon.
Definition: SDL3pp_video.h:7024
void SetIcon(SurfaceParam icon)
Set the icon for a window.
Definition: SDL3pp_video.h:5355
constexpr int WINDOWPOS_CENTERED_MASK
A magic value used with WINDOWPOS_CENTERED.
Definition: SDL3pp_video.h:3267
EGLDisplay EGL_GetCurrentDisplay()
Get the currently active EGL display.
Definition: SDL3pp_video.h:7478
void SetProgressValue(float value)
Sets the value of the progress bar for the given window’s taskbar icon.
Definition: SDL3pp_video.h:7072
constexpr ProgressState PROGRESS_STATE_INDETERMINATE
The progress bar is shown in a indeterminate state.
Definition: SDL3pp_video.h:762
void SetMouseGrab(bool grabbed)
Set a window's mouse grab mode.
Definition: SDL3pp_video.h:6557
void MinimizeWindow(WindowParam window)
Request that the window be minimized to an iconic representation.
Definition: SDL3pp_video.h:6177
constexpr GLContextReleaseFlag GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH
BEHAVIOR_FLUSH.
Definition: SDL3pp_video.h:3746
void SetSurfaceVSync(int vsync)
Toggle VSync for the window surface.
Definition: SDL3pp_video.h:6380
constexpr GLAttr GL_ACCELERATED_VISUAL
set to 1 to require hardware acceleration, set to 0 to force software rendering; defaults to allow ei...
Definition: SDL3pp_video.h:3648
void SetWindowMouseGrab(WindowParam window, bool grabbed)
Set a window's mouse grab mode.
Definition: SDL3pp_video.h:6552
EGLAttrib *(SDLCALL *)(void *userdata) EGLAttribArrayCallback
EGL platform attribute initialization callback.
Definition: SDL3pp_video.h:3515
constexpr bool WINDOWPOS_ISCENTERED(int X)
A macro to test if the window position is marked as "centered.".
Definition: SDL3pp_video.h:3306
Main include header for the SDL3pp library.
Safely wrap GLContext for non owning parameters.
Definition: SDL3pp_video.h:90
constexpr GLContextParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_video.h:100
GLContextRaw value
parameter's GLContextRaw
Definition: SDL3pp_video.h:91
constexpr GLContextParam(GLContextRaw value)
Constructs from GLContextRaw.
Definition: SDL3pp_video.h:94
constexpr auto operator<=>(const GLContextParam &other) const =default
Comparison.
RAII owning version GLContext.
Definition: SDL3pp_video.h:3449
constexpr GLContextScoped(GLContext &&other) noexcept
Move constructor.
Definition: SDL3pp_video.h:3455
~GLContextScoped()
Destructor.
Definition: SDL3pp_video.h:3461
Definition: SDL3pp_callbackWrapper.h:197
The structure that defines a point (using integers).
Definition: SDL3pp_rect.h:83
Safely wrap Properties for non owning parameters.
Definition: SDL3pp_properties.h:53
Semi-safe reference for Properties.
Definition: SDL3pp_properties.h:716
A rectangle, with the origin at the upper left (using integers).
Definition: SDL3pp_rect.h:845
constexpr Point GetTopLeft() const
Get top left corner of the rect.
Definition: SDL3pp_rect.h:1094
constexpr Point GetSize() const
Get size of the rect.
Definition: SDL3pp_rect.h:1126
Semi-safe reference for Renderer.
Definition: SDL3pp_render.h:2419
Safely wrap Surface for non owning parameters.
Definition: SDL3pp_surface.h:53
Safely wrap Window for non owning parameters.
Definition: SDL3pp_video.h:54
constexpr WindowParam(WindowRaw value)
Constructs from WindowRaw.
Definition: SDL3pp_video.h:58
constexpr auto operator<=>(const WindowParam &other) const =default
Comparison.
WindowRaw value
parameter's WindowRaw
Definition: SDL3pp_video.h:55
constexpr WindowParam(std::nullptr_t=nullptr)
Constructs null/invalid.
Definition: SDL3pp_video.h:64
Semi-safe reference for Window.
Definition: SDL3pp_video.h:3169
~WindowRef()
Destructor.
Definition: SDL3pp_video.h:3200
constexpr WindowRef(const WindowRef &other) noexcept=default
Copy constructor.
WindowRef(WindowRaw resource) noexcept
Constructs from WindowParam.
Definition: SDL3pp_video.h:3191
WindowRef(WindowParam resource) noexcept
Constructs from WindowParam.
Definition: SDL3pp_video.h:3179