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 <memory>
5#include <optional>
6#include <vector>
7#include <SDL3/SDL_render.h>
8#include <SDL3/SDL_video.h>
9#include "SDL3pp_properties.h"
10#include "SDL3pp_rect.h"
11#include "SDL3pp_surface.h"
12
13namespace SDL {
42// Forward decl
43struct WindowBase;
44
45// Forward decl
46struct WindowRef;
47
48// Forward decl
49struct Window;
50
51// Forward decl
52struct RendererBase;
53
54// Forward decl
55struct RendererRef;
56
70using DisplayOrientation = SDL_DisplayOrientation;
71
73 SDL_ORIENTATION_UNKNOWN;
74
79constexpr DisplayOrientation ORIENTATION_LANDSCAPE = SDL_ORIENTATION_LANDSCAPE;
80
86 SDL_ORIENTATION_LANDSCAPE_FLIPPED;
87
89 SDL_ORIENTATION_PORTRAIT;
90
92 SDL_ORIENTATION_PORTRAIT_FLIPPED;
94
96
106using DisplayModeData = SDL_DisplayModeData;
107
119using DisplayMode = SDL_DisplayMode;
120
138using WindowFlags = SDL_WindowFlags;
139
141 SDL_WINDOW_FULLSCREEN;
142
144 SDL_WINDOW_OPENGL;
145
147 SDL_WINDOW_OCCLUDED;
148
154constexpr WindowFlags WINDOW_HIDDEN = SDL_WINDOW_HIDDEN;
155
157 SDL_WINDOW_BORDERLESS;
158
160 SDL_WINDOW_RESIZABLE;
161
163 SDL_WINDOW_MINIMIZED;
164
166 SDL_WINDOW_MAXIMIZED;
167
169 SDL_WINDOW_MOUSE_GRABBED;
170
172 SDL_WINDOW_INPUT_FOCUS;
173
175 SDL_WINDOW_MOUSE_FOCUS;
176
178 SDL_WINDOW_EXTERNAL;
179
180constexpr WindowFlags WINDOW_MODAL = SDL_WINDOW_MODAL;
181
185constexpr WindowFlags WINDOW_HIGH_PIXEL_DENSITY = SDL_WINDOW_HIGH_PIXEL_DENSITY;
186
190constexpr WindowFlags WINDOW_MOUSE_CAPTURE = SDL_WINDOW_MOUSE_CAPTURE;
191
193 SDL_WINDOW_MOUSE_RELATIVE_MODE;
194
196 SDL_WINDOW_ALWAYS_ON_TOP;
197
202constexpr WindowFlags WINDOW_UTILITY = SDL_WINDOW_UTILITY;
203
208constexpr WindowFlags WINDOW_TOOLTIP = SDL_WINDOW_TOOLTIP;
209
213constexpr WindowFlags WINDOW_POPUP_MENU = SDL_WINDOW_POPUP_MENU;
214
216 SDL_WINDOW_KEYBOARD_GRABBED;
217
219 SDL_WINDOW_VULKAN;
220
222 SDL_WINDOW_METAL;
223
225 SDL_WINDOW_TRANSPARENT;
226
228 SDL_WINDOW_NOT_FOCUSABLE;
229
231
245using FlashOperation = SDL_FlashOperation;
246
248 SDL_FLASH_CANCEL;
249
251 SDL_FLASH_BRIEFLY;
252
254 SDL_FLASH_UNTIL_FOCUSED;
255
257
275using HitTestResult = SDL_HitTestResult;
276
278 SDL_HITTEST_NORMAL;
279
281 SDL_HITTEST_DRAGGABLE;
282
284 SDL_HITTEST_RESIZE_TOPLEFT;
286
288 SDL_HITTEST_RESIZE_TOP;
289
291 SDL_HITTEST_RESIZE_TOPRIGHT;
293
295 SDL_HITTEST_RESIZE_RIGHT;
296
301 SDL_HITTEST_RESIZE_BOTTOMRIGHT;
302
304 SDL_HITTEST_RESIZE_BOTTOM;
305
307 SDL_HITTEST_RESIZE_BOTTOMLEFT;
309
311 SDL_HITTEST_RESIZE_LEFT;
312
314
330using HitTest = SDL_HitTest;
331
344 std::function<HitTestResult(WindowRef window, const Point& area)>;
345
353
355
356// Forward decl
357struct GLContextBase;
358
359// Forward decl
360struct GLContextRef;
361
362// Forward decl
363struct GLContext;
364
376{
377 SDL_DisplayID m_displayID;
378
379public:
385 constexpr Display(SDL_DisplayID displayID = {})
386 : m_displayID(displayID)
387 {
388 }
389
393 constexpr bool operator==(const Display& other) const = default;
394
398 constexpr bool operator==(SDL_DisplayID displayID) const
399 {
400 return operator==(Display(displayID));
401 }
402
408 constexpr operator SDL_DisplayID() const { return m_displayID; }
409
415 constexpr explicit operator bool() const { return m_displayID != 0; }
416
429 {
430 int count = 0;
431 auto data = reinterpret_cast<Display*>(SDL_GetDisplays(&count));
432 return OwnArray<Display>{data, size_t(count)};
433 }
434
447 static Display GetPrimary() { return CheckError(SDL_GetPrimaryDisplay()); }
448
475 {
476 return CheckError(SDL_GetDisplayProperties(m_displayID));
477 }
478
491 const char* GetName() const { return SDL_GetDisplayName(m_displayID); }
492
510 {
511 Rect bounds;
512 SDL_GetDisplayBounds(m_displayID, &bounds);
513 return bounds;
514 }
515
539 {
540 Rect bounds;
541 CheckError(SDL_GetDisplayUsableBounds(m_displayID, &bounds));
542 return bounds;
543 }
544
558 {
559 return SDL_GetNaturalDisplayOrientation(m_displayID);
560 }
561
575 {
576 return SDL_GetCurrentDisplayOrientation(m_displayID);
577 }
578
603 float GetContentScale() const
604 {
605 return SDL_GetDisplayContentScale(m_displayID);
606 }
607
632 {
633 int count = 0;
634 auto data = CheckError(SDL_GetFullscreenDisplayModes(m_displayID, &count));
635 return OwnArray<DisplayMode*>{data, size_t(count)};
636 }
637
666 int h,
667 float refresh_rate,
668 bool include_high_density_modes) const
669 {
670 SDL_DisplayMode closest;
671 CheckError(SDL_GetClosestFullscreenDisplayMode(
672 m_displayID, w, h, refresh_rate, include_high_density_modes, &closest));
673 return closest;
674 }
675
695 {
696 return CheckError(SDL_GetDesktopDisplayMode(m_displayID));
697 }
698
718 {
719 return SDL_GetCurrentDisplayMode(m_displayID);
720 }
721
736 static Display GetForPoint(const SDL_Point& point)
737 {
738 return {SDL_GetDisplayForPoint(&point)};
739 }
740
756 static Display GetForRect(const SDL_Rect& rect)
757 {
758 return SDL_GetDisplayForRect(&rect);
759 }
760
771};
772
780using WindowID = SDL_WindowID;
781
782namespace prop::Global {
783
797constexpr auto VIDEO_WAYLAND_WL_DISPLAY_POINTER =
798 SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER;
799
800} // namespace prop::Global
801
812using SystemTheme = SDL_SystemTheme;
813
815 SDL_SYSTEM_THEME_UNKNOWN;
816
818 SDL_SYSTEM_THEME_LIGHT;
819
821 SDL_SYSTEM_THEME_DARK;
822
824
837struct WindowBase : Resource<SDL_Window*>
838{
839 using Resource::Resource;
840
926 WindowBase(StringParam title, SDL_Point size, WindowFlags flags = 0)
927 : Resource(CheckError(SDL_CreateWindow(title, size.x, size.y, flags)))
928 {
929 }
930
990 SDL_Point offset,
991 SDL_Point size,
992 WindowFlags flags = 0)
993 : Resource(CheckError(SDL_CreatePopupWindow(parent.get(),
994 offset.x,
995 offset.y,
996 size.x,
997 size.y,
998 flags)))
999 {
1000 }
1001
1124 : Resource(CheckError(SDL_CreateWindowWithProperties(props.get())))
1125 {
1126 }
1127
1142 Display GetDisplay() const { return SDL_GetDisplayForWindow(get()); }
1143
1160 float GetPixelDensity() const { return SDL_GetWindowPixelDensity(get()); }
1161
1183 float GetDisplayScale() const { return SDL_GetWindowDisplayScale(get()); }
1184
1217 {
1218 CheckError(SDL_SetWindowFullscreenMode(get(), mode));
1219 }
1220
1235 {
1236 return SDL_GetWindowFullscreenMode(get());
1237 }
1238
1250 OwnPtr<void> GetICCProfile(size_t* size) const
1251 {
1252 return OwnPtr<void>{CheckError(SDL_GetWindowICCProfile(get(), size))};
1253 }
1254
1266 {
1267 return CheckError(SDL_GetWindowPixelFormat(get()));
1268 }
1269
1285 WindowID GetID() const { return CheckError(SDL_GetWindowID(get())); }
1286
1299 WindowRef GetParent() const;
1300
1421 {
1422 return CheckError(SDL_GetWindowProperties(get()));
1423 }
1424
1442 WindowFlags GetFlags() const { return SDL_GetWindowFlags(get()); }
1443
1459 {
1460 CheckError(SDL_SetWindowTitle(get(), title));
1461 }
1462
1475 const char* GetTitle() const { return SDL_GetWindowTitle(get()); }
1476
1498 {
1499 CheckError(SDL_SetWindowIcon(get(), icon.get()));
1500 }
1501
1513 void SetRect(Rect rect)
1514 {
1515 SetPosition(rect.GetTopLeft());
1516 SetSize(rect.GetSize());
1517 }
1518
1532 Rect GetRect() const { return Rect{GetPosition(), GetSize()}; }
1533
1569 void SetPosition(SDL_Point p)
1570 {
1571 CheckError(SDL_SetWindowPosition(get(), p.x, p.y));
1572 }
1573
1591 {
1592 Point p;
1593 GetPosition(&p.x, &p.y);
1594 return p;
1595 }
1596
1618 void GetPosition(int* x, int* y) const
1619 {
1620 CheckError(SDL_GetWindowPosition(get(), x, y));
1621 }
1622
1655 void SetSize(SDL_Point p) { CheckError(SDL_SetWindowSize(get(), p.x, p.y)); }
1656
1677 {
1678 Point p;
1679 GetSize(&p.x, &p.y);
1680 return p;
1681 }
1682
1702 void GetSize(int* w, int* h) const
1703 {
1704 CheckError(SDL_GetWindowSize(get(), w, h));
1705 }
1706
1725 {
1726 Rect rect;
1727 CheckError(SDL_GetWindowSafeArea(get(), &rect));
1728 return rect;
1729 }
1730
1768 void SetAspectRatio(float min_aspect, float max_aspect)
1769 {
1770 CheckError(SDL_SetWindowAspectRatio(get(), min_aspect, max_aspect));
1771 }
1772
1788 void GetAspectRatio(float* min_aspect, float* max_aspect) const
1789 {
1790 CheckError(SDL_GetWindowAspectRatio(get(), min_aspect, max_aspect));
1791 }
1792
1825 void GetBordersSize(int* top, int* left, int* bottom, int* right) const
1826 {
1827 CheckError(SDL_GetWindowBordersSize(get(), top, left, bottom, right));
1828 }
1829
1844 {
1845 Point p;
1846 GetSizeInPixels(&p.x, &p.y);
1847 return p;
1848 }
1849
1866 void GetSizeInPixels(int* w, int* h) const
1867 {
1868 CheckError(SDL_GetWindowSizeInPixels(get(), w, h));
1869 }
1870
1884 void SetMinimumSize(SDL_Point p)
1885 {
1886 CheckError(SDL_SetWindowMinimumSize(get(), p.x, p.y));
1887 }
1888
1905 void GetMinimumSize(int* w, int* h) const
1906 {
1907 CheckError(SDL_GetWindowMinimumSize(get(), w, h));
1908 }
1909
1923 void SetMaximumSize(SDL_Point p)
1924 {
1925 CheckError(SDL_SetWindowMaximumSize(get(), p.x, p.y));
1926 }
1927
1944 void GetMaximumSize(int* w, int* h) const
1945 {
1946 CheckError(SDL_GetWindowMaximumSize(get(), w, h));
1947 }
1948
1967 void SetBordered(bool bordered)
1968 {
1969 CheckError(SDL_SetWindowBordered(get(), bordered));
1970 }
1971
1990 void SetResizable(bool resizable)
1991 {
1992 CheckError(SDL_SetWindowResizable(get(), resizable));
1993 }
1994
2010 void SetAlwaysOnTop(bool on_top)
2011 {
2012 CheckError(SDL_SetWindowAlwaysOnTop(get(), on_top));
2013 }
2014
2027 void Show() { CheckError(SDL_ShowWindow(get())); }
2028
2041 void Hide() { CheckError(SDL_HideWindow(get())); }
2042
2059 void Raise() { CheckError(SDL_RaiseWindow(get())); }
2060
2091 void Maximize() { CheckError(SDL_MaximizeWindow(get())); }
2092
2118 void Minimize() { CheckError(SDL_MinimizeWindow(get())); }
2119
2146 void Restore() { CheckError(SDL_RestoreWindow(get())); }
2147
2176 void SetFullscreen(bool fullscreen)
2177 {
2178 CheckError(SDL_SetWindowFullscreen(get(), fullscreen));
2179 }
2180
2207 void Sync() { CheckError(SDL_SyncWindow(get())); }
2208
2221 bool HasSurface() const { return SDL_WindowHasSurface(get()); }
2222
2249 SurfaceRef GetSurface() { return SDL_GetWindowSurface(get()); }
2250
2273 void SetSurfaceVSync(int vsync)
2274 {
2275 CheckError(SDL_SetWindowSurfaceVSync(get(), vsync));
2276 }
2277
2291 {
2292 int vsync;
2293 CheckError(SDL_GetWindowSurfaceVSync(get(), &vsync));
2294 return vsync;
2295 }
2296
2314 void UpdateSurface() { CheckError(SDL_UpdateWindowSurface(get())); }
2315
2341 {
2342 SDL_assert_paranoid(rects.size() < SDL_MAX_SINT32);
2343 CheckError(SDL_UpdateWindowSurfaceRects(get(), rects.data(), rects.size()));
2344 }
2345
2358 void DestroySurface() { CheckError(SDL_DestroyWindowSurface(get())); }
2359
2389 void SetKeyboardGrab(bool grabbed)
2390 {
2391 CheckError(SDL_SetWindowKeyboardGrab(get(), grabbed));
2392 }
2393
2411 void SetMouseGrab(bool grabbed)
2412 {
2413 CheckError(SDL_SetWindowMouseGrab(get(), grabbed));
2414 }
2415
2427 bool GetKeyboardGrab() const { return SDL_GetWindowKeyboardGrab(get()); }
2428
2443 bool GetMouseGrab() const { return SDL_GetWindowMouseGrab(get()); }
2444
2463 void SetMouseRect(const SDL_Rect& rect)
2464 {
2465 CheckError(SDL_SetWindowMouseRect(get(), &rect));
2466 }
2467
2482 const SDL_Rect* GetMouseRect() const { return SDL_GetWindowMouseRect(get()); }
2483
2501 void SetOpacity(float opacity)
2502 {
2503 CheckError(SDL_SetWindowOpacity(get(), opacity));
2504 }
2505
2521 float GetOpacity() const { return SDL_GetWindowOpacity(get()); }
2522
2554
2571 void SetModal(bool modal) { CheckError(SDL_SetWindowModal(get(), modal)); }
2572
2583 void SetFocusable(bool focusable)
2584 {
2585 CheckError(SDL_SetWindowFocusable(get(), focusable));
2586 }
2587
2607 void ShowSystemMenu(SDL_Point p)
2608 {
2609 CheckError(SDL_ShowWindowSystemMenu(get(), p.x, p.y));
2610 }
2611
2653 void SetHitTest(HitTestCB callback);
2654
2695 void SetHitTest(HitTest callback, void* callback_data)
2696 {
2697 CheckError(SDL_SetWindowHitTest(get(), callback, callback_data));
2698 }
2699
2725 {
2726 CheckError(SDL_SetWindowShape(get(), shape.get()));
2727 }
2728
2739 void Flash(FlashOperation operation)
2740 {
2741 CheckError(SDL_FlashWindow(get(), operation));
2742 }
2743
2744 RendererRef GetRenderer() const;
2745
2746 void StartTextInput();
2747
2748 void StartTextInput(PropertiesBase& props);
2749
2750 bool IsTextInputActive() const;
2751
2752 void StopTextInput();
2753
2754 void ClearComposition();
2755
2756 void SetTextInputArea(const SDL_Rect& rect, int cursor);
2757
2758 void GetTextInputArea(Rect* rect, int* cursor);
2759
2760 bool IsScreenKeyboardShown() const;
2761
2762 void WarpMouse(float x, float y);
2763
2764 void SetRelativeMouseMode(bool enabled);
2765
2766 bool GetRelativeMouseMode() const;
2767};
2768
2778{
2780
2784 constexpr WindowRef(const WindowRef& other)
2785 : WindowBase(other.get())
2786 {
2787 }
2788
2792 constexpr WindowRef(WindowRef&& other)
2793 : WindowBase(other.release())
2794 {
2795 }
2796
2800 constexpr ~WindowRef() = default;
2801
2806 {
2807 release(other.release());
2808 return *this;
2809 }
2810
2825 void reset(SDL_Window* newResource = {})
2826 {
2827 SDL_DestroyWindow(release(newResource));
2828 }
2829
2846 static WindowRef FromID(WindowID id);
2847
2860 static WindowRef GetGrabbed();
2861};
2862
2872{
2874
2878 constexpr explicit Window(SDL_Window* resource = {})
2879 : WindowRef(resource)
2880 {
2881 }
2882
2883 constexpr Window(const Window& other) = delete;
2884
2888 constexpr Window(Window&& other) = default;
2889
2894
2899 {
2900 reset(other.release());
2901 return *this;
2902 }
2903};
2904
2905#ifdef SDL3PP_DOC
2906
2915#define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000u
2916
2927#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK | (X))
2928
2936#define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
2937
2945#define SDL_WINDOWPOS_ISUNDEFINED(X) \
2946 (((X) & 0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)
2947
2956#define SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000u
2957
2968#define SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK | (X))
2969
2977#define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0)
2978
2986#define SDL_WINDOWPOS_ISCENTERED(X) \
2987 (((X) & 0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)
2988
2989#endif // SDL3PP_DOC
2990
3003struct GLContextBase : Resource<SDL_GLContextState*>
3004{
3005 using Resource::Resource;
3006
3030 : Resource(CheckError(SDL_GL_CreateContext(window.get())))
3031 {
3032 }
3033
3049 {
3050 CheckError(SDL_GL_MakeCurrent(window.get(), get()));
3051 }
3052};
3053
3063{
3065
3069 constexpr GLContextRef(const GLContextRef& other)
3070 : GLContextBase(other.get())
3071 {
3072 }
3073
3077 constexpr GLContextRef(GLContextRef&& other)
3078 : GLContextBase(other.release())
3079 {
3080 }
3081
3085 constexpr ~GLContextRef() = default;
3086
3091 {
3092 release(other.release());
3093 return *this;
3094 }
3095
3108 bool reset(SDL_GLContextState* newResource = {})
3109 {
3110 return SDL_GL_DestroyContext(release(newResource));
3111 }
3112};
3113
3123{
3125
3129 constexpr explicit GLContext(SDL_GLContextState* resource = {})
3130 : GLContextRef(resource)
3131 {
3132 }
3133
3134 constexpr GLContext(const GLContext& other) = delete;
3135
3139 constexpr GLContext(GLContext&& other) = default;
3140
3145
3150 {
3151 reset(other.release());
3152 return *this;
3153 }
3154};
3155
3161using EGLDisplay = SDL_EGLDisplay;
3162
3168using EGLConfig = SDL_EGLConfig;
3169
3175using EGLSurface = SDL_EGLSurface;
3176
3182using EGLAttrib = SDL_EGLAttrib;
3183
3189using EGLint = SDL_EGLint;
3190
3214using EGLAttribArrayCallback = SDL_EGLAttribArrayCallback;
3215
3239using EGLAttribArrayCB = std::function<SDL_EGLAttrib*()>;
3240
3270using EGLIntArrayCallback = SDL_EGLIntArrayCallback;
3271
3301using EGLIntArrayCB = std::function<SDL_EGLint*(SDL_EGLDisplay, SDL_EGLConfig)>;
3302
3325using GLAttr = SDL_GLAttr;
3326
3331constexpr GLAttr GL_RED_SIZE = SDL_GL_RED_SIZE;
3332
3337constexpr GLAttr GL_GREEN_SIZE = SDL_GL_GREEN_SIZE;
3338
3343constexpr GLAttr GL_BLUE_SIZE = SDL_GL_BLUE_SIZE;
3344
3349constexpr GLAttr GL_ALPHA_SIZE = SDL_GL_ALPHA_SIZE;
3350
3354constexpr GLAttr GL_BUFFER_SIZE = SDL_GL_BUFFER_SIZE;
3355
3360constexpr GLAttr GL_DOUBLEBUFFER = SDL_GL_DOUBLEBUFFER;
3361
3365constexpr GLAttr GL_DEPTH_SIZE = SDL_GL_DEPTH_SIZE;
3366
3370constexpr GLAttr GL_STENCIL_SIZE = SDL_GL_STENCIL_SIZE;
3371
3376constexpr GLAttr GL_ACCUM_RED_SIZE = SDL_GL_ACCUM_RED_SIZE;
3377
3382constexpr GLAttr GL_ACCUM_GREEN_SIZE = SDL_GL_ACCUM_GREEN_SIZE;
3383
3388constexpr GLAttr GL_ACCUM_BLUE_SIZE = SDL_GL_ACCUM_BLUE_SIZE;
3389
3394constexpr GLAttr GL_ACCUM_ALPHA_SIZE = SDL_GL_ACCUM_ALPHA_SIZE;
3395
3397 SDL_GL_STEREO;
3398
3402constexpr GLAttr GL_MULTISAMPLEBUFFERS = SDL_GL_MULTISAMPLEBUFFERS;
3403
3408constexpr GLAttr GL_MULTISAMPLESAMPLES = SDL_GL_MULTISAMPLESAMPLES;
3409
3414constexpr GLAttr GL_ACCELERATED_VISUAL = SDL_GL_ACCELERATED_VISUAL;
3415
3417 SDL_GL_RETAINED_BACKING;
3418
3420 SDL_GL_CONTEXT_MAJOR_VERSION;
3421
3423 SDL_GL_CONTEXT_MINOR_VERSION;
3424
3429constexpr GLAttr GL_CONTEXT_FLAGS = SDL_GL_CONTEXT_FLAGS;
3430
3435constexpr GLAttr GL_CONTEXT_PROFILE_MASK = SDL_GL_CONTEXT_PROFILE_MASK;
3436
3438 SDL_GL_SHARE_WITH_CURRENT_CONTEXT;
3439
3441 SDL_GL_FRAMEBUFFER_SRGB_CAPABLE;
3443
3448constexpr GLAttr GL_CONTEXT_RELEASE_BEHAVIOR = SDL_GL_CONTEXT_RELEASE_BEHAVIOR;
3449
3455 SDL_GL_CONTEXT_RESET_NOTIFICATION;
3456
3458 SDL_GL_CONTEXT_NO_ERROR;
3459
3460constexpr GLAttr GL_FLOATBUFFERS = SDL_GL_FLOATBUFFERS;
3461
3462constexpr GLAttr GL_EGL_PLATFORM = SDL_GL_EGL_PLATFORM;
3463
3465
3476using GLProfile = Uint32;
3477
3479 SDL_GL_CONTEXT_PROFILE_CORE;
3480
3482 SDL_GL_CONTEXT_PROFILE_COMPATIBILITY;
3484
3486 SDL_GL_CONTEXT_PROFILE_ES;
3487
3489
3500using GLContextFlag = Uint32;
3501
3503 SDL_GL_CONTEXT_DEBUG_FLAG;
3504
3506 SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG;
3507
3509 SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG;
3510
3512 SDL_GL_CONTEXT_RESET_ISOLATION_FLAG;
3513
3515
3528
3530 SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE;
3531
3533 SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH;
3534
3536
3548
3550 SDL_GL_CONTEXT_RESET_NO_NOTIFICATION;
3551
3553 SDL_GL_CONTEXT_RESET_LOSE_CONTEXT;
3554
3556
3568inline int GetNumVideoDrivers() { return SDL_GetNumVideoDrivers(); }
3569
3589inline const char* GetVideoDriver(int index)
3590{
3591 return SDL_GetVideoDriver(index);
3592}
3593
3611inline const char* GetCurrentVideoDriver()
3612{
3613 return SDL_GetCurrentVideoDriver();
3614}
3615
3625inline SystemTheme GetSystemTheme() { return SDL_GetSystemTheme(); }
3626
3627namespace prop::Display {
3628
3629constexpr auto HDR_ENABLED_BOOLEAN = SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN;
3630
3631constexpr auto KMSDRM_PANEL_ORIENTATION_NUMBER =
3632 SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER;
3633
3634} // namespace prop::Display
3635
3647{
3648 int count = 0;
3649 auto data = CheckError(reinterpret_cast<WindowRef*>(SDL_GetWindows(&count)));
3650 return OwnArray<WindowRef>{data, size_t(count)};
3651}
3652
3653namespace prop::Window {
3654
3655constexpr auto CREATE_ALWAYS_ON_TOP_BOOLEAN =
3656 SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN;
3657
3658constexpr auto CREATE_BORDERLESS_BOOLEAN =
3659 SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN;
3660
3661constexpr auto CREATE_FOCUSABLE_BOOLEAN =
3662 SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN;
3663
3664constexpr auto CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN =
3665 SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN;
3666
3667constexpr auto CREATE_FLAGS_NUMBER = SDL_PROP_WINDOW_CREATE_FLAGS_NUMBER;
3668
3669constexpr auto CREATE_FULLSCREEN_BOOLEAN =
3670 SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN;
3671
3672constexpr auto CREATE_HEIGHT_NUMBER = SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER;
3673
3674constexpr auto CREATE_HIDDEN_BOOLEAN = SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN;
3675
3676constexpr auto CREATE_HIGH_PIXEL_DENSITY_BOOLEAN =
3677 SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN;
3678
3679constexpr auto CREATE_MAXIMIZED_BOOLEAN =
3680 SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN;
3681
3682constexpr auto CREATE_MENU_BOOLEAN = SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN;
3683
3684constexpr auto CREATE_METAL_BOOLEAN = SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN;
3685
3686constexpr auto CREATE_MINIMIZED_BOOLEAN =
3687 SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN;
3688
3689constexpr auto CREATE_MODAL_BOOLEAN = SDL_PROP_WINDOW_CREATE_MODAL_BOOLEAN;
3690
3691constexpr auto CREATE_MOUSE_GRABBED_BOOLEAN =
3692 SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN;
3693
3694constexpr auto CREATE_OPENGL_BOOLEAN = SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN;
3695
3696constexpr auto CREATE_PARENT_POINTER = SDL_PROP_WINDOW_CREATE_PARENT_POINTER;
3697
3698constexpr auto CREATE_RESIZABLE_BOOLEAN =
3699 SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN;
3700
3701constexpr auto CREATE_TITLE_STRING = SDL_PROP_WINDOW_CREATE_TITLE_STRING;
3702
3703constexpr auto CREATE_TRANSPARENT_BOOLEAN =
3704 SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN;
3705
3706constexpr auto CREATE_TOOLTIP_BOOLEAN = SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN;
3707
3708constexpr auto CREATE_UTILITY_BOOLEAN = SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN;
3709
3710constexpr auto CREATE_VULKAN_BOOLEAN = SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN;
3711
3712constexpr auto CREATE_WIDTH_NUMBER = SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER;
3713
3714constexpr auto CREATE_X_NUMBER = SDL_PROP_WINDOW_CREATE_X_NUMBER;
3715
3716constexpr auto CREATE_Y_NUMBER = SDL_PROP_WINDOW_CREATE_Y_NUMBER;
3717
3718constexpr auto CREATE_COCOA_WINDOW_POINTER =
3719 SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER;
3720
3721constexpr auto CREATE_COCOA_VIEW_POINTER =
3722 SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER;
3723
3724constexpr auto CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN =
3725 SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN;
3726
3727constexpr auto CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN =
3728 SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN;
3729
3730constexpr auto CREATE_WAYLAND_WL_SURFACE_POINTER =
3731 SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER;
3732
3733constexpr auto CREATE_WIN32_HWND_POINTER =
3734 SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER;
3735
3736constexpr auto CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER =
3737 SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER;
3738
3739constexpr auto CREATE_X11_WINDOW_NUMBER =
3740 SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER;
3741
3742constexpr auto SHAPE_POINTER = SDL_PROP_WINDOW_SHAPE_POINTER;
3743
3744constexpr auto HDR_ENABLED_BOOLEAN = SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN;
3745
3746constexpr auto SDR_WHITE_LEVEL_FLOAT = SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT;
3747
3748constexpr auto HDR_HEADROOM_FLOAT = SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT;
3749
3750constexpr auto ANDROID_WINDOW_POINTER = SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER;
3751
3752constexpr auto ANDROID_SURFACE_POINTER =
3753 SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER;
3754
3755constexpr auto UIKIT_WINDOW_POINTER = SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER;
3756
3757constexpr auto UIKIT_METAL_VIEW_TAG_NUMBER =
3758 SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER;
3759
3760constexpr auto UIKIT_OPENGL_FRAMEBUFFER_NUMBER =
3761 SDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER;
3762
3763constexpr auto UIKIT_OPENGL_RENDERBUFFER_NUMBER =
3764 SDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER;
3765
3766constexpr auto UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER =
3767 SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER;
3768
3769constexpr auto KMSDRM_DEVICE_INDEX_NUMBER =
3770 SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER;
3771
3772constexpr auto KMSDRM_DRM_FD_NUMBER = SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER;
3773
3774constexpr auto KMSDRM_GBM_DEVICE_POINTER =
3775 SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER;
3776
3777constexpr auto COCOA_WINDOW_POINTER = SDL_PROP_WINDOW_COCOA_WINDOW_POINTER;
3778
3779constexpr auto COCOA_METAL_VIEW_TAG_NUMBER =
3780 SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER;
3781
3782constexpr auto OPENVR_OVERLAY_ID = SDL_PROP_WINDOW_OPENVR_OVERLAY_ID;
3783
3784constexpr auto VIVANTE_DISPLAY_POINTER =
3785 SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER;
3786
3787constexpr auto VIVANTE_WINDOW_POINTER = SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER;
3788
3789constexpr auto VIVANTE_SURFACE_POINTER =
3790 SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER;
3791
3792constexpr auto WIN32_HWND_POINTER = SDL_PROP_WINDOW_WIN32_HWND_POINTER;
3793
3794constexpr auto WIN32_HDC_POINTER = SDL_PROP_WINDOW_WIN32_HDC_POINTER;
3795
3796constexpr auto WIN32_INSTANCE_POINTER = SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER;
3797
3798constexpr auto WAYLAND_DISPLAY_POINTER =
3799 SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER;
3800
3801constexpr auto WAYLAND_SURFACE_POINTER =
3802 SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER;
3803
3804constexpr auto WAYLAND_VIEWPORT_POINTER =
3805 SDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTER;
3806
3807constexpr auto WAYLAND_EGL_WINDOW_POINTER =
3808 SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER;
3809
3810constexpr auto WAYLAND_XDG_SURFACE_POINTER =
3811 SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER;
3812
3813constexpr auto WAYLAND_XDG_TOPLEVEL_POINTER =
3814 SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER;
3815
3816constexpr auto WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING =
3817 SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING;
3818
3819constexpr auto WAYLAND_XDG_POPUP_POINTER =
3820 SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER;
3821
3822constexpr auto WAYLAND_XDG_POSITIONER_POINTER =
3823 SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER;
3824
3825constexpr auto X11_DISPLAY_POINTER = SDL_PROP_WINDOW_X11_DISPLAY_POINTER;
3826
3827constexpr auto X11_SCREEN_NUMBER = SDL_PROP_WINDOW_X11_SCREEN_NUMBER;
3828
3829constexpr auto X11_WINDOW_NUMBER = SDL_PROP_WINDOW_X11_WINDOW_NUMBER;
3830
3831} // namespace prop::Window
3832
3834{
3835 return SDL_GetWindowFromID(id);
3836}
3837
3839{
3840 return SDL_GetWindowParent(get());
3841}
3842
3843#ifdef SDL3PP_DOC
3844
3846#define SDL_WINDOW_SURFACE_VSYNC_DISABLED 0
3847
3849#define SDL_WINDOW_SURFACE_VSYNC_ADAPTIVE (-1)
3850
3851#endif // SDL3PP_DOC
3852
3853inline WindowRef WindowRef::GetGrabbed() { return SDL_GetGrabbedWindow(); }
3854
3871inline bool ScreenSaverEnabled() { return SDL_ScreenSaverEnabled(); }
3872
3885inline void EnableScreenSaver() { CheckError(SDL_EnableScreenSaver()); }
3886
3905inline void DisableScreenSaver() { CheckError(SDL_DisableScreenSaver()); }
3906
3929{
3930 CheckError(SDL_GL_LoadLibrary(path));
3931}
3932
3987{
3988 return SDL_GL_GetProcAddress(proc);
3989}
3990
4009{
4010 return SDL_EGL_GetProcAddress(proc);
4011}
4012
4022inline void GL_UnloadLibrary() { SDL_GL_UnloadLibrary(); }
4023
4046{
4047 return SDL_GL_ExtensionSupported(extension);
4048}
4049
4060inline void GL_ResetAttributes() { SDL_GL_ResetAttributes(); }
4061
4082inline void GL_SetAttribute(GLAttr attr, int value)
4083{
4084 CheckError(SDL_GL_SetAttribute(attr, value));
4085}
4086
4102inline void GL_GetAttribute(GLAttr attr, int* value)
4103{
4104 CheckError(SDL_GL_GetAttribute(attr, value));
4105}
4106
4118{
4119 return CheckError(SDL_GL_GetCurrentWindow());
4120}
4121
4135{
4136 return CheckError(SDL_GL_GetCurrentContext());
4137}
4138
4150{
4151 return CheckError(SDL_EGL_GetCurrentDisplay());
4152}
4153
4165{
4166 return CheckError(SDL_EGL_GetCurrentConfig());
4167}
4168
4181{
4182 return CheckError(SDL_EGL_GetWindowSurface(window.get()));
4183}
4184
4206 EGLAttribArrayCallback platformAttribCallback,
4207 EGLIntArrayCallback surfaceAttribCallback,
4208 EGLIntArrayCallback contextAttribCallback,
4209 void* userdata)
4210{
4211 SDL_EGL_SetAttributeCallbacks(platformAttribCallback,
4212 surfaceAttribCallback,
4213 contextAttribCallback,
4214 userdata);
4215}
4216
4245inline void GL_SetSwapInterval(int interval)
4246{
4247 CheckError(SDL_GL_SetSwapInterval(interval));
4248}
4249
4268inline void GL_GetSwapInterval(int* interval)
4269{
4270 CheckError(SDL_GL_GetSwapInterval(interval));
4271}
4272
4290inline void GL_SwapWindow(WindowBase& window)
4291{
4292 CheckError(SDL_GL_SwapWindow(window.get()));
4293}
4294
4295#pragma region impl
4296
4298
4300{
4302 void* cbHandle = Wrapper::Wrap(get(), std::move(callback));
4303 SetHitTest(
4304 [](SDL_Window* win, const SDL_Point* area, void* data) {
4305 return Wrapper::Call(data, WindowRef{win}, Point(*area));
4306 },
4307 cbHandle);
4308}
4309
4310#pragma endregion impl
4311
4312} // namespace SDL
4313
4314#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:376
Rect GetBounds() const
Get the desktop area represented by a display.
Definition SDL3pp_video.h:509
const DisplayMode * GetDesktopMode() const
Get information about the desktop's display mode.
Definition SDL3pp_video.h:694
OwnArray< DisplayMode * > GetFullscreenModes() const
Get a list of fullscreen display modes available on a display.
Definition SDL3pp_video.h:631
static Display GetForPoint(const SDL_Point &point)
Get the display containing a point.
Definition SDL3pp_video.h:736
static Display GetForRect(const SDL_Rect &rect)
Get the display primarily containing a rect.
Definition SDL3pp_video.h:756
static Display GetForWindow(WindowBase &window)
Get the display associated with a window.
PropertiesRef GetProperties() const
Get the properties associated with a display.
Definition SDL3pp_video.h:474
DisplayMode GetClosestFullscreenMode(int w, int h, float refresh_rate, bool include_high_density_modes) const
Get the closest match to the requested display mode.
Definition SDL3pp_video.h:665
float GetContentScale() const
Get the content scale of a display.
Definition SDL3pp_video.h:603
constexpr bool operator==(const Display &other) const =default
Default comparison operator.
const char * GetName() const
Get the name of a display in UTF-8 encoding.
Definition SDL3pp_video.h:491
DisplayOrientation GetNaturalOrientation() const
Get the orientation of a display when it is unrotated.
Definition SDL3pp_video.h:557
static Display GetPrimary()
Return the primary display.
Definition SDL3pp_video.h:447
DisplayOrientation GetCurrentOrientation() const
Get the orientation of a display.
Definition SDL3pp_video.h:574
static OwnArray< Display > GetAll()
Get a list of currently connected displays.
Definition SDL3pp_video.h:428
const DisplayMode * GetCurrentMode() const
Get information about the current display mode.
Definition SDL3pp_video.h:717
Rect GetUsableBounds() const
Get the usable desktop area represented by a display, in screen coordinates.
Definition SDL3pp_video.h:538
constexpr bool operator==(SDL_DisplayID displayID) const
Compares with the underlying type.
Definition SDL3pp_video.h:398
constexpr Display(SDL_DisplayID displayID={})
Wraps Display.
Definition SDL3pp_video.h:385
Optional-like shim for references.
Definition SDL3pp_optionalRef.h:20
A optional reference to resource.
Definition SDL3pp_resource.h:88
Base class for SDL memory allocated array wrap.
Definition SDL3pp_ownPtr.h:43
Pixel format.
Definition SDL3pp_pixels.h:374
A SDL managed resource.
Definition SDL3pp_resource.h:17
constexpr SDL_Window * release(SDL_Window * newResource={})
Return contained resource and empties or replace value.
Definition SDL3pp_resource.h:60
constexpr Resource(T resource={})
Constructs the underlying resource.
Definition SDL3pp_resource.h:22
constexpr SDL_Window * get() const
Return contained resource;.
Definition SDL3pp_resource.h:57
span-like for empty-derived structs
Definition SDL3pp_spanRef.h:24
Helpers to use C++ strings parameters.
Definition SDL3pp_strings.h:43
#define SDL_assert_paranoid(condition)
An assertion test that is performed only when built with paranoid settings.
Definition SDL3pp_assert.h:374
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition SDL3pp_error.h:206
void GetTextInputArea(Rect *rect, int *cursor)
Get the area used to type Unicode text input.
Definition SDL3pp_keyboard.h:609
void StopTextInput()
Stop receiving any text input events in a window.
Definition SDL3pp_keyboard.h:546
bool IsScreenKeyboardShown() const
Check whether the screen keyboard is shown for given window.
Definition SDL3pp_keyboard.h:643
bool IsTextInputActive() const
Check whether or not Unicode text input events are enabled for a window.
Definition SDL3pp_keyboard.h:527
void StartTextInput()
Start accepting Unicode text input events in a window.
Definition SDL3pp_keyboard.h:373
void SetTextInputArea(const SDL_Rect &rect, int cursor)
Set the area used to type Unicode text input.
Definition SDL3pp_keyboard.h:587
void ClearComposition()
Dismiss the composition window/IME without disabling the subsystem.
Definition SDL3pp_keyboard.h:563
void WarpMouse(float x, float y)
Move the mouse cursor to the given position within the window.
Definition SDL3pp_mouse.h:657
bool GetRelativeMouseMode() const
Query whether relative mouse mode is enabled for a window.
Definition SDL3pp_mouse.h:728
void SetRelativeMouseMode(bool enabled)
Set relative mouse mode for a window.
Definition SDL3pp_mouse.h:712
std::unique_ptr< T, PtrDeleter > OwnPtr
Handle to an owned SDL memory allocated pointer.
Definition SDL3pp_ownPtr.h:32
RendererRef GetRenderer() const
Get the renderer associated with a window.
Definition SDL3pp_render.h:3226
SDL_FunctionPointer FunctionPointer
A generic function pointer.
Definition SDL3pp_stdinc.h:5484
void DisableScreenSaver()
Prevent the screen from being blanked by a screen saver.
Definition SDL3pp_video.h:3905
constexpr GLContextFlag GL_CONTEXT_RESET_ISOLATION_FLAG
RESET_ISOLATION_FLAG.
Definition SDL3pp_video.h:3511
SDL_DisplayOrientation DisplayOrientation
Display orientation values; the way a display is rotated.
Definition SDL3pp_video.h:70
constexpr GLAttr GL_CONTEXT_RELEASE_BEHAVIOR
sets context the release behavior.
Definition SDL3pp_video.h:3448
void GL_SetSwapInterval(int interval)
Set the swap interval for the current OpenGL context.
Definition SDL3pp_video.h:4245
constexpr HitTestResult HITTEST_DRAGGABLE
Region can drag entire window.
Definition SDL3pp_video.h:280
constexpr HitTestResult HITTEST_RESIZE_BOTTOMLEFT
Region is the resizable bottom-left corner border.
Definition SDL3pp_video.h:306
SDL_GLAttr GLAttr
An enumeration of OpenGL configuration attributes.
Definition SDL3pp_video.h:3325
SDL_WindowFlags WindowFlags
The flags on a window.
Definition SDL3pp_video.h:138
constexpr FlashOperation FLASH_CANCEL
Cancel any window flash state.
Definition SDL3pp_video.h:247
constexpr SystemTheme SYSTEM_THEME_LIGHT
Light colored system theme.
Definition SDL3pp_video.h:817
constexpr WindowFlags WINDOW_MAXIMIZED
window is maximized
Definition SDL3pp_video.h:165
void EnableScreenSaver()
Allow the screen to be blanked by a screen saver.
Definition SDL3pp_video.h:3885
void GL_GetSwapInterval(int *interval)
Get the swap interval for the current OpenGL context.
Definition SDL3pp_video.h:4268
constexpr GLAttr GL_FRAMEBUFFER_SRGB_CAPABLE
requests sRGB capable visual; defaults to 0.
Definition SDL3pp_video.h:3440
constexpr GLAttr GL_MULTISAMPLESAMPLES
the number of samples used around the current pixel used for multisample anti-aliasing.
Definition SDL3pp_video.h:3408
constexpr SystemTheme SYSTEM_THEME_DARK
Dark colored system theme.
Definition SDL3pp_video.h:820
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:202
constexpr WindowFlags WINDOW_MOUSE_FOCUS
window has mouse focus
Definition SDL3pp_video.h:174
constexpr GLAttr GL_STENCIL_SIZE
the minimum number of bits in the stencil buffer; defaults to 0.
Definition SDL3pp_video.h:3370
Uint32 GLContextReleaseFlag
Possible values to be set for the GL_CONTEXT_RELEASE_BEHAVIOR attribute.
Definition SDL3pp_video.h:3527
constexpr WindowFlags WINDOW_TRANSPARENT
window with transparent buffer
Definition SDL3pp_video.h:224
FunctionPointer EGL_GetProcAddress(StringParam proc)
Get an EGL library function by name.
Definition SDL3pp_video.h:4008
constexpr GLProfile GL_CONTEXT_PROFILE_CORE
OpenGL Core Profile context.
Definition SDL3pp_video.h:3478
constexpr DisplayOrientation ORIENTATION_UNKNOWN
The display orientation can't be determined.
Definition SDL3pp_video.h:72
SDL_HitTest HitTest
Callback used for hit-testing.
Definition SDL3pp_video.h:330
constexpr HitTestResult HITTEST_RESIZE_TOPRIGHT
Region is the resizable top-right corner border.
Definition SDL3pp_video.h:290
constexpr GLAttr GL_CONTEXT_MAJOR_VERSION
OpenGL context major version.
Definition SDL3pp_video.h:3419
constexpr HitTestResult HITTEST_NORMAL
Region is normal. No special properties.
Definition SDL3pp_video.h:277
constexpr GLContextFlag GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
FORWARD_COMPATIBLE_FLAG.
Definition SDL3pp_video.h:3505
WindowRef GL_GetCurrentWindow()
Get the currently active OpenGL window.
Definition SDL3pp_video.h:4117
constexpr GLAttr GL_RETAINED_BACKING
not used (deprecated).
Definition SDL3pp_video.h:3416
constexpr HitTestResult HITTEST_RESIZE_RIGHT
Region is the resizable right border.
Definition SDL3pp_video.h:294
constexpr FlashOperation FLASH_BRIEFLY
Flash the window briefly to get attention.
Definition SDL3pp_video.h:250
void GL_UnloadLibrary()
Unload the OpenGL library previously loaded by GL_LoadLibrary().
Definition SDL3pp_video.h:4022
constexpr GLAttr GL_STEREO
whether the output is stereo 3D; defaults to off.
Definition SDL3pp_video.h:3396
constexpr GLAttr GL_CONTEXT_MINOR_VERSION
OpenGL context minor version.
Definition SDL3pp_video.h:3422
constexpr GLAttr GL_CONTEXT_PROFILE_MASK
type of GL context (Core, Compatibility, ES).
Definition SDL3pp_video.h:3435
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:3331
constexpr WindowFlags WINDOW_MOUSE_GRABBED
window has grabbed mouse input
Definition SDL3pp_video.h:168
bool ScreenSaverEnabled()
Check whether the screensaver is currently enabled.
Definition SDL3pp_video.h:3871
GLContextRef GL_GetCurrentContext()
Get the currently active OpenGL context.
Definition SDL3pp_video.h:4134
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:3337
FunctionPointer GL_GetProcAddress(StringParam proc)
Get an OpenGL function by name.
Definition SDL3pp_video.h:3986
SDL_EGLAttribArrayCallback EGLAttribArrayCallback
EGL platform attribute initialization callback.
Definition SDL3pp_video.h:3214
constexpr GLAttr GL_CONTEXT_RESET_NOTIFICATION
set context reset notification.
Definition SDL3pp_video.h:3454
constexpr GLProfile GL_CONTEXT_PROFILE_COMPATIBILITY
OpenGL Compatibility Profile context.
Definition SDL3pp_video.h:3481
SDL_DisplayMode DisplayMode
The structure that defines a display mode.
Definition SDL3pp_video.h:119
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:4205
SDL_HitTestResult HitTestResult
Possible return values from the HitTest callback.
Definition SDL3pp_video.h:275
constexpr WindowFlags WINDOW_METAL
window usable for Metal view
Definition SDL3pp_video.h:221
constexpr WindowFlags WINDOW_MINIMIZED
window is minimized
Definition SDL3pp_video.h:162
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:3394
constexpr DisplayOrientation ORIENTATION_PORTRAIT
The display is in portrait mode.
Definition SDL3pp_video.h:88
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:3376
SDL_SystemTheme SystemTheme
System theme.
Definition SDL3pp_video.h:812
constexpr WindowFlags WINDOW_HIGH_PIXEL_DENSITY
window uses high pixel density back buffer if possible
Definition SDL3pp_video.h:185
constexpr GLAttr GL_CONTEXT_FLAGS
some combination of 0 or more of elements of the GLContextFlag enumeration; defaults to 0.
Definition SDL3pp_video.h:3429
constexpr GLProfile GL_CONTEXT_PROFILE_ES
GLX_CONTEXT_ES2_PROFILE_BIT_EXT.
Definition SDL3pp_video.h:3485
constexpr GLAttr GL_DOUBLEBUFFER
whether the output is single or double buffered; defaults to double buffering on.
Definition SDL3pp_video.h:3360
SDL_DisplayModeData DisplayModeData
Internal display mode data.
Definition SDL3pp_video.h:106
constexpr HitTestResult HITTEST_RESIZE_LEFT
Region is the resizable left border.
Definition SDL3pp_video.h:310
void GL_GetAttribute(GLAttr attr, int *value)
Get the actual value for an attribute from the current context.
Definition SDL3pp_video.h:4102
void GL_SetAttribute(GLAttr attr, int value)
Set an OpenGL window attribute before window creation.
Definition SDL3pp_video.h:4082
const char * GetCurrentVideoDriver()
Get the name of the currently initialized video driver.
Definition SDL3pp_video.h:3611
constexpr GLAttr GL_MULTISAMPLEBUFFERS
the number of buffers used for multisample anti-aliasing; defaults to 0.
Definition SDL3pp_video.h:3402
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:3349
constexpr WindowFlags WINDOW_MODAL
window is modal
Definition SDL3pp_video.h:180
int GetNumVideoDrivers()
Get the number of video drivers compiled into SDL.
Definition SDL3pp_video.h:3568
bool GL_ExtensionSupported(StringParam extension)
Check if an OpenGL extension is supported for the current context.
Definition SDL3pp_video.h:4045
constexpr WindowFlags WINDOW_INPUT_FOCUS
window has input focus
Definition SDL3pp_video.h:171
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:3382
constexpr GLContextFlag GL_CONTEXT_DEBUG_FLAG
DEBUG_FLAG.
Definition SDL3pp_video.h:3502
Uint32 GLContextFlag
Possible flags to be set for the GL_CONTEXT_FLAGS attribute.
Definition SDL3pp_video.h:3500
SDL_WindowID WindowID
This is a unique ID for a window.
Definition SDL3pp_video.h:780
static WindowRef FromID(WindowID id)
Get a window from a stored ID.
Definition SDL3pp_video.h:3833
constexpr HitTestResult HITTEST_RESIZE_TOP
Region is the resizable top border.
Definition SDL3pp_video.h:287
const char * GetVideoDriver(int index)
Get the name of a built in video driver.
Definition SDL3pp_video.h:3589
SDL_EGLSurface EGLSurface
Opaque type for an EGL surface.
Definition SDL3pp_video.h:3175
SDL_FlashOperation FlashOperation
Window flash operation.
Definition SDL3pp_video.h:245
constexpr WindowFlags WINDOW_VULKAN
window usable for Vulkan surface
Definition SDL3pp_video.h:218
constexpr HitTestResult HITTEST_RESIZE_TOPLEFT
Region is the resizable top-left corner border.
Definition SDL3pp_video.h:283
constexpr HitTestResult HITTEST_RESIZE_BOTTOMRIGHT
Region is the resizable bottom-right corner border.
Definition SDL3pp_video.h:300
SDL_EGLConfig EGLConfig
Opaque type for an EGL config.
Definition SDL3pp_video.h:3168
constexpr SystemTheme SYSTEM_THEME_UNKNOWN
Unknown system theme.
Definition SDL3pp_video.h:814
constexpr WindowFlags WINDOW_KEYBOARD_GRABBED
window has grabbed keyboard input
Definition SDL3pp_video.h:215
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:3343
constexpr GLAttr GL_EGL_PLATFORM
GL_EGL_PLATFORM.
Definition SDL3pp_video.h:3462
WindowRef GetParent() const
Get parent of a window.
Definition SDL3pp_video.h:3838
constexpr WindowFlags WINDOW_BORDERLESS
no window decoration
Definition SDL3pp_video.h:156
SDL_EGLDisplay EGLDisplay
Opaque type for an EGL display.
Definition SDL3pp_video.h:3161
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:208
constexpr WindowFlags WINDOW_MOUSE_CAPTURE
window has mouse captured (unrelated to MOUSE_GRABBED)
Definition SDL3pp_video.h:190
constexpr GLAttr GL_BUFFER_SIZE
the minimum number of bits for frame buffer size; defaults to 0.
Definition SDL3pp_video.h:3354
constexpr DisplayOrientation ORIENTATION_LANDSCAPE
The display is in landscape mode, with the right side up, relative to portrait mode.
Definition SDL3pp_video.h:79
constexpr DisplayOrientation ORIENTATION_PORTRAIT_FLIPPED
The display is in portrait mode, upside down.
Definition SDL3pp_video.h:91
constexpr WindowFlags WINDOW_OPENGL
window usable with OpenGL context
Definition SDL3pp_video.h:143
constexpr GLAttr GL_CONTEXT_NO_ERROR
GL_CONTEXT_NO_ERROR.
Definition SDL3pp_video.h:3457
SDL_EGLint EGLint
An EGL integer attribute, used when creating an EGL surface.
Definition SDL3pp_video.h:3189
constexpr GLContextFlag GL_CONTEXT_ROBUST_ACCESS_FLAG
ROBUST_ACCESS_FLAG.
Definition SDL3pp_video.h:3508
constexpr DisplayOrientation ORIENTATION_LANDSCAPE_FLIPPED
The display is in landscape mode, with the left side up, relative to portrait mode.
Definition SDL3pp_video.h:85
constexpr WindowFlags WINDOW_MOUSE_RELATIVE_MODE
window has relative mode enabled
Definition SDL3pp_video.h:192
std::function< HitTestResult(WindowRef window, const Point &area)> HitTestCB
Callback used for hit-testing.
Definition SDL3pp_video.h:344
constexpr WindowFlags WINDOW_OCCLUDED
window is occluded
Definition SDL3pp_video.h:146
constexpr FlashOperation FLASH_UNTIL_FOCUSED
Flash the window until it gets focus.
Definition SDL3pp_video.h:253
Uint32 GLProfile
Possible values to be set for the GL_CONTEXT_PROFILE_MASK attribute.
Definition SDL3pp_video.h:3476
EGLSurface EGL_GetWindowSurface(WindowBase &window)
Get the EGL surface associated with the window.
Definition SDL3pp_video.h:4180
SystemTheme GetSystemTheme()
Get the current system theme.
Definition SDL3pp_video.h:3625
constexpr WindowFlags WINDOW_NOT_FOCUSABLE
window should not be focusable
Definition SDL3pp_video.h:227
constexpr GLContextResetNotification GL_CONTEXT_RESET_NO_NOTIFICATION
NO_NOTIFICATION.
Definition SDL3pp_video.h:3549
constexpr GLAttr GL_FLOATBUFFERS
GL_FLOATBUFFERS.
Definition SDL3pp_video.h:3460
constexpr WindowFlags WINDOW_RESIZABLE
window can be resized
Definition SDL3pp_video.h:159
OwnArray< WindowRef > GetWindows()
Get a list of valid windows.
Definition SDL3pp_video.h:3646
constexpr WindowFlags WINDOW_POPUP_MENU
window should be treated as a popup menu, requires a parent window
Definition SDL3pp_video.h:213
constexpr GLContextResetNotification GL_CONTEXT_RESET_LOSE_CONTEXT
LOSE_CONTEXT.
Definition SDL3pp_video.h:3552
void GL_ResetAttributes()
Reset all previously set OpenGL context attributes to their default values.
Definition SDL3pp_video.h:4060
Uint32 GLContextResetNotification
Possible values to be set GL_CONTEXT_RESET_NOTIFICATION attribute.
Definition SDL3pp_video.h:3547
constexpr WindowFlags WINDOW_EXTERNAL
window not created by SDL
Definition SDL3pp_video.h:177
constexpr WindowFlags WINDOW_ALWAYS_ON_TOP
window should always be above others
Definition SDL3pp_video.h:195
std::function< SDL_EGLAttrib *()> EGLAttribArrayCB
EGL platform attribute initialization callback.
Definition SDL3pp_video.h:3239
static WindowRef GetGrabbed()
Get the window that currently has an input grab enabled.
Definition SDL3pp_video.h:3853
constexpr WindowFlags WINDOW_HIDDEN
window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; WindowBase....
Definition SDL3pp_video.h:154
constexpr GLAttr GL_SHARE_WITH_CURRENT_CONTEXT
OpenGL context sharing; defaults to 0.
Definition SDL3pp_video.h:3437
EGLConfig EGL_GetCurrentConfig()
Get the currently active EGL config.
Definition SDL3pp_video.h:4164
constexpr HitTestResult HITTEST_RESIZE_BOTTOM
Region is the resizable bottom border.
Definition SDL3pp_video.h:303
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:3388
constexpr WindowFlags WINDOW_FULLSCREEN
window is in fullscreen mode
Definition SDL3pp_video.h:140
constexpr GLContextReleaseFlag GL_CONTEXT_RELEASE_BEHAVIOR_NONE
BEHAVIOR_NONE.
Definition SDL3pp_video.h:3529
void GL_SwapWindow(WindowBase &window)
Update a window with OpenGL rendering.
Definition SDL3pp_video.h:4290
SDL_EGLAttrib EGLAttrib
An EGL attribute, used when creating an EGL context.
Definition SDL3pp_video.h:3182
void GL_LoadLibrary(StringParam path)
Dynamically load an OpenGL library.
Definition SDL3pp_video.h:3928
constexpr GLAttr GL_DEPTH_SIZE
the minimum number of bits in the depth buffer; defaults to 16.
Definition SDL3pp_video.h:3365
std::function< SDL_EGLint *(SDL_EGLDisplay, SDL_EGLConfig)> EGLIntArrayCB
EGL surface/context attribute initialization callback types.
Definition SDL3pp_video.h:3301
EGLDisplay EGL_GetCurrentDisplay()
Get the currently active EGL display.
Definition SDL3pp_video.h:4149
constexpr GLContextReleaseFlag GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH
BEHAVIOR_FLUSH.
Definition SDL3pp_video.h:3532
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:3414
SDL_EGLIntArrayCallback EGLIntArrayCallback
EGL surface/context attribute initialization callback types.
Definition SDL3pp_video.h:3270
the main namespace where all SDL3pp public functions and types live
Definition SDL3pp_assert.h:7
An opaque handle to an OpenGL context.
Definition SDL3pp_video.h:3004
GLContextBase(WindowBase &window)
Create an OpenGL context for an OpenGL window, and make it current.
Definition SDL3pp_video.h:3029
void MakeCurrent(WindowBase &window)
Set up an OpenGL context for rendering into an OpenGL window.
Definition SDL3pp_video.h:3048
Handle to a non owned gLContext.
Definition SDL3pp_video.h:3063
bool reset(SDL_GLContextState *newResource={})
Delete an OpenGL context.
Definition SDL3pp_video.h:3108
constexpr ~GLContextRef()=default
Default constructor.
constexpr GLContextRef(const GLContextRef &other)
Copy constructor.
Definition SDL3pp_video.h:3069
GLContextRef & operator=(GLContextRef other)
Assignment operator.
Definition SDL3pp_video.h:3090
constexpr GLContextRef(GLContextRef &&other)
Move constructor.
Definition SDL3pp_video.h:3077
Handle to an owned gLContext.
Definition SDL3pp_video.h:3123
constexpr GLContext(GLContext &&other)=default
Move constructor.
~GLContext()
Frees up resource when object goes out of scope.
Definition SDL3pp_video.h:3144
constexpr GLContext(SDL_GLContextState *resource={})
Constructs from the underlying resource.
Definition SDL3pp_video.h:3129
GLContext & operator=(GLContext other)
Assignment operator.
Definition SDL3pp_video.h:3149
Store callbacks by key.
Definition SDL3pp_callbackWrapper.h:222
The structure that defines a point (using integers)
Definition SDL3pp_rect.h:41
Wrap properties id.
Definition SDL3pp_properties.h:203
Handle to a non owned properties.
Definition SDL3pp_properties.h:693
A rectangle, with the origin at the upper left (using integers).
Definition SDL3pp_rect.h:817
constexpr Point GetTopLeft() const
Get top left corner of the rect.
Definition SDL3pp_rect.h:1084
constexpr Point GetSize() const
Get size of the rect.
Definition SDL3pp_rect.h:1116
Handle to a non owned renderer.
Definition SDL3pp_render.h:1886
A collection of pixels used in software blitting.
Definition SDL3pp_surface.h:138
Handle to a non owned surface.
Definition SDL3pp_surface.h:1814
Represents a handle to a window.
Definition SDL3pp_video.h:838
void SetSurfaceVSync(int vsync)
Toggle VSync for the window surface.
Definition SDL3pp_video.h:2273
void Maximize()
Request that the window be made as large as possible.
Definition SDL3pp_video.h:2091
OwnPtr< void > GetICCProfile(size_t *size) const
Get the raw ICC profile data for the screen the window is currently on.
Definition SDL3pp_video.h:1250
void SetKeyboardGrab(bool grabbed)
Set a window's keyboard grab mode.
Definition SDL3pp_video.h:2389
float GetPixelDensity() const
Get the pixel density of a window.
Definition SDL3pp_video.h:1160
void SetResizable(bool resizable)
Set the user-resizable state of a window.
Definition SDL3pp_video.h:1990
void SetMouseGrab(bool grabbed)
Set a window's mouse grab mode.
Definition SDL3pp_video.h:2411
void SetFocusable(bool focusable)
Set whether the window may have input focus.
Definition SDL3pp_video.h:2583
void SetModal(bool modal)
Toggle the state of the window as modal.
Definition SDL3pp_video.h:2571
void Sync()
Block until any pending window state is finalized.
Definition SDL3pp_video.h:2207
void SetPosition(SDL_Point p)
Request that the window's position be set.
Definition SDL3pp_video.h:1569
const char * GetTitle() const
Get the title of a window.
Definition SDL3pp_video.h:1475
Rect GetSafeArea() const
Get the safe area for this window.
Definition SDL3pp_video.h:1724
void GetPosition(int *x, int *y) const
Get the position of a window.
Definition SDL3pp_video.h:1618
PropertiesRef GetProperties() const
Get the properties associated with a window.
Definition SDL3pp_video.h:1420
float GetOpacity() const
Get the opacity of a window.
Definition SDL3pp_video.h:2521
Display GetDisplay() const
Get the display associated with a window.
Definition SDL3pp_video.h:1142
int GetSurfaceVSync() const
Get VSync for the window surface.
Definition SDL3pp_video.h:2290
void SetIcon(SurfaceBase &icon)
Set the icon for a window.
Definition SDL3pp_video.h:1497
void SetMouseRect(const SDL_Rect &rect)
Confines the cursor to the specified area of a window.
Definition SDL3pp_video.h:2463
void SetShape(SurfaceBase &shape)
Set the shape of a transparent window.
Definition SDL3pp_video.h:2724
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:1768
void Raise()
Request that a window be raised above other windows and gain the input focus.
Definition SDL3pp_video.h:2059
void SetMaximumSize(SDL_Point p)
Set the maximum size of a window's client area.
Definition SDL3pp_video.h:1923
void SetFullscreenMode(OptionalRef< const DisplayMode > mode)
Set the display mode to use when a window is visible and fullscreen.
Definition SDL3pp_video.h:1216
void Show()
Show a window.
Definition SDL3pp_video.h:2027
void SetMinimumSize(SDL_Point p)
Set the minimum size of a window's client area.
Definition SDL3pp_video.h:1884
const DisplayMode * GetFullscreenMode() const
Query the display mode to use when a window is visible at fullscreen.
Definition SDL3pp_video.h:1234
void Restore()
Request that the size and position of a minimized or maximized window be restored.
Definition SDL3pp_video.h:2146
void SetHitTest(HitTestCB callback)
Provide a callback that decides if a window region has special properties.
Definition SDL3pp_video.h:4299
WindowBase(PropertiesBase &props)
Create a window with the specified properties.
Definition SDL3pp_video.h:1123
void ShowSystemMenu(SDL_Point p)
Display the system-level window menu.
Definition SDL3pp_video.h:2607
void GetMaximumSize(int *w, int *h) const
Get the maximum size of a window's client area.
Definition SDL3pp_video.h:1944
void Hide()
Hide a window.
Definition SDL3pp_video.h:2041
Point GetPosition() const
Get the position of a window.
Definition SDL3pp_video.h:1590
bool GetMouseGrab() const
Get a window's mouse grab mode.
Definition SDL3pp_video.h:2443
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:1825
Point GetSizeInPixels() const
Get the size of a window's client area, in pixels.
Definition SDL3pp_video.h:1843
SurfaceRef GetSurface()
Get the SDL surface associated with the window.
Definition SDL3pp_video.h:2249
void GetSize(int *w, int *h) const
Get the size of a window's client area.
Definition SDL3pp_video.h:1702
void UpdateSurface()
Copy the window surface to the screen.
Definition SDL3pp_video.h:2314
WindowBase(StringParam title, SDL_Point size, WindowFlags flags=0)
Create a window with the specified dimensions and flags.
Definition SDL3pp_video.h:926
void GetAspectRatio(float *min_aspect, float *max_aspect) const
Get the size of a window's client area.
Definition SDL3pp_video.h:1788
const SDL_Rect * GetMouseRect() const
Get the mouse confinement rectangle of a window.
Definition SDL3pp_video.h:2482
void SetFullscreen(bool fullscreen)
Request that the window's fullscreen state be changed.
Definition SDL3pp_video.h:2176
void DestroySurface()
Destroy the surface associated with the window.
Definition SDL3pp_video.h:2358
void UpdateSurfaceRects(SpanRef< const SDL_Rect > rects)
Copy areas of the window surface to the screen.
Definition SDL3pp_video.h:2340
PixelFormat GetPixelFormat() const
Get the pixel format associated with the window.
Definition SDL3pp_video.h:1265
void SetAlwaysOnTop(bool on_top)
Set the window to always be above the others.
Definition SDL3pp_video.h:2010
void SetRect(Rect rect)
Request the window's position and size to be set.
Definition SDL3pp_video.h:1513
void SetHitTest(HitTest callback, void *callback_data)
Provide a callback that decides if a window region has special properties.
Definition SDL3pp_video.h:2695
void GetMinimumSize(int *w, int *h) const
Get the minimum size of a window's client area.
Definition SDL3pp_video.h:1905
WindowFlags GetFlags() const
Get the window flags.
Definition SDL3pp_video.h:1442
void SetBordered(bool bordered)
Set the border state of a window.
Definition SDL3pp_video.h:1967
float GetDisplayScale() const
Get the content display scale relative to a window's pixel size.
Definition SDL3pp_video.h:1183
void GetSizeInPixels(int *w, int *h) const
Get the size of a window's client area, in pixels.
Definition SDL3pp_video.h:1866
WindowID GetID() const
Get the numeric ID of a window.
Definition SDL3pp_video.h:1285
void Minimize()
Request that the window be minimized to an iconic representation.
Definition SDL3pp_video.h:2118
void SetTitle(StringParam title)
Set the title of a window.
Definition SDL3pp_video.h:1458
Point GetSize() const
Get the size of a window's client area.
Definition SDL3pp_video.h:1676
bool GetKeyboardGrab() const
Get a window's keyboard grab mode.
Definition SDL3pp_video.h:2427
void SetOpacity(float opacity)
Set the opacity for a window.
Definition SDL3pp_video.h:2501
WindowBase(WindowBase &parent, SDL_Point offset, SDL_Point size, WindowFlags flags=0)
Create a child popup window of the specified parent window.
Definition SDL3pp_video.h:989
void Flash(FlashOperation operation)
Request a window to demand attention from the user.
Definition SDL3pp_video.h:2739
void SetSize(SDL_Point p)
Request that the size of a window's client area be set.
Definition SDL3pp_video.h:1655
void SetParent(OptionalWindow parent)
Set the window as a child of a parent window.
Rect GetRect() const
Get the position and client size of a window.
Definition SDL3pp_video.h:1532
bool HasSurface() const
Return whether the window has a surface associated with it.
Definition SDL3pp_video.h:2221
Handle to a non owned window.
Definition SDL3pp_video.h:2778
constexpr WindowRef(const WindowRef &other)
Copy constructor.
Definition SDL3pp_video.h:2784
constexpr ~WindowRef()=default
Default constructor.
constexpr WindowRef(WindowRef &&other)
Move constructor.
Definition SDL3pp_video.h:2792
WindowRef & operator=(WindowRef other)
Assignment operator.
Definition SDL3pp_video.h:2805
void reset(SDL_Window *newResource={})
Destroy a window.
Definition SDL3pp_video.h:2825
Handle to an owned window.
Definition SDL3pp_video.h:2872
Window & operator=(Window other)
Assignment operator.
Definition SDL3pp_video.h:2898
constexpr Window(SDL_Window *resource={})
Constructs from the underlying resource.
Definition SDL3pp_video.h:2878
~Window()
Frees up resource when object goes out of scope.
Definition SDL3pp_video.h:2893
constexpr Window(Window &&other)=default
Move constructor.