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 = {})
182 : m_displayID(displayID)
183 {
184 }
185
191 constexpr operator DisplayID() const { 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
267
280 const char* GetName() const;
281
298 Rect GetBounds() const;
299
322 Rect GetUsableBounds() const;
323
337
351
376 float GetContentScale() const;
377
400
427 float refresh_rate,
428 bool include_high_density_modes) const;
429
448 const DisplayMode& GetDesktopMode() const;
449
468 const DisplayMode& GetCurrentMode() const;
469};
470
478using WindowID = SDL_WindowID;
479
480namespace prop::Global {
481
494constexpr auto VIDEO_WAYLAND_WL_DISPLAY_POINTER =
495 SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER;
496
497} // namespace prop::Global
498
504using SystemTheme = SDL_SystemTheme;
505
507 SDL_SYSTEM_THEME_UNKNOWN;
508
510 SDL_SYSTEM_THEME_LIGHT;
511
513 SDL_SYSTEM_THEME_DARK;
514
524using DisplayModeData = SDL_DisplayModeData;
525
539
541 SDL_WINDOW_FULLSCREEN;
542
544 SDL_WINDOW_OPENGL;
545
547 SDL_WINDOW_OCCLUDED;
548
553constexpr WindowFlags WINDOW_HIDDEN = SDL_WINDOW_HIDDEN;
554
556 SDL_WINDOW_BORDERLESS;
557
559 SDL_WINDOW_RESIZABLE;
560
562 SDL_WINDOW_MINIMIZED;
563
565 SDL_WINDOW_MAXIMIZED;
566
568 SDL_WINDOW_MOUSE_GRABBED;
569
571 SDL_WINDOW_INPUT_FOCUS;
572
574 SDL_WINDOW_MOUSE_FOCUS;
575
577 SDL_WINDOW_EXTERNAL;
578
579constexpr WindowFlags WINDOW_MODAL = SDL_WINDOW_MODAL;
580
582constexpr WindowFlags WINDOW_HIGH_PIXEL_DENSITY = SDL_WINDOW_HIGH_PIXEL_DENSITY;
583
585constexpr WindowFlags WINDOW_MOUSE_CAPTURE = SDL_WINDOW_MOUSE_CAPTURE;
586
588 SDL_WINDOW_MOUSE_RELATIVE_MODE;
589
591 SDL_WINDOW_ALWAYS_ON_TOP;
592
597constexpr WindowFlags WINDOW_UTILITY = SDL_WINDOW_UTILITY;
598
603constexpr WindowFlags WINDOW_TOOLTIP = SDL_WINDOW_TOOLTIP;
604
606constexpr WindowFlags WINDOW_POPUP_MENU = SDL_WINDOW_POPUP_MENU;
607
609 SDL_WINDOW_KEYBOARD_GRABBED;
610
612 SDL_WINDOW_VULKAN;
613
615 SDL_WINDOW_METAL;
616
618 SDL_WINDOW_TRANSPARENT;
619
621 SDL_WINDOW_NOT_FOCUSABLE;
622
628using FlashOperation = SDL_FlashOperation;
629
631 SDL_FLASH_CANCEL;
632
634 SDL_FLASH_BRIEFLY;
635
637 SDL_FLASH_UNTIL_FOCUSED;
638
649using HitTestResult = SDL_HitTestResult;
650
652 SDL_HITTEST_NORMAL;
653
655 SDL_HITTEST_DRAGGABLE;
656
658 SDL_HITTEST_RESIZE_TOPLEFT;
660
662 SDL_HITTEST_RESIZE_TOP;
663
665 SDL_HITTEST_RESIZE_TOPRIGHT;
667
669 SDL_HITTEST_RESIZE_RIGHT;
670
673 SDL_HITTEST_RESIZE_BOTTOMRIGHT;
674
676 SDL_HITTEST_RESIZE_BOTTOM;
677
679 SDL_HITTEST_RESIZE_BOTTOMLEFT;
681
683 SDL_HITTEST_RESIZE_LEFT;
684
695using HitTest = SDL_HitTest;
696
710 std::function<HitTestResult(WindowRaw window, const Point& area)>;
711
717using EGLSurface = SDL_EGLSurface;
718
729{
730 WindowRaw m_resource = nullptr;
731
732public:
734 constexpr Window() = default;
735
743 constexpr explicit Window(const WindowRaw resource)
744 : m_resource(resource)
745 {
746 }
747
749 constexpr Window(const Window& other) = delete;
750
752 constexpr Window(Window&& other)
753 : Window(other.release())
754 {
755 }
756
757 constexpr Window(const WindowRef& other) = delete;
758
759 constexpr Window(WindowRef&& other) = delete;
760
847 Window(StringParam title, const PointRaw& size, WindowFlags flags = 0)
848 : m_resource(SDL_CreateWindow(title, size.x, size.y, flags))
849 {
850 }
851
924 const PointRaw& offset,
925 const PointRaw& size,
926 WindowFlags flags = 0)
927 : m_resource(SDL_CreatePopupWindow(parent,
928 offset.x,
929 offset.y,
930 size.x,
931 size.y,
932 flags))
933 {
934 }
935
1061 : m_resource(SDL_CreateWindowWithProperties(props))
1062 {
1063 }
1064
1066 ~Window() { SDL_DestroyWindow(m_resource); }
1067
1070 {
1071 std::swap(m_resource, other.m_resource);
1072 return *this;
1073 }
1074
1076 constexpr WindowRaw get() const { return m_resource; }
1077
1079 constexpr WindowRaw release()
1080 {
1081 auto r = m_resource;
1082 m_resource = nullptr;
1083 return r;
1084 }
1085
1087 constexpr auto operator<=>(const Window& other) const = default;
1088
1090 constexpr bool operator==(std::nullptr_t _) const { return !m_resource; }
1091
1093 constexpr explicit operator bool() const { return !!m_resource; }
1094
1096 constexpr operator WindowParam() const { return {m_resource}; }
1097
1116 void Destroy();
1117
1134 static WindowRef FromID(WindowID id);
1135
1148 static WindowRef GetGrabbed();
1149
1164 Display GetDisplay() const;
1165
1182 float GetPixelDensity() const;
1183
1205 float GetDisplayScale() const;
1206
1239
1253 const DisplayMode& GetFullscreenMode() const;
1254
1266
1278
1294 WindowID GetID() const;
1295
1308 WindowRef GetParent() const;
1309
1429
1447 WindowFlags GetFlags() const;
1448
1463 void SetTitle(StringParam title);
1464
1477 const char* GetTitle() const;
1478
1499 void SetIcon(SurfaceParam icon);
1500
1536 void SetPosition(const PointRaw& p);
1537
1559 void GetPosition(int* x, int* y) const;
1560
1580 Point GetPosition() const;
1581
1614 void SetSize(const PointRaw& size);
1615
1635 void GetSize(int* w, int* h) const;
1636
1656 Point GetSize() const;
1657
1669 void SetRect(Rect rect);
1670
1684 Rect GetRect() const;
1685
1702 Rect GetSafeArea() const;
1703
1740 void SetAspectRatio(float min_aspect, float max_aspect);
1741
1757 void GetAspectRatio(float* min_aspect, float* max_aspect) const;
1758
1791 void GetBordersSize(int* top, int* left, int* bottom, int* right) const;
1792
1810 void GetSizeInPixels(int* w, int* h) const;
1811
1827 Point GetSizeInPixels() const;
1828
1842 void SetMinimumSize(const PointRaw& p);
1843
1860 void GetMinimumSize(int* w, int* h) const;
1861
1875 void SetMaximumSize(const PointRaw& p);
1876
1893 void GetMaximumSize(int* w, int* h) const;
1894
1913 void SetBordered(bool bordered);
1914
1933 void SetResizable(bool resizable);
1934
1950 void SetAlwaysOnTop(bool on_top);
1951
1964 void Show();
1965
1978 void Hide();
1979
1996 void Raise();
1997
2028 void Maximize();
2029
2055 void Minimize();
2056
2083 void Restore();
2084
2113 void SetFullscreen(bool fullscreen);
2114
2141 void Sync();
2142
2155 bool HasSurface() const;
2156
2184
2207 void SetSurfaceVSync(int vsync);
2208
2222 int GetSurfaceVSync() const;
2223
2241 void UpdateSurface();
2242
2268
2281 void DestroySurface();
2282
2312 void SetKeyboardGrab(bool grabbed);
2313
2331 void SetMouseGrab(bool grabbed);
2332
2344 bool GetKeyboardGrab() const;
2345
2360 bool GetMouseGrab() const;
2361
2380 void SetMouseRect(const RectRaw& rect);
2381
2396 const RectRaw* GetMouseRect() const;
2397
2415 void SetOpacity(float opacity);
2416
2432 float GetOpacity() const;
2433
2464 void SetParent(WindowParam parent);
2465
2482 void SetModal(bool modal);
2483
2494 void SetFocusable(bool focusable);
2495
2515 void ShowSystemMenu(const PointRaw& p);
2516
2557 void SetHitTest(HitTest callback, void* callback_data);
2558
2600 void SetHitTest(HitTestCB callback);
2601
2626 void SetShape(SurfaceParam shape);
2627
2638 void Flash(FlashOperation operation);
2639
2662
2677 void MakeCurrent(GLContext context);
2678
2690
2707 void GL_Swap();
2708
2733 void StartTextInput();
2734
2783 void StartTextInput(PropertiesParam props);
2784
2796 bool IsTextInputActive() const;
2797
2812 void StopTextInput();
2813
2826 void ClearComposition();
2827
2847 void SetTextInputArea(const RectRaw& rect, int cursor);
2848
2866 void GetTextInputArea(RectRaw* rect, int* cursor);
2867
2879 bool IsScreenKeyboardShown() const;
2880
2899 void WarpMouse(const FPointRaw& p);
2900
2925 void SetRelativeMouseMode(bool enabled);
2926
2938 bool GetRelativeMouseMode() const;
2939
2950 RendererRef GetRenderer() const;
2951};
2952
2955{
2964 : Window(resource.value)
2965 {
2966 }
2967
2969 WindowRef(const WindowRef& other)
2970 : Window(other.get())
2971 {
2972 }
2973
2976};
2977
2986constexpr int WINDOWPOS_UNDEFINED_MASK = SDL_WINDOWPOS_UNDEFINED_MASK;
2987
2999{
3000 return SDL_WINDOWPOS_UNDEFINED_DISPLAY(X);
3001}
3002
3010constexpr int WINDOWPOS_UNDEFINED = SDL_WINDOWPOS_UNDEFINED;
3011
3019constexpr bool WINDOWPOS_ISUNDEFINED(int X)
3020{
3021 return SDL_WINDOWPOS_ISUNDEFINED(X);
3022}
3023
3032constexpr int WINDOWPOS_CENTERED_MASK = SDL_WINDOWPOS_CENTERED_MASK;
3033
3044constexpr int WINDOWPOS_CENTERED_DISPLAY(int X)
3045{
3046 return SDL_WINDOWPOS_CENTERED_DISPLAY(X);
3047}
3048
3056constexpr int WINDOWPOS_CENTERED = SDL_WINDOWPOS_CENTERED;
3057
3065constexpr bool WINDOWPOS_ISCENTERED(int X)
3066{
3067 return SDL_WINDOWPOS_ISCENTERED(X);
3068}
3069
3080{
3081 GLContextRaw m_resource = nullptr;
3082
3083public:
3085 constexpr GLContext() = default;
3086
3092 constexpr GLContext(const GLContextRaw resource)
3093 : m_resource(resource)
3094 {
3095 }
3096
3098 constexpr GLContext(const GLContext& other) = default;
3099
3101 constexpr GLContext(GLContext&& other)
3102 : GLContext(other.release())
3103 {
3104 }
3105
3129 : m_resource(SDL_GL_CreateContext(window))
3130 {
3131 }
3132
3135
3138 {
3139 std::swap(m_resource, other.m_resource);
3140 return *this;
3141 }
3142
3144 constexpr GLContextRaw get() const { return m_resource; }
3145
3148 {
3149 auto r = m_resource;
3150 m_resource = nullptr;
3151 return r;
3152 }
3153
3155 constexpr auto operator<=>(const GLContext& other) const = default;
3156
3158 constexpr bool operator==(std::nullptr_t _) const { return !m_resource; }
3159
3161 constexpr explicit operator bool() const { return !!m_resource; }
3162
3164 constexpr operator GLContextParam() const { return {m_resource}; }
3165
3175 void Destroy();
3176
3191 void MakeCurrent(WindowParam window);
3192};
3193
3196{
3198
3199 constexpr GLContextScoped(const GLContext& other) = delete;
3200
3202 constexpr GLContextScoped(GLContext&& other)
3203 : GLContext(other.release())
3204 {
3205 }
3206
3209};
3210
3216using EGLDisplay = SDL_EGLDisplay;
3217
3223using EGLConfig = SDL_EGLConfig;
3224
3230using EGLAttrib = SDL_EGLAttrib;
3231
3237using EGLint = SDL_EGLint;
3238
3262using EGLAttribArrayCallback = SDL_EGLAttribArrayCallback;
3263
3288using EGLAttribArrayCB = std::function<SDL_EGLAttrib*()>;
3289
3319using EGLIntArrayCallback = SDL_EGLIntArrayCallback;
3320
3351using EGLIntArrayCB = std::function<SDL_EGLint*(SDL_EGLDisplay, SDL_EGLConfig)>;
3352
3370using GLAttr = SDL_GLAttr;
3371
3376constexpr GLAttr GL_RED_SIZE = SDL_GL_RED_SIZE;
3377
3382constexpr GLAttr GL_GREEN_SIZE = SDL_GL_GREEN_SIZE;
3383
3388constexpr GLAttr GL_BLUE_SIZE = SDL_GL_BLUE_SIZE;
3389
3394constexpr GLAttr GL_ALPHA_SIZE = SDL_GL_ALPHA_SIZE;
3395
3397constexpr GLAttr GL_BUFFER_SIZE = SDL_GL_BUFFER_SIZE;
3398
3403constexpr GLAttr GL_DOUBLEBUFFER = SDL_GL_DOUBLEBUFFER;
3404
3406constexpr GLAttr GL_DEPTH_SIZE = SDL_GL_DEPTH_SIZE;
3407
3409constexpr GLAttr GL_STENCIL_SIZE = SDL_GL_STENCIL_SIZE;
3410
3415constexpr GLAttr GL_ACCUM_RED_SIZE = SDL_GL_ACCUM_RED_SIZE;
3416
3421constexpr GLAttr GL_ACCUM_GREEN_SIZE = SDL_GL_ACCUM_GREEN_SIZE;
3422
3427constexpr GLAttr GL_ACCUM_BLUE_SIZE = SDL_GL_ACCUM_BLUE_SIZE;
3428
3433constexpr GLAttr GL_ACCUM_ALPHA_SIZE = SDL_GL_ACCUM_ALPHA_SIZE;
3434
3436 SDL_GL_STEREO;
3437
3439constexpr GLAttr GL_MULTISAMPLEBUFFERS = SDL_GL_MULTISAMPLEBUFFERS;
3440
3445constexpr GLAttr GL_MULTISAMPLESAMPLES = SDL_GL_MULTISAMPLESAMPLES;
3446
3451constexpr GLAttr GL_ACCELERATED_VISUAL = SDL_GL_ACCELERATED_VISUAL;
3452
3454 SDL_GL_RETAINED_BACKING;
3455
3457 SDL_GL_CONTEXT_MAJOR_VERSION;
3458
3460 SDL_GL_CONTEXT_MINOR_VERSION;
3461
3466constexpr GLAttr GL_CONTEXT_FLAGS = SDL_GL_CONTEXT_FLAGS;
3467
3472constexpr GLAttr GL_CONTEXT_PROFILE_MASK = SDL_GL_CONTEXT_PROFILE_MASK;
3473
3475 SDL_GL_SHARE_WITH_CURRENT_CONTEXT;
3476
3478 SDL_GL_FRAMEBUFFER_SRGB_CAPABLE;
3480
3485constexpr GLAttr GL_CONTEXT_RELEASE_BEHAVIOR = SDL_GL_CONTEXT_RELEASE_BEHAVIOR;
3486
3492 SDL_GL_CONTEXT_RESET_NOTIFICATION;
3493
3495 SDL_GL_CONTEXT_NO_ERROR;
3496
3497constexpr GLAttr GL_FLOATBUFFERS = SDL_GL_FLOATBUFFERS;
3498
3499constexpr GLAttr GL_EGL_PLATFORM = SDL_GL_EGL_PLATFORM;
3500
3507
3509 SDL_GL_CONTEXT_PROFILE_CORE;
3510
3512 SDL_GL_CONTEXT_PROFILE_COMPATIBILITY;
3514
3516 SDL_GL_CONTEXT_PROFILE_ES;
3517
3524
3526 SDL_GL_CONTEXT_DEBUG_FLAG;
3527
3529 SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG;
3530
3532 SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG;
3533
3535 SDL_GL_CONTEXT_RESET_ISOLATION_FLAG;
3536
3543
3545 SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE;
3546
3548 SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH;
3549
3556
3558 SDL_GL_CONTEXT_RESET_NO_NOTIFICATION;
3559
3561 SDL_GL_CONTEXT_RESET_LOSE_CONTEXT;
3562
3574inline int GetNumVideoDrivers() { return SDL_GetNumVideoDrivers(); }
3575
3595inline const char* GetVideoDriver(int index)
3596{
3597 return SDL_GetVideoDriver(index);
3598}
3599
3617inline const char* GetCurrentVideoDriver()
3618{
3619 return SDL_GetCurrentVideoDriver();
3620}
3621
3631inline SystemTheme GetSystemTheme() { return SDL_GetSystemTheme(); }
3632
3644{
3645 int count = 0;
3646 auto data = reinterpret_cast<DisplayID*>(SDL_GetDisplays(&count));
3647 return OwnArray<DisplayID>{data, size_t(count)};
3648}
3649
3664{
3665 return CheckError(SDL_GetPrimaryDisplay());
3666}
3667
3669
3697{
3698 return {CheckError(SDL_GetDisplayProperties(displayID))};
3699}
3700
3702{
3703 return SDL::GetDisplayProperties(m_displayID);
3704}
3705
3706namespace prop::Display {
3707
3708constexpr auto HDR_ENABLED_BOOLEAN = SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN;
3709
3710constexpr auto KMSDRM_PANEL_ORIENTATION_NUMBER =
3711 SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER;
3712
3713} // namespace prop::Display
3714
3728inline const char* GetDisplayName(DisplayID displayID)
3729{
3730 return SDL_GetDisplayName(displayID);
3731}
3732
3733inline const char* Display::GetName() const
3734{
3735 return SDL::GetDisplayName(m_displayID);
3736}
3737
3756{
3757 Rect bounds;
3758 SDL_GetDisplayBounds(displayID, &bounds);
3759 return bounds;
3760}
3761
3763{
3764 return SDL::GetDisplayBounds(m_displayID);
3765}
3766
3790{
3791 Rect bounds;
3792 SDL_GetDisplayUsableBounds(displayID, &bounds);
3793 return bounds;
3794}
3795
3797{
3798 return SDL::GetDisplayUsableBounds(m_displayID);
3799}
3800
3815{
3816 return SDL_GetNaturalDisplayOrientation(displayID);
3817}
3818
3820{
3821 return SDL::GetNaturalDisplayOrientation(m_displayID);
3822}
3823
3838{
3839 return SDL_GetCurrentDisplayOrientation(displayID);
3840}
3841
3843{
3844 return SDL::GetCurrentDisplayOrientation(m_displayID);
3845}
3846
3872inline float GetDisplayContentScale(DisplayID displayID)
3873{
3874 return SDL_GetDisplayContentScale(displayID);
3875}
3876
3877inline float Display::GetContentScale() const
3878{
3879 return SDL::GetDisplayContentScale(m_displayID);
3880}
3881
3905{
3906 int count = 0;
3907 auto data = CheckError(SDL_GetFullscreenDisplayModes(displayID, &count));
3908 return OwnArray<DisplayMode*>{data, size_t(count)};
3909}
3910
3912{
3913 return SDL::GetFullscreenDisplayModes(m_displayID);
3914}
3915
3943 Display displayID,
3944 const PointRaw& size,
3945 float refresh_rate,
3946 bool include_high_density_modes)
3947{
3948 DisplayMode mode;
3949 CheckError(SDL_GetClosestFullscreenDisplayMode(displayID,
3950 size.x,
3951 size.y,
3952 refresh_rate,
3953 include_high_density_modes,
3954 &mode));
3955 return mode;
3956}
3957
3959 const PointRaw& size,
3960 float refresh_rate,
3961 bool include_high_density_modes) const
3962{
3964 m_displayID, size, refresh_rate, include_high_density_modes);
3965}
3966
3987{
3988 return *SDL_GetDesktopDisplayMode(displayID);
3989}
3990
3992{
3993 return SDL::GetDesktopDisplayMode(m_displayID);
3994}
3995
4016{
4017 return *SDL_GetCurrentDisplayMode(displayID);
4018}
4019
4021{
4022 return SDL::GetCurrentDisplayMode(m_displayID);
4023}
4024
4040{
4041 return SDL_GetDisplayForPoint(&point);
4042}
4043
4045{
4046 return SDL::GetDisplayForPoint(point);
4047}
4048
4065{
4066 return CheckError(SDL_GetDisplayForRect(&rect));
4067}
4068
4070{
4071 return SDL::GetDisplayForRect(rect);
4072}
4073
4090{
4091 return CheckError(SDL_GetDisplayForWindow(window));
4092}
4093
4095{
4096 return SDL::GetDisplayForWindow(m_resource);
4097}
4098
4117{
4118 return SDL_GetWindowPixelDensity(window);
4119}
4120
4121inline float Window::GetPixelDensity() const
4122{
4123 return SDL::GetWindowPixelDensity(m_resource);
4124}
4125
4148{
4149 return SDL_GetWindowDisplayScale(window);
4150}
4151
4152inline float Window::GetDisplayScale() const
4153{
4154 return SDL::GetWindowDisplayScale(m_resource);
4155}
4156
4190{
4191 CheckError(SDL_SetWindowFullscreenMode(window, mode));
4192}
4193
4195{
4196 SDL::SetWindowFullscreenMode(m_resource, mode);
4197}
4198
4214{
4215 return *SDL_GetWindowFullscreenMode(window);
4216}
4217
4219{
4220 return SDL::GetWindowFullscreenMode(m_resource);
4221}
4222
4235{
4236 size_t size;
4237 return OwnPtr<void>{CheckError(SDL_GetWindowICCProfile(window, &size))};
4238}
4239
4241{
4242 return SDL::GetWindowICCProfile(m_resource);
4243}
4244
4257{
4258 return CheckError(SDL_GetWindowPixelFormat(window));
4259}
4260
4262{
4263 return SDL::GetWindowPixelFormat(m_resource);
4264}
4265
4277{
4278 int count = 0;
4279 auto data = CheckError(SDL_GetWindows(&count));
4280 return OwnArray<WindowRef>{reinterpret_cast<WindowRef*>(data), size_t(count)};
4281}
4282
4369 const PointRaw& size,
4370 WindowFlags flags)
4371{
4372 return Window(std::move(title), size, flags);
4373}
4374
4447 const PointRaw& offset,
4448 const PointRaw& size,
4449 WindowFlags flags)
4450{
4451 return Window(parent, offset, size, flags);
4452}
4453
4579{
4580 return Window(props);
4581}
4582
4583namespace prop::Window {
4584
4585constexpr auto CREATE_ALWAYS_ON_TOP_BOOLEAN =
4586 SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN;
4587
4588constexpr auto CREATE_BORDERLESS_BOOLEAN =
4589 SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN;
4590
4591#if SDL_VERSION_ATLEAST(3, 2, 18)
4592
4593constexpr auto CREATE_CONSTRAIN_POPUP_BOOLEAN =
4594 SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN;
4595
4596#endif // SDL_VERSION_ATLEAST(3, 2, 18)
4597
4598constexpr auto CREATE_FOCUSABLE_BOOLEAN =
4599 SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN;
4600
4601constexpr auto CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN =
4602 SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN;
4603
4604constexpr auto CREATE_FLAGS_NUMBER = SDL_PROP_WINDOW_CREATE_FLAGS_NUMBER;
4605
4606constexpr auto CREATE_FULLSCREEN_BOOLEAN =
4607 SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN;
4608
4609constexpr auto CREATE_HEIGHT_NUMBER = SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER;
4610
4611constexpr auto CREATE_HIDDEN_BOOLEAN = SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN;
4612
4613constexpr auto CREATE_HIGH_PIXEL_DENSITY_BOOLEAN =
4614 SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN;
4615
4616constexpr auto CREATE_MAXIMIZED_BOOLEAN =
4617 SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN;
4618
4619constexpr auto CREATE_MENU_BOOLEAN = SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN;
4620
4621constexpr auto CREATE_METAL_BOOLEAN = SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN;
4622
4623constexpr auto CREATE_MINIMIZED_BOOLEAN =
4624 SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN;
4625
4626constexpr auto CREATE_MODAL_BOOLEAN = SDL_PROP_WINDOW_CREATE_MODAL_BOOLEAN;
4627
4628constexpr auto CREATE_MOUSE_GRABBED_BOOLEAN =
4629 SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN;
4630
4631constexpr auto CREATE_OPENGL_BOOLEAN = SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN;
4632
4633constexpr auto CREATE_PARENT_POINTER = SDL_PROP_WINDOW_CREATE_PARENT_POINTER;
4634
4635constexpr auto CREATE_RESIZABLE_BOOLEAN =
4636 SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN;
4637
4638constexpr auto CREATE_TITLE_STRING = SDL_PROP_WINDOW_CREATE_TITLE_STRING;
4639
4640constexpr auto CREATE_TRANSPARENT_BOOLEAN =
4641 SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN;
4642
4643constexpr auto CREATE_TOOLTIP_BOOLEAN = SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN;
4644
4645constexpr auto CREATE_UTILITY_BOOLEAN = SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN;
4646
4647constexpr auto CREATE_VULKAN_BOOLEAN = SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN;
4648
4649constexpr auto CREATE_WIDTH_NUMBER = SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER;
4650
4651constexpr auto CREATE_X_NUMBER = SDL_PROP_WINDOW_CREATE_X_NUMBER;
4652
4653constexpr auto CREATE_Y_NUMBER = SDL_PROP_WINDOW_CREATE_Y_NUMBER;
4654
4655constexpr auto CREATE_COCOA_WINDOW_POINTER =
4656 SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER;
4657
4658constexpr auto CREATE_COCOA_VIEW_POINTER =
4659 SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER;
4660
4661constexpr auto CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN =
4662 SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN;
4663
4664constexpr auto CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN =
4665 SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN;
4666
4667constexpr auto CREATE_WAYLAND_WL_SURFACE_POINTER =
4668 SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER;
4669
4670constexpr auto CREATE_WIN32_HWND_POINTER =
4671 SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER;
4672
4673constexpr auto CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER =
4674 SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER;
4675
4676constexpr auto CREATE_X11_WINDOW_NUMBER =
4677 SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER;
4678
4679constexpr auto SHAPE_POINTER = SDL_PROP_WINDOW_SHAPE_POINTER;
4680
4681constexpr auto HDR_ENABLED_BOOLEAN = SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN;
4682
4683constexpr auto SDR_WHITE_LEVEL_FLOAT = SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT;
4684
4685constexpr auto HDR_HEADROOM_FLOAT = SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT;
4686
4687constexpr auto ANDROID_WINDOW_POINTER = SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER;
4688
4689constexpr auto ANDROID_SURFACE_POINTER =
4690 SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER;
4691
4692constexpr auto UIKIT_WINDOW_POINTER = SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER;
4693
4694constexpr auto UIKIT_METAL_VIEW_TAG_NUMBER =
4695 SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER;
4696
4697constexpr auto UIKIT_OPENGL_FRAMEBUFFER_NUMBER =
4698 SDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER;
4699
4700constexpr auto UIKIT_OPENGL_RENDERBUFFER_NUMBER =
4701 SDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER;
4702
4703constexpr auto UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER =
4704 SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER;
4705
4706constexpr auto KMSDRM_DEVICE_INDEX_NUMBER =
4707 SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER;
4708
4709constexpr auto KMSDRM_DRM_FD_NUMBER = SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER;
4710
4711constexpr auto KMSDRM_GBM_DEVICE_POINTER =
4712 SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER;
4713
4714constexpr auto COCOA_WINDOW_POINTER = SDL_PROP_WINDOW_COCOA_WINDOW_POINTER;
4715
4716constexpr auto COCOA_METAL_VIEW_TAG_NUMBER =
4717 SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER;
4718
4719constexpr auto OPENVR_OVERLAY_ID = SDL_PROP_WINDOW_OPENVR_OVERLAY_ID;
4720
4721constexpr auto VIVANTE_DISPLAY_POINTER =
4722 SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER;
4723
4724constexpr auto VIVANTE_WINDOW_POINTER = SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER;
4725
4726constexpr auto VIVANTE_SURFACE_POINTER =
4727 SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER;
4728
4729constexpr auto WIN32_HWND_POINTER = SDL_PROP_WINDOW_WIN32_HWND_POINTER;
4730
4731constexpr auto WIN32_HDC_POINTER = SDL_PROP_WINDOW_WIN32_HDC_POINTER;
4732
4733constexpr auto WIN32_INSTANCE_POINTER = SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER;
4734
4735constexpr auto WAYLAND_DISPLAY_POINTER =
4736 SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER;
4737
4738constexpr auto WAYLAND_SURFACE_POINTER =
4739 SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER;
4740
4741constexpr auto WAYLAND_VIEWPORT_POINTER =
4742 SDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTER;
4743
4744constexpr auto WAYLAND_EGL_WINDOW_POINTER =
4745 SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER;
4746
4747constexpr auto WAYLAND_XDG_SURFACE_POINTER =
4748 SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER;
4749
4750constexpr auto WAYLAND_XDG_TOPLEVEL_POINTER =
4751 SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER;
4752
4753constexpr auto WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING =
4754 SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING;
4755
4756constexpr auto WAYLAND_XDG_POPUP_POINTER =
4757 SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER;
4758
4759constexpr auto WAYLAND_XDG_POSITIONER_POINTER =
4760 SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER;
4761
4762constexpr auto X11_DISPLAY_POINTER = SDL_PROP_WINDOW_X11_DISPLAY_POINTER;
4763
4764constexpr auto X11_SCREEN_NUMBER = SDL_PROP_WINDOW_X11_SCREEN_NUMBER;
4765
4766constexpr auto X11_WINDOW_NUMBER = SDL_PROP_WINDOW_X11_WINDOW_NUMBER;
4767
4768} // namespace prop::Window
4769
4787{
4788 return CheckError(SDL_GetWindowID(window));
4789}
4790
4791inline WindowID Window::GetID() const { return SDL::GetWindowID(m_resource); }
4792
4810{
4811 return {SDL_GetWindowFromID(id)};
4812}
4813
4815{
4816 return SDL::GetWindowFromID(id);
4817}
4818
4833{
4834 return {CheckError(SDL_GetWindowParent(window))};
4835}
4836
4838{
4839 return SDL::GetWindowParent(m_resource);
4840}
4841
4960{
4961 return {CheckError(SDL_GetWindowProperties(window))};
4962}
4963
4965{
4966 return SDL::GetWindowProperties(m_resource);
4967}
4968
4988{
4989 return SDL_GetWindowFlags(window);
4990}
4991
4993{
4994 return SDL::GetWindowFlags(m_resource);
4995}
4996
5012inline void SetWindowTitle(WindowParam window, StringParam title)
5013{
5014 CheckError(SDL_SetWindowTitle(window, title));
5015}
5016
5018{
5019 SDL::SetWindowTitle(m_resource, std::move(title));
5020}
5021
5034inline const char* GetWindowTitle(WindowParam window)
5035{
5036 return SDL_GetWindowTitle(window);
5037}
5038
5039inline const char* Window::GetTitle() const
5040{
5041 return SDL::GetWindowTitle(m_resource);
5042}
5043
5065inline void SetWindowIcon(WindowParam window, SurfaceParam icon)
5066{
5067 CheckError(SDL_SetWindowIcon(window, icon));
5068}
5069
5071{
5072 SDL::SetWindowIcon(m_resource, icon);
5073}
5074
5110inline void SetWindowPosition(WindowParam window, const PointRaw& p)
5111{
5112 CheckError(SDL_SetWindowPosition(window, p.x, p.y));
5113}
5114
5115inline void Window::SetPosition(const PointRaw& p)
5116{
5117 SDL::SetWindowPosition(m_resource, p);
5118}
5119
5142inline void GetWindowPosition(WindowParam window, int* x, int* y)
5143{
5144 CheckError(SDL_GetWindowPosition(window, x, y));
5145}
5146
5167{
5168 Point p;
5169 GetWindowPosition(window, &p.x, &p.y);
5170 return p;
5171}
5172
5173inline void Window::GetPosition(int* x, int* y) const
5174{
5175 SDL::GetWindowPosition(m_resource, x, y);
5176}
5177
5179{
5180 return SDL::GetWindowPosition(m_resource);
5181}
5182
5216inline void SetWindowSize(WindowParam window, const PointRaw& size)
5217{
5218 CheckError(SDL_SetWindowSize(window, size.x, size.y));
5219}
5220
5221inline void Window::SetSize(const PointRaw& size)
5222{
5223 SDL::SetWindowSize(m_resource, size);
5224}
5225
5246inline void GetWindowSize(WindowParam window, int* w, int* h)
5247{
5248 CheckError(SDL_GetWindowSize(window, w, h));
5249}
5250
5271{
5272 Point p;
5273 GetWindowSize(window, &p.x, &p.y);
5274 return p;
5275}
5276
5277inline void Window::GetSize(int* w, int* h) const
5278{
5279 SDL::GetWindowSize(m_resource, w, h);
5280}
5281
5282inline Point Window::GetSize() const { return SDL::GetWindowSize(m_resource); }
5283
5296inline void SetWindowRect(WindowParam window, Rect rect)
5297{
5298 SetWindowPosition(window, rect.GetTopLeft());
5299 SetWindowSize(window, rect.GetSize());
5300}
5301
5302inline void Window::SetRect(Rect rect) { SDL::SetWindowRect(m_resource, rect); }
5303
5319{
5320 return Rect{GetWindowPosition(window), GetWindowSize(window)};
5321}
5322
5323inline Rect Window::GetRect() const { return SDL::GetWindowRect(m_resource); }
5324
5343{
5344 Rect rect;
5345 CheckError(SDL_GetWindowSafeArea(window, &rect));
5346 return rect;
5347}
5348
5350{
5351 return SDL::GetWindowSafeArea(m_resource);
5352}
5353
5392 float min_aspect,
5393 float max_aspect)
5394{
5395 CheckError(SDL_SetWindowAspectRatio(window, min_aspect, max_aspect));
5396}
5397
5398inline void Window::SetAspectRatio(float min_aspect, float max_aspect)
5399{
5400 SDL::SetWindowAspectRatio(m_resource, min_aspect, max_aspect);
5401}
5402
5420 float* min_aspect,
5421 float* max_aspect)
5422{
5423 CheckError(SDL_GetWindowAspectRatio(window, min_aspect, max_aspect));
5424}
5425
5426inline void Window::GetAspectRatio(float* min_aspect, float* max_aspect) const
5427{
5428 SDL::GetWindowAspectRatio(m_resource, min_aspect, max_aspect);
5429}
5430
5465 int* top,
5466 int* left,
5467 int* bottom,
5468 int* right)
5469{
5470 CheckError(SDL_GetWindowBordersSize(window, top, left, bottom, right));
5471}
5472
5473inline void Window::GetBordersSize(int* top,
5474 int* left,
5475 int* bottom,
5476 int* right) const
5477{
5478 SDL::GetWindowBordersSize(m_resource, top, left, bottom, right);
5479}
5480
5498inline void GetWindowSizeInPixels(WindowParam window, int* w, int* h)
5499{
5500 CheckError(SDL_GetWindowSizeInPixels(window, w, h));
5501}
5502
5519{
5520 Point p;
5521 GetWindowSizeInPixels(window, &p.x, &p.y);
5522 return p;
5523}
5524
5525inline void Window::GetSizeInPixels(int* w, int* h) const
5526{
5527 SDL::GetWindowSizeInPixels(m_resource, w, h);
5528}
5529
5531{
5532 return SDL::GetWindowSizeInPixels(m_resource);
5533}
5534
5549inline void SetWindowMinimumSize(WindowParam window, const PointRaw& p)
5550{
5551 CheckError(SDL_SetWindowMinimumSize(window, p.x, p.y));
5552}
5553
5555{
5556 SDL::SetWindowMinimumSize(m_resource, p);
5557}
5558
5576inline void GetWindowMinimumSize(WindowParam window, int* w, int* h)
5577{
5578 CheckError(SDL_GetWindowMinimumSize(window, w, h));
5579}
5580
5581inline void Window::GetMinimumSize(int* w, int* h) const
5582{
5583 SDL::GetWindowMinimumSize(m_resource, w, h);
5584}
5585
5600inline void SetWindowMaximumSize(WindowParam window, const PointRaw& p)
5601{
5602 CheckError(SDL_SetWindowMaximumSize(window, p.x, p.y));
5603}
5604
5606{
5607 SDL::SetWindowMaximumSize(m_resource, p);
5608}
5609
5627inline void GetWindowMaximumSize(WindowParam window, int* w, int* h)
5628{
5629 CheckError(SDL_GetWindowMaximumSize(window, w, h));
5630}
5631
5632inline void Window::GetMaximumSize(int* w, int* h) const
5633{
5634 SDL::GetWindowMaximumSize(m_resource, w, h);
5635}
5636
5656inline void SetWindowBordered(WindowParam window, bool bordered)
5657{
5658 CheckError(SDL_SetWindowBordered(window, bordered));
5659}
5660
5661inline void Window::SetBordered(bool bordered)
5662{
5663 SDL::SetWindowBordered(m_resource, bordered);
5664}
5665
5685inline void SetWindowResizable(WindowParam window, bool resizable)
5686{
5687 CheckError(SDL_SetWindowResizable(window, resizable));
5688}
5689
5690inline void Window::SetResizable(bool resizable)
5691{
5692 SDL::SetWindowResizable(m_resource, resizable);
5693}
5694
5711inline void SetWindowAlwaysOnTop(WindowParam window, bool on_top)
5712{
5713 CheckError(SDL_SetWindowAlwaysOnTop(window, on_top));
5714}
5715
5716inline void Window::SetAlwaysOnTop(bool on_top)
5717{
5718 SDL::SetWindowAlwaysOnTop(m_resource, on_top);
5719}
5720
5734inline void ShowWindow(WindowParam window)
5735{
5736 CheckError(SDL_ShowWindow(window));
5737}
5738
5739inline void Window::Show() { SDL::ShowWindow(m_resource); }
5740
5754inline void HideWindow(WindowParam window)
5755{
5756 CheckError(SDL_HideWindow(window));
5757}
5758
5759inline void Window::Hide() { SDL::HideWindow(m_resource); }
5760
5777inline void RaiseWindow(WindowParam window)
5778{
5779 CheckError(SDL_RaiseWindow(window));
5780}
5781
5782inline void Window::Raise() { SDL::RaiseWindow(m_resource); }
5783
5815inline void MaximizeWindow(WindowParam window)
5816{
5817 CheckError(SDL_MaximizeWindow(window));
5818}
5819
5820inline void Window::Maximize() { SDL::MaximizeWindow(m_resource); }
5821
5848inline void MinimizeWindow(WindowParam window)
5849{
5850 CheckError(SDL_MinimizeWindow(window));
5851}
5852
5853inline void Window::Minimize() { SDL::MinimizeWindow(m_resource); }
5854
5882inline void RestoreWindow(WindowParam window)
5883{
5884 CheckError(SDL_RestoreWindow(window));
5885}
5886
5887inline void Window::Restore() { SDL::RestoreWindow(m_resource); }
5888
5918inline void SetWindowFullscreen(WindowParam window, bool fullscreen)
5919{
5920 CheckError(SDL_SetWindowFullscreen(window, fullscreen));
5921}
5922
5923inline void Window::SetFullscreen(bool fullscreen)
5924{
5925 SDL::SetWindowFullscreen(m_resource, fullscreen);
5926}
5927
5956inline void SyncWindow(WindowParam window)
5957{
5958 CheckError(SDL_SyncWindow(window));
5959}
5960
5961inline void Window::Sync() { SDL::SyncWindow(m_resource); }
5962
5977{
5978 return SDL_WindowHasSurface(window);
5979}
5980
5981inline bool Window::HasSurface() const
5982{
5983 return SDL::WindowHasSurface(m_resource);
5984}
5985
6014{
6015 return Surface::Borrow(SDL_GetWindowSurface(window));
6016}
6017
6019{
6020 return SDL::GetWindowSurface(m_resource);
6021}
6022
6046inline void SetWindowSurfaceVSync(WindowParam window, int vsync)
6047{
6048 CheckError(SDL_SetWindowSurfaceVSync(window, vsync));
6049}
6050
6051inline void Window::SetSurfaceVSync(int vsync)
6052{
6053 SDL::SetWindowSurfaceVSync(m_resource, vsync);
6054}
6055
6057constexpr int WINDOW_SURFACE_VSYNC_DISABLED = SDL_WINDOW_SURFACE_VSYNC_DISABLED;
6058
6060constexpr int WINDOW_SURFACE_VSYNC_ADAPTIVE = SDL_WINDOW_SURFACE_VSYNC_ADAPTIVE;
6061
6075{
6076 int vsync;
6077 CheckError(SDL_GetWindowSurfaceVSync(window, &vsync));
6078 return vsync;
6079}
6080
6081inline int Window::GetSurfaceVSync() const
6082{
6083 return SDL::GetWindowSurfaceVSync(m_resource);
6084}
6085
6105{
6106 CheckError(SDL_UpdateWindowSurface(window));
6107}
6108
6110
6138{
6139 CheckError(SDL_UpdateWindowSurfaceRects(window, rects.data(), rects.size()));
6140}
6141
6143{
6144 SDL::UpdateWindowSurfaceRects(m_resource, rects);
6145}
6146
6161{
6162 CheckError(SDL_DestroyWindowSurface(window));
6163}
6164
6166
6196inline void SetWindowKeyboardGrab(WindowParam window, bool grabbed)
6197{
6198 CheckError(SDL_SetWindowKeyboardGrab(window, grabbed));
6199}
6200
6201inline void Window::SetKeyboardGrab(bool grabbed)
6202{
6203 SDL::SetWindowKeyboardGrab(m_resource, grabbed);
6204}
6205
6224inline void SetWindowMouseGrab(WindowParam window, bool grabbed)
6225{
6226 CheckError(SDL_SetWindowMouseGrab(window, grabbed));
6227}
6228
6229inline void Window::SetMouseGrab(bool grabbed)
6230{
6231 SDL::SetWindowMouseGrab(m_resource, grabbed);
6232}
6233
6247{
6248 return SDL_GetWindowKeyboardGrab(window);
6249}
6250
6251inline bool Window::GetKeyboardGrab() const
6252{
6253 return SDL::GetWindowKeyboardGrab(m_resource);
6254}
6255
6272{
6273 return SDL_GetWindowMouseGrab(window);
6274}
6275
6276inline bool Window::GetMouseGrab() const
6277{
6278 return SDL::GetWindowMouseGrab(m_resource);
6279}
6280
6293inline WindowRef GetGrabbedWindow() { return {SDL_GetGrabbedWindow()}; }
6294
6296
6316inline void SetWindowMouseRect(WindowParam window, const RectRaw& rect)
6317{
6318 CheckError(SDL_SetWindowMouseRect(window, &rect));
6319}
6320
6321inline void Window::SetMouseRect(const RectRaw& rect)
6322{
6323 SDL::SetWindowMouseRect(m_resource, rect);
6324}
6325
6342{
6343 return SDL_GetWindowMouseRect(window);
6344}
6345
6346inline const RectRaw* Window::GetMouseRect() const
6347{
6348 return SDL::GetWindowMouseRect(m_resource);
6349}
6350
6369inline void SetWindowOpacity(WindowParam window, float opacity)
6370{
6371 CheckError(SDL_SetWindowOpacity(window, opacity));
6372}
6373
6374inline void Window::SetOpacity(float opacity)
6375{
6376 SDL::SetWindowOpacity(m_resource, opacity);
6377}
6378
6395inline float GetWindowOpacity(WindowParam window)
6396{
6397 return SDL_GetWindowOpacity(window);
6398}
6399
6400inline float Window::GetOpacity() const
6401{
6402 return SDL::GetWindowOpacity(m_resource);
6403}
6404
6436inline void SetWindowParent(WindowParam window, WindowParam parent)
6437{
6438 CheckError(SDL_SetWindowParent(window, parent));
6439}
6440
6442{
6443 SDL::SetWindowParent(m_resource, parent);
6444}
6445
6463inline void SetWindowModal(WindowParam window, bool modal)
6464{
6465 CheckError(SDL_SetWindowModal(window, modal));
6466}
6467
6468inline void Window::SetModal(bool modal)
6469{
6470 SDL::SetWindowModal(m_resource, modal);
6471}
6472
6484inline void SetWindowFocusable(WindowParam window, bool focusable)
6485{
6486 CheckError(SDL_SetWindowFocusable(window, focusable));
6487}
6488
6489inline void Window::SetFocusable(bool focusable)
6490{
6491 SDL::SetWindowFocusable(m_resource, focusable);
6492}
6493
6514inline void ShowWindowSystemMenu(WindowParam window, const PointRaw& p)
6515{
6516 CheckError(SDL_ShowWindowSystemMenu(window, p.x, p.y));
6517}
6518
6520{
6521 SDL::ShowWindowSystemMenu(m_resource, p);
6522}
6523
6566 HitTest callback,
6567 void* callback_data)
6568{
6570 Wrapper::erase(window);
6571 CheckError(SDL_SetWindowHitTest(window, callback, callback_data));
6572}
6573
6614inline void SetWindowHitTest(WindowParam window, HitTestCB callback)
6615{
6617 void* cbHandle = Wrapper::Wrap(window, std::move(callback));
6619 window,
6620 [](SDL_Window* win, const SDL_Point* area, void* data) {
6621 return Wrapper::Call(data, win, Point(*area));
6622 },
6623 cbHandle);
6624}
6625
6626inline void Window::SetHitTest(HitTest callback, void* callback_data)
6627{
6628 SDL::SetWindowHitTest(m_resource, callback, callback_data);
6629}
6630
6631inline void Window::SetHitTest(HitTestCB callback)
6632{
6633 SDL::SetWindowHitTest(m_resource, callback);
6634}
6635
6660inline void SetWindowShape(WindowParam window, SurfaceParam shape)
6661{
6662 CheckError(SDL_SetWindowShape(window, shape));
6663}
6664
6666{
6667 SDL::SetWindowShape(m_resource, shape);
6668}
6669
6681inline void FlashWindow(WindowParam window, FlashOperation operation)
6682{
6683 CheckError(SDL_FlashWindow(window, operation));
6684}
6685
6686inline void Window::Flash(FlashOperation operation)
6687{
6688 SDL::FlashWindow(m_resource, operation);
6689}
6690
6710inline void DestroyWindow(WindowRaw window)
6711{
6713 Wrapper::erase(window);
6714 SDL_DestroyWindow(window);
6715}
6716
6718
6735inline bool ScreenSaverEnabled() { return SDL_ScreenSaverEnabled(); }
6736
6749inline void EnableScreenSaver() { CheckError(SDL_EnableScreenSaver()); }
6750
6769inline void DisableScreenSaver() { CheckError(SDL_DisableScreenSaver()); }
6770
6793{
6794 CheckError(SDL_GL_LoadLibrary(path));
6795}
6796
6851{
6852 return SDL_GL_GetProcAddress(proc);
6853}
6854
6873{
6874 return SDL_EGL_GetProcAddress(proc);
6875}
6876
6886inline void GL_UnloadLibrary() { SDL_GL_UnloadLibrary(); }
6887
6909{
6910 return SDL_GL_ExtensionSupported(extension);
6911}
6912
6923inline void GL_ResetAttributes() { SDL_GL_ResetAttributes(); }
6924
6944inline void GL_SetAttribute(GLAttr attr, int value)
6945{
6946 CheckError(SDL_GL_SetAttribute(attr, value));
6947}
6948
6963inline void GL_GetAttribute(GLAttr attr, int* value)
6964{
6965 CheckError(SDL_GL_GetAttribute(attr, value));
6966}
6967
6991{
6992 return GLContext(window);
6993}
6994
6995inline GLContext Window::CreateGLContext() { return GLContext(m_resource); }
6996
7012inline void GL_MakeCurrent(WindowParam window, GLContext context)
7013{
7014 CheckError(SDL_GL_MakeCurrent(window, context.get()));
7015}
7016
7017inline void Window::MakeCurrent(GLContext context)
7018{
7019 SDL::GL_MakeCurrent(m_resource, context);
7020}
7021
7023{
7024 SDL::GL_MakeCurrent(window, m_resource);
7025}
7026
7039{
7040 return {CheckError(SDL_GL_GetCurrentWindow())};
7041}
7042
7055inline GLContext GL_GetCurrentContext() { return SDL_GL_GetCurrentContext(); }
7056
7068{
7069 return SDL_EGL_GetCurrentDisplay();
7070}
7071
7082inline EGLConfig EGL_GetCurrentConfig() { return SDL_EGL_GetCurrentConfig(); }
7083
7096{
7097 return SDL_EGL_GetWindowSurface(window);
7098}
7099
7101{
7102 return SDL::EGL_GetWindowSurface(m_resource);
7103}
7104
7126 EGLAttribArrayCallback platformAttribCallback,
7127 EGLIntArrayCallback surfaceAttribCallback,
7128 EGLIntArrayCallback contextAttribCallback,
7129 void* userdata)
7130{
7131 SDL_EGL_SetAttributeCallbacks(platformAttribCallback,
7132 surfaceAttribCallback,
7133 contextAttribCallback,
7134 userdata);
7135}
7136
7165inline void GL_SetSwapInterval(int interval)
7166{
7167 CheckError(SDL_GL_SetSwapInterval(interval));
7168}
7169
7188inline void GL_GetSwapInterval(int* interval)
7189{
7190 CheckError(SDL_GL_GetSwapInterval(interval));
7191}
7192
7210inline void GL_SwapWindow(WindowParam window)
7211{
7212 CheckError(SDL_GL_SwapWindow(window));
7213}
7214
7215inline void Window::GL_Swap() { SDL::GL_SwapWindow(m_resource); }
7216
7230{
7231 CheckError(SDL_GL_DestroyContext(context));
7232}
7233
7235
7237
7238} // namespace SDL
7239
7240#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={})
Wraps Display.
Definition: SDL3pp_video.h:181
An opaque handle to an OpenGL context.
Definition: SDL3pp_video.h:3080
constexpr GLContextRaw release()
Retrieves underlying GLContextRaw and clear this.
Definition: SDL3pp_video.h:3147
constexpr GLContext(const GLContext &other)=default
Copy constructor.
constexpr GLContext()=default
Default ctor.
constexpr auto operator<=>(const GLContext &other) const =default
Comparison.
GLContext(WindowParam window)
Create an OpenGL context for an OpenGL window, and make it current.
Definition: SDL3pp_video.h:3128
constexpr GLContext(GLContext &&other)
Move constructor.
Definition: SDL3pp_video.h:3101
constexpr bool operator==(std::nullptr_t _) const
Comparison.
Definition: SDL3pp_video.h:3158
~GLContext()
Destructor.
Definition: SDL3pp_video.h:3134
constexpr GLContext(const GLContextRaw resource)
Constructs from GLContextParam.
Definition: SDL3pp_video.h:3092
constexpr GLContextRaw get() const
Retrieves underlying GLContextRaw.
Definition: SDL3pp_video.h:3144
GLContext & operator=(GLContext other)
Assignment operator.
Definition: SDL3pp_video.h:3137
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:411
span-like for empty-derived structs
Definition: SDL3pp_spanRef.h:24
constexpr T * data() const
Retrieves contained data.
Definition: SDL3pp_spanRef.h:75
constexpr size_t size() const
Retrieves contained size.
Definition: SDL3pp_spanRef.h:69
Helpers to use C++ strings parameters.
Definition: SDL3pp_strings.h:43
A collection of pixels used in software blitting.
Definition: SDL3pp_surface.h:201
static constexpr Surface Borrow(SurfaceParam resource)
Safely borrows the from SurfaceParam.
Definition: SDL3pp_surface.h:378
The struct used as an opaque handle to a window.
Definition: SDL3pp_video.h:729
constexpr WindowRaw get() const
Retrieves underlying WindowRaw.
Definition: SDL3pp_video.h:1076
constexpr Window(const WindowRaw resource)
Constructs from WindowParam.
Definition: SDL3pp_video.h:743
constexpr WindowRaw release()
Retrieves underlying WindowRaw and clear this.
Definition: SDL3pp_video.h:1079
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:923
constexpr Window(Window &&other)
Move constructor.
Definition: SDL3pp_video.h:752
constexpr Window(const Window &other)=delete
Copy constructor.
Window & operator=(Window other)
Assignment operator.
Definition: SDL3pp_video.h:1069
constexpr auto operator<=>(const Window &other) const =default
Comparison.
Window(StringParam title, const PointRaw &size, WindowFlags flags=0)
Create a window with the specified dimensions and flags.
Definition: SDL3pp_video.h:847
~Window()
Destructor.
Definition: SDL3pp_video.h:1066
constexpr bool operator==(std::nullptr_t _) const
Comparison.
Definition: SDL3pp_video.h:1090
Window(PropertiesParam props)
Create a window with the specified properties.
Definition: SDL3pp_video.h:1060
constexpr Window()=default
Default ctor.
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:342
void ClearComposition()
Dismiss the composition window/IME without disabling the subsystem.
Definition: SDL3pp_keyboard.h:332
void StartTextInput()
Start accepting Unicode text input events in a window.
Definition: SDL3pp_keyboard.h:227
bool IsTextInputActive() const
Check whether or not Unicode text input events are enabled for a window.
Definition: SDL3pp_keyboard.h:322
void StopTextInput()
Stop receiving any text input events in a window.
Definition: SDL3pp_keyboard.h:327
bool IsScreenKeyboardShown() const
Check whether the screen keyboard is shown for given window.
Definition: SDL3pp_keyboard.h:365
void SetTextInputArea(const RectRaw &rect, int cursor)
Set the area used to type Unicode text input.
Definition: SDL3pp_keyboard.h:337
bool GetRelativeMouseMode() const
Query whether relative mouse mode is enabled for a window.
Definition: SDL3pp_mouse.h:721
void SetRelativeMouseMode(bool enabled)
Set relative mouse mode for a window.
Definition: SDL3pp_mouse.h:705
void WarpMouse(const FPointRaw &p)
Move the mouse cursor to the given position within the window.
Definition: SDL3pp_mouse.h:651
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:3415
SDL_FunctionPointer FunctionPointer
A generic function pointer.
Definition: SDL3pp_stdinc.h:6265
::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 DisableScreenSaver()
Prevent the screen from being blanked by a screen saver.
Definition: SDL3pp_video.h:6769
constexpr GLContextFlag GL_CONTEXT_RESET_ISOLATION_FLAG
RESET_ISOLATION_FLAG.
Definition: SDL3pp_video.h:3534
Rect GetBounds() const
Get the desktop area represented by a display.
Definition: SDL3pp_video.h:3762
void SetWindowSurfaceVSync(WindowParam window, int vsync)
Toggle VSync for the window surface.
Definition: SDL3pp_video.h:6046
void GetMaximumSize(int *w, int *h) const
Get the maximum size of a window's client area.
Definition: SDL3pp_video.h:5632
float GetPixelDensity() const
Get the pixel density of a window.
Definition: SDL3pp_video.h:4121
void SetHitTest(HitTest callback, void *callback_data)
Provide a callback that decides if a window region has special properties.
Definition: SDL3pp_video.h:6626
Rect GetWindowSafeArea(WindowParam window)
Get the safe area for this window.
Definition: SDL3pp_video.h:5342
constexpr int WINDOWPOS_CENTERED
Used to indicate that the window position should be centered.
Definition: SDL3pp_video.h:3056
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:3485
void GetMinimumSize(int *w, int *h) const
Get the minimum size of a window's client area.
Definition: SDL3pp_video.h:5581
Rect GetWindowRect(WindowParam window)
Get the position and client size of a window.
Definition: SDL3pp_video.h:5318
void SetFocusable(bool focusable)
Set whether the window may have input focus.
Definition: SDL3pp_video.h:6489
void GL_SetSwapInterval(int interval)
Set the swap interval for the current OpenGL context.
Definition: SDL3pp_video.h:7165
constexpr HitTestResult HITTEST_DRAGGABLE
Region can drag entire window.
Definition: SDL3pp_video.h:654
constexpr HitTestResult HITTEST_RESIZE_BOTTOMLEFT
Region is the resizable bottom-left corner border.
Definition: SDL3pp_video.h:678
SDL_GLAttr GLAttr
An enumeration of OpenGL configuration attributes.
Definition: SDL3pp_video.h:3370
DisplayOrientation GetNaturalDisplayOrientation(DisplayID displayID)
Get the orientation of a display when it is unrotated.
Definition: SDL3pp_video.h:3814
void GL_DestroyContext(GLContextRaw context)
Delete an OpenGL context.
Definition: SDL3pp_video.h:7229
constexpr FlashOperation FLASH_CANCEL
Cancel any window flash state.
Definition: SDL3pp_video.h:630
int GetWindowSurfaceVSync(WindowParam window)
Get VSync for the window surface.
Definition: SDL3pp_video.h:6074
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:3942
void UpdateSurface()
Copy the window surface to the screen.
Definition: SDL3pp_video.h:6109
OwnArray< DisplayMode * > GetFullscreenModes() const
Get a list of fullscreen display modes available on a display.
Definition: SDL3pp_video.h:3911
constexpr bool WINDOWPOS_ISUNDEFINED(int X)
A macro to test if the window position is marked as "undefined.".
Definition: SDL3pp_video.h:3019
constexpr SystemTheme SYSTEM_THEME_LIGHT
Light colored system theme.
Definition: SDL3pp_video.h:509
constexpr WindowFlags WINDOW_MAXIMIZED
window is maximized
Definition: SDL3pp_video.h:564
void EnableScreenSaver()
Allow the screen to be blanked by a screen saver.
Definition: SDL3pp_video.h:6749
void SetRect(Rect rect)
Request the window's position and size to be set.
Definition: SDL3pp_video.h:5302
void GL_GetSwapInterval(int *interval)
Get the swap interval for the current OpenGL context.
Definition: SDL3pp_video.h:7188
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:5398
void UpdateWindowSurfaceRects(WindowParam window, SpanRef< const RectRaw > rects)
Copy areas of the window surface to the screen.
Definition: SDL3pp_video.h:6136
void SetMinimumSize(const PointRaw &p)
Set the minimum size of a window's client area.
Definition: SDL3pp_video.h:5554
void SetWindowIcon(WindowParam window, SurfaceParam icon)
Set the icon for a window.
Definition: SDL3pp_video.h:5065
Window CreateWindowWithProperties(PropertiesParam props)
Create a window with the specified properties.
Definition: SDL3pp_video.h:4578
constexpr GLAttr GL_FRAMEBUFFER_SRGB_CAPABLE
requests sRGB capable visual; defaults to 0.
Definition: SDL3pp_video.h:3477
constexpr GLAttr GL_MULTISAMPLESAMPLES
the number of samples used around the current pixel used for multisample anti-aliasing.
Definition: SDL3pp_video.h:3445
constexpr SystemTheme SYSTEM_THEME_DARK
Dark colored system theme.
Definition: SDL3pp_video.h:512
WindowID GetID() const
Get the numeric ID of a window.
Definition: SDL3pp_video.h:4791
float GetDisplayScale() const
Get the content display scale relative to a window's pixel size.
Definition: SDL3pp_video.h:4152
Uint64 WindowFlags
The flags on a window.
Definition: SDL3pp_video.h:538
bool GetWindowMouseGrab(WindowParam window)
Get a window's mouse grab mode.
Definition: SDL3pp_video.h:6271
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:597
constexpr WindowFlags WINDOW_MOUSE_FOCUS
window has mouse focus
Definition: SDL3pp_video.h:573
constexpr GLAttr GL_STENCIL_SIZE
the minimum number of bits in the stencil buffer; defaults to 0.
Definition: SDL3pp_video.h:3409
void SetWindowPosition(WindowParam window, const PointRaw &p)
Request that the window's position be set.
Definition: SDL3pp_video.h:5110
void Restore()
Request that the size and position of a minimized or maximized window be restored.
Definition: SDL3pp_video.h:5887
void GetWindowPosition(WindowParam window, int *x, int *y)
Get the position of a window.
Definition: SDL3pp_video.h:5142
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:4188
WindowRef GetWindowParent(WindowParam window)
Get parent of a window.
Definition: SDL3pp_video.h:4832
EGLSurface GetEGLSurface()
Get the EGL surface associated with the window.
Definition: SDL3pp_video.h:7100
void SetWindowSize(WindowParam window, const PointRaw &size)
Request that the size of a window's client area be set.
Definition: SDL3pp_video.h:5216
PropertiesRef GetProperties() const
Get the properties associated with a display.
Definition: SDL3pp_video.h:3701
Uint32 GLContextReleaseFlag
Possible values to be set for the GL_CONTEXT_RELEASE_BEHAVIOR attribute.
Definition: SDL3pp_video.h:3542
constexpr WindowFlags WINDOW_TRANSPARENT
window with transparent buffer
Definition: SDL3pp_video.h:617
void DestroySurface()
Destroy the surface associated with the window.
Definition: SDL3pp_video.h:6165
Point GetSize() const
Get the size of a window's client area.
Definition: SDL3pp_video.h:5282
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:3958
const DisplayMode & GetDesktopDisplayMode(DisplayID displayID)
Get information about the desktop's display mode.
Definition: SDL3pp_video.h:3986
FunctionPointer EGL_GetProcAddress(StringParam proc)
Get an EGL library function by name.
Definition: SDL3pp_video.h:6872
constexpr GLProfile GL_CONTEXT_PROFILE_CORE
OpenGL Core Profile context.
Definition: SDL3pp_video.h:3508
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:2986
void FlashWindow(WindowParam window, FlashOperation operation)
Request a window to demand attention from the user.
Definition: SDL3pp_video.h:6681
static WindowRef GetGrabbed()
Get the window that currently has an input grab enabled.
Definition: SDL3pp_video.h:6295
void GL_SwapWindow(WindowParam window)
Update a window with OpenGL rendering.
Definition: SDL3pp_video.h:7210
SDL_HitTest HitTest
Callback used for hit-testing.
Definition: SDL3pp_video.h:695
constexpr int WINDOW_SURFACE_VSYNC_ADAPTIVE
Constant to enable adaptive vsync.
Definition: SDL3pp_video.h:6060
void GetWindowAspectRatio(WindowParam window, float *min_aspect, float *max_aspect)
Get the size of a window's client area.
Definition: SDL3pp_video.h:5419
constexpr HitTestResult HITTEST_RESIZE_TOPRIGHT
Region is the resizable top-right corner border.
Definition: SDL3pp_video.h:664
constexpr GLAttr GL_CONTEXT_MAJOR_VERSION
OpenGL context major version.
Definition: SDL3pp_video.h:3456
constexpr HitTestResult HITTEST_NORMAL
Region is normal. No special properties.
Definition: SDL3pp_video.h:651
void GL_Swap()
Update a window with OpenGL rendering.
Definition: SDL3pp_video.h:7215
void SetPosition(const PointRaw &p)
Request that the window's position be set.
Definition: SDL3pp_video.h:5115
Surface GetSurface()
Get the SDL surface associated with the window.
Definition: SDL3pp_video.h:6018
constexpr GLContextFlag GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
FORWARD_COMPATIBLE_FLAG.
Definition: SDL3pp_video.h:3528
constexpr int WINDOWPOS_UNDEFINED_DISPLAY(int X)
Used to indicate that you don't care what the window position is.
Definition: SDL3pp_video.h:2998
WindowRef GL_GetCurrentWindow()
Get the currently active OpenGL window.
Definition: SDL3pp_video.h:7038
constexpr GLAttr GL_RETAINED_BACKING
not used (deprecated).
Definition: SDL3pp_video.h:3453
Rect GetDisplayUsableBounds(Display displayID)
Get the usable desktop area represented by a display, in screen coordinates.
Definition: SDL3pp_video.h:3789
Display GetDisplay() const
Get the display associated with a window.
Definition: SDL3pp_video.h:4094
constexpr HitTestResult HITTEST_RESIZE_RIGHT
Region is the resizable right border.
Definition: SDL3pp_video.h:668
float GetContentScale() const
Get the content scale of a display.
Definition: SDL3pp_video.h:3877
float GetOpacity() const
Get the opacity of a window.
Definition: SDL3pp_video.h:6400
constexpr FlashOperation FLASH_BRIEFLY
Flash the window briefly to get attention.
Definition: SDL3pp_video.h:633
void DestroyWindowSurface(WindowParam window)
Destroy the surface associated with the window.
Definition: SDL3pp_video.h:6160
void GL_UnloadLibrary()
Unload the OpenGL library previously loaded by GL_LoadLibrary().
Definition: SDL3pp_video.h:6886
bool GetWindowKeyboardGrab(WindowParam window)
Get a window's keyboard grab mode.
Definition: SDL3pp_video.h:6246
constexpr GLAttr GL_STEREO
whether the output is stereo 3D; defaults to off.
Definition: SDL3pp_video.h:3435
constexpr GLAttr GL_CONTEXT_MINOR_VERSION
OpenGL context minor version.
Definition: SDL3pp_video.h:3459
constexpr GLAttr GL_CONTEXT_PROFILE_MASK
type of GL context (Core, Compatibility, ES).
Definition: SDL3pp_video.h:3472
DisplayOrientation GetCurrentDisplayOrientation(DisplayID displayID)
Get the orientation of a display.
Definition: SDL3pp_video.h:3837
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:3376
Display GetDisplayForRect(const RectRaw &rect)
Get the display primarily containing a rect.
Definition: SDL3pp_video.h:4064
constexpr WindowFlags WINDOW_MOUSE_GRABBED
window has grabbed mouse input
Definition: SDL3pp_video.h:567
bool ScreenSaverEnabled()
Check whether the screensaver is currently enabled.
Definition: SDL3pp_video.h:6735
Display GetDisplayForPoint(const PointRaw &point)
Get the display containing a point.
Definition: SDL3pp_video.h:4039
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:3382
FunctionPointer GL_GetProcAddress(StringParam proc)
Get an OpenGL function by name.
Definition: SDL3pp_video.h:6850
SDL_EGLAttribArrayCallback EGLAttribArrayCallback
EGL platform attribute initialization callback.
Definition: SDL3pp_video.h:3262
constexpr GLAttr GL_CONTEXT_RESET_NOTIFICATION
set context reset notification.
Definition: SDL3pp_video.h:3491
Window CreateWindow(StringParam title, const PointRaw &size, WindowFlags flags)
Create a window with the specified dimensions and flags.
Definition: SDL3pp_video.h:4368
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:3511
float GetDisplayContentScale(DisplayID displayID)
Get the content scale of a display.
Definition: SDL3pp_video.h:3872
GLContext GL_CreateContext(WindowParam window)
Create an OpenGL context for an OpenGL window, and make it current.
Definition: SDL3pp_video.h:6990
void SetWindowMinimumSize(WindowParam window, const PointRaw &p)
Set the minimum size of a window's client area.
Definition: SDL3pp_video.h:5549
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:7125
GLContext CreateGLContext()
Create an OpenGL context for an OpenGL window, and make it current.
Definition: SDL3pp_video.h:6995
const DisplayMode & GetCurrentDisplayMode(DisplayID displayID)
Get information about the current display mode.
Definition: SDL3pp_video.h:4015
void Flash(FlashOperation operation)
Request a window to demand attention from the user.
Definition: SDL3pp_video.h:6686
SDL_HitTestResult HitTestResult
Possible return values from the HitTest callback.
Definition: SDL3pp_video.h:649
Rect GetDisplayBounds(Display displayID)
Get the desktop area represented by a display.
Definition: SDL3pp_video.h:3755
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:5391
constexpr WindowFlags WINDOW_METAL
window usable for Metal view
Definition: SDL3pp_video.h:614
constexpr WindowFlags WINDOW_MINIMIZED
window is minimized
Definition: SDL3pp_video.h:561
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:3433
constexpr int WINDOW_SURFACE_VSYNC_DISABLED
Constant to disable vsync.
Definition: SDL3pp_video.h:6057
bool GetMouseGrab() const
Get a window's mouse grab mode.
Definition: SDL3pp_video.h:6276
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:4116
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:3415
OwnArray< DisplayMode * > GetFullscreenDisplayModes(Display displayID)
Get a list of fullscreen display modes available on a display.
Definition: SDL3pp_video.h:3904
const DisplayMode & GetWindowFullscreenMode(WindowParam window)
Query the display mode to use when a window is visible at fullscreen.
Definition: SDL3pp_video.h:4213
void SetWindowFullscreen(WindowParam window, bool fullscreen)
Request that the window's fullscreen state be changed.
Definition: SDL3pp_video.h:5918
void SetKeyboardGrab(bool grabbed)
Set a window's keyboard grab mode.
Definition: SDL3pp_video.h:6201
SDL_SystemTheme SystemTheme
System theme.
Definition: SDL3pp_video.h:504
void RestoreWindow(WindowParam window)
Request that the size and position of a minimized or maximized window be restored.
Definition: SDL3pp_video.h:5882
constexpr WindowFlags WINDOW_HIGH_PIXEL_DENSITY
window uses high pixel density back buffer if possible
Definition: SDL3pp_video.h:582
constexpr GLAttr GL_CONTEXT_FLAGS
some combination of 0 or more of elements of the GLContextFlag enumeration; defaults to 0.
Definition: SDL3pp_video.h:3466
void SetAlwaysOnTop(bool on_top)
Set the window to always be above the others.
Definition: SDL3pp_video.h:5716
void SetWindowShape(WindowParam window, SurfaceParam shape)
Set the shape of a transparent window.
Definition: SDL3pp_video.h:6660
constexpr GLProfile GL_CONTEXT_PROFILE_ES
GLX_CONTEXT_ES2_PROFILE_BIT_EXT.
Definition: SDL3pp_video.h:3515
constexpr GLAttr GL_DOUBLEBUFFER
whether the output is single or double buffered; defaults to double buffering on.
Definition: SDL3pp_video.h:3403
float GetWindowDisplayScale(WindowParam window)
Get the content display scale relative to a window's pixel size.
Definition: SDL3pp_video.h:4147
Display GetPrimaryDisplay()
Return the primary display.
Definition: SDL3pp_video.h:3663
SDL_DisplayModeData DisplayModeData
Internal display mode data.
Definition: SDL3pp_video.h:524
constexpr HitTestResult HITTEST_RESIZE_LEFT
Region is the resizable left border.
Definition: SDL3pp_video.h:682
Point GetPosition() const
Get the position of a window.
Definition: SDL3pp_video.h:5178
void SetWindowBordered(WindowParam window, bool bordered)
Set the border state of a window.
Definition: SDL3pp_video.h:5656
float GetWindowOpacity(WindowParam window)
Get the opacity of a window.
Definition: SDL3pp_video.h:6395
PixelFormat GetWindowPixelFormat(WindowParam window)
Get the pixel format associated with the window.
Definition: SDL3pp_video.h:4256
void GL_GetAttribute(GLAttr attr, int *value)
Get the actual value for an attribute from the current context.
Definition: SDL3pp_video.h:6963
void Show()
Show a window.
Definition: SDL3pp_video.h:5739
void MakeCurrent(GLContext context)
Set up an OpenGL context for rendering into an OpenGL window.
Definition: SDL3pp_video.h:7017
PropertiesRef GetDisplayProperties(DisplayID displayID)
Get the properties associated with a display.
Definition: SDL3pp_video.h:3696
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:6565
void Minimize()
Request that the window be minimized to an iconic representation.
Definition: SDL3pp_video.h:5853
void MaximizeWindow(WindowParam window)
Request that the window be made as large as possible.
Definition: SDL3pp_video.h:5815
void GL_SetAttribute(GLAttr attr, int value)
Set an OpenGL window attribute before window creation.
Definition: SDL3pp_video.h:6944
void SetSize(const PointRaw &size)
Request that the size of a window's client area be set.
Definition: SDL3pp_video.h:5221
const char * GetCurrentVideoDriver()
Get the name of the currently initialized video driver.
Definition: SDL3pp_video.h:3617
Point GetSizeInPixels() const
Get the size of a window's client area, in pixels.
Definition: SDL3pp_video.h:5530
constexpr GLAttr GL_MULTISAMPLEBUFFERS
the number of buffers used for multisample anti-aliasing; defaults to 0.
Definition: SDL3pp_video.h:3439
PropertiesRef GetProperties() const
Get the properties associated with a window.
Definition: SDL3pp_video.h:4964
void ShowSystemMenu(const PointRaw &p)
Display the system-level window menu.
Definition: SDL3pp_video.h:6519
const DisplayMode & GetCurrentMode() const
Get information about the current display mode.
Definition: SDL3pp_video.h:4020
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:3394
constexpr WindowFlags WINDOW_MODAL
window is modal
Definition: SDL3pp_video.h:579
int GetNumVideoDrivers()
Get the number of video drivers compiled into SDL.
Definition: SDL3pp_video.h:3574
std::function< HitTestResult(WindowRaw window, const Point &area)> HitTestCB
Callback used for hit-testing.
Definition: SDL3pp_video.h:710
void SetWindowMouseRect(WindowParam window, const RectRaw &rect)
Confines the cursor to the specified area of a window.
Definition: SDL3pp_video.h:6316
bool GL_ExtensionSupported(StringParam extension)
Check if an OpenGL extension is supported for the current context.
Definition: SDL3pp_video.h:6908
constexpr WindowFlags WINDOW_INPUT_FOCUS
window has input focus
Definition: SDL3pp_video.h:570
void SetWindowRect(WindowParam window, Rect rect)
Request the window's position and size to be set.
Definition: SDL3pp_video.h:5296
int GetSurfaceVSync() const
Get VSync for the window surface.
Definition: SDL3pp_video.h:6081
void SetOpacity(float opacity)
Set the opacity for a window.
Definition: SDL3pp_video.h:6374
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:3421
constexpr GLContextFlag GL_CONTEXT_DEBUG_FLAG
DEBUG_FLAG.
Definition: SDL3pp_video.h:3525
Uint32 GLContextFlag
Possible flags to be set for the GL_CONTEXT_FLAGS attribute.
Definition: SDL3pp_video.h:3523
SDL_WindowID WindowID
This is a unique ID for a window.
Definition: SDL3pp_video.h:478
const char * GetName() const
Get the name of a display in UTF-8 encoding.
Definition: SDL3pp_video.h:3733
void SetWindowResizable(WindowParam window, bool resizable)
Set the user-resizable state of a window.
Definition: SDL3pp_video.h:5685
void SetBordered(bool bordered)
Set the border state of a window.
Definition: SDL3pp_video.h:5661
DisplayOrientation GetNaturalOrientation() const
Get the orientation of a display when it is unrotated.
Definition: SDL3pp_video.h:3819
void ShowWindow(WindowParam window)
Show a window.
Definition: SDL3pp_video.h:5734
void SetTitle(StringParam title)
Set the title of a window.
Definition: SDL3pp_video.h:5017
void SetWindowParent(WindowParam window, WindowParam parent)
Set the window as a child of a parent window.
Definition: SDL3pp_video.h:6436
constexpr HitTestResult HITTEST_RESIZE_TOP
Region is the resizable top border.
Definition: SDL3pp_video.h:661
void ShowWindowSystemMenu(WindowParam window, const PointRaw &p)
Display the system-level window menu.
Definition: SDL3pp_video.h:6514
const char * GetVideoDriver(int index)
Get the name of a built in video driver.
Definition: SDL3pp_video.h:3595
void GetWindowMaximumSize(WindowParam window, int *w, int *h)
Get the maximum size of a window's client area.
Definition: SDL3pp_video.h:5627
EGLSurface EGL_GetWindowSurface(WindowParam window)
Get the EGL surface associated with the window.
Definition: SDL3pp_video.h:7095
constexpr int WINDOWPOS_CENTERED_DISPLAY(int X)
Used to indicate that the window position should be centered.
Definition: SDL3pp_video.h:3044
void Maximize()
Request that the window be made as large as possible.
Definition: SDL3pp_video.h:5820
SDL_EGLSurface EGLSurface
Opaque type for an EGL surface.
Definition: SDL3pp_video.h:717
const char * GetDisplayName(DisplayID displayID)
Get the name of a display in UTF-8 encoding.
Definition: SDL3pp_video.h:3728
SDL_FlashOperation FlashOperation
Window flash operation.
Definition: SDL3pp_video.h:628
constexpr WindowFlags WINDOW_VULKAN
window usable for Vulkan surface
Definition: SDL3pp_video.h:611
Rect GetRect() const
Get the position and client size of a window.
Definition: SDL3pp_video.h:5323
bool WindowHasSurface(WindowParam window)
Return whether the window has a surface associated with it.
Definition: SDL3pp_video.h:5976
constexpr HitTestResult HITTEST_RESIZE_TOPLEFT
Region is the resizable top-left corner border.
Definition: SDL3pp_video.h:657
constexpr HitTestResult HITTEST_RESIZE_BOTTOMRIGHT
Region is the resizable bottom-right corner border.
Definition: SDL3pp_video.h:672
SDL_EGLConfig EGLConfig
Opaque type for an EGL config.
Definition: SDL3pp_video.h:3223
constexpr SystemTheme SYSTEM_THEME_UNKNOWN
Unknown system theme.
Definition: SDL3pp_video.h:506
constexpr WindowFlags WINDOW_KEYBOARD_GRABBED
window has grabbed keyboard input
Definition: SDL3pp_video.h:608
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:3388
constexpr GLAttr GL_EGL_PLATFORM
GL_EGL_PLATFORM.
Definition: SDL3pp_video.h:3499
constexpr WindowFlags WINDOW_BORDERLESS
no window decoration
Definition: SDL3pp_video.h:555
const DisplayMode & GetDesktopMode() const
Get information about the desktop's display mode.
Definition: SDL3pp_video.h:3991
void SetWindowFocusable(WindowParam window, bool focusable)
Set whether the window may have input focus.
Definition: SDL3pp_video.h:6484
SDL_EGLDisplay EGLDisplay
Opaque type for an EGL display.
Definition: SDL3pp_video.h:3216
void GetWindowSizeInPixels(WindowParam window, int *w, int *h)
Get the size of a window's client area, in pixels.
Definition: SDL3pp_video.h:5498
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:603
constexpr WindowFlags WINDOW_MOUSE_CAPTURE
window has mouse captured (unrelated to MOUSE_GRABBED)
Definition: SDL3pp_video.h:585
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:4446
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:5464
WindowRef GetGrabbedWindow()
Get the window that currently has an input grab enabled.
Definition: SDL3pp_video.h:6293
void UpdateWindowSurface(WindowParam window)
Copy the window surface to the screen.
Definition: SDL3pp_video.h:6104
constexpr GLAttr GL_BUFFER_SIZE
the minimum number of bits for frame buffer size; defaults to 0.
Definition: SDL3pp_video.h:3397
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:543
bool GetKeyboardGrab() const
Get a window's keyboard grab mode.
Definition: SDL3pp_video.h:6251
constexpr GLAttr GL_CONTEXT_NO_ERROR
GL_CONTEXT_NO_ERROR.
Definition: SDL3pp_video.h:3494
const char * GetWindowTitle(WindowParam window)
Get the title of a window.
Definition: SDL3pp_video.h:5034
void SetWindowAlwaysOnTop(WindowParam window, bool on_top)
Set the window to always be above the others.
Definition: SDL3pp_video.h:5711
void GetWindowSize(WindowParam window, int *w, int *h)
Get the size of a window's client area.
Definition: SDL3pp_video.h:5246
SDL_EGLint EGLint
An EGL integer attribute, used when creating an EGL surface.
Definition: SDL3pp_video.h:3237
WindowFlags GetWindowFlags(WindowParam window)
Get the window flags.
Definition: SDL3pp_video.h:4987
constexpr GLContextFlag GL_CONTEXT_ROBUST_ACCESS_FLAG
ROBUST_ACCESS_FLAG.
Definition: SDL3pp_video.h:3531
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:6013
constexpr int WINDOWPOS_UNDEFINED
Used to indicate that you don't care what the window position/display is.
Definition: SDL3pp_video.h:3010
const char * GetTitle() const
Get the title of a window.
Definition: SDL3pp_video.h:5039
constexpr WindowFlags WINDOW_MOUSE_RELATIVE_MODE
window has relative mode enabled
Definition: SDL3pp_video.h:587
constexpr WindowFlags WINDOW_OCCLUDED
window is occluded
Definition: SDL3pp_video.h:546
constexpr FlashOperation FLASH_UNTIL_FOCUSED
Flash the window until it gets focus.
Definition: SDL3pp_video.h:636
static Display GetForPoint(const PointRaw &point)
Get the display containing a point.
Definition: SDL3pp_video.h:4044
void SetWindowOpacity(WindowParam window, float opacity)
Set the opacity for a window.
Definition: SDL3pp_video.h:6369
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:3506
void SetMouseRect(const RectRaw &rect)
Confines the cursor to the specified area of a window.
Definition: SDL3pp_video.h:6321
void SetWindowModal(WindowParam window, bool modal)
Toggle the state of the window as modal.
Definition: SDL3pp_video.h:6463
void Destroy()
Destroy a window.
Definition: SDL3pp_video.h:6717
SystemTheme GetSystemTheme()
Get the current system theme.
Definition: SDL3pp_video.h:3631
static Display GetForRect(const RectRaw &rect)
Get the display primarily containing a rect.
Definition: SDL3pp_video.h:4069
DisplayOrientation GetCurrentOrientation() const
Get the orientation of a display.
Definition: SDL3pp_video.h:3842
OwnPtr< void > GetICCProfile() const
Get the raw ICC profile data for the screen the window is currently on.
Definition: SDL3pp_video.h:4240
static WindowRef FromID(WindowID id)
Get a window from a stored ID.
Definition: SDL3pp_video.h:4814
PropertiesRef GetWindowProperties(WindowParam window)
Get the properties associated with a window.
Definition: SDL3pp_video.h:4959
void GetAspectRatio(float *min_aspect, float *max_aspect) const
Get the size of a window's client area.
Definition: SDL3pp_video.h:5426
void GetWindowMinimumSize(WindowParam window, int *w, int *h)
Get the minimum size of a window's client area.
Definition: SDL3pp_video.h:5576
constexpr WindowFlags WINDOW_NOT_FOCUSABLE
window should not be focusable
Definition: SDL3pp_video.h:620
void SetWindowKeyboardGrab(WindowParam window, bool grabbed)
Set a window's keyboard grab mode.
Definition: SDL3pp_video.h:6196
constexpr GLContextResetNotification GL_CONTEXT_RESET_NO_NOTIFICATION
NO_NOTIFICATION.
Definition: SDL3pp_video.h:3557
constexpr GLAttr GL_FLOATBUFFERS
GL_FLOATBUFFERS.
Definition: SDL3pp_video.h:3497
void GL_MakeCurrent(WindowParam window, GLContext context)
Set up an OpenGL context for rendering into an OpenGL window.
Definition: SDL3pp_video.h:7012
void Raise()
Request that a window be raised above other windows and gain the input focus.
Definition: SDL3pp_video.h:5782
void SetMaximumSize(const PointRaw &p)
Set the maximum size of a window's client area.
Definition: SDL3pp_video.h:5605
GLContext GL_GetCurrentContext()
Get the currently active OpenGL context.
Definition: SDL3pp_video.h:7055
constexpr WindowFlags WINDOW_RESIZABLE
window can be resized
Definition: SDL3pp_video.h:558
OwnArray< WindowRef > GetWindows()
Get a list of valid windows.
Definition: SDL3pp_video.h:4276
PixelFormat GetPixelFormat() const
Get the pixel format associated with the window.
Definition: SDL3pp_video.h:4261
constexpr WindowFlags WINDOW_POPUP_MENU
window should be treated as a popup menu, requires a parent window
Definition: SDL3pp_video.h:606
void Hide()
Hide a window.
Definition: SDL3pp_video.h:5759
void SetParent(WindowParam parent)
Set the window as a child of a parent window.
Definition: SDL3pp_video.h:6441
constexpr GLContextResetNotification GL_CONTEXT_RESET_LOSE_CONTEXT
LOSE_CONTEXT.
Definition: SDL3pp_video.h:3560
Display GetDisplayForWindow(WindowParam window)
Get the display associated with a window.
Definition: SDL3pp_video.h:4089
void SetModal(bool modal)
Toggle the state of the window as modal.
Definition: SDL3pp_video.h:6468
void GL_ResetAttributes()
Reset all previously set OpenGL context attributes to their default values.
Definition: SDL3pp_video.h:6923
Uint32 GLContextResetNotification
Possible values to be set GL_CONTEXT_RESET_NOTIFICATION attribute.
Definition: SDL3pp_video.h:3555
void Destroy()
Delete an OpenGL context.
Definition: SDL3pp_video.h:7234
constexpr WindowFlags WINDOW_EXTERNAL
window not created by SDL
Definition: SDL3pp_video.h:576
Rect GetSafeArea() const
Get the safe area for this window.
Definition: SDL3pp_video.h:5349
void SetWindowMaximumSize(WindowParam window, const PointRaw &p)
Set the maximum size of a window's client area.
Definition: SDL3pp_video.h:5600
WindowFlags GetFlags() const
Get the window flags.
Definition: SDL3pp_video.h:4992
void SyncWindow(WindowParam window)
Block until any pending window state is finalized.
Definition: SDL3pp_video.h:5956
OwnArray< DisplayID > GetDisplays()
Get a list of currently connected displays.
Definition: SDL3pp_video.h:3643
const RectRaw * GetMouseRect() const
Get the mouse confinement rectangle of a window.
Definition: SDL3pp_video.h:6346
constexpr WindowFlags WINDOW_ALWAYS_ON_TOP
window should always be above others
Definition: SDL3pp_video.h:590
std::function< SDL_EGLAttrib *()> EGLAttribArrayCB
EGL platform attribute initialization callback.
Definition: SDL3pp_video.h:3288
const DisplayMode & GetFullscreenMode() const
Query the display mode to use when a window is visible at fullscreen.
Definition: SDL3pp_video.h:4218
constexpr WindowFlags WINDOW_HIDDEN
window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; Window....
Definition: SDL3pp_video.h:553
constexpr GLAttr GL_SHARE_WITH_CURRENT_CONTEXT
OpenGL context sharing; defaults to 0.
Definition: SDL3pp_video.h:3474
void SetWindowTitle(WindowParam window, StringParam title)
Set the title of a window.
Definition: SDL3pp_video.h:5012
void Sync()
Block until any pending window state is finalized.
Definition: SDL3pp_video.h:5961
WindowID GetWindowID(WindowParam window)
Get the numeric ID of a window.
Definition: SDL3pp_video.h:4786
EGLConfig EGL_GetCurrentConfig()
Get the currently active EGL config.
Definition: SDL3pp_video.h:7082
void HideWindow(WindowParam window)
Hide a window.
Definition: SDL3pp_video.h:5754
static Display GetPrimary()
Return the primary display.
Definition: SDL3pp_video.h:3668
constexpr HitTestResult HITTEST_RESIZE_BOTTOM
Region is the resizable bottom border.
Definition: SDL3pp_video.h:675
OwnPtr< void > GetWindowICCProfile(WindowParam window)
Get the raw ICC profile data for the screen the window is currently on.
Definition: SDL3pp_video.h:4234
void RaiseWindow(WindowParam window)
Request that a window be raised above other windows and gain the input focus.
Definition: SDL3pp_video.h:5777
bool HasSurface() const
Return whether the window has a surface associated with it.
Definition: SDL3pp_video.h:5981
Rect GetUsableBounds() const
Get the usable desktop area represented by a display, in screen coordinates.
Definition: SDL3pp_video.h:3796
void SetResizable(bool resizable)
Set the user-resizable state of a window.
Definition: SDL3pp_video.h:5690
void DestroyWindow(WindowRaw window)
Destroy a window.
Definition: SDL3pp_video.h:6710
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:3427
const RectRaw * GetWindowMouseRect(WindowParam window)
Get the mouse confinement rectangle of a window.
Definition: SDL3pp_video.h:6341
WindowRef GetWindowFromID(WindowID id)
Get a window from a stored ID.
Definition: SDL3pp_video.h:4809
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:5473
constexpr WindowFlags WINDOW_FULLSCREEN
window is in fullscreen mode
Definition: SDL3pp_video.h:540
void UpdateSurfaceRects(SpanRef< const RectRaw > rects)
Copy areas of the window surface to the screen.
Definition: SDL3pp_video.h:6142
constexpr GLContextReleaseFlag GL_CONTEXT_RELEASE_BEHAVIOR_NONE
BEHAVIOR_NONE.
Definition: SDL3pp_video.h:3544
void SetShape(SurfaceParam shape)
Set the shape of a transparent window.
Definition: SDL3pp_video.h:6665
WindowRef GetParent() const
Get parent of a window.
Definition: SDL3pp_video.h:4837
SDL_EGLAttrib EGLAttrib
An EGL attribute, used when creating an EGL context.
Definition: SDL3pp_video.h:3230
void GL_LoadLibrary(StringParam path)
Dynamically load an OpenGL library.
Definition: SDL3pp_video.h:6792
void SetFullscreen(bool fullscreen)
Request that the window's fullscreen state be changed.
Definition: SDL3pp_video.h:5923
void MakeCurrent(WindowParam window)
Set up an OpenGL context for rendering into an OpenGL window.
Definition: SDL3pp_video.h:7022
void SetFullscreenMode(OptionalRef< const DisplayMode > mode)
Set the display mode to use when a window is visible and fullscreen.
Definition: SDL3pp_video.h:4194
constexpr GLAttr GL_DEPTH_SIZE
the minimum number of bits in the depth buffer; defaults to 16.
Definition: SDL3pp_video.h:3406
void SetIcon(SurfaceParam icon)
Set the icon for a window.
Definition: SDL3pp_video.h:5070
std::function< SDL_EGLint *(SDL_EGLDisplay, SDL_EGLConfig)> EGLIntArrayCB
EGL surface/context attribute initialization callback types.
Definition: SDL3pp_video.h:3351
constexpr int WINDOWPOS_CENTERED_MASK
A magic value used with WINDOWPOS_CENTERED.
Definition: SDL3pp_video.h:3032
EGLDisplay EGL_GetCurrentDisplay()
Get the currently active EGL display.
Definition: SDL3pp_video.h:7067
void SetMouseGrab(bool grabbed)
Set a window's mouse grab mode.
Definition: SDL3pp_video.h:6229
void MinimizeWindow(WindowParam window)
Request that the window be minimized to an iconic representation.
Definition: SDL3pp_video.h:5848
constexpr GLContextReleaseFlag GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH
BEHAVIOR_FLUSH.
Definition: SDL3pp_video.h:3547
void SetSurfaceVSync(int vsync)
Toggle VSync for the window surface.
Definition: SDL3pp_video.h:6051
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:3451
void SetWindowMouseGrab(WindowParam window, bool grabbed)
Set a window's mouse grab mode.
Definition: SDL3pp_video.h:6224
constexpr bool WINDOWPOS_ISCENTERED(int X)
A macro to test if the window position is marked as "centered.".
Definition: SDL3pp_video.h:3065
SDL_EGLIntArrayCallback EGLIntArrayCallback
EGL surface/context attribute initialization callback types.
Definition: SDL3pp_video.h:3319
Main include header for the SDL3pp library.
Safely wrap GLContext for non owning parameters.
Definition: SDL3pp_video.h:90
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.
constexpr GLContextParam(std::nullptr_t _=nullptr)
Constructs null/invalid.
Definition: SDL3pp_video.h:100
RAII owning version GLContext.
Definition: SDL3pp_video.h:3196
constexpr GLContextScoped(GLContext &&other)
Move constructor.
Definition: SDL3pp_video.h:3202
~GLContextScoped()
Destructor.
Definition: SDL3pp_video.h:3208
Store callbacks by key.
Definition: SDL3pp_callbackWrapper.h:222
The structure that defines a point (using integers).
Definition: SDL3pp_rect.h:83
Safely wrap Properties for non owning parameters.
Definition: SDL3pp_properties.h:52
Semi-safe reference for Properties.
Definition: SDL3pp_properties.h:701
A rectangle, with the origin at the upper left (using integers).
Definition: SDL3pp_rect.h:839
constexpr Point GetTopLeft() const
Get top left corner of the rect.
Definition: SDL3pp_rect.h:1088
constexpr Point GetSize() const
Get size of the rect.
Definition: SDL3pp_rect.h:1120
Semi-safe reference for Renderer.
Definition: SDL3pp_render.h:2100
Safely wrap Surface for non owning parameters.
Definition: SDL3pp_surface.h:46
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:2955
~WindowRef()
Destructor.
Definition: SDL3pp_video.h:2975
WindowRef(WindowParam resource)
Constructs from WindowParam.
Definition: SDL3pp_video.h:2963
WindowRef(const WindowRef &other)
Copy constructor.
Definition: SDL3pp_video.h:2969