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
41using DisplayID = SDL_DisplayID;
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
204
217 static Display GetPrimary();
218
245
258 const char* GetName() const;
259
276 Rect GetBounds() const;
277
300 Rect GetUsableBounds() const;
301
315
329
354 float GetContentScale() const;
355
378
405 float refresh_rate,
406 bool include_high_density_modes) const;
407
426 const DisplayMode& GetDesktopMode() const;
427
446 const DisplayMode& GetCurrentMode() const;
447
462 static Display GetForPoint(const PointRaw& point);
463
479 static Display GetForRect(const RectRaw& rect);
480};
481
489using WindowID = SDL_WindowID;
490
491namespace prop::Global {
492
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
551
553 SDL_WINDOW_FULLSCREEN;
554
556 SDL_WINDOW_OPENGL;
557
559 SDL_WINDOW_OCCLUDED;
560
565constexpr WindowFlags WINDOW_HIDDEN = SDL_WINDOW_HIDDEN;
566
568 SDL_WINDOW_BORDERLESS;
569
571 SDL_WINDOW_RESIZABLE;
572
574 SDL_WINDOW_MINIMIZED;
575
577 SDL_WINDOW_MAXIMIZED;
578
580 SDL_WINDOW_MOUSE_GRABBED;
581
583 SDL_WINDOW_INPUT_FOCUS;
584
586 SDL_WINDOW_MOUSE_FOCUS;
587
589 SDL_WINDOW_EXTERNAL;
590
591constexpr WindowFlags WINDOW_MODAL = SDL_WINDOW_MODAL;
592
594constexpr WindowFlags WINDOW_HIGH_PIXEL_DENSITY = SDL_WINDOW_HIGH_PIXEL_DENSITY;
595
597constexpr WindowFlags WINDOW_MOUSE_CAPTURE = SDL_WINDOW_MOUSE_CAPTURE;
598
600 SDL_WINDOW_MOUSE_RELATIVE_MODE;
601
603 SDL_WINDOW_ALWAYS_ON_TOP;
604
609constexpr WindowFlags WINDOW_UTILITY = SDL_WINDOW_UTILITY;
610
615constexpr WindowFlags WINDOW_TOOLTIP = SDL_WINDOW_TOOLTIP;
616
618constexpr WindowFlags WINDOW_POPUP_MENU = SDL_WINDOW_POPUP_MENU;
619
621 SDL_WINDOW_KEYBOARD_GRABBED;
622
624 SDL_WINDOW_VULKAN;
625
627 SDL_WINDOW_METAL;
628
630 SDL_WINDOW_TRANSPARENT;
631
633 SDL_WINDOW_NOT_FOCUSABLE;
634
640using FlashOperation = SDL_FlashOperation;
641
643 SDL_FLASH_CANCEL;
644
646 SDL_FLASH_BRIEFLY;
647
649 SDL_FLASH_UNTIL_FOCUSED;
650
661using HitTestResult = SDL_HitTestResult;
662
664 SDL_HITTEST_NORMAL;
665
667 SDL_HITTEST_DRAGGABLE;
668
670 SDL_HITTEST_RESIZE_TOPLEFT;
672
674 SDL_HITTEST_RESIZE_TOP;
675
677 SDL_HITTEST_RESIZE_TOPRIGHT;
679
681 SDL_HITTEST_RESIZE_RIGHT;
682
685 SDL_HITTEST_RESIZE_BOTTOMRIGHT;
686
688 SDL_HITTEST_RESIZE_BOTTOM;
689
691 SDL_HITTEST_RESIZE_BOTTOMLEFT;
693
695 SDL_HITTEST_RESIZE_LEFT;
696
707using HitTest = SDL_HitTest;
708
722 std::function<HitTestResult(WindowRaw window, const Point& area)>;
723
734{
735 WindowRaw m_resource = nullptr;
736
737public:
739 constexpr Window() = default;
740
748 constexpr explicit Window(const WindowRaw resource)
749 : m_resource(resource)
750 {
751 }
752
754 constexpr Window(const Window& other) = delete;
755
757 constexpr Window(Window&& other)
758 : Window(other.release())
759 {
760 }
761
762 constexpr Window(const WindowRef& other) = delete;
763
764 constexpr Window(WindowRef&& other) = delete;
765
853 Window(StringParam title, const PointRaw& size, WindowFlags flags = 0)
854 : m_resource(SDL_CreateWindow(title, size.x, size.y, flags))
855 {
856 }
857
930 const PointRaw& offset,
931 const PointRaw& size,
932 WindowFlags flags = 0)
933 : m_resource(SDL_CreatePopupWindow(parent,
934 offset.x,
935 offset.y,
936 size.x,
937 size.y,
938 flags))
939 {
940 }
941
1070 : m_resource(SDL_CreateWindowWithProperties(props))
1071 {
1072 }
1073
1075 ~Window() { SDL_DestroyWindow(m_resource); }
1076
1079 {
1080 std::swap(m_resource, other.m_resource);
1081 return *this;
1082 }
1083
1085 constexpr WindowRaw get() const { return m_resource; }
1086
1088 constexpr WindowRaw release()
1089 {
1090 auto r = m_resource;
1091 m_resource = nullptr;
1092 return r;
1093 }
1094
1096 constexpr auto operator<=>(const Window& other) const = default;
1097
1099 constexpr bool operator==(std::nullptr_t _) const { return !m_resource; }
1100
1102 constexpr explicit operator bool() const { return !!m_resource; }
1103
1105 constexpr operator WindowParam() const { return {m_resource}; }
1106
1126 void Destroy();
1127
1142 Display GetDisplay() const;
1143
1160 float GetPixelDensity() const;
1161
1183 float GetDisplayScale() const;
1184
1217
1231 const DisplayMode& GetFullscreenMode() const;
1232
1244
1256
1272 WindowID GetID() const;
1273
1286 WindowRef GetParent() const;
1287
1408
1426 WindowFlags GetFlags() const;
1427
1442 void SetTitle(StringParam title);
1443
1456 const char* GetTitle() const;
1457
1478 void SetIcon(SurfaceParam icon);
1479
1491 void SetRect(Rect rect)
1492 {
1493 SetPosition(rect.GetTopLeft());
1494 SetSize(rect.GetSize());
1495 }
1496
1510 Rect GetRect() const { return Rect{GetPosition(), GetSize()}; }
1511
1547 void SetPosition(const PointRaw& p);
1548
1566 {
1567 Point p;
1568 GetPosition(&p.x, &p.y);
1569 return p;
1570 }
1571
1593 void GetPosition(int* x, int* y) const;
1594
1627 void SetSize(const PointRaw& p);
1628
1649 {
1650 Point p;
1651 GetSize(&p.x, &p.y);
1652 return p;
1653 }
1654
1674 void GetSize(int* w, int* h) const;
1675
1692 Rect GetSafeArea() const;
1693
1731 void SetAspectRatio(float min_aspect, float max_aspect);
1732
1748 void GetAspectRatio(float* min_aspect, float* max_aspect) const;
1749
1783 void GetBordersSize(int* top, int* left, int* bottom, int* right) const;
1784
1799 {
1800 Point p;
1801 GetSizeInPixels(&p.x, &p.y);
1802 return p;
1803 }
1804
1821 void GetSizeInPixels(int* w, int* h) const;
1822
1836 void SetMinimumSize(const PointRaw& p);
1837
1854 void GetMinimumSize(int* w, int* h) const;
1855
1869 void SetMaximumSize(const PointRaw& p);
1870
1887 void GetMaximumSize(int* w, int* h) const;
1888
1907 void SetBordered(bool bordered);
1908
1927 void SetResizable(bool resizable);
1928
1944 void SetAlwaysOnTop(bool on_top);
1945
1958 void Show();
1959
1972 void Hide();
1973
1990 void Raise();
1991
2022 void Maximize();
2023
2049 void Minimize();
2050
2077 void Restore();
2078
2107 void SetFullscreen(bool fullscreen);
2108
2136 void Sync();
2137
2150 bool HasSurface() const;
2151
2179
2202 void SetSurfaceVSync(int vsync);
2203
2217 int GetSurfaceVSync() const;
2218
2236 void UpdateSurface();
2237
2263
2276 void DestroySurface();
2277
2307 void SetKeyboardGrab(bool grabbed);
2308
2326 void SetMouseGrab(bool grabbed);
2327
2339 bool GetKeyboardGrab() const;
2340
2355 bool GetMouseGrab() const;
2356
2375 void SetMouseRect(const RectRaw& rect);
2376
2391 const RectRaw* GetMouseRect() const;
2392
2410 void SetOpacity(float opacity);
2411
2427 float GetOpacity() const;
2428
2459 void SetParent(WindowParam parent);
2460
2477 void SetModal(bool modal);
2478
2489 void SetFocusable(bool focusable);
2490
2510 void ShowSystemMenu(const PointRaw& p);
2511
2553 void SetHitTest(HitTestCB callback)
2554 {
2556 void* cbHandle = Wrapper::Wrap(m_resource, std::move(callback));
2557 SetHitTest(
2558 [](SDL_Window* win, const SDL_Point* area, void* data) {
2559 return Wrapper::Call(data, win, Point(*area));
2560 },
2561 cbHandle);
2562 }
2563
2604 void SetHitTest(HitTest callback, void* callback_data);
2605
2630 void SetShape(SurfaceParam shape);
2631
2642 void Flash(FlashOperation operation);
2643
2660 static WindowRef FromID(WindowID id);
2661
2674 static WindowRef GetGrabbed();
2675
2700 void StartTextInput();
2701
2750 void StartTextInput(PropertiesParam props);
2751
2763 bool IsTextInputActive() const;
2764
2779 void StopTextInput();
2780
2793 void ClearComposition();
2794
2814 void SetTextInputArea(const RectRaw& rect, int cursor);
2815
2833 void GetTextInputArea(RectRaw* rect, int* cursor);
2834
2846 bool IsScreenKeyboardShown() const;
2847
2866 void WarpMouse(const FPointRaw& p);
2867
2892 void SetRelativeMouseMode(bool enabled);
2893
2905 bool GetRelativeMouseMode() const;
2906
2917 RendererRef GetRenderer() const;
2918};
2919
2922{
2931 : Window(resource.value)
2932 {
2933 }
2934
2936 WindowRef(const WindowRef& other)
2937 : Window(other.get())
2938 {
2939 }
2940
2943};
2944
2945#ifdef SDL3PP_DOC
2946
2955#define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000u
2956
2967#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK | (X))
2968
2976#define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
2977
2985#define SDL_WINDOWPOS_ISUNDEFINED(X) \
2986 (((X) & 0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)
2987
2996#define SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000u
2997
3008#define SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK | (X))
3009
3017#define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0)
3018
3026#define SDL_WINDOWPOS_ISCENTERED(X) \
3027 (((X) & 0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)
3028
3029#endif // SDL3PP_DOC
3030
3041{
3042 GLContextRaw m_resource = nullptr;
3043
3044public:
3046 constexpr GLContext() = default;
3047
3053 constexpr GLContext(const GLContextRaw resource)
3054 : m_resource(resource)
3055 {
3056 }
3057
3059 constexpr GLContext(const GLContext& other) = default;
3060
3062 constexpr GLContext(GLContext&& other)
3063 : GLContext(other.release())
3064 {
3065 }
3066
3090 : m_resource(SDL_GL_CreateContext(window))
3091 {
3092 }
3093
3096
3099 {
3100 std::swap(m_resource, other.m_resource);
3101 return *this;
3102 }
3103
3105 constexpr GLContextRaw get() const { return m_resource; }
3106
3109 {
3110 auto r = m_resource;
3111 m_resource = nullptr;
3112 return r;
3113 }
3114
3116 constexpr auto operator<=>(const GLContext& other) const = default;
3117
3119 constexpr bool operator==(std::nullptr_t _) const { return !m_resource; }
3120
3122 constexpr explicit operator bool() const { return !!m_resource; }
3123
3125 constexpr operator GLContextParam() const { return {m_resource}; }
3126
3136 void Destroy();
3137
3152 void MakeCurrent(WindowParam window);
3153};
3154
3157{
3159
3160 constexpr GLContextScoped(const GLContext& other) = delete;
3161
3163 constexpr GLContextScoped(GLContext&& other)
3164 : GLContext(other.release())
3165 {
3166 }
3167
3170};
3171
3177using EGLDisplay = SDL_EGLDisplay;
3178
3184using EGLConfig = SDL_EGLConfig;
3185
3191using EGLSurface = SDL_EGLSurface;
3192
3198using EGLAttrib = SDL_EGLAttrib;
3199
3205using EGLint = SDL_EGLint;
3206
3230using EGLAttribArrayCallback = SDL_EGLAttribArrayCallback;
3231
3256using EGLAttribArrayCB = std::function<SDL_EGLAttrib*()>;
3257
3287using EGLIntArrayCallback = SDL_EGLIntArrayCallback;
3288
3319using EGLIntArrayCB = std::function<SDL_EGLint*(SDL_EGLDisplay, SDL_EGLConfig)>;
3320
3338using GLAttr = SDL_GLAttr;
3339
3344constexpr GLAttr GL_RED_SIZE = SDL_GL_RED_SIZE;
3345
3350constexpr GLAttr GL_GREEN_SIZE = SDL_GL_GREEN_SIZE;
3351
3356constexpr GLAttr GL_BLUE_SIZE = SDL_GL_BLUE_SIZE;
3357
3362constexpr GLAttr GL_ALPHA_SIZE = SDL_GL_ALPHA_SIZE;
3363
3365constexpr GLAttr GL_BUFFER_SIZE = SDL_GL_BUFFER_SIZE;
3366
3371constexpr GLAttr GL_DOUBLEBUFFER = SDL_GL_DOUBLEBUFFER;
3372
3374constexpr GLAttr GL_DEPTH_SIZE = SDL_GL_DEPTH_SIZE;
3375
3377constexpr GLAttr GL_STENCIL_SIZE = SDL_GL_STENCIL_SIZE;
3378
3383constexpr GLAttr GL_ACCUM_RED_SIZE = SDL_GL_ACCUM_RED_SIZE;
3384
3389constexpr GLAttr GL_ACCUM_GREEN_SIZE = SDL_GL_ACCUM_GREEN_SIZE;
3390
3395constexpr GLAttr GL_ACCUM_BLUE_SIZE = SDL_GL_ACCUM_BLUE_SIZE;
3396
3401constexpr GLAttr GL_ACCUM_ALPHA_SIZE = SDL_GL_ACCUM_ALPHA_SIZE;
3402
3404 SDL_GL_STEREO;
3405
3407constexpr GLAttr GL_MULTISAMPLEBUFFERS = SDL_GL_MULTISAMPLEBUFFERS;
3408
3413constexpr GLAttr GL_MULTISAMPLESAMPLES = SDL_GL_MULTISAMPLESAMPLES;
3414
3419constexpr GLAttr GL_ACCELERATED_VISUAL = SDL_GL_ACCELERATED_VISUAL;
3420
3422 SDL_GL_RETAINED_BACKING;
3423
3425 SDL_GL_CONTEXT_MAJOR_VERSION;
3426
3428 SDL_GL_CONTEXT_MINOR_VERSION;
3429
3434constexpr GLAttr GL_CONTEXT_FLAGS = SDL_GL_CONTEXT_FLAGS;
3435
3440constexpr GLAttr GL_CONTEXT_PROFILE_MASK = SDL_GL_CONTEXT_PROFILE_MASK;
3441
3443 SDL_GL_SHARE_WITH_CURRENT_CONTEXT;
3444
3446 SDL_GL_FRAMEBUFFER_SRGB_CAPABLE;
3448
3453constexpr GLAttr GL_CONTEXT_RELEASE_BEHAVIOR = SDL_GL_CONTEXT_RELEASE_BEHAVIOR;
3454
3460 SDL_GL_CONTEXT_RESET_NOTIFICATION;
3461
3463 SDL_GL_CONTEXT_NO_ERROR;
3464
3465constexpr GLAttr GL_FLOATBUFFERS = SDL_GL_FLOATBUFFERS;
3466
3467constexpr GLAttr GL_EGL_PLATFORM = SDL_GL_EGL_PLATFORM;
3468
3475
3477 SDL_GL_CONTEXT_PROFILE_CORE;
3478
3480 SDL_GL_CONTEXT_PROFILE_COMPATIBILITY;
3482
3484 SDL_GL_CONTEXT_PROFILE_ES;
3485
3492
3494 SDL_GL_CONTEXT_DEBUG_FLAG;
3495
3497 SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG;
3498
3500 SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG;
3501
3503 SDL_GL_CONTEXT_RESET_ISOLATION_FLAG;
3504
3512
3514 SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE;
3515
3517 SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH;
3518
3525
3527 SDL_GL_CONTEXT_RESET_NO_NOTIFICATION;
3528
3530 SDL_GL_CONTEXT_RESET_LOSE_CONTEXT;
3531
3543inline int GetNumVideoDrivers() { return SDL_GetNumVideoDrivers(); }
3544
3564inline const char* GetVideoDriver(int index)
3565{
3566 return SDL_GetVideoDriver(index);
3567}
3568
3586inline const char* GetCurrentVideoDriver()
3587{
3588 return SDL_GetCurrentVideoDriver();
3589}
3590
3600inline SystemTheme GetSystemTheme() { return SDL_GetSystemTheme(); }
3601
3613{
3614 int count = 0;
3615 auto data = reinterpret_cast<DisplayID*>(SDL_GetDisplays(&count));
3616 return OwnArray<DisplayID>{data, size_t(count)};
3617}
3618
3620
3634{
3635 return CheckError(SDL_GetPrimaryDisplay());
3636}
3637
3639
3667{
3668 return {CheckError(SDL_GetDisplayProperties(displayID))};
3669}
3670
3672{
3673 return SDL::GetDisplayProperties(m_displayID);
3674}
3675
3676namespace prop::Display {
3677
3678constexpr auto HDR_ENABLED_BOOLEAN = SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN;
3679
3680constexpr auto KMSDRM_PANEL_ORIENTATION_NUMBER =
3681 SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER;
3682
3683} // namespace prop::Display
3684
3698inline const char* GetDisplayName(DisplayID displayID)
3699{
3700 return SDL_GetDisplayName(displayID);
3701}
3702
3703inline const char* Display::GetName() const
3704{
3705 return SDL::GetDisplayName(m_displayID);
3706}
3707
3726{
3727 Rect bounds;
3728 SDL_GetDisplayBounds(displayID, &bounds);
3729 return bounds;
3730}
3731
3733{
3734 return SDL::GetDisplayBounds(m_displayID);
3735}
3736
3761{
3762 Rect bounds;
3763 SDL_GetDisplayUsableBounds(displayID, &bounds);
3764 return bounds;
3765}
3766
3768{
3769 return SDL::GetDisplayUsableBounds(m_displayID);
3770}
3771
3786{
3787 return SDL_GetNaturalDisplayOrientation(displayID);
3788}
3789
3791{
3792 return SDL::GetNaturalDisplayOrientation(m_displayID);
3793}
3794
3809{
3810 return SDL_GetCurrentDisplayOrientation(displayID);
3811}
3812
3814{
3815 return SDL::GetCurrentDisplayOrientation(m_displayID);
3816}
3817
3843inline float GetDisplayContentScale(DisplayID displayID)
3844{
3845 return SDL_GetDisplayContentScale(displayID);
3846}
3847
3848inline float Display::GetContentScale() const
3849{
3850 return SDL::GetDisplayContentScale(m_displayID);
3851}
3852
3876{
3877 int count = 0;
3878 auto data = CheckError(SDL_GetFullscreenDisplayModes(displayID, &count));
3879 return OwnArray<DisplayMode*>{data, size_t(count)};
3880}
3881
3883{
3884 return SDL::GetFullscreenDisplayModes(m_displayID);
3885}
3886
3915 DisplayID displayID,
3916 const PointRaw& size,
3917 float refresh_rate,
3918 bool include_high_density_modes)
3919{
3920 DisplayMode mode;
3921 CheckError(SDL_GetClosestFullscreenDisplayMode(displayID,
3922 size.x,
3923 size.y,
3924 refresh_rate,
3925 include_high_density_modes,
3926 &mode));
3927 return mode;
3928}
3929
3931 const PointRaw& size,
3932 float refresh_rate,
3933 bool include_high_density_modes) const
3934{
3936 m_displayID, size, refresh_rate, include_high_density_modes);
3937}
3938
3959{
3960 return *SDL_GetDesktopDisplayMode(displayID);
3961}
3962
3964{
3965 return SDL::GetDesktopDisplayMode(m_displayID);
3966}
3967
3988{
3989 return *SDL_GetCurrentDisplayMode(displayID);
3990}
3991
3993{
3994 return SDL::GetCurrentDisplayMode(m_displayID);
3995}
3996
4012{
4013 return SDL_GetDisplayForPoint(&point);
4014}
4015
4017{
4018 return SDL::GetDisplayForPoint(point);
4019}
4020
4037{
4038 return SDL_GetDisplayForRect(&rect);
4039}
4040
4042{
4043 return SDL::GetDisplayForRect(rect);
4044}
4045
4062{
4063 return SDL_GetDisplayForWindow(window);
4064}
4065
4067{
4068 return SDL::GetDisplayForWindow(m_resource);
4069}
4070
4089{
4090 return SDL_GetWindowPixelDensity(window);
4091}
4092
4093inline float Window::GetPixelDensity() const
4094{
4095 return SDL::GetWindowPixelDensity(m_resource);
4096}
4097
4121{
4122 return SDL_GetWindowDisplayScale(window);
4123}
4124
4125inline float Window::GetDisplayScale() const
4126{
4127 return SDL::GetWindowDisplayScale(m_resource);
4128}
4129
4164{
4165 CheckError(SDL_SetWindowFullscreenMode(window, mode));
4166}
4167
4169{
4170 SDL::SetWindowFullscreenMode(m_resource, mode);
4171}
4172
4188{
4189 return *SDL_GetWindowFullscreenMode(window);
4190}
4191
4193{
4194 return SDL::GetWindowFullscreenMode(m_resource);
4195}
4196
4209{
4210 size_t size;
4211 return OwnPtr<void>{CheckError(SDL_GetWindowICCProfile(window, &size))};
4212}
4213
4215{
4216 return SDL::GetWindowICCProfile(m_resource);
4217}
4218
4231{
4232 return CheckError(SDL_GetWindowPixelFormat(window));
4233}
4234
4236{
4237 return SDL::GetWindowPixelFormat(m_resource);
4238}
4239
4251{
4252 int count = 0;
4253 auto data = CheckError(SDL_GetWindows(&count));
4254 return OwnArray<WindowRef>{reinterpret_cast<WindowRef*>(data), size_t(count)};
4255}
4256
4345 const PointRaw& size,
4346 WindowFlags flags)
4347{
4348 return Window(std::move(title), size, flags);
4349}
4350
4423 const PointRaw& offset,
4424 const PointRaw& size,
4425 WindowFlags flags)
4426{
4427 return Window(parent, offset, size, flags);
4428}
4429
4558{
4559 return Window(props);
4560}
4561
4562namespace prop::Window {
4563
4564constexpr auto CREATE_ALWAYS_ON_TOP_BOOLEAN =
4565 SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN;
4566
4567constexpr auto CREATE_BORDERLESS_BOOLEAN =
4568 SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN;
4569
4570constexpr auto CREATE_CONSTRAIN_POPUP_BOOLEAN =
4571 SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN;
4572
4573constexpr auto CREATE_FOCUSABLE_BOOLEAN =
4574 SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN;
4575
4576constexpr auto CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN =
4577 SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN;
4578
4579constexpr auto CREATE_FLAGS_NUMBER = SDL_PROP_WINDOW_CREATE_FLAGS_NUMBER;
4580
4581constexpr auto CREATE_FULLSCREEN_BOOLEAN =
4582 SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN;
4583
4584constexpr auto CREATE_HEIGHT_NUMBER = SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER;
4585
4586constexpr auto CREATE_HIDDEN_BOOLEAN = SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN;
4587
4588constexpr auto CREATE_HIGH_PIXEL_DENSITY_BOOLEAN =
4589 SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN;
4590
4591constexpr auto CREATE_MAXIMIZED_BOOLEAN =
4592 SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN;
4593
4594constexpr auto CREATE_MENU_BOOLEAN = SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN;
4595
4596constexpr auto CREATE_METAL_BOOLEAN = SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN;
4597
4598constexpr auto CREATE_MINIMIZED_BOOLEAN =
4599 SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN;
4600
4601constexpr auto CREATE_MODAL_BOOLEAN = SDL_PROP_WINDOW_CREATE_MODAL_BOOLEAN;
4602
4603constexpr auto CREATE_MOUSE_GRABBED_BOOLEAN =
4604 SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN;
4605
4606constexpr auto CREATE_OPENGL_BOOLEAN = SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN;
4607
4608constexpr auto CREATE_PARENT_POINTER = SDL_PROP_WINDOW_CREATE_PARENT_POINTER;
4609
4610constexpr auto CREATE_RESIZABLE_BOOLEAN =
4611 SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN;
4612
4613constexpr auto CREATE_TITLE_STRING = SDL_PROP_WINDOW_CREATE_TITLE_STRING;
4614
4615constexpr auto CREATE_TRANSPARENT_BOOLEAN =
4616 SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN;
4617
4618constexpr auto CREATE_TOOLTIP_BOOLEAN = SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN;
4619
4620constexpr auto CREATE_UTILITY_BOOLEAN = SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN;
4621
4622constexpr auto CREATE_VULKAN_BOOLEAN = SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN;
4623
4624constexpr auto CREATE_WIDTH_NUMBER = SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER;
4625
4626constexpr auto CREATE_X_NUMBER = SDL_PROP_WINDOW_CREATE_X_NUMBER;
4627
4628constexpr auto CREATE_Y_NUMBER = SDL_PROP_WINDOW_CREATE_Y_NUMBER;
4629
4630constexpr auto CREATE_COCOA_WINDOW_POINTER =
4631 SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER;
4632
4633constexpr auto CREATE_COCOA_VIEW_POINTER =
4634 SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER;
4635
4636constexpr auto CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN =
4637 SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN;
4638
4639constexpr auto CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN =
4640 SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN;
4641
4642constexpr auto CREATE_WAYLAND_WL_SURFACE_POINTER =
4643 SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER;
4644
4645constexpr auto CREATE_WIN32_HWND_POINTER =
4646 SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER;
4647
4648constexpr auto CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER =
4649 SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER;
4650
4651constexpr auto CREATE_X11_WINDOW_NUMBER =
4652 SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER;
4653
4654constexpr auto SHAPE_POINTER = SDL_PROP_WINDOW_SHAPE_POINTER;
4655
4656constexpr auto HDR_ENABLED_BOOLEAN = SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN;
4657
4658constexpr auto SDR_WHITE_LEVEL_FLOAT = SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT;
4659
4660constexpr auto HDR_HEADROOM_FLOAT = SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT;
4661
4662constexpr auto ANDROID_WINDOW_POINTER = SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER;
4663
4664constexpr auto ANDROID_SURFACE_POINTER =
4665 SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER;
4666
4667constexpr auto UIKIT_WINDOW_POINTER = SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER;
4668
4669constexpr auto UIKIT_METAL_VIEW_TAG_NUMBER =
4670 SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER;
4671
4672constexpr auto UIKIT_OPENGL_FRAMEBUFFER_NUMBER =
4673 SDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER;
4674
4675constexpr auto UIKIT_OPENGL_RENDERBUFFER_NUMBER =
4676 SDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER;
4677
4678constexpr auto UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER =
4679 SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER;
4680
4681constexpr auto KMSDRM_DEVICE_INDEX_NUMBER =
4682 SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER;
4683
4684constexpr auto KMSDRM_DRM_FD_NUMBER = SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER;
4685
4686constexpr auto KMSDRM_GBM_DEVICE_POINTER =
4687 SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER;
4688
4689constexpr auto COCOA_WINDOW_POINTER = SDL_PROP_WINDOW_COCOA_WINDOW_POINTER;
4690
4691constexpr auto COCOA_METAL_VIEW_TAG_NUMBER =
4692 SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER;
4693
4694constexpr auto OPENVR_OVERLAY_ID = SDL_PROP_WINDOW_OPENVR_OVERLAY_ID;
4695
4696constexpr auto VIVANTE_DISPLAY_POINTER =
4697 SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER;
4698
4699constexpr auto VIVANTE_WINDOW_POINTER = SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER;
4700
4701constexpr auto VIVANTE_SURFACE_POINTER =
4702 SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER;
4703
4704constexpr auto WIN32_HWND_POINTER = SDL_PROP_WINDOW_WIN32_HWND_POINTER;
4705
4706constexpr auto WIN32_HDC_POINTER = SDL_PROP_WINDOW_WIN32_HDC_POINTER;
4707
4708constexpr auto WIN32_INSTANCE_POINTER = SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER;
4709
4710constexpr auto WAYLAND_DISPLAY_POINTER =
4711 SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER;
4712
4713constexpr auto WAYLAND_SURFACE_POINTER =
4714 SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER;
4715
4716constexpr auto WAYLAND_VIEWPORT_POINTER =
4717 SDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTER;
4718
4719constexpr auto WAYLAND_EGL_WINDOW_POINTER =
4720 SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER;
4721
4722constexpr auto WAYLAND_XDG_SURFACE_POINTER =
4723 SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER;
4724
4725constexpr auto WAYLAND_XDG_TOPLEVEL_POINTER =
4726 SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER;
4727
4728constexpr auto WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING =
4729 SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING;
4730
4731constexpr auto WAYLAND_XDG_POPUP_POINTER =
4732 SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER;
4733
4734constexpr auto WAYLAND_XDG_POSITIONER_POINTER =
4735 SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER;
4736
4737constexpr auto X11_DISPLAY_POINTER = SDL_PROP_WINDOW_X11_DISPLAY_POINTER;
4738
4739constexpr auto X11_SCREEN_NUMBER = SDL_PROP_WINDOW_X11_SCREEN_NUMBER;
4740
4741constexpr auto X11_WINDOW_NUMBER = SDL_PROP_WINDOW_X11_WINDOW_NUMBER;
4742
4743} // namespace prop::Window
4744
4762{
4763 return CheckError(SDL_GetWindowID(window));
4764}
4765
4766inline WindowID Window::GetID() const { return SDL::GetWindowID(m_resource); }
4767
4785{
4786 return {SDL_GetWindowFromID(id)};
4787}
4788
4790{
4791 return SDL::GetWindowFromID(id);
4792}
4793
4808{
4809 return {CheckError(SDL_GetWindowParent(window))};
4810}
4811
4813{
4814 return SDL::GetWindowParent(m_resource);
4815}
4816
4938{
4939 return {CheckError(SDL_GetWindowProperties(window))};
4940}
4941
4943{
4944 return SDL::GetWindowProperties(m_resource);
4945}
4946
4966{
4967 return SDL_GetWindowFlags(window);
4968}
4969
4971{
4972 return SDL::GetWindowFlags(m_resource);
4973}
4974
4990inline void SetWindowTitle(WindowParam window, StringParam title)
4991{
4992 CheckError(SDL_SetWindowTitle(window, title));
4993}
4994
4996{
4997 SDL::SetWindowTitle(m_resource, std::move(title));
4998}
4999
5013inline const char* GetWindowTitle(WindowParam window)
5014{
5015 return SDL_GetWindowTitle(window);
5016}
5017
5018inline const char* Window::GetTitle() const
5019{
5020 return SDL::GetWindowTitle(m_resource);
5021}
5022
5044inline void SetWindowIcon(WindowParam window, SurfaceParam icon)
5045{
5046 CheckError(SDL_SetWindowIcon(window, icon));
5047}
5048
5050{
5051 SDL::SetWindowIcon(m_resource, icon);
5052}
5053
5090inline void SetWindowPosition(WindowParam window, const PointRaw& p)
5091{
5092 CheckError(SDL_SetWindowPosition(window, p.x, p.y));
5093}
5094
5095inline void Window::SetPosition(const PointRaw& p)
5096{
5097 SDL::SetWindowPosition(m_resource, p);
5098}
5099
5122inline void GetWindowPosition(WindowParam window, int* x, int* y)
5123{
5124 CheckError(SDL_GetWindowPosition(window, x, y));
5125}
5126
5127inline void Window::GetPosition(int* x, int* y) const
5128{
5129 SDL::GetWindowPosition(m_resource, x, y);
5130}
5131
5165inline void SetWindowSize(WindowParam window, const PointRaw& p)
5166{
5167 CheckError(SDL_SetWindowSize(window, p.x, p.y));
5168}
5169
5170inline void Window::SetSize(const PointRaw& p)
5171{
5172 SDL::SetWindowSize(m_resource, p);
5173}
5174
5195inline void GetWindowSize(WindowParam window, int* w, int* h)
5196{
5197 CheckError(SDL_GetWindowSize(window, w, h));
5198}
5199
5200inline void Window::GetSize(int* w, int* h) const
5201{
5202 SDL::GetWindowSize(m_resource, w, h);
5203}
5204
5223{
5224 Rect rect;
5225 CheckError(SDL_GetWindowSafeArea(window, &rect));
5226 return rect;
5227}
5228
5230{
5231 return SDL::GetWindowSafeArea(m_resource);
5232}
5233
5273 float min_aspect,
5274 float max_aspect)
5275{
5276 CheckError(SDL_SetWindowAspectRatio(window, min_aspect, max_aspect));
5277}
5278
5279inline void Window::SetAspectRatio(float min_aspect, float max_aspect)
5280{
5281 SDL::SetWindowAspectRatio(m_resource, min_aspect, max_aspect);
5282}
5283
5301 float* min_aspect,
5302 float* max_aspect)
5303{
5304 CheckError(SDL_GetWindowAspectRatio(window, min_aspect, max_aspect));
5305}
5306
5307inline void Window::GetAspectRatio(float* min_aspect, float* max_aspect) const
5308{
5309 SDL::GetWindowAspectRatio(m_resource, min_aspect, max_aspect);
5310}
5311
5347 int* top,
5348 int* left,
5349 int* bottom,
5350 int* right)
5351{
5352 CheckError(SDL_GetWindowBordersSize(window, top, left, bottom, right));
5353}
5354
5355inline void Window::GetBordersSize(int* top,
5356 int* left,
5357 int* bottom,
5358 int* right) const
5359{
5360 SDL::GetWindowBordersSize(m_resource, top, left, bottom, right);
5361}
5362
5380inline void GetWindowSizeInPixels(WindowParam window, int* w, int* h)
5381{
5382 CheckError(SDL_GetWindowSizeInPixels(window, w, h));
5383}
5384
5385inline void Window::GetSizeInPixels(int* w, int* h) const
5386{
5387 SDL::GetWindowSizeInPixels(m_resource, w, h);
5388}
5389
5404inline void SetWindowMinimumSize(WindowParam window, const PointRaw& p)
5405{
5406 CheckError(SDL_SetWindowMinimumSize(window, p.x, p.y));
5407}
5408
5410{
5411 SDL::SetWindowMinimumSize(m_resource, p);
5412}
5413
5431inline void GetWindowMinimumSize(WindowParam window, int* w, int* h)
5432{
5433 CheckError(SDL_GetWindowMinimumSize(window, w, h));
5434}
5435
5436inline void Window::GetMinimumSize(int* w, int* h) const
5437{
5438 SDL::GetWindowMinimumSize(m_resource, w, h);
5439}
5440
5455inline void SetWindowMaximumSize(WindowParam window, const PointRaw& p)
5456{
5457 CheckError(SDL_SetWindowMaximumSize(window, p.x, p.y));
5458}
5459
5461{
5462 SDL::SetWindowMaximumSize(m_resource, p);
5463}
5464
5482inline void GetWindowMaximumSize(WindowParam window, int* w, int* h)
5483{
5484 CheckError(SDL_GetWindowMaximumSize(window, w, h));
5485}
5486
5487inline void Window::GetMaximumSize(int* w, int* h) const
5488{
5489 SDL::GetWindowMaximumSize(m_resource, w, h);
5490}
5491
5511inline void SetWindowBordered(WindowParam window, bool bordered)
5512{
5513 CheckError(SDL_SetWindowBordered(window, bordered));
5514}
5515
5516inline void Window::SetBordered(bool bordered)
5517{
5518 SDL::SetWindowBordered(m_resource, bordered);
5519}
5520
5540inline void SetWindowResizable(WindowParam window, bool resizable)
5541{
5542 CheckError(SDL_SetWindowResizable(window, resizable));
5543}
5544
5545inline void Window::SetResizable(bool resizable)
5546{
5547 SDL::SetWindowResizable(m_resource, resizable);
5548}
5549
5566inline void SetWindowAlwaysOnTop(WindowParam window, bool on_top)
5567{
5568 CheckError(SDL_SetWindowAlwaysOnTop(window, on_top));
5569}
5570
5571inline void Window::SetAlwaysOnTop(bool on_top)
5572{
5573 SDL::SetWindowAlwaysOnTop(m_resource, on_top);
5574}
5575
5589inline void ShowWindow(WindowParam window)
5590{
5591 CheckError(SDL_ShowWindow(window));
5592}
5593
5594inline void Window::Show() { SDL::ShowWindow(m_resource); }
5595
5609inline void HideWindow(WindowParam window)
5610{
5611 CheckError(SDL_HideWindow(window));
5612}
5613
5614inline void Window::Hide() { SDL::HideWindow(m_resource); }
5615
5633inline void RaiseWindow(WindowParam window)
5634{
5635 CheckError(SDL_RaiseWindow(window));
5636}
5637
5638inline void Window::Raise() { SDL::RaiseWindow(m_resource); }
5639
5671inline void MaximizeWindow(WindowParam window)
5672{
5673 CheckError(SDL_MaximizeWindow(window));
5674}
5675
5676inline void Window::Maximize() { SDL::MaximizeWindow(m_resource); }
5677
5704inline void MinimizeWindow(WindowParam window)
5705{
5706 CheckError(SDL_MinimizeWindow(window));
5707}
5708
5709inline void Window::Minimize() { SDL::MinimizeWindow(m_resource); }
5710
5738inline void RestoreWindow(WindowParam window)
5739{
5740 CheckError(SDL_RestoreWindow(window));
5741}
5742
5743inline void Window::Restore() { SDL::RestoreWindow(m_resource); }
5744
5774inline void SetWindowFullscreen(WindowParam window, bool fullscreen)
5775{
5776 CheckError(SDL_SetWindowFullscreen(window, fullscreen));
5777}
5778
5779inline void Window::SetFullscreen(bool fullscreen)
5780{
5781 SDL::SetWindowFullscreen(m_resource, fullscreen);
5782}
5783
5812inline void SyncWindow(WindowParam window)
5813{
5814 CheckError(SDL_SyncWindow(window));
5815}
5816
5817inline void Window::Sync() { SDL::SyncWindow(m_resource); }
5818
5833{
5834 return SDL_WindowHasSurface(window);
5835}
5836
5837inline bool Window::HasSurface() const
5838{
5839 return SDL::WindowHasSurface(m_resource);
5840}
5841
5870{
5871 return Surface::Borrow(SDL_GetWindowSurface(window));
5872}
5873
5875{
5876 return SDL::GetWindowSurface(m_resource);
5877}
5878
5902inline void SetWindowSurfaceVSync(WindowParam window, int vsync)
5903{
5904 CheckError(SDL_SetWindowSurfaceVSync(window, vsync));
5905}
5906
5907inline void Window::SetSurfaceVSync(int vsync)
5908{
5909 SDL::SetWindowSurfaceVSync(m_resource, vsync);
5910}
5911
5913constexpr int WINDOW_SURFACE_VSYNC_DISABLED = SDL_WINDOW_SURFACE_VSYNC_DISABLED;
5914
5916constexpr int WINDOW_SURFACE_VSYNC_ADAPTIVE = SDL_WINDOW_SURFACE_VSYNC_ADAPTIVE;
5917
5931{
5932 int vsync;
5933 CheckError(SDL_GetWindowSurfaceVSync(window, &vsync));
5934 return vsync;
5935}
5936
5937inline int Window::GetSurfaceVSync() const
5938{
5939 return SDL::GetWindowSurfaceVSync(m_resource);
5940}
5941
5961{
5962 CheckError(SDL_UpdateWindowSurface(window));
5963}
5964
5966
5994{
5995 CheckError(SDL_UpdateWindowSurfaceRects(window, rects.data(), rects.size()));
5996}
5997
5999{
6000 SDL::UpdateWindowSurfaceRects(m_resource, rects);
6001}
6002
6017{
6018 CheckError(SDL_DestroyWindowSurface(window));
6019}
6020
6022
6053inline void SetWindowKeyboardGrab(WindowParam window, bool grabbed)
6054{
6055 CheckError(SDL_SetWindowKeyboardGrab(window, grabbed));
6056}
6057
6058inline void Window::SetKeyboardGrab(bool grabbed)
6059{
6060 SDL::SetWindowKeyboardGrab(m_resource, grabbed);
6061}
6062
6081inline void SetWindowMouseGrab(WindowParam window, bool grabbed)
6082{
6083 CheckError(SDL_SetWindowMouseGrab(window, grabbed));
6084}
6085
6086inline void Window::SetMouseGrab(bool grabbed)
6087{
6088 SDL::SetWindowMouseGrab(m_resource, grabbed);
6089}
6090
6104{
6105 return SDL_GetWindowKeyboardGrab(window);
6106}
6107
6108inline bool Window::GetKeyboardGrab() const
6109{
6110 return SDL::GetWindowKeyboardGrab(m_resource);
6111}
6112
6129{
6130 return SDL_GetWindowMouseGrab(window);
6131}
6132
6133inline bool Window::GetMouseGrab() const
6134{
6135 return SDL::GetWindowMouseGrab(m_resource);
6136}
6137
6150inline WindowRef GetGrabbedWindow() { return {SDL_GetGrabbedWindow()}; }
6151
6153
6173inline void SetWindowMouseRect(WindowParam window, const RectRaw& rect)
6174{
6175 CheckError(SDL_SetWindowMouseRect(window, &rect));
6176}
6177
6178inline void Window::SetMouseRect(const RectRaw& rect)
6179{
6180 SDL::SetWindowMouseRect(m_resource, rect);
6181}
6182
6199{
6200 return SDL_GetWindowMouseRect(window);
6201}
6202
6203inline const RectRaw* Window::GetMouseRect() const
6204{
6205 return SDL::GetWindowMouseRect(m_resource);
6206}
6207
6226inline void SetWindowOpacity(WindowParam window, float opacity)
6227{
6228 CheckError(SDL_SetWindowOpacity(window, opacity));
6229}
6230
6231inline void Window::SetOpacity(float opacity)
6232{
6233 SDL::SetWindowOpacity(m_resource, opacity);
6234}
6235
6252inline float GetWindowOpacity(WindowParam window)
6253{
6254 return SDL_GetWindowOpacity(window);
6255}
6256
6257inline float Window::GetOpacity() const
6258{
6259 return SDL::GetWindowOpacity(m_resource);
6260}
6261
6293inline void SetWindowParent(WindowParam window, WindowParam parent)
6294{
6295 CheckError(SDL_SetWindowParent(window, parent));
6296}
6297
6299{
6300 SDL::SetWindowParent(m_resource, parent);
6301}
6302
6320inline void SetWindowModal(WindowParam window, bool modal)
6321{
6322 CheckError(SDL_SetWindowModal(window, modal));
6323}
6324
6325inline void Window::SetModal(bool modal)
6326{
6327 SDL::SetWindowModal(m_resource, modal);
6328}
6329
6341inline void SetWindowFocusable(WindowParam window, bool focusable)
6342{
6343 CheckError(SDL_SetWindowFocusable(window, focusable));
6344}
6345
6346inline void Window::SetFocusable(bool focusable)
6347{
6348 SDL::SetWindowFocusable(m_resource, focusable);
6349}
6350
6371inline void ShowWindowSystemMenu(WindowParam window, const PointRaw& p)
6372{
6373 CheckError(SDL_ShowWindowSystemMenu(window, p.x, p.y));
6374}
6375
6377{
6378 SDL::ShowWindowSystemMenu(m_resource, p);
6379}
6380
6423 HitTest callback,
6424 void* callback_data)
6425{
6426 CheckError(SDL_SetWindowHitTest(window, callback, callback_data));
6427}
6428
6469inline void SetWindowHitTest(WindowParam window, HitTestCB callback)
6470{
6472 void* cbHandle = Wrapper::Wrap(window, std::move(callback));
6474 window,
6475 [](SDL_Window* win, const SDL_Point* area, void* data) {
6476 return Wrapper::Call(data, win, Point(*area));
6477 },
6478 cbHandle);
6479}
6480
6506inline void SetWindowShape(WindowParam window, SurfaceParam shape)
6507{
6508 CheckError(SDL_SetWindowShape(window, shape));
6509}
6510
6512{
6513 SDL::SetWindowShape(m_resource, shape);
6514}
6515
6527inline void FlashWindow(WindowParam window, FlashOperation operation)
6528{
6529 CheckError(SDL_FlashWindow(window, operation));
6530}
6531
6532inline void Window::Flash(FlashOperation operation)
6533{
6534 SDL::FlashWindow(m_resource, operation);
6535}
6536
6557inline void DestroyWindow(WindowRaw window) { SDL_DestroyWindow(window); }
6558
6560
6577inline bool ScreenSaverEnabled() { return SDL_ScreenSaverEnabled(); }
6578
6591inline void EnableScreenSaver() { CheckError(SDL_EnableScreenSaver()); }
6592
6611inline void DisableScreenSaver() { CheckError(SDL_DisableScreenSaver()); }
6612
6635{
6636 CheckError(SDL_GL_LoadLibrary(path));
6637}
6638
6693{
6694 return SDL_GL_GetProcAddress(proc);
6695}
6696
6715{
6716 return SDL_EGL_GetProcAddress(proc);
6717}
6718
6728inline void GL_UnloadLibrary() { SDL_GL_UnloadLibrary(); }
6729
6752{
6753 return SDL_GL_ExtensionSupported(extension);
6754}
6755
6766inline void GL_ResetAttributes() { SDL_GL_ResetAttributes(); }
6767
6788inline void GL_SetAttribute(GLAttr attr, int value)
6789{
6790 CheckError(SDL_GL_SetAttribute(attr, value));
6791}
6792
6808inline void GL_GetAttribute(GLAttr attr, int* value)
6809{
6810 CheckError(SDL_GL_GetAttribute(attr, value));
6811}
6812
6836{
6837 return GLContext(window);
6838}
6839
6855inline void GL_MakeCurrent(WindowParam window, GLContext context)
6856{
6857 CheckError(SDL_GL_MakeCurrent(window, context.get()));
6858}
6859
6861{
6862 SDL::GL_MakeCurrent(window, m_resource);
6863}
6864
6876{
6877 return {CheckError(SDL_GL_GetCurrentWindow())};
6878}
6879
6892inline GLContext GL_GetCurrentContext() { return SDL_GL_GetCurrentContext(); }
6893
6905{
6906 return SDL_EGL_GetCurrentDisplay();
6907}
6908
6919inline EGLConfig EGL_GetCurrentConfig() { return SDL_EGL_GetCurrentConfig(); }
6920
6933{
6934 return SDL_EGL_GetWindowSurface(window);
6935}
6936
6958 EGLAttribArrayCallback platformAttribCallback,
6959 EGLIntArrayCallback surfaceAttribCallback,
6960 EGLIntArrayCallback contextAttribCallback,
6961 void* userdata)
6962{
6963 SDL_EGL_SetAttributeCallbacks(platformAttribCallback,
6964 surfaceAttribCallback,
6965 contextAttribCallback,
6966 userdata);
6967}
6968
6997inline void GL_SetSwapInterval(int interval)
6998{
6999 CheckError(SDL_GL_SetSwapInterval(interval));
7000}
7001
7020inline void GL_GetSwapInterval(int* interval)
7021{
7022 CheckError(SDL_GL_GetSwapInterval(interval));
7023}
7024
7042inline void GL_SwapWindow(WindowParam window)
7043{
7044 CheckError(SDL_GL_SwapWindow(window));
7045}
7046
7060{
7061 CheckError(SDL_GL_DestroyContext(context));
7062}
7063
7065
7067
7068} // namespace SDL
7069
7070#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:3041
constexpr GLContextRaw release()
Retrieves underlying GLContextRaw and clear this.
Definition: SDL3pp_video.h:3108
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:3089
constexpr GLContext(GLContext &&other)
Move constructor.
Definition: SDL3pp_video.h:3062
constexpr bool operator==(std::nullptr_t _) const
Comparison.
Definition: SDL3pp_video.h:3119
~GLContext()
Destructor.
Definition: SDL3pp_video.h:3095
constexpr GLContext(const GLContextRaw resource)
Constructs from GLContextParam.
Definition: SDL3pp_video.h:3053
constexpr GLContextRaw get() const
Retrieves underlying GLContextRaw.
Definition: SDL3pp_video.h:3105
GLContext & operator=(GLContext other)
Assignment operator.
Definition: SDL3pp_video.h:3098
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:399
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:195
static constexpr Surface Borrow(SurfaceParam resource)
Safely borrows the from SurfaceParam.
Definition: SDL3pp_surface.h:374
The struct used as an opaque handle to a window.
Definition: SDL3pp_video.h:734
void SetHitTest(HitTest callback, void *callback_data)
Provide a callback that decides if a window region has special properties.
void SetRect(Rect rect)
Request the window's position and size to be set.
Definition: SDL3pp_video.h:1491
constexpr WindowRaw get() const
Retrieves underlying WindowRaw.
Definition: SDL3pp_video.h:1085
constexpr Window(const WindowRaw resource)
Constructs from WindowParam.
Definition: SDL3pp_video.h:748
Point GetSize() const
Get the size of a window's client area.
Definition: SDL3pp_video.h:1648
constexpr WindowRaw release()
Retrieves underlying WindowRaw and clear this.
Definition: SDL3pp_video.h:1088
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:929
constexpr Window(Window &&other)
Move constructor.
Definition: SDL3pp_video.h:757
constexpr Window(const Window &other)=delete
Copy constructor.
Window & operator=(Window other)
Assignment operator.
Definition: SDL3pp_video.h:1078
constexpr auto operator<=>(const Window &other) const =default
Comparison.
Point GetPosition() const
Get the position of a window.
Definition: SDL3pp_video.h:1565
Point GetSizeInPixels() const
Get the size of a window's client area, in pixels.
Definition: SDL3pp_video.h:1798
Window(StringParam title, const PointRaw &size, WindowFlags flags=0)
Create a window with the specified dimensions and flags.
Definition: SDL3pp_video.h:853
~Window()
Destructor.
Definition: SDL3pp_video.h:1075
Rect GetRect() const
Get the position and client size of a window.
Definition: SDL3pp_video.h:1510
constexpr bool operator==(std::nullptr_t _) const
Comparison.
Definition: SDL3pp_video.h:1099
void SetHitTest(HitTestCB callback)
Provide a callback that decides if a window region has special properties.
Definition: SDL3pp_video.h:2553
Window(PropertiesParam props)
Create a window with the specified properties.
Definition: SDL3pp_video.h:1069
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:198
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:724
void SetRelativeMouseMode(bool enabled)
Set relative mouse mode for a window.
Definition: SDL3pp_mouse.h:708
void WarpMouse(const FPointRaw &p)
Move the mouse cursor to the given position within the window.
Definition: SDL3pp_mouse.h:654
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:25
SDL_Rect RectRaw
Alias to raw representation for Rect.
Definition: SDL3pp_rect.h:28
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:3414
SDL_FunctionPointer FunctionPointer
A generic function pointer.
Definition: SDL3pp_stdinc.h:6203
Uint32 Uint32
An unsigned 32-bit integer type.
Definition: SDL3pp_stdinc.h:325
Uint64 Uint64
An unsigned 64-bit integer type.
Definition: SDL3pp_stdinc.h:363
void DisableScreenSaver()
Prevent the screen from being blanked by a screen saver.
Definition: SDL3pp_video.h:6611
constexpr GLContextFlag GL_CONTEXT_RESET_ISOLATION_FLAG
RESET_ISOLATION_FLAG.
Definition: SDL3pp_video.h:3502
Rect GetBounds() const
Get the desktop area represented by a display.
Definition: SDL3pp_video.h:3732
void SetWindowSurfaceVSync(WindowParam window, int vsync)
Toggle VSync for the window surface.
Definition: SDL3pp_video.h:5902
void GetMaximumSize(int *w, int *h) const
Get the maximum size of a window's client area.
Definition: SDL3pp_video.h:5487
float GetPixelDensity() const
Get the pixel density of a window.
Definition: SDL3pp_video.h:4093
Rect GetWindowSafeArea(WindowParam window)
Get the safe area for this window.
Definition: SDL3pp_video.h:5222
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:3453
void GetMinimumSize(int *w, int *h) const
Get the minimum size of a window's client area.
Definition: SDL3pp_video.h:5436
void SetFocusable(bool focusable)
Set whether the window may have input focus.
Definition: SDL3pp_video.h:6346
void GL_SetSwapInterval(int interval)
Set the swap interval for the current OpenGL context.
Definition: SDL3pp_video.h:6997
constexpr HitTestResult HITTEST_DRAGGABLE
Region can drag entire window.
Definition: SDL3pp_video.h:666
constexpr HitTestResult HITTEST_RESIZE_BOTTOMLEFT
Region is the resizable bottom-left corner border.
Definition: SDL3pp_video.h:690
SDL_GLAttr GLAttr
An enumeration of OpenGL configuration attributes.
Definition: SDL3pp_video.h:3338
DisplayOrientation GetNaturalDisplayOrientation(DisplayID displayID)
Get the orientation of a display when it is unrotated.
Definition: SDL3pp_video.h:3785
void GL_DestroyContext(GLContextRaw context)
Delete an OpenGL context.
Definition: SDL3pp_video.h:7059
constexpr FlashOperation FLASH_CANCEL
Cancel any window flash state.
Definition: SDL3pp_video.h:642
int GetWindowSurfaceVSync(WindowParam window)
Get VSync for the window surface.
Definition: SDL3pp_video.h:5930
void UpdateSurface()
Copy the window surface to the screen.
Definition: SDL3pp_video.h:5965
OwnArray< DisplayMode * > GetFullscreenModes() const
Get a list of fullscreen display modes available on a display.
Definition: SDL3pp_video.h:3882
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:576
void EnableScreenSaver()
Allow the screen to be blanked by a screen saver.
Definition: SDL3pp_video.h:6591
void GL_GetSwapInterval(int *interval)
Get the swap interval for the current OpenGL context.
Definition: SDL3pp_video.h:7020
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:5279
void UpdateWindowSurfaceRects(WindowParam window, SpanRef< const RectRaw > rects)
Copy areas of the window surface to the screen.
Definition: SDL3pp_video.h:5992
void SetMinimumSize(const PointRaw &p)
Set the minimum size of a window's client area.
Definition: SDL3pp_video.h:5409
void SetWindowIcon(WindowParam window, SurfaceParam icon)
Set the icon for a window.
Definition: SDL3pp_video.h:5044
Window CreateWindowWithProperties(PropertiesParam props)
Create a window with the specified properties.
Definition: SDL3pp_video.h:4557
constexpr GLAttr GL_FRAMEBUFFER_SRGB_CAPABLE
requests sRGB capable visual; defaults to 0.
Definition: SDL3pp_video.h:3445
constexpr GLAttr GL_MULTISAMPLESAMPLES
the number of samples used around the current pixel used for multisample anti-aliasing.
Definition: SDL3pp_video.h:3413
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:4766
float GetDisplayScale() const
Get the content display scale relative to a window's pixel size.
Definition: SDL3pp_video.h:4125
Uint64 WindowFlags
The flags on a window.
Definition: SDL3pp_video.h:550
bool GetWindowMouseGrab(WindowParam window)
Get a window's mouse grab mode.
Definition: SDL3pp_video.h:6128
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:609
constexpr WindowFlags WINDOW_MOUSE_FOCUS
window has mouse focus
Definition: SDL3pp_video.h:585
constexpr GLAttr GL_STENCIL_SIZE
the minimum number of bits in the stencil buffer; defaults to 0.
Definition: SDL3pp_video.h:3377
void SetWindowPosition(WindowParam window, const PointRaw &p)
Request that the window's position be set.
Definition: SDL3pp_video.h:5090
void Restore()
Request that the size and position of a minimized or maximized window be restored.
Definition: SDL3pp_video.h:5743
void GetWindowPosition(WindowParam window, int *x, int *y)
Get the position of a window.
Definition: SDL3pp_video.h:5122
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:4162
WindowRef GetWindowParent(WindowParam window)
Get parent of a window.
Definition: SDL3pp_video.h:4807
PropertiesRef GetProperties() const
Get the properties associated with a display.
Definition: SDL3pp_video.h:3671
Uint32 GLContextReleaseFlag
Possible values to be set for the GL_CONTEXT_RELEASE_BEHAVIOR attribute.
Definition: SDL3pp_video.h:3511
constexpr WindowFlags WINDOW_TRANSPARENT
window with transparent buffer
Definition: SDL3pp_video.h:629
void DestroySurface()
Destroy the surface associated with the window.
Definition: SDL3pp_video.h:6021
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:3930
const DisplayMode & GetDesktopDisplayMode(DisplayID displayID)
Get information about the desktop's display mode.
Definition: SDL3pp_video.h:3958
FunctionPointer EGL_GetProcAddress(StringParam proc)
Get an EGL library function by name.
Definition: SDL3pp_video.h:6714
constexpr GLProfile GL_CONTEXT_PROFILE_CORE
OpenGL Core Profile context.
Definition: SDL3pp_video.h:3476
constexpr DisplayOrientation ORIENTATION_UNKNOWN
The display orientation can't be determined.
Definition: SDL3pp_video.h:125
void FlashWindow(WindowParam window, FlashOperation operation)
Request a window to demand attention from the user.
Definition: SDL3pp_video.h:6527
static WindowRef GetGrabbed()
Get the window that currently has an input grab enabled.
Definition: SDL3pp_video.h:6152
void GL_SwapWindow(WindowParam window)
Update a window with OpenGL rendering.
Definition: SDL3pp_video.h:7042
SDL_HitTest HitTest
Callback used for hit-testing.
Definition: SDL3pp_video.h:707
constexpr int WINDOW_SURFACE_VSYNC_ADAPTIVE
Constant to enable adaptive vsync.
Definition: SDL3pp_video.h:5916
void GetWindowAspectRatio(WindowParam window, float *min_aspect, float *max_aspect)
Get the size of a window's client area.
Definition: SDL3pp_video.h:5300
constexpr HitTestResult HITTEST_RESIZE_TOPRIGHT
Region is the resizable top-right corner border.
Definition: SDL3pp_video.h:676
Rect GetDisplayBounds(DisplayID displayID)
Get the desktop area represented by a display.
Definition: SDL3pp_video.h:3725
constexpr GLAttr GL_CONTEXT_MAJOR_VERSION
OpenGL context major version.
Definition: SDL3pp_video.h:3424
constexpr HitTestResult HITTEST_NORMAL
Region is normal. No special properties.
Definition: SDL3pp_video.h:663
void SetPosition(const PointRaw &p)
Request that the window's position be set.
Definition: SDL3pp_video.h:5095
Surface GetSurface()
Get the SDL surface associated with the window.
Definition: SDL3pp_video.h:5874
constexpr GLContextFlag GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
FORWARD_COMPATIBLE_FLAG.
Definition: SDL3pp_video.h:3496
WindowRef GL_GetCurrentWindow()
Get the currently active OpenGL window.
Definition: SDL3pp_video.h:6875
constexpr GLAttr GL_RETAINED_BACKING
not used (deprecated).
Definition: SDL3pp_video.h:3421
Display GetDisplay() const
Get the display associated with a window.
Definition: SDL3pp_video.h:4066
constexpr HitTestResult HITTEST_RESIZE_RIGHT
Region is the resizable right border.
Definition: SDL3pp_video.h:680
float GetContentScale() const
Get the content scale of a display.
Definition: SDL3pp_video.h:3848
float GetOpacity() const
Get the opacity of a window.
Definition: SDL3pp_video.h:6257
constexpr FlashOperation FLASH_BRIEFLY
Flash the window briefly to get attention.
Definition: SDL3pp_video.h:645
void DestroyWindowSurface(WindowParam window)
Destroy the surface associated with the window.
Definition: SDL3pp_video.h:6016
void GL_UnloadLibrary()
Unload the OpenGL library previously loaded by GL_LoadLibrary().
Definition: SDL3pp_video.h:6728
bool GetWindowKeyboardGrab(WindowParam window)
Get a window's keyboard grab mode.
Definition: SDL3pp_video.h:6103
constexpr GLAttr GL_STEREO
whether the output is stereo 3D; defaults to off.
Definition: SDL3pp_video.h:3403
constexpr GLAttr GL_CONTEXT_MINOR_VERSION
OpenGL context minor version.
Definition: SDL3pp_video.h:3427
constexpr GLAttr GL_CONTEXT_PROFILE_MASK
type of GL context (Core, Compatibility, ES).
Definition: SDL3pp_video.h:3440
DisplayOrientation GetCurrentDisplayOrientation(DisplayID displayID)
Get the orientation of a display.
Definition: SDL3pp_video.h:3808
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:3344
Display GetDisplayForRect(const RectRaw &rect)
Get the display primarily containing a rect.
Definition: SDL3pp_video.h:4036
constexpr WindowFlags WINDOW_MOUSE_GRABBED
window has grabbed mouse input
Definition: SDL3pp_video.h:579
bool ScreenSaverEnabled()
Check whether the screensaver is currently enabled.
Definition: SDL3pp_video.h:6577
Display GetDisplayForPoint(const PointRaw &point)
Get the display containing a point.
Definition: SDL3pp_video.h:4011
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:3350
FunctionPointer GL_GetProcAddress(StringParam proc)
Get an OpenGL function by name.
Definition: SDL3pp_video.h:6692
SDL_EGLAttribArrayCallback EGLAttribArrayCallback
EGL platform attribute initialization callback.
Definition: SDL3pp_video.h:3230
constexpr GLAttr GL_CONTEXT_RESET_NOTIFICATION
set context reset notification.
Definition: SDL3pp_video.h:3459
Window CreateWindow(StringParam title, const PointRaw &size, WindowFlags flags)
Create a window with the specified dimensions and flags.
Definition: SDL3pp_video.h:4344
SDL_DisplayID DisplayID
Alias to raw representation for Display.
Definition: SDL3pp_video.h:41
constexpr GLProfile GL_CONTEXT_PROFILE_COMPATIBILITY
OpenGL Compatibility Profile context.
Definition: SDL3pp_video.h:3479
float GetDisplayContentScale(DisplayID displayID)
Get the content scale of a display.
Definition: SDL3pp_video.h:3843
GLContext GL_CreateContext(WindowParam window)
Create an OpenGL context for an OpenGL window, and make it current.
Definition: SDL3pp_video.h:6835
void SetWindowMinimumSize(WindowParam window, const PointRaw &p)
Set the minimum size of a window's client area.
Definition: SDL3pp_video.h:5404
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:6957
const DisplayMode & GetCurrentDisplayMode(DisplayID displayID)
Get information about the current display mode.
Definition: SDL3pp_video.h:3987
void Flash(FlashOperation operation)
Request a window to demand attention from the user.
Definition: SDL3pp_video.h:6532
SDL_HitTestResult HitTestResult
Possible return values from the HitTest callback.
Definition: SDL3pp_video.h:661
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:5272
constexpr WindowFlags WINDOW_METAL
window usable for Metal view
Definition: SDL3pp_video.h:626
constexpr WindowFlags WINDOW_MINIMIZED
window is minimized
Definition: SDL3pp_video.h:573
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:3401
constexpr int WINDOW_SURFACE_VSYNC_DISABLED
Constant to disable vsync.
Definition: SDL3pp_video.h:5913
bool GetMouseGrab() const
Get a window's mouse grab mode.
Definition: SDL3pp_video.h:6133
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:4088
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:3383
const DisplayMode & GetWindowFullscreenMode(WindowParam window)
Query the display mode to use when a window is visible at fullscreen.
Definition: SDL3pp_video.h:4187
void SetWindowFullscreen(WindowParam window, bool fullscreen)
Request that the window's fullscreen state be changed.
Definition: SDL3pp_video.h:5774
void SetKeyboardGrab(bool grabbed)
Set a window's keyboard grab mode.
Definition: SDL3pp_video.h:6058
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:5738
constexpr WindowFlags WINDOW_HIGH_PIXEL_DENSITY
window uses high pixel density back buffer if possible
Definition: SDL3pp_video.h:594
constexpr GLAttr GL_CONTEXT_FLAGS
some combination of 0 or more of elements of the GLContextFlag enumeration; defaults to 0.
Definition: SDL3pp_video.h:3434
void SetAlwaysOnTop(bool on_top)
Set the window to always be above the others.
Definition: SDL3pp_video.h:5571
void SetWindowShape(WindowParam window, SurfaceParam shape)
Set the shape of a transparent window.
Definition: SDL3pp_video.h:6506
void SetSize(const PointRaw &p)
Request that the size of a window's client area be set.
Definition: SDL3pp_video.h:5170
constexpr GLProfile GL_CONTEXT_PROFILE_ES
GLX_CONTEXT_ES2_PROFILE_BIT_EXT.
Definition: SDL3pp_video.h:3483
constexpr GLAttr GL_DOUBLEBUFFER
whether the output is single or double buffered; defaults to double buffering on.
Definition: SDL3pp_video.h:3371
float GetWindowDisplayScale(WindowParam window)
Get the content display scale relative to a window's pixel size.
Definition: SDL3pp_video.h:4120
Display GetPrimaryDisplay()
Return the primary display.
Definition: SDL3pp_video.h:3633
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:694
void SetWindowBordered(WindowParam window, bool bordered)
Set the border state of a window.
Definition: SDL3pp_video.h:5511
float GetWindowOpacity(WindowParam window)
Get the opacity of a window.
Definition: SDL3pp_video.h:6252
PixelFormat GetWindowPixelFormat(WindowParam window)
Get the pixel format associated with the window.
Definition: SDL3pp_video.h:4230
void GL_GetAttribute(GLAttr attr, int *value)
Get the actual value for an attribute from the current context.
Definition: SDL3pp_video.h:6808
void Show()
Show a window.
Definition: SDL3pp_video.h:5594
PropertiesRef GetDisplayProperties(DisplayID displayID)
Get the properties associated with a display.
Definition: SDL3pp_video.h:3666
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:6422
void Minimize()
Request that the window be minimized to an iconic representation.
Definition: SDL3pp_video.h:5709
void MaximizeWindow(WindowParam window)
Request that the window be made as large as possible.
Definition: SDL3pp_video.h:5671
void GL_SetAttribute(GLAttr attr, int value)
Set an OpenGL window attribute before window creation.
Definition: SDL3pp_video.h:6788
const char * GetCurrentVideoDriver()
Get the name of the currently initialized video driver.
Definition: SDL3pp_video.h:3586
constexpr GLAttr GL_MULTISAMPLEBUFFERS
the number of buffers used for multisample anti-aliasing; defaults to 0.
Definition: SDL3pp_video.h:3407
PropertiesRef GetProperties() const
Get the properties associated with a window.
Definition: SDL3pp_video.h:4942
void ShowSystemMenu(const PointRaw &p)
Display the system-level window menu.
Definition: SDL3pp_video.h:6376
const DisplayMode & GetCurrentMode() const
Get information about the current display mode.
Definition: SDL3pp_video.h:3992
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:3362
constexpr WindowFlags WINDOW_MODAL
window is modal
Definition: SDL3pp_video.h:591
int GetNumVideoDrivers()
Get the number of video drivers compiled into SDL.
Definition: SDL3pp_video.h:3543
std::function< HitTestResult(WindowRaw window, const Point &area)> HitTestCB
Callback used for hit-testing.
Definition: SDL3pp_video.h:722
void SetWindowMouseRect(WindowParam window, const RectRaw &rect)
Confines the cursor to the specified area of a window.
Definition: SDL3pp_video.h:6173
bool GL_ExtensionSupported(StringParam extension)
Check if an OpenGL extension is supported for the current context.
Definition: SDL3pp_video.h:6751
constexpr WindowFlags WINDOW_INPUT_FOCUS
window has input focus
Definition: SDL3pp_video.h:582
int GetSurfaceVSync() const
Get VSync for the window surface.
Definition: SDL3pp_video.h:5937
void SetOpacity(float opacity)
Set the opacity for a window.
Definition: SDL3pp_video.h:6231
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:3389
constexpr GLContextFlag GL_CONTEXT_DEBUG_FLAG
DEBUG_FLAG.
Definition: SDL3pp_video.h:3493
Uint32 GLContextFlag
Possible flags to be set for the GL_CONTEXT_FLAGS attribute.
Definition: SDL3pp_video.h:3491
SDL_WindowID WindowID
This is a unique ID for a window.
Definition: SDL3pp_video.h:489
const char * GetName() const
Get the name of a display in UTF-8 encoding.
Definition: SDL3pp_video.h:3703
void SetWindowResizable(WindowParam window, bool resizable)
Set the user-resizable state of a window.
Definition: SDL3pp_video.h:5540
void SetBordered(bool bordered)
Set the border state of a window.
Definition: SDL3pp_video.h:5516
DisplayOrientation GetNaturalOrientation() const
Get the orientation of a display when it is unrotated.
Definition: SDL3pp_video.h:3790
void ShowWindow(WindowParam window)
Show a window.
Definition: SDL3pp_video.h:5589
void SetTitle(StringParam title)
Set the title of a window.
Definition: SDL3pp_video.h:4995
void SetWindowParent(WindowParam window, WindowParam parent)
Set the window as a child of a parent window.
Definition: SDL3pp_video.h:6293
constexpr HitTestResult HITTEST_RESIZE_TOP
Region is the resizable top border.
Definition: SDL3pp_video.h:673
void ShowWindowSystemMenu(WindowParam window, const PointRaw &p)
Display the system-level window menu.
Definition: SDL3pp_video.h:6371
const char * GetVideoDriver(int index)
Get the name of a built in video driver.
Definition: SDL3pp_video.h:3564
void GetWindowMaximumSize(WindowParam window, int *w, int *h)
Get the maximum size of a window's client area.
Definition: SDL3pp_video.h:5482
EGLSurface EGL_GetWindowSurface(WindowParam window)
Get the EGL surface associated with the window.
Definition: SDL3pp_video.h:6932
void Maximize()
Request that the window be made as large as possible.
Definition: SDL3pp_video.h:5676
SDL_EGLSurface EGLSurface
Opaque type for an EGL surface.
Definition: SDL3pp_video.h:3191
const char * GetDisplayName(DisplayID displayID)
Get the name of a display in UTF-8 encoding.
Definition: SDL3pp_video.h:3698
SDL_FlashOperation FlashOperation
Window flash operation.
Definition: SDL3pp_video.h:640
constexpr WindowFlags WINDOW_VULKAN
window usable for Vulkan surface
Definition: SDL3pp_video.h:623
bool WindowHasSurface(WindowParam window)
Return whether the window has a surface associated with it.
Definition: SDL3pp_video.h:5832
constexpr HitTestResult HITTEST_RESIZE_TOPLEFT
Region is the resizable top-left corner border.
Definition: SDL3pp_video.h:669
constexpr HitTestResult HITTEST_RESIZE_BOTTOMRIGHT
Region is the resizable bottom-right corner border.
Definition: SDL3pp_video.h:684
SDL_EGLConfig EGLConfig
Opaque type for an EGL config.
Definition: SDL3pp_video.h:3184
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:620
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:3356
OwnArray< DisplayMode * > GetFullscreenDisplayModes(DisplayID displayID)
Get a list of fullscreen display modes available on a display.
Definition: SDL3pp_video.h:3875
constexpr GLAttr GL_EGL_PLATFORM
GL_EGL_PLATFORM.
Definition: SDL3pp_video.h:3467
constexpr WindowFlags WINDOW_BORDERLESS
no window decoration
Definition: SDL3pp_video.h:567
const DisplayMode & GetDesktopMode() const
Get information about the desktop's display mode.
Definition: SDL3pp_video.h:3963
void SetWindowFocusable(WindowParam window, bool focusable)
Set whether the window may have input focus.
Definition: SDL3pp_video.h:6341
SDL_EGLDisplay EGLDisplay
Opaque type for an EGL display.
Definition: SDL3pp_video.h:3177
void GetWindowSizeInPixels(WindowParam window, int *w, int *h)
Get the size of a window's client area, in pixels.
Definition: SDL3pp_video.h:5380
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:615
Rect GetDisplayUsableBounds(DisplayID displayID)
Get the usable desktop area represented by a display, in screen coordinates.
Definition: SDL3pp_video.h:3760
constexpr WindowFlags WINDOW_MOUSE_CAPTURE
window has mouse captured (unrelated to MOUSE_GRABBED)
Definition: SDL3pp_video.h:597
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:4422
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:5346
WindowRef GetGrabbedWindow()
Get the window that currently has an input grab enabled.
Definition: SDL3pp_video.h:6150
void UpdateWindowSurface(WindowParam window)
Copy the window surface to the screen.
Definition: SDL3pp_video.h:5960
constexpr GLAttr GL_BUFFER_SIZE
the minimum number of bits for frame buffer size; defaults to 0.
Definition: SDL3pp_video.h:3365
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:555
bool GetKeyboardGrab() const
Get a window's keyboard grab mode.
Definition: SDL3pp_video.h:6108
constexpr GLAttr GL_CONTEXT_NO_ERROR
GL_CONTEXT_NO_ERROR.
Definition: SDL3pp_video.h:3462
void SetWindowSize(WindowParam window, const PointRaw &p)
Request that the size of a window's client area be set.
Definition: SDL3pp_video.h:5165
const char * GetWindowTitle(WindowParam window)
Get the title of a window.
Definition: SDL3pp_video.h:5013
void SetWindowAlwaysOnTop(WindowParam window, bool on_top)
Set the window to always be above the others.
Definition: SDL3pp_video.h:5566
void GetWindowSize(WindowParam window, int *w, int *h)
Get the size of a window's client area.
Definition: SDL3pp_video.h:5195
static OwnArray< DisplayID > GetAll()
Get a list of currently connected displays.
Definition: SDL3pp_video.h:3619
SDL_EGLint EGLint
An EGL integer attribute, used when creating an EGL surface.
Definition: SDL3pp_video.h:3205
WindowFlags GetWindowFlags(WindowParam window)
Get the window flags.
Definition: SDL3pp_video.h:4965
constexpr GLContextFlag GL_CONTEXT_ROBUST_ACCESS_FLAG
ROBUST_ACCESS_FLAG.
Definition: SDL3pp_video.h:3499
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:5869
const char * GetTitle() const
Get the title of a window.
Definition: SDL3pp_video.h:5018
constexpr WindowFlags WINDOW_MOUSE_RELATIVE_MODE
window has relative mode enabled
Definition: SDL3pp_video.h:599
constexpr WindowFlags WINDOW_OCCLUDED
window is occluded
Definition: SDL3pp_video.h:558
constexpr FlashOperation FLASH_UNTIL_FOCUSED
Flash the window until it gets focus.
Definition: SDL3pp_video.h:648
static Display GetForPoint(const PointRaw &point)
Get the display containing a point.
Definition: SDL3pp_video.h:4016
void SetWindowOpacity(WindowParam window, float opacity)
Set the opacity for a window.
Definition: SDL3pp_video.h:6226
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:3474
void SetMouseRect(const RectRaw &rect)
Confines the cursor to the specified area of a window.
Definition: SDL3pp_video.h:6178
void SetWindowModal(WindowParam window, bool modal)
Toggle the state of the window as modal.
Definition: SDL3pp_video.h:6320
void Destroy()
Destroy a window.
Definition: SDL3pp_video.h:6559
SystemTheme GetSystemTheme()
Get the current system theme.
Definition: SDL3pp_video.h:3600
static Display GetForRect(const RectRaw &rect)
Get the display primarily containing a rect.
Definition: SDL3pp_video.h:4041
DisplayOrientation GetCurrentOrientation() const
Get the orientation of a display.
Definition: SDL3pp_video.h:3813
OwnPtr< void > GetICCProfile() const
Get the raw ICC profile data for the screen the window is currently on.
Definition: SDL3pp_video.h:4214
static WindowRef FromID(WindowID id)
Get a window from a stored ID.
Definition: SDL3pp_video.h:4789
PropertiesRef GetWindowProperties(WindowParam window)
Get the properties associated with a window.
Definition: SDL3pp_video.h:4937
void GetAspectRatio(float *min_aspect, float *max_aspect) const
Get the size of a window's client area.
Definition: SDL3pp_video.h:5307
void GetWindowMinimumSize(WindowParam window, int *w, int *h)
Get the minimum size of a window's client area.
Definition: SDL3pp_video.h:5431
constexpr WindowFlags WINDOW_NOT_FOCUSABLE
window should not be focusable
Definition: SDL3pp_video.h:632
void SetWindowKeyboardGrab(WindowParam window, bool grabbed)
Set a window's keyboard grab mode.
Definition: SDL3pp_video.h:6053
constexpr GLContextResetNotification GL_CONTEXT_RESET_NO_NOTIFICATION
NO_NOTIFICATION.
Definition: SDL3pp_video.h:3526
constexpr GLAttr GL_FLOATBUFFERS
GL_FLOATBUFFERS.
Definition: SDL3pp_video.h:3465
void GL_MakeCurrent(WindowParam window, GLContext context)
Set up an OpenGL context for rendering into an OpenGL window.
Definition: SDL3pp_video.h:6855
void Raise()
Request that a window be raised above other windows and gain the input focus.
Definition: SDL3pp_video.h:5638
void SetMaximumSize(const PointRaw &p)
Set the maximum size of a window's client area.
Definition: SDL3pp_video.h:5460
GLContext GL_GetCurrentContext()
Get the currently active OpenGL context.
Definition: SDL3pp_video.h:6892
constexpr WindowFlags WINDOW_RESIZABLE
window can be resized
Definition: SDL3pp_video.h:570
OwnArray< WindowRef > GetWindows()
Get a list of valid windows.
Definition: SDL3pp_video.h:4250
PixelFormat GetPixelFormat() const
Get the pixel format associated with the window.
Definition: SDL3pp_video.h:4235
constexpr WindowFlags WINDOW_POPUP_MENU
window should be treated as a popup menu, requires a parent window
Definition: SDL3pp_video.h:618
void Hide()
Hide a window.
Definition: SDL3pp_video.h:5614
void SetParent(WindowParam parent)
Set the window as a child of a parent window.
Definition: SDL3pp_video.h:6298
constexpr GLContextResetNotification GL_CONTEXT_RESET_LOSE_CONTEXT
LOSE_CONTEXT.
Definition: SDL3pp_video.h:3529
Display GetDisplayForWindow(WindowParam window)
Get the display associated with a window.
Definition: SDL3pp_video.h:4061
void SetModal(bool modal)
Toggle the state of the window as modal.
Definition: SDL3pp_video.h:6325
void GL_ResetAttributes()
Reset all previously set OpenGL context attributes to their default values.
Definition: SDL3pp_video.h:6766
Uint32 GLContextResetNotification
Possible values to be set GL_CONTEXT_RESET_NOTIFICATION attribute.
Definition: SDL3pp_video.h:3524
void Destroy()
Delete an OpenGL context.
Definition: SDL3pp_video.h:7064
constexpr WindowFlags WINDOW_EXTERNAL
window not created by SDL
Definition: SDL3pp_video.h:588
Rect GetSafeArea() const
Get the safe area for this window.
Definition: SDL3pp_video.h:5229
void SetWindowMaximumSize(WindowParam window, const PointRaw &p)
Set the maximum size of a window's client area.
Definition: SDL3pp_video.h:5455
WindowFlags GetFlags() const
Get the window flags.
Definition: SDL3pp_video.h:4970
void SyncWindow(WindowParam window)
Block until any pending window state is finalized.
Definition: SDL3pp_video.h:5812
OwnArray< DisplayID > GetDisplays()
Get a list of currently connected displays.
Definition: SDL3pp_video.h:3612
const RectRaw * GetMouseRect() const
Get the mouse confinement rectangle of a window.
Definition: SDL3pp_video.h:6203
constexpr WindowFlags WINDOW_ALWAYS_ON_TOP
window should always be above others
Definition: SDL3pp_video.h:602
std::function< SDL_EGLAttrib *()> EGLAttribArrayCB
EGL platform attribute initialization callback.
Definition: SDL3pp_video.h:3256
const DisplayMode & GetFullscreenMode() const
Query the display mode to use when a window is visible at fullscreen.
Definition: SDL3pp_video.h:4192
constexpr WindowFlags WINDOW_HIDDEN
window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; Window....
Definition: SDL3pp_video.h:565
constexpr GLAttr GL_SHARE_WITH_CURRENT_CONTEXT
OpenGL context sharing; defaults to 0.
Definition: SDL3pp_video.h:3442
void SetWindowTitle(WindowParam window, StringParam title)
Set the title of a window.
Definition: SDL3pp_video.h:4990
void Sync()
Block until any pending window state is finalized.
Definition: SDL3pp_video.h:5817
WindowID GetWindowID(WindowParam window)
Get the numeric ID of a window.
Definition: SDL3pp_video.h:4761
EGLConfig EGL_GetCurrentConfig()
Get the currently active EGL config.
Definition: SDL3pp_video.h:6919
void HideWindow(WindowParam window)
Hide a window.
Definition: SDL3pp_video.h:5609
static Display GetPrimary()
Return the primary display.
Definition: SDL3pp_video.h:3638
constexpr HitTestResult HITTEST_RESIZE_BOTTOM
Region is the resizable bottom border.
Definition: SDL3pp_video.h:687
OwnPtr< void > GetWindowICCProfile(WindowParam window)
Get the raw ICC profile data for the screen the window is currently on.
Definition: SDL3pp_video.h:4208
void RaiseWindow(WindowParam window)
Request that a window be raised above other windows and gain the input focus.
Definition: SDL3pp_video.h:5633
bool HasSurface() const
Return whether the window has a surface associated with it.
Definition: SDL3pp_video.h:5837
Rect GetUsableBounds() const
Get the usable desktop area represented by a display, in screen coordinates.
Definition: SDL3pp_video.h:3767
void SetResizable(bool resizable)
Set the user-resizable state of a window.
Definition: SDL3pp_video.h:5545
void DestroyWindow(WindowRaw window)
Destroy a window.
Definition: SDL3pp_video.h:6557
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:3395
const RectRaw * GetWindowMouseRect(WindowParam window)
Get the mouse confinement rectangle of a window.
Definition: SDL3pp_video.h:6198
WindowRef GetWindowFromID(WindowID id)
Get a window from a stored ID.
Definition: SDL3pp_video.h:4784
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:5355
constexpr WindowFlags WINDOW_FULLSCREEN
window is in fullscreen mode
Definition: SDL3pp_video.h:552
void UpdateSurfaceRects(SpanRef< const RectRaw > rects)
Copy areas of the window surface to the screen.
Definition: SDL3pp_video.h:5998
constexpr GLContextReleaseFlag GL_CONTEXT_RELEASE_BEHAVIOR_NONE
BEHAVIOR_NONE.
Definition: SDL3pp_video.h:3513
void SetShape(SurfaceParam shape)
Set the shape of a transparent window.
Definition: SDL3pp_video.h:6511
WindowRef GetParent() const
Get parent of a window.
Definition: SDL3pp_video.h:4812
SDL_EGLAttrib EGLAttrib
An EGL attribute, used when creating an EGL context.
Definition: SDL3pp_video.h:3198
void GL_LoadLibrary(StringParam path)
Dynamically load an OpenGL library.
Definition: SDL3pp_video.h:6634
void SetFullscreen(bool fullscreen)
Request that the window's fullscreen state be changed.
Definition: SDL3pp_video.h:5779
void MakeCurrent(WindowParam window)
Set up an OpenGL context for rendering into an OpenGL window.
Definition: SDL3pp_video.h:6860
void SetFullscreenMode(OptionalRef< const DisplayMode > mode)
Set the display mode to use when a window is visible and fullscreen.
Definition: SDL3pp_video.h:4168
constexpr GLAttr GL_DEPTH_SIZE
the minimum number of bits in the depth buffer; defaults to 16.
Definition: SDL3pp_video.h:3374
void SetIcon(SurfaceParam icon)
Set the icon for a window.
Definition: SDL3pp_video.h:5049
std::function< SDL_EGLint *(SDL_EGLDisplay, SDL_EGLConfig)> EGLIntArrayCB
EGL surface/context attribute initialization callback types.
Definition: SDL3pp_video.h:3319
DisplayMode GetClosestFullscreenDisplayMode(DisplayID 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:3914
EGLDisplay EGL_GetCurrentDisplay()
Get the currently active EGL display.
Definition: SDL3pp_video.h:6904
void SetMouseGrab(bool grabbed)
Set a window's mouse grab mode.
Definition: SDL3pp_video.h:6086
void MinimizeWindow(WindowParam window)
Request that the window be minimized to an iconic representation.
Definition: SDL3pp_video.h:5704
constexpr GLContextReleaseFlag GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH
BEHAVIOR_FLUSH.
Definition: SDL3pp_video.h:3516
void SetSurfaceVSync(int vsync)
Toggle VSync for the window surface.
Definition: SDL3pp_video.h:5907
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:3419
void SetWindowMouseGrab(WindowParam window, bool grabbed)
Set a window's mouse grab mode.
Definition: SDL3pp_video.h:6081
SDL_EGLIntArrayCallback EGLIntArrayCallback
EGL surface/context attribute initialization callback types.
Definition: SDL3pp_video.h:3287
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:3157
constexpr GLContextScoped(GLContext &&other)
Move constructor.
Definition: SDL3pp_video.h:3163
~GLContextScoped()
Destructor.
Definition: SDL3pp_video.h:3169
Store callbacks by key.
Definition: SDL3pp_callbackWrapper.h:222
The structure that defines a point (using integers).
Definition: SDL3pp_rect.h:80
Safely wrap Properties for non owning parameters.
Definition: SDL3pp_properties.h:52
Semi-safe reference for Properties.
Definition: SDL3pp_properties.h:569
A rectangle, with the origin at the upper left (using integers).
Definition: SDL3pp_rect.h:836
constexpr Point GetTopLeft() const
Get top left corner of the rect.
Definition: SDL3pp_rect.h:1085
constexpr Point GetSize() const
Get size of the rect.
Definition: SDL3pp_rect.h:1117
Semi-safe reference for Renderer.
Definition: SDL3pp_render.h:2090
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:2922
~WindowRef()
Destructor.
Definition: SDL3pp_video.h:2942
WindowRef(WindowParam resource)
Constructs from WindowParam.
Definition: SDL3pp_video.h:2930
WindowRef(const WindowRef &other)
Copy constructor.
Definition: SDL3pp_video.h:2936