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 {
43// Forward decl
44struct WindowRef;
45
46// Forward decl
47struct Window;
48
49// Forward decl
50struct RendererRef;
51
65using DisplayOrientation = SDL_DisplayOrientation;
66
68 SDL_ORIENTATION_UNKNOWN;
69
74constexpr DisplayOrientation ORIENTATION_LANDSCAPE = SDL_ORIENTATION_LANDSCAPE;
75
81 SDL_ORIENTATION_LANDSCAPE_FLIPPED;
82
84 SDL_ORIENTATION_PORTRAIT;
85
87 SDL_ORIENTATION_PORTRAIT_FLIPPED;
89
91
101using DisplayModeData = SDL_DisplayModeData;
102
114using DisplayMode = SDL_DisplayMode;
115
133using WindowFlags = SDL_WindowFlags;
134
136 SDL_WINDOW_FULLSCREEN;
137
139 SDL_WINDOW_OPENGL;
140
142 SDL_WINDOW_OCCLUDED;
143
149constexpr WindowFlags WINDOW_HIDDEN = SDL_WINDOW_HIDDEN;
150
152 SDL_WINDOW_BORDERLESS;
153
155 SDL_WINDOW_RESIZABLE;
156
158 SDL_WINDOW_MINIMIZED;
159
161 SDL_WINDOW_MAXIMIZED;
162
164 SDL_WINDOW_MOUSE_GRABBED;
165
167 SDL_WINDOW_INPUT_FOCUS;
168
170 SDL_WINDOW_MOUSE_FOCUS;
171
173 SDL_WINDOW_EXTERNAL;
174
175constexpr WindowFlags WINDOW_MODAL = SDL_WINDOW_MODAL;
176
180constexpr WindowFlags WINDOW_HIGH_PIXEL_DENSITY = SDL_WINDOW_HIGH_PIXEL_DENSITY;
181
185constexpr WindowFlags WINDOW_MOUSE_CAPTURE = SDL_WINDOW_MOUSE_CAPTURE;
186
188 SDL_WINDOW_MOUSE_RELATIVE_MODE;
189
191 SDL_WINDOW_ALWAYS_ON_TOP;
192
197constexpr WindowFlags WINDOW_UTILITY = SDL_WINDOW_UTILITY;
198
203constexpr WindowFlags WINDOW_TOOLTIP = SDL_WINDOW_TOOLTIP;
204
208constexpr WindowFlags WINDOW_POPUP_MENU = SDL_WINDOW_POPUP_MENU;
209
211 SDL_WINDOW_KEYBOARD_GRABBED;
212
214 SDL_WINDOW_VULKAN;
215
217 SDL_WINDOW_METAL;
218
220 SDL_WINDOW_TRANSPARENT;
221
223 SDL_WINDOW_NOT_FOCUSABLE;
224
226
240using FlashOperation = SDL_FlashOperation;
241
243 SDL_FLASH_CANCEL;
244
246 SDL_FLASH_BRIEFLY;
247
249 SDL_FLASH_UNTIL_FOCUSED;
250
252
270using HitTestResult = SDL_HitTestResult;
271
273 SDL_HITTEST_NORMAL;
274
276 SDL_HITTEST_DRAGGABLE;
277
279 SDL_HITTEST_RESIZE_TOPLEFT;
281
283 SDL_HITTEST_RESIZE_TOP;
284
286 SDL_HITTEST_RESIZE_TOPRIGHT;
288
290 SDL_HITTEST_RESIZE_RIGHT;
291
296 SDL_HITTEST_RESIZE_BOTTOMRIGHT;
297
299 SDL_HITTEST_RESIZE_BOTTOM;
300
302 SDL_HITTEST_RESIZE_BOTTOMLEFT;
304
306 SDL_HITTEST_RESIZE_LEFT;
307
309
325using HitTest = SDL_HitTest;
326
339 std::function<HitTestResult(WindowRef window, const Point& area)>;
340
350
360
362
363// Forward decl
364struct GLContextRef;
365
366// Forward decl
367struct GLContext;
368
378
388
400{
401 SDL_DisplayID m_displayID;
402
403public:
409 constexpr Display(SDL_DisplayID displayID = {})
410 : m_displayID(displayID)
411 {
412 }
413
417 constexpr bool operator==(const Display& other) const = default;
418
422 constexpr bool operator==(SDL_DisplayID displayID) const
423 {
424 return operator==(Display(displayID));
425 }
426
432 constexpr operator SDL_DisplayID() const { return m_displayID; }
433
439 constexpr explicit operator bool() const { return m_displayID != 0; }
440
453 {
454 int count = 0;
455 auto data = reinterpret_cast<Display*>(SDL_GetDisplays(&count));
456 return OwnArray<Display>{data, size_t(count)};
457 }
458
471 static Display GetPrimary() { return CheckError(SDL_GetPrimaryDisplay()); }
472
499 {
500 return CheckError(SDL_GetDisplayProperties(m_displayID));
501 }
502
515 const char* GetName() const { return SDL_GetDisplayName(m_displayID); }
516
534 {
535 Rect bounds;
536 SDL_GetDisplayBounds(m_displayID, &bounds);
537 return bounds;
538 }
539
563 {
564 Rect bounds;
565 CheckError(SDL_GetDisplayUsableBounds(m_displayID, &bounds));
566 return bounds;
567 }
568
582 {
583 return SDL_GetNaturalDisplayOrientation(m_displayID);
584 }
585
599 {
600 return SDL_GetCurrentDisplayOrientation(m_displayID);
601 }
602
627 float GetContentScale() const
628 {
629 return SDL_GetDisplayContentScale(m_displayID);
630 }
631
656 {
657 int count = 0;
658 auto data = CheckError(SDL_GetFullscreenDisplayModes(m_displayID, &count));
659 return OwnArray<DisplayMode*>{data, size_t(count)};
660 }
661
690 int h,
691 float refresh_rate,
692 bool include_high_density_modes) const
693 {
694 SDL_DisplayMode closest;
695 CheckError(SDL_GetClosestFullscreenDisplayMode(
696 m_displayID, w, h, refresh_rate, include_high_density_modes, &closest));
697 return closest;
698 }
699
719 {
720 return CheckError(SDL_GetDesktopDisplayMode(m_displayID));
721 }
722
742 {
743 return SDL_GetCurrentDisplayMode(m_displayID);
744 }
745
760 static Display GetForPoint(const SDL_Point& point)
761 {
762 return {SDL_GetDisplayForPoint(&point)};
763 }
764
780 static Display GetForRect(const SDL_Rect& rect)
781 {
782 return SDL_GetDisplayForRect(&rect);
783 }
784
795};
796
804using WindowID = SDL_WindowID;
805
806namespace prop::Global {
807
821constexpr auto VIDEO_WAYLAND_WL_DISPLAY_POINTER =
822 SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER;
823
824} // namespace prop::Global
825
836using SystemTheme = SDL_SystemTheme;
837
839 SDL_SYSTEM_THEME_UNKNOWN;
840
842 SDL_SYSTEM_THEME_LIGHT;
843
845 SDL_SYSTEM_THEME_DARK;
846
848
859struct WindowRef : Resource<SDL_Window*>
860{
861 using Resource::Resource;
862
877 Display GetDisplay() const { return SDL_GetDisplayForWindow(get()); }
878
895 float GetPixelDensity() const { return SDL_GetWindowPixelDensity(get()); }
896
918 float GetDisplayScale() const { return SDL_GetWindowDisplayScale(get()); }
919
952 {
953 CheckError(SDL_SetWindowFullscreenMode(get(), mode));
954 }
955
970 {
971 return SDL_GetWindowFullscreenMode(get());
972 }
973
985 OwnPtr<void> GetICCProfile(size_t* size) const
986 {
987 return OwnPtr<void>{CheckError(SDL_GetWindowICCProfile(get(), size))};
988 }
989
1001 {
1002 return CheckError(SDL_GetWindowPixelFormat(get()));
1003 }
1004
1020 WindowID GetID() const { return CheckError(SDL_GetWindowID(get())); }
1021
1034 WindowRef GetParent() const { return SDL_GetWindowParent(get()); }
1035
1156 {
1157 return CheckError(SDL_GetWindowProperties(get()));
1158 }
1159
1177 WindowFlags GetFlags() const { return SDL_GetWindowFlags(get()); }
1178
1194 {
1195 CheckError(SDL_SetWindowTitle(get(), title));
1196 }
1197
1210 const char* GetTitle() const { return SDL_GetWindowTitle(get()); }
1211
1233 {
1234 CheckError(SDL_SetWindowIcon(get(), icon.get()));
1235 }
1236
1248 void SetRect(Rect rect)
1249 {
1250 SetPosition(rect.GetTopLeft());
1251 SetSize(rect.GetSize());
1252 }
1253
1267 Rect GetRect() const { return Rect{GetPosition(), GetSize()}; }
1268
1304 void SetPosition(const SDL_Point& p)
1305 {
1306 CheckError(SDL_SetWindowPosition(get(), p.x, p.y));
1307 }
1308
1326 {
1327 Point p;
1328 GetPosition(&p.x, &p.y);
1329 return p;
1330 }
1331
1353 void GetPosition(int* x, int* y) const
1354 {
1355 CheckError(SDL_GetWindowPosition(get(), x, y));
1356 }
1357
1390 void SetSize(const SDL_Point& p)
1391 {
1392 CheckError(SDL_SetWindowSize(get(), p.x, p.y));
1393 }
1394
1415 {
1416 Point p;
1417 GetSize(&p.x, &p.y);
1418 return p;
1419 }
1420
1440 void GetSize(int* w, int* h) const
1441 {
1442 CheckError(SDL_GetWindowSize(get(), w, h));
1443 }
1444
1463 {
1464 Rect rect;
1465 CheckError(SDL_GetWindowSafeArea(get(), &rect));
1466 return rect;
1467 }
1468
1506 void SetAspectRatio(float min_aspect, float max_aspect)
1507 {
1508 CheckError(SDL_SetWindowAspectRatio(get(), min_aspect, max_aspect));
1509 }
1510
1526 void GetAspectRatio(float* min_aspect, float* max_aspect) const
1527 {
1528 CheckError(SDL_GetWindowAspectRatio(get(), min_aspect, max_aspect));
1529 }
1530
1563 void GetBordersSize(int* top, int* left, int* bottom, int* right) const
1564 {
1565 CheckError(SDL_GetWindowBordersSize(get(), top, left, bottom, right));
1566 }
1567
1582 {
1583 Point p;
1584 GetSizeInPixels(&p.x, &p.y);
1585 return p;
1586 }
1587
1604 void GetSizeInPixels(int* w, int* h) const
1605 {
1606 CheckError(SDL_GetWindowSizeInPixels(get(), w, h));
1607 }
1608
1622 void SetMinimumSize(const SDL_Point& p)
1623 {
1624 CheckError(SDL_SetWindowMinimumSize(get(), p.x, p.y));
1625 }
1626
1643 void GetMinimumSize(int* w, int* h) const
1644 {
1645 CheckError(SDL_GetWindowMinimumSize(get(), w, h));
1646 }
1647
1661 void SetMaximumSize(const SDL_Point& p)
1662 {
1663 CheckError(SDL_SetWindowMaximumSize(get(), p.x, p.y));
1664 }
1665
1682 void GetMaximumSize(int* w, int* h) const
1683 {
1684 CheckError(SDL_GetWindowMaximumSize(get(), w, h));
1685 }
1686
1705 void SetBordered(bool bordered)
1706 {
1707 CheckError(SDL_SetWindowBordered(get(), bordered));
1708 }
1709
1728 void SetResizable(bool resizable)
1729 {
1730 CheckError(SDL_SetWindowResizable(get(), resizable));
1731 }
1732
1748 void SetAlwaysOnTop(bool on_top)
1749 {
1750 CheckError(SDL_SetWindowAlwaysOnTop(get(), on_top));
1751 }
1752
1765 void Show() { CheckError(SDL_ShowWindow(get())); }
1766
1779 void Hide() { CheckError(SDL_HideWindow(get())); }
1780
1797 void Raise() { CheckError(SDL_RaiseWindow(get())); }
1798
1829 void Maximize() { CheckError(SDL_MaximizeWindow(get())); }
1830
1856 void Minimize() { CheckError(SDL_MinimizeWindow(get())); }
1857
1884 void Restore() { CheckError(SDL_RestoreWindow(get())); }
1885
1914 void SetFullscreen(bool fullscreen)
1915 {
1916 CheckError(SDL_SetWindowFullscreen(get(), fullscreen));
1917 }
1918
1945 void Sync() { CheckError(SDL_SyncWindow(get())); }
1946
1959 bool HasSurface() const { return SDL_WindowHasSurface(get()); }
1960
1987 SurfaceRef GetSurface() { return SDL_GetWindowSurface(get()); }
1988
2011 void SetSurfaceVSync(int vsync)
2012 {
2013 CheckError(SDL_SetWindowSurfaceVSync(get(), vsync));
2014 }
2015
2029 {
2030 int vsync;
2031 CheckError(SDL_GetWindowSurfaceVSync(get(), &vsync));
2032 return vsync;
2033 }
2034
2052 void UpdateSurface() { CheckError(SDL_UpdateWindowSurface(get())); }
2053
2079 {
2080 SDL_assert_paranoid(rects.size() < SDL_MAX_SINT32);
2081 CheckError(SDL_UpdateWindowSurfaceRects(get(), rects.data(), rects.size()));
2082 }
2083
2096 void DestroySurface() { CheckError(SDL_DestroyWindowSurface(get())); }
2097
2127 void SetKeyboardGrab(bool grabbed)
2128 {
2129 CheckError(SDL_SetWindowKeyboardGrab(get(), grabbed));
2130 }
2131
2149 void SetMouseGrab(bool grabbed)
2150 {
2151 CheckError(SDL_SetWindowMouseGrab(get(), grabbed));
2152 }
2153
2165 bool GetKeyboardGrab() const { return SDL_GetWindowKeyboardGrab(get()); }
2166
2181 bool GetMouseGrab() const { return SDL_GetWindowMouseGrab(get()); }
2182
2201 void SetMouseRect(const SDL_Rect& rect)
2202 {
2203 CheckError(SDL_SetWindowMouseRect(get(), &rect));
2204 }
2205
2220 const SDL_Rect* GetMouseRect() const { return SDL_GetWindowMouseRect(get()); }
2221
2239 void SetOpacity(float opacity)
2240 {
2241 CheckError(SDL_SetWindowOpacity(get(), opacity));
2242 }
2243
2259 float GetOpacity() const { return SDL_GetWindowOpacity(get()); }
2260
2292 {
2293 CheckError(SDL_SetWindowParent(get(), parent.get()));
2294 }
2295
2312 void SetModal(bool modal) { CheckError(SDL_SetWindowModal(get(), modal)); }
2313
2324 void SetFocusable(bool focusable)
2325 {
2326 CheckError(SDL_SetWindowFocusable(get(), focusable));
2327 }
2328
2348 void ShowSystemMenu(const SDL_Point& p)
2349 {
2350 CheckError(SDL_ShowWindowSystemMenu(get(), p.x, p.y));
2351 }
2352
2394 void SetHitTest(HitTestCB callback);
2395
2436 void SetHitTest(HitTest callback, void* callback_data)
2437 {
2438 CheckError(SDL_SetWindowHitTest(get(), callback, callback_data));
2439 }
2440
2466 {
2467 CheckError(SDL_SetWindowShape(get(), shape.get()));
2468 }
2469
2480 void Flash(FlashOperation operation)
2481 {
2482 CheckError(SDL_FlashWindow(get(), operation));
2483 }
2484
2501 static WindowRef FromID(WindowID id) { return SDL_GetWindowFromID(id); }
2502
2515 static WindowRef GetGrabbed() { return SDL_GetGrabbedWindow(); }
2516
2537 static void reset(SDL_Window* resource) { SDL_DestroyWindow(resource); }
2538
2539 RendererRef GetRenderer() const;
2540
2541 void StartTextInput();
2542
2543 void StartTextInput(PropertiesRef props);
2544
2545 bool IsTextInputActive() const;
2546
2547 void StopTextInput();
2548
2549 void ClearComposition();
2550
2551 void SetTextInputArea(const SDL_Rect& rect, int cursor);
2552
2553 void GetTextInputArea(Rect* rect, int* cursor);
2554
2555 bool IsScreenKeyboardShown() const;
2556
2557 void WarpMouse(float x, float y);
2558
2559 void SetRelativeMouseMode(bool enabled);
2560
2561 bool GetRelativeMouseMode() const;
2562};
2563
2571struct Window : ResourceUnique<WindowRef>
2572{
2574
2663 const SDL_Point& size,
2664 WindowFlags flags = 0)
2665 {
2666 return Window(CheckError(SDL_CreateWindow(title, size.x, size.y, flags)));
2667 }
2668
2731 const SDL_Point& offset,
2732 const SDL_Point& size,
2733 WindowFlags flags = 0)
2734 {
2735 return Window(CheckError(SDL_CreatePopupWindow(
2736 parent, offset.x, offset.y, size.x, size.y, flags)));
2737 }
2738
2863 {
2864 return Window(CheckError(SDL_CreateWindowWithProperties(props.get())));
2865 }
2866
2885 void Destroy() { reset(); }
2890
2891};
2892
2893
2895{
2896 return WindowShared(std::move(*this));
2897}
2898
2908struct WindowUnsafe : ResourceUnsafe<WindowRef>
2909{
2911
2915 constexpr explicit WindowUnsafe(Window&& other)
2916 : WindowUnsafe(other.release())
2917 {
2918 }
2919};
2920
2921#ifdef SDL3PP_DOC
2922
2931#define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000u
2932
2943#define SDL_WINDOWPOS_UNDEFINED_DISPLAY(X) (SDL_WINDOWPOS_UNDEFINED_MASK | (X))
2944
2952#define SDL_WINDOWPOS_UNDEFINED SDL_WINDOWPOS_UNDEFINED_DISPLAY(0)
2953
2961#define SDL_WINDOWPOS_ISUNDEFINED(X) \
2962 (((X) & 0xFFFF0000) == SDL_WINDOWPOS_UNDEFINED_MASK)
2963
2972#define SDL_WINDOWPOS_CENTERED_MASK 0x2FFF0000u
2973
2984#define SDL_WINDOWPOS_CENTERED_DISPLAY(X) (SDL_WINDOWPOS_CENTERED_MASK | (X))
2985
2993#define SDL_WINDOWPOS_CENTERED SDL_WINDOWPOS_CENTERED_DISPLAY(0)
2994
3002#define SDL_WINDOWPOS_ISCENTERED(X) \
3003 (((X) & 0xFFFF0000) == SDL_WINDOWPOS_CENTERED_MASK)
3004
3005#endif // SDL3PP_DOC
3006
3017struct GLContextRef : Resource<SDL_GLContextState*>
3018{
3019 using Resource::Resource;
3020
3036 {
3037 CheckError(SDL_GL_MakeCurrent(window.get(), get()));
3038 }
3039
3052 static void reset(SDL_GLContextState* resource)
3053 {
3054 CheckError(SDL_GL_DestroyContext(resource));
3055 }
3056};
3057
3065struct GLContext : ResourceUnique<GLContextRef>
3066{
3068
3092 {
3093 return GLContext(CheckError(SDL_GL_CreateContext(window.get())));
3094 }
3095
3107 void Destroy() { reset(); }
3112
3113};
3114
3115
3117{
3118 return GLContextShared(std::move(*this));
3119}
3120
3130struct GLContextUnsafe : ResourceUnsafe<GLContextRef>
3131{
3133
3137 constexpr explicit GLContextUnsafe(GLContext&& other)
3138 : GLContextUnsafe(other.release())
3139 {
3140 }
3141};
3142
3148using EGLDisplay = SDL_EGLDisplay;
3149
3155using EGLConfig = SDL_EGLConfig;
3156
3162using EGLSurface = SDL_EGLSurface;
3163
3169using EGLAttrib = SDL_EGLAttrib;
3170
3176using EGLint = SDL_EGLint;
3177
3201using EGLAttribArrayCallback = SDL_EGLAttribArrayCallback;
3202
3226using EGLAttribArrayCB = std::function<SDL_EGLAttrib*()>;
3227
3257using EGLIntArrayCallback = SDL_EGLIntArrayCallback;
3258
3288using EGLIntArrayCB = std::function<SDL_EGLint*(SDL_EGLDisplay, SDL_EGLConfig)>;
3289
3312using GLAttr = SDL_GLAttr;
3313
3318constexpr GLAttr GL_RED_SIZE = SDL_GL_RED_SIZE;
3319
3324constexpr GLAttr GL_GREEN_SIZE = SDL_GL_GREEN_SIZE;
3325
3330constexpr GLAttr GL_BLUE_SIZE = SDL_GL_BLUE_SIZE;
3331
3336constexpr GLAttr GL_ALPHA_SIZE = SDL_GL_ALPHA_SIZE;
3337
3341constexpr GLAttr GL_BUFFER_SIZE = SDL_GL_BUFFER_SIZE;
3342
3347constexpr GLAttr GL_DOUBLEBUFFER = SDL_GL_DOUBLEBUFFER;
3348
3352constexpr GLAttr GL_DEPTH_SIZE = SDL_GL_DEPTH_SIZE;
3353
3357constexpr GLAttr GL_STENCIL_SIZE = SDL_GL_STENCIL_SIZE;
3358
3363constexpr GLAttr GL_ACCUM_RED_SIZE = SDL_GL_ACCUM_RED_SIZE;
3364
3369constexpr GLAttr GL_ACCUM_GREEN_SIZE = SDL_GL_ACCUM_GREEN_SIZE;
3370
3375constexpr GLAttr GL_ACCUM_BLUE_SIZE = SDL_GL_ACCUM_BLUE_SIZE;
3376
3381constexpr GLAttr GL_ACCUM_ALPHA_SIZE = SDL_GL_ACCUM_ALPHA_SIZE;
3382
3384 SDL_GL_STEREO;
3385
3389constexpr GLAttr GL_MULTISAMPLEBUFFERS = SDL_GL_MULTISAMPLEBUFFERS;
3390
3395constexpr GLAttr GL_MULTISAMPLESAMPLES = SDL_GL_MULTISAMPLESAMPLES;
3396
3401constexpr GLAttr GL_ACCELERATED_VISUAL = SDL_GL_ACCELERATED_VISUAL;
3402
3404 SDL_GL_RETAINED_BACKING;
3405
3407 SDL_GL_CONTEXT_MAJOR_VERSION;
3408
3410 SDL_GL_CONTEXT_MINOR_VERSION;
3411
3416constexpr GLAttr GL_CONTEXT_FLAGS = SDL_GL_CONTEXT_FLAGS;
3417
3422constexpr GLAttr GL_CONTEXT_PROFILE_MASK = SDL_GL_CONTEXT_PROFILE_MASK;
3423
3425 SDL_GL_SHARE_WITH_CURRENT_CONTEXT;
3426
3428 SDL_GL_FRAMEBUFFER_SRGB_CAPABLE;
3430
3435constexpr GLAttr GL_CONTEXT_RELEASE_BEHAVIOR = SDL_GL_CONTEXT_RELEASE_BEHAVIOR;
3436
3442 SDL_GL_CONTEXT_RESET_NOTIFICATION;
3443
3445 SDL_GL_CONTEXT_NO_ERROR;
3446
3447constexpr GLAttr GL_FLOATBUFFERS = SDL_GL_FLOATBUFFERS;
3448
3449constexpr GLAttr GL_EGL_PLATFORM = SDL_GL_EGL_PLATFORM;
3450
3452
3463using GLProfile = Uint32;
3464
3466 SDL_GL_CONTEXT_PROFILE_CORE;
3467
3469 SDL_GL_CONTEXT_PROFILE_COMPATIBILITY;
3471
3473 SDL_GL_CONTEXT_PROFILE_ES;
3474
3476
3487using GLContextFlag = Uint32;
3488
3490 SDL_GL_CONTEXT_DEBUG_FLAG;
3491
3493 SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG;
3494
3496 SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG;
3497
3499 SDL_GL_CONTEXT_RESET_ISOLATION_FLAG;
3500
3502
3515
3517 SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE;
3518
3520 SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH;
3521
3523
3535
3537 SDL_GL_CONTEXT_RESET_NO_NOTIFICATION;
3538
3540 SDL_GL_CONTEXT_RESET_LOSE_CONTEXT;
3541
3543
3555inline int GetNumVideoDrivers() { return SDL_GetNumVideoDrivers(); }
3556
3576inline const char* GetVideoDriver(int index)
3577{
3578 return SDL_GetVideoDriver(index);
3579}
3580
3598inline const char* GetCurrentVideoDriver()
3599{
3600 return SDL_GetCurrentVideoDriver();
3601}
3602
3612inline SystemTheme GetSystemTheme() { return SDL_GetSystemTheme(); }
3613
3614namespace prop::Display {
3615
3616constexpr auto HDR_ENABLED_BOOLEAN = SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN;
3617
3618constexpr auto KMSDRM_PANEL_ORIENTATION_NUMBER =
3619 SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER;
3620
3621} // namespace prop::Display
3622
3634{
3635 int count = 0;
3636 auto data = CheckError(reinterpret_cast<WindowRef*>(SDL_GetWindows(&count)));
3637 return OwnArray<WindowRef>{data, size_t(count)};
3638}
3639
3640namespace prop::Window {
3641
3642constexpr auto CREATE_ALWAYS_ON_TOP_BOOLEAN =
3643 SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN;
3644
3645constexpr auto CREATE_BORDERLESS_BOOLEAN =
3646 SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN;
3647
3648constexpr auto CREATE_FOCUSABLE_BOOLEAN =
3649 SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN;
3650
3651constexpr auto CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN =
3652 SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN;
3653
3654constexpr auto CREATE_FLAGS_NUMBER = SDL_PROP_WINDOW_CREATE_FLAGS_NUMBER;
3655
3656constexpr auto CREATE_FULLSCREEN_BOOLEAN =
3657 SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN;
3658
3659constexpr auto CREATE_HEIGHT_NUMBER = SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER;
3660
3661constexpr auto CREATE_HIDDEN_BOOLEAN = SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN;
3662
3663constexpr auto CREATE_HIGH_PIXEL_DENSITY_BOOLEAN =
3664 SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN;
3665
3666constexpr auto CREATE_MAXIMIZED_BOOLEAN =
3667 SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN;
3668
3669constexpr auto CREATE_MENU_BOOLEAN = SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN;
3670
3671constexpr auto CREATE_METAL_BOOLEAN = SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN;
3672
3673constexpr auto CREATE_MINIMIZED_BOOLEAN =
3674 SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN;
3675
3676constexpr auto CREATE_MODAL_BOOLEAN = SDL_PROP_WINDOW_CREATE_MODAL_BOOLEAN;
3677
3678constexpr auto CREATE_MOUSE_GRABBED_BOOLEAN =
3679 SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN;
3680
3681constexpr auto CREATE_OPENGL_BOOLEAN = SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN;
3682
3683constexpr auto CREATE_PARENT_POINTER = SDL_PROP_WINDOW_CREATE_PARENT_POINTER;
3684
3685constexpr auto CREATE_RESIZABLE_BOOLEAN =
3686 SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN;
3687
3688constexpr auto CREATE_TITLE_STRING = SDL_PROP_WINDOW_CREATE_TITLE_STRING;
3689
3690constexpr auto CREATE_TRANSPARENT_BOOLEAN =
3691 SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN;
3692
3693constexpr auto CREATE_TOOLTIP_BOOLEAN = SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN;
3694
3695constexpr auto CREATE_UTILITY_BOOLEAN = SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN;
3696
3697constexpr auto CREATE_VULKAN_BOOLEAN = SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN;
3698
3699constexpr auto CREATE_WIDTH_NUMBER = SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER;
3700
3701constexpr auto CREATE_X_NUMBER = SDL_PROP_WINDOW_CREATE_X_NUMBER;
3702
3703constexpr auto CREATE_Y_NUMBER = SDL_PROP_WINDOW_CREATE_Y_NUMBER;
3704
3705constexpr auto CREATE_COCOA_WINDOW_POINTER =
3706 SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER;
3707
3708constexpr auto CREATE_COCOA_VIEW_POINTER =
3709 SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER;
3710
3711constexpr auto CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN =
3712 SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN;
3713
3714constexpr auto CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN =
3715 SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN;
3716
3717constexpr auto CREATE_WAYLAND_WL_SURFACE_POINTER =
3718 SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER;
3719
3720constexpr auto CREATE_WIN32_HWND_POINTER =
3721 SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER;
3722
3723constexpr auto CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER =
3724 SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER;
3725
3726constexpr auto CREATE_X11_WINDOW_NUMBER =
3727 SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER;
3728
3729constexpr auto SHAPE_POINTER = SDL_PROP_WINDOW_SHAPE_POINTER;
3730
3731constexpr auto HDR_ENABLED_BOOLEAN = SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN;
3732
3733constexpr auto SDR_WHITE_LEVEL_FLOAT = SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT;
3734
3735constexpr auto HDR_HEADROOM_FLOAT = SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT;
3736
3737constexpr auto ANDROID_WINDOW_POINTER = SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER;
3738
3739constexpr auto ANDROID_SURFACE_POINTER =
3740 SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER;
3741
3742constexpr auto UIKIT_WINDOW_POINTER = SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER;
3743
3744constexpr auto UIKIT_METAL_VIEW_TAG_NUMBER =
3745 SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER;
3746
3747constexpr auto UIKIT_OPENGL_FRAMEBUFFER_NUMBER =
3748 SDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER;
3749
3750constexpr auto UIKIT_OPENGL_RENDERBUFFER_NUMBER =
3751 SDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER;
3752
3753constexpr auto UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER =
3754 SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER;
3755
3756constexpr auto KMSDRM_DEVICE_INDEX_NUMBER =
3757 SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER;
3758
3759constexpr auto KMSDRM_DRM_FD_NUMBER = SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER;
3760
3761constexpr auto KMSDRM_GBM_DEVICE_POINTER =
3762 SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER;
3763
3764constexpr auto COCOA_WINDOW_POINTER = SDL_PROP_WINDOW_COCOA_WINDOW_POINTER;
3765
3766constexpr auto COCOA_METAL_VIEW_TAG_NUMBER =
3767 SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER;
3768
3769constexpr auto OPENVR_OVERLAY_ID = SDL_PROP_WINDOW_OPENVR_OVERLAY_ID;
3770
3771constexpr auto VIVANTE_DISPLAY_POINTER =
3772 SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER;
3773
3774constexpr auto VIVANTE_WINDOW_POINTER = SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER;
3775
3776constexpr auto VIVANTE_SURFACE_POINTER =
3777 SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER;
3778
3779constexpr auto WIN32_HWND_POINTER = SDL_PROP_WINDOW_WIN32_HWND_POINTER;
3780
3781constexpr auto WIN32_HDC_POINTER = SDL_PROP_WINDOW_WIN32_HDC_POINTER;
3782
3783constexpr auto WIN32_INSTANCE_POINTER = SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER;
3784
3785constexpr auto WAYLAND_DISPLAY_POINTER =
3786 SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER;
3787
3788constexpr auto WAYLAND_SURFACE_POINTER =
3789 SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER;
3790
3791constexpr auto WAYLAND_VIEWPORT_POINTER =
3792 SDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTER;
3793
3794constexpr auto WAYLAND_EGL_WINDOW_POINTER =
3795 SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER;
3796
3797constexpr auto WAYLAND_XDG_SURFACE_POINTER =
3798 SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER;
3799
3800constexpr auto WAYLAND_XDG_TOPLEVEL_POINTER =
3801 SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER;
3802
3803constexpr auto WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING =
3804 SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING;
3805
3806constexpr auto WAYLAND_XDG_POPUP_POINTER =
3807 SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER;
3808
3809constexpr auto WAYLAND_XDG_POSITIONER_POINTER =
3810 SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER;
3811
3812constexpr auto X11_DISPLAY_POINTER = SDL_PROP_WINDOW_X11_DISPLAY_POINTER;
3813
3814constexpr auto X11_SCREEN_NUMBER = SDL_PROP_WINDOW_X11_SCREEN_NUMBER;
3815
3816constexpr auto X11_WINDOW_NUMBER = SDL_PROP_WINDOW_X11_WINDOW_NUMBER;
3817
3818} // namespace prop::Window
3819
3820#ifdef SDL3PP_DOC
3821
3823#define SDL_WINDOW_SURFACE_VSYNC_DISABLED 0
3824
3826#define SDL_WINDOW_SURFACE_VSYNC_ADAPTIVE (-1)
3827
3828#endif // SDL3PP_DOC
3829
3846inline bool ScreenSaverEnabled() { return SDL_ScreenSaverEnabled(); }
3847
3860inline void EnableScreenSaver() { CheckError(SDL_EnableScreenSaver()); }
3861
3880inline void DisableScreenSaver() { CheckError(SDL_DisableScreenSaver()); }
3881
3904{
3905 CheckError(SDL_GL_LoadLibrary(path));
3906}
3907
3962{
3963 return SDL_GL_GetProcAddress(proc);
3964}
3965
3984{
3985 return SDL_EGL_GetProcAddress(proc);
3986}
3987
3997inline void GL_UnloadLibrary() { SDL_GL_UnloadLibrary(); }
3998
4021{
4022 return SDL_GL_ExtensionSupported(extension);
4023}
4024
4035inline void GL_ResetAttributes() { SDL_GL_ResetAttributes(); }
4036
4057inline void GL_SetAttribute(GLAttr attr, int value)
4058{
4059 CheckError(SDL_GL_SetAttribute(attr, value));
4060}
4061
4077inline void GL_GetAttribute(GLAttr attr, int* value)
4078{
4079 CheckError(SDL_GL_GetAttribute(attr, value));
4080}
4081
4093{
4094 return CheckError(SDL_GL_GetCurrentWindow());
4095}
4096
4110{
4111 return CheckError(SDL_GL_GetCurrentContext());
4112}
4113
4125{
4126 return CheckError(SDL_EGL_GetCurrentDisplay());
4127}
4128
4140{
4141 return CheckError(SDL_EGL_GetCurrentConfig());
4142}
4143
4156{
4157 return CheckError(SDL_EGL_GetWindowSurface(window));
4158}
4159
4181 EGLAttribArrayCallback platformAttribCallback,
4182 EGLIntArrayCallback surfaceAttribCallback,
4183 EGLIntArrayCallback contextAttribCallback,
4184 void* userdata)
4185{
4186 SDL_EGL_SetAttributeCallbacks(platformAttribCallback,
4187 surfaceAttribCallback,
4188 contextAttribCallback,
4189 userdata);
4190}
4191
4220inline void GL_SetSwapInterval(int interval)
4221{
4222 CheckError(SDL_GL_SetSwapInterval(interval));
4223}
4224
4243inline void GL_GetSwapInterval(int* interval)
4244{
4245 CheckError(SDL_GL_GetSwapInterval(interval));
4246}
4247
4265inline void GL_SwapWindow(WindowRef window)
4266{
4267 CheckError(SDL_GL_SwapWindow(window));
4268}
4269
4270#pragma region impl
4271
4273
4275{
4277 void* cbHandle = Wrapper::Wrap(get(), std::move(callback));
4278 SetHitTest(
4279 [](SDL_Window* win, const SDL_Point* area, void* data) {
4280 return Wrapper::Call(data, WindowRef{win}, Point(*area));
4281 },
4282 cbHandle);
4283}
4284
4285#pragma endregion impl
4286
4287} // namespace SDL
4288
4289#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:400
Rect GetBounds() const
Get the desktop area represented by a display.
Definition SDL3pp_video.h:533
const DisplayMode * GetDesktopMode() const
Get information about the desktop's display mode.
Definition SDL3pp_video.h:718
OwnArray< DisplayMode * > GetFullscreenModes() const
Get a list of fullscreen display modes available on a display.
Definition SDL3pp_video.h:655
static Display GetForPoint(const SDL_Point &point)
Get the display containing a point.
Definition SDL3pp_video.h:760
static Display GetForRect(const SDL_Rect &rect)
Get the display primarily containing a rect.
Definition SDL3pp_video.h:780
PropertiesRef GetProperties() const
Get the properties associated with a display.
Definition SDL3pp_video.h:498
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:689
float GetContentScale() const
Get the content scale of a display.
Definition SDL3pp_video.h:627
static Display GetForWindow(WindowRef &window)
Get the display associated with a window.
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:515
DisplayOrientation GetNaturalOrientation() const
Get the orientation of a display when it is unrotated.
Definition SDL3pp_video.h:581
static Display GetPrimary()
Return the primary display.
Definition SDL3pp_video.h:471
DisplayOrientation GetCurrentOrientation() const
Get the orientation of a display.
Definition SDL3pp_video.h:598
static OwnArray< Display > GetAll()
Get a list of currently connected displays.
Definition SDL3pp_video.h:452
const DisplayMode * GetCurrentMode() const
Get information about the current display mode.
Definition SDL3pp_video.h:741
Rect GetUsableBounds() const
Get the usable desktop area represented by a display, in screen coordinates.
Definition SDL3pp_video.h:562
constexpr bool operator==(SDL_DisplayID displayID) const
Compares with the underlying type.
Definition SDL3pp_video.h:422
constexpr Display(SDL_DisplayID displayID={})
Wraps Display.
Definition SDL3pp_video.h:409
Optional-like shim for references.
Definition SDL3pp_optionalRef.h:20
Base class for SDL memory allocated array wrap.
Definition SDL3pp_ownPtr.h:43
Pixel format.
Definition SDL3pp_pixels.h:391
RESOURCE release()
Returns reference and reset this.
Definition SDL3pp_resource.h:178
Implement shared ownership for a resource.
Definition SDL3pp_resource.h:283
Implement unique ownership for a resource.
Definition SDL3pp_resource.h:226
constexpr ResourceUnique(std::nullptr_t=nullptr)
Default constructor.
Definition SDL3pp_resource.h:231
void reset()
Resets the value, destroying the resource if not nullptr.
Definition SDL3pp_resource.h:265
A dumb pointer to resource.
Definition SDL3pp_resource.h:197
constexpr ResourceUnsafe()=default
Default constructor.
Implement weak ownership for a resource.
Definition SDL3pp_resource.h:328
A SDL managed resource.
Definition SDL3pp_resource.h:29
constexpr Resource(T resource={})
Constructs from the underlying resource.
Definition SDL3pp_resource.h:37
constexpr SDL_Window * get() const
Return contained resource;.
Definition SDL3pp_resource.h:76
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:364
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition SDL3pp_error.h:206
bool IsScreenKeyboardShown() const
Check whether the screen keyboard is shown for given window.
Definition SDL3pp_keyboard.h:643
void StopTextInput()
Stop receiving any text input events in a window.
Definition SDL3pp_keyboard.h:549
void StartTextInput()
Start accepting Unicode text input events in a window.
Definition SDL3pp_keyboard.h:376
void ClearComposition()
Dismiss the composition window/IME without disabling the subsystem.
Definition SDL3pp_keyboard.h:563
void SetTextInputArea(const SDL_Rect &rect, int cursor)
Set the area used to type Unicode text input.
Definition SDL3pp_keyboard.h:587
void GetTextInputArea(Rect *rect, int *cursor)
Get the area used to type Unicode text input.
Definition SDL3pp_keyboard.h:609
bool IsTextInputActive() const
Check whether or not Unicode text input events are enabled for a window.
Definition SDL3pp_keyboard.h:530
void WarpMouse(float x, float y)
Move the mouse cursor to the given position within the window.
Definition SDL3pp_mouse.h:640
bool GetRelativeMouseMode() const
Query whether relative mouse mode is enabled for a window.
Definition SDL3pp_mouse.h:711
void SetRelativeMouseMode(bool enabled)
Set relative mouse mode for a window.
Definition SDL3pp_mouse.h:695
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:3258
SDL_FunctionPointer FunctionPointer
A generic function pointer.
Definition SDL3pp_stdinc.h:5467
void DisableScreenSaver()
Prevent the screen from being blanked by a screen saver.
Definition SDL3pp_video.h:3880
constexpr GLContextFlag GL_CONTEXT_RESET_ISOLATION_FLAG
RESET_ISOLATION_FLAG.
Definition SDL3pp_video.h:3498
SDL_DisplayOrientation DisplayOrientation
Display orientation values; the way a display is rotated.
Definition SDL3pp_video.h:65
constexpr GLAttr GL_CONTEXT_RELEASE_BEHAVIOR
sets context the release behavior.
Definition SDL3pp_video.h:3435
void GL_SetSwapInterval(int interval)
Set the swap interval for the current OpenGL context.
Definition SDL3pp_video.h:4220
constexpr HitTestResult HITTEST_DRAGGABLE
Region can drag entire window.
Definition SDL3pp_video.h:275
constexpr HitTestResult HITTEST_RESIZE_BOTTOMLEFT
Region is the resizable bottom-left corner border.
Definition SDL3pp_video.h:301
SDL_GLAttr GLAttr
An enumeration of OpenGL configuration attributes.
Definition SDL3pp_video.h:3312
SDL_WindowFlags WindowFlags
The flags on a window.
Definition SDL3pp_video.h:133
constexpr FlashOperation FLASH_CANCEL
Cancel any window flash state.
Definition SDL3pp_video.h:242
constexpr SystemTheme SYSTEM_THEME_LIGHT
Light colored system theme.
Definition SDL3pp_video.h:841
constexpr WindowFlags WINDOW_MAXIMIZED
window is maximized
Definition SDL3pp_video.h:160
void EnableScreenSaver()
Allow the screen to be blanked by a screen saver.
Definition SDL3pp_video.h:3860
void GL_GetSwapInterval(int *interval)
Get the swap interval for the current OpenGL context.
Definition SDL3pp_video.h:4243
constexpr GLAttr GL_FRAMEBUFFER_SRGB_CAPABLE
requests sRGB capable visual; defaults to 0.
Definition SDL3pp_video.h:3427
constexpr GLAttr GL_MULTISAMPLESAMPLES
the number of samples used around the current pixel used for multisample anti-aliasing.
Definition SDL3pp_video.h:3395
constexpr SystemTheme SYSTEM_THEME_DARK
Dark colored system theme.
Definition SDL3pp_video.h:844
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:197
constexpr WindowFlags WINDOW_MOUSE_FOCUS
window has mouse focus
Definition SDL3pp_video.h:169
constexpr GLAttr GL_STENCIL_SIZE
the minimum number of bits in the stencil buffer; defaults to 0.
Definition SDL3pp_video.h:3357
Uint32 GLContextReleaseFlag
Possible values to be set for the GL_CONTEXT_RELEASE_BEHAVIOR attribute.
Definition SDL3pp_video.h:3514
constexpr WindowFlags WINDOW_TRANSPARENT
window with transparent buffer
Definition SDL3pp_video.h:219
FunctionPointer EGL_GetProcAddress(StringParam proc)
Get an EGL library function by name.
Definition SDL3pp_video.h:3983
constexpr GLProfile GL_CONTEXT_PROFILE_CORE
OpenGL Core Profile context.
Definition SDL3pp_video.h:3465
constexpr DisplayOrientation ORIENTATION_UNKNOWN
The display orientation can't be determined.
Definition SDL3pp_video.h:67
EGLSurface EGL_GetWindowSurface(WindowRef window)
Get the EGL surface associated with the window.
Definition SDL3pp_video.h:4155
SDL_HitTest HitTest
Callback used for hit-testing.
Definition SDL3pp_video.h:325
constexpr HitTestResult HITTEST_RESIZE_TOPRIGHT
Region is the resizable top-right corner border.
Definition SDL3pp_video.h:285
constexpr GLAttr GL_CONTEXT_MAJOR_VERSION
OpenGL context major version.
Definition SDL3pp_video.h:3406
constexpr HitTestResult HITTEST_NORMAL
Region is normal. No special properties.
Definition SDL3pp_video.h:272
constexpr GLContextFlag GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
FORWARD_COMPATIBLE_FLAG.
Definition SDL3pp_video.h:3492
WindowRef GL_GetCurrentWindow()
Get the currently active OpenGL window.
Definition SDL3pp_video.h:4092
constexpr GLAttr GL_RETAINED_BACKING
not used (deprecated).
Definition SDL3pp_video.h:3403
constexpr HitTestResult HITTEST_RESIZE_RIGHT
Region is the resizable right border.
Definition SDL3pp_video.h:289
constexpr FlashOperation FLASH_BRIEFLY
Flash the window briefly to get attention.
Definition SDL3pp_video.h:245
void GL_UnloadLibrary()
Unload the OpenGL library previously loaded by GL_LoadLibrary().
Definition SDL3pp_video.h:3997
constexpr GLAttr GL_STEREO
whether the output is stereo 3D; defaults to off.
Definition SDL3pp_video.h:3383
constexpr GLAttr GL_CONTEXT_MINOR_VERSION
OpenGL context minor version.
Definition SDL3pp_video.h:3409
constexpr GLAttr GL_CONTEXT_PROFILE_MASK
type of GL context (Core, Compatibility, ES).
Definition SDL3pp_video.h:3422
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:3318
constexpr WindowFlags WINDOW_MOUSE_GRABBED
window has grabbed mouse input
Definition SDL3pp_video.h:163
bool ScreenSaverEnabled()
Check whether the screensaver is currently enabled.
Definition SDL3pp_video.h:3846
GLContextRef GL_GetCurrentContext()
Get the currently active OpenGL context.
Definition SDL3pp_video.h:4109
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:3324
FunctionPointer GL_GetProcAddress(StringParam proc)
Get an OpenGL function by name.
Definition SDL3pp_video.h:3961
SDL_EGLAttribArrayCallback EGLAttribArrayCallback
EGL platform attribute initialization callback.
Definition SDL3pp_video.h:3201
constexpr GLAttr GL_CONTEXT_RESET_NOTIFICATION
set context reset notification.
Definition SDL3pp_video.h:3441
constexpr GLProfile GL_CONTEXT_PROFILE_COMPATIBILITY
OpenGL Compatibility Profile context.
Definition SDL3pp_video.h:3468
SDL_DisplayMode DisplayMode
The structure that defines a display mode.
Definition SDL3pp_video.h:114
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:4180
SDL_HitTestResult HitTestResult
Possible return values from the HitTest callback.
Definition SDL3pp_video.h:270
constexpr WindowFlags WINDOW_METAL
window usable for Metal view
Definition SDL3pp_video.h:216
constexpr WindowFlags WINDOW_MINIMIZED
window is minimized
Definition SDL3pp_video.h:157
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:3381
void GL_SwapWindow(WindowRef window)
Update a window with OpenGL rendering.
Definition SDL3pp_video.h:4265
constexpr DisplayOrientation ORIENTATION_PORTRAIT
The display is in portrait mode.
Definition SDL3pp_video.h:83
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:3363
SDL_SystemTheme SystemTheme
System theme.
Definition SDL3pp_video.h:836
constexpr WindowFlags WINDOW_HIGH_PIXEL_DENSITY
window uses high pixel density back buffer if possible
Definition SDL3pp_video.h:180
constexpr GLAttr GL_CONTEXT_FLAGS
some combination of 0 or more of elements of the GLContextFlag enumeration; defaults to 0.
Definition SDL3pp_video.h:3416
constexpr GLProfile GL_CONTEXT_PROFILE_ES
GLX_CONTEXT_ES2_PROFILE_BIT_EXT.
Definition SDL3pp_video.h:3472
constexpr GLAttr GL_DOUBLEBUFFER
whether the output is single or double buffered; defaults to double buffering on.
Definition SDL3pp_video.h:3347
SDL_DisplayModeData DisplayModeData
Internal display mode data.
Definition SDL3pp_video.h:101
constexpr HitTestResult HITTEST_RESIZE_LEFT
Region is the resizable left border.
Definition SDL3pp_video.h:305
void GL_GetAttribute(GLAttr attr, int *value)
Get the actual value for an attribute from the current context.
Definition SDL3pp_video.h:4077
void GL_SetAttribute(GLAttr attr, int value)
Set an OpenGL window attribute before window creation.
Definition SDL3pp_video.h:4057
const char * GetCurrentVideoDriver()
Get the name of the currently initialized video driver.
Definition SDL3pp_video.h:3598
constexpr GLAttr GL_MULTISAMPLEBUFFERS
the number of buffers used for multisample anti-aliasing; defaults to 0.
Definition SDL3pp_video.h:3389
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:3336
constexpr WindowFlags WINDOW_MODAL
window is modal
Definition SDL3pp_video.h:175
int GetNumVideoDrivers()
Get the number of video drivers compiled into SDL.
Definition SDL3pp_video.h:3555
bool GL_ExtensionSupported(StringParam extension)
Check if an OpenGL extension is supported for the current context.
Definition SDL3pp_video.h:4020
constexpr WindowFlags WINDOW_INPUT_FOCUS
window has input focus
Definition SDL3pp_video.h:166
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:3369
constexpr GLContextFlag GL_CONTEXT_DEBUG_FLAG
DEBUG_FLAG.
Definition SDL3pp_video.h:3489
Uint32 GLContextFlag
Possible flags to be set for the GL_CONTEXT_FLAGS attribute.
Definition SDL3pp_video.h:3487
SDL_WindowID WindowID
This is a unique ID for a window.
Definition SDL3pp_video.h:804
ResourceShared< GLContext > GLContextShared
Handle to a shared gLContext.
Definition SDL3pp_video.h:377
constexpr HitTestResult HITTEST_RESIZE_TOP
Region is the resizable top border.
Definition SDL3pp_video.h:282
const char * GetVideoDriver(int index)
Get the name of a built in video driver.
Definition SDL3pp_video.h:3576
SDL_EGLSurface EGLSurface
Opaque type for an EGL surface.
Definition SDL3pp_video.h:3162
SDL_FlashOperation FlashOperation
Window flash operation.
Definition SDL3pp_video.h:240
constexpr WindowFlags WINDOW_VULKAN
window usable for Vulkan surface
Definition SDL3pp_video.h:213
constexpr HitTestResult HITTEST_RESIZE_TOPLEFT
Region is the resizable top-left corner border.
Definition SDL3pp_video.h:278
constexpr HitTestResult HITTEST_RESIZE_BOTTOMRIGHT
Region is the resizable bottom-right corner border.
Definition SDL3pp_video.h:295
SDL_EGLConfig EGLConfig
Opaque type for an EGL config.
Definition SDL3pp_video.h:3155
constexpr SystemTheme SYSTEM_THEME_UNKNOWN
Unknown system theme.
Definition SDL3pp_video.h:838
constexpr WindowFlags WINDOW_KEYBOARD_GRABBED
window has grabbed keyboard input
Definition SDL3pp_video.h:210
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:3330
constexpr GLAttr GL_EGL_PLATFORM
GL_EGL_PLATFORM.
Definition SDL3pp_video.h:3449
constexpr WindowFlags WINDOW_BORDERLESS
no window decoration
Definition SDL3pp_video.h:151
SDL_EGLDisplay EGLDisplay
Opaque type for an EGL display.
Definition SDL3pp_video.h:3148
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:203
constexpr WindowFlags WINDOW_MOUSE_CAPTURE
window has mouse captured (unrelated to MOUSE_GRABBED)
Definition SDL3pp_video.h:185
WindowShared share()
Move this window into a WindowShared.
Definition SDL3pp_video.h:2894
constexpr GLAttr GL_BUFFER_SIZE
the minimum number of bits for frame buffer size; defaults to 0.
Definition SDL3pp_video.h:3341
constexpr DisplayOrientation ORIENTATION_LANDSCAPE
The display is in landscape mode, with the right side up, relative to portrait mode.
Definition SDL3pp_video.h:74
constexpr DisplayOrientation ORIENTATION_PORTRAIT_FLIPPED
The display is in portrait mode, upside down.
Definition SDL3pp_video.h:86
constexpr WindowFlags WINDOW_OPENGL
window usable with OpenGL context
Definition SDL3pp_video.h:138
constexpr GLAttr GL_CONTEXT_NO_ERROR
GL_CONTEXT_NO_ERROR.
Definition SDL3pp_video.h:3444
SDL_EGLint EGLint
An EGL integer attribute, used when creating an EGL surface.
Definition SDL3pp_video.h:3176
constexpr GLContextFlag GL_CONTEXT_ROBUST_ACCESS_FLAG
ROBUST_ACCESS_FLAG.
Definition SDL3pp_video.h:3495
constexpr DisplayOrientation ORIENTATION_LANDSCAPE_FLIPPED
The display is in landscape mode, with the left side up, relative to portrait mode.
Definition SDL3pp_video.h:80
constexpr WindowFlags WINDOW_MOUSE_RELATIVE_MODE
window has relative mode enabled
Definition SDL3pp_video.h:187
std::function< HitTestResult(WindowRef window, const Point &area)> HitTestCB
Callback used for hit-testing.
Definition SDL3pp_video.h:339
constexpr WindowFlags WINDOW_OCCLUDED
window is occluded
Definition SDL3pp_video.h:141
constexpr FlashOperation FLASH_UNTIL_FOCUSED
Flash the window until it gets focus.
Definition SDL3pp_video.h:248
Uint32 GLProfile
Possible values to be set for the GL_CONTEXT_PROFILE_MASK attribute.
Definition SDL3pp_video.h:3463
SystemTheme GetSystemTheme()
Get the current system theme.
Definition SDL3pp_video.h:3612
constexpr WindowFlags WINDOW_NOT_FOCUSABLE
window should not be focusable
Definition SDL3pp_video.h:222
constexpr GLContextResetNotification GL_CONTEXT_RESET_NO_NOTIFICATION
NO_NOTIFICATION.
Definition SDL3pp_video.h:3536
constexpr GLAttr GL_FLOATBUFFERS
GL_FLOATBUFFERS.
Definition SDL3pp_video.h:3447
constexpr WindowFlags WINDOW_RESIZABLE
window can be resized
Definition SDL3pp_video.h:154
OwnArray< WindowRef > GetWindows()
Get a list of valid windows.
Definition SDL3pp_video.h:3633
constexpr WindowFlags WINDOW_POPUP_MENU
window should be treated as a popup menu, requires a parent window
Definition SDL3pp_video.h:208
constexpr GLContextResetNotification GL_CONTEXT_RESET_LOSE_CONTEXT
LOSE_CONTEXT.
Definition SDL3pp_video.h:3539
void GL_ResetAttributes()
Reset all previously set OpenGL context attributes to their default values.
Definition SDL3pp_video.h:4035
Uint32 GLContextResetNotification
Possible values to be set GL_CONTEXT_RESET_NOTIFICATION attribute.
Definition SDL3pp_video.h:3534
constexpr WindowFlags WINDOW_EXTERNAL
window not created by SDL
Definition SDL3pp_video.h:172
constexpr WindowFlags WINDOW_ALWAYS_ON_TOP
window should always be above others
Definition SDL3pp_video.h:190
std::function< SDL_EGLAttrib *()> EGLAttribArrayCB
EGL platform attribute initialization callback.
Definition SDL3pp_video.h:3226
constexpr WindowFlags WINDOW_HIDDEN
window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; WindowRef....
Definition SDL3pp_video.h:149
constexpr GLAttr GL_SHARE_WITH_CURRENT_CONTEXT
OpenGL context sharing; defaults to 0.
Definition SDL3pp_video.h:3424
ResourceShared< Window > WindowShared
Handle to a shared window.
Definition SDL3pp_video.h:349
EGLConfig EGL_GetCurrentConfig()
Get the currently active EGL config.
Definition SDL3pp_video.h:4139
constexpr HitTestResult HITTEST_RESIZE_BOTTOM
Region is the resizable bottom border.
Definition SDL3pp_video.h:298
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:3375
constexpr WindowFlags WINDOW_FULLSCREEN
window is in fullscreen mode
Definition SDL3pp_video.h:135
constexpr GLContextReleaseFlag GL_CONTEXT_RELEASE_BEHAVIOR_NONE
BEHAVIOR_NONE.
Definition SDL3pp_video.h:3516
SDL_EGLAttrib EGLAttrib
An EGL attribute, used when creating an EGL context.
Definition SDL3pp_video.h:3169
void GL_LoadLibrary(StringParam path)
Dynamically load an OpenGL library.
Definition SDL3pp_video.h:3903
constexpr GLAttr GL_DEPTH_SIZE
the minimum number of bits in the depth buffer; defaults to 16.
Definition SDL3pp_video.h:3352
std::function< SDL_EGLint *(SDL_EGLDisplay, SDL_EGLConfig)> EGLIntArrayCB
EGL surface/context attribute initialization callback types.
Definition SDL3pp_video.h:3288
EGLDisplay EGL_GetCurrentDisplay()
Get the currently active EGL display.
Definition SDL3pp_video.h:4124
constexpr GLContextReleaseFlag GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH
BEHAVIOR_FLUSH.
Definition SDL3pp_video.h:3519
GLContextShared share()
Move this gLContext into a GLContextShared.
Definition SDL3pp_video.h:3116
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:3401
SDL_EGLIntArrayCallback EGLIntArrayCallback
EGL surface/context attribute initialization callback types.
Definition SDL3pp_video.h:3257
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:3018
static void reset(SDL_GLContextState *resource)
Delete an OpenGL context.
Definition SDL3pp_video.h:3052
void MakeCurrent(WindowRef window)
Set up an OpenGL context for rendering into an OpenGL window.
Definition SDL3pp_video.h:3035
Unsafe Handle to gLContext.
Definition SDL3pp_video.h:3131
constexpr GLContextUnsafe(GLContext &&other)
Constructs GLContextUnsafe from GLContext.
Definition SDL3pp_video.h:3137
Handle to an owned gLContext.
Definition SDL3pp_video.h:3066
static GLContext Create(WindowRef window)
Create an OpenGL context for an OpenGL window, and make it current.
Definition SDL3pp_video.h:3091
void Destroy()
Delete an OpenGL context.
Definition SDL3pp_video.h:3107
Store callbacks by key.
Definition SDL3pp_callbackWrapper.h:222
The structure that defines a point (using integers).
Definition SDL3pp_rect.h:46
SDL properties ID.
Definition SDL3pp_properties.h:209
A rectangle, with the origin at the upper left (using integers).
Definition SDL3pp_rect.h:833
constexpr Point GetTopLeft() const
Get top left corner of the rect.
Definition SDL3pp_rect.h:1100
constexpr Point GetSize() const
Get size of the rect.
Definition SDL3pp_rect.h:1132
A structure representing rendering state.
Definition SDL3pp_render.h:182
A collection of pixels used in software blitting.
Definition SDL3pp_surface.h:153
Represents a handle to a window.
Definition SDL3pp_video.h:860
float GetDisplayScale() const
Get the content display scale relative to a window's pixel size.
Definition SDL3pp_video.h:918
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:985
bool GetMouseGrab() const
Get a window's mouse grab mode.
Definition SDL3pp_video.h:2181
static void reset(SDL_Window *resource)
Destroy a window.
Definition SDL3pp_video.h:2537
static WindowRef GetGrabbed()
Get the window that currently has an input grab enabled.
Definition SDL3pp_video.h:2515
void Raise()
Request that a window be raised above other windows and gain the input focus.
Definition SDL3pp_video.h:1797
void GetSizeInPixels(int *w, int *h) const
Get the size of a window's client area, in pixels.
Definition SDL3pp_video.h:1604
void SetResizable(bool resizable)
Set the user-resizable state of a window.
Definition SDL3pp_video.h:1728
void Sync()
Block until any pending window state is finalized.
Definition SDL3pp_video.h:1945
SurfaceRef GetSurface()
Get the SDL surface associated with the window.
Definition SDL3pp_video.h:1987
void SetMouseRect(const SDL_Rect &rect)
Confines the cursor to the specified area of a window.
Definition SDL3pp_video.h:2201
void GetSize(int *w, int *h) const
Get the size of a window's client area.
Definition SDL3pp_video.h:1440
void UpdateSurface()
Copy the window surface to the screen.
Definition SDL3pp_video.h:2052
void Maximize()
Request that the window be made as large as possible.
Definition SDL3pp_video.h:1829
float GetOpacity() const
Get the opacity of a window.
Definition SDL3pp_video.h:2259
void Flash(FlashOperation operation)
Request a window to demand attention from the user.
Definition SDL3pp_video.h:2480
void SetMaximumSize(const SDL_Point &p)
Set the maximum size of a window's client area.
Definition SDL3pp_video.h:1661
void SetPosition(const SDL_Point &p)
Request that the window's position be set.
Definition SDL3pp_video.h:1304
void SetModal(bool modal)
Toggle the state of the window as modal.
Definition SDL3pp_video.h:2312
void GetPosition(int *x, int *y) const
Get the position of a window.
Definition SDL3pp_video.h:1353
Point GetPosition() const
Get the position of a window.
Definition SDL3pp_video.h:1325
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:1506
Rect GetSafeArea() const
Get the safe area for this window.
Definition SDL3pp_video.h:1462
void SetSize(const SDL_Point &p)
Request that the size of a window's client area be set.
Definition SDL3pp_video.h:1390
void SetFullscreenMode(OptionalRef< const DisplayMode > mode)
Set the display mode to use when a window is visible and fullscreen.
Definition SDL3pp_video.h:951
void SetHitTest(HitTestCB callback)
Provide a callback that decides if a window region has special properties.
Definition SDL3pp_video.h:4274
void ShowSystemMenu(const SDL_Point &p)
Display the system-level window menu.
Definition SDL3pp_video.h:2348
void Hide()
Hide a window.
Definition SDL3pp_video.h:1779
float GetPixelDensity() const
Get the pixel density of a window.
Definition SDL3pp_video.h:895
bool HasSurface() const
Return whether the window has a surface associated with it.
Definition SDL3pp_video.h:1959
void GetMaximumSize(int *w, int *h) const
Get the maximum size of a window's client area.
Definition SDL3pp_video.h:1682
void SetFocusable(bool focusable)
Set whether the window may have input focus.
Definition SDL3pp_video.h:2324
const DisplayMode * GetFullscreenMode() const
Query the display mode to use when a window is visible at fullscreen.
Definition SDL3pp_video.h:969
WindowFlags GetFlags() const
Get the window flags.
Definition SDL3pp_video.h:1177
void SetIcon(SurfaceRef icon)
Set the icon for a window.
Definition SDL3pp_video.h:1232
PropertiesRef GetProperties() const
Get the properties associated with a window.
Definition SDL3pp_video.h:1155
void SetRect(Rect rect)
Request the window's position and size to be set.
Definition SDL3pp_video.h:1248
void SetOpacity(float opacity)
Set the opacity for a window.
Definition SDL3pp_video.h:2239
PixelFormat GetPixelFormat() const
Get the pixel format associated with the window.
Definition SDL3pp_video.h:1000
Point GetSizeInPixels() const
Get the size of a window's client area, in pixels.
Definition SDL3pp_video.h:1581
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:1563
void GetMinimumSize(int *w, int *h) const
Get the minimum size of a window's client area.
Definition SDL3pp_video.h:1643
void SetMouseGrab(bool grabbed)
Set a window's mouse grab mode.
Definition SDL3pp_video.h:2149
Display GetDisplay() const
Get the display associated with a window.
Definition SDL3pp_video.h:877
void SetMinimumSize(const SDL_Point &p)
Set the minimum size of a window's client area.
Definition SDL3pp_video.h:1622
static WindowRef FromID(WindowID id)
Get a window from a stored ID.
Definition SDL3pp_video.h:2501
void SetKeyboardGrab(bool grabbed)
Set a window's keyboard grab mode.
Definition SDL3pp_video.h:2127
Rect GetRect() const
Get the position and client size of a window.
Definition SDL3pp_video.h:1267
void Restore()
Request that the size and position of a minimized or maximized window be restored.
Definition SDL3pp_video.h:1884
void Minimize()
Request that the window be minimized to an iconic representation.
Definition SDL3pp_video.h:1856
void UpdateSurfaceRects(SpanRef< const SDL_Rect > rects)
Copy areas of the window surface to the screen.
Definition SDL3pp_video.h:2078
const char * GetTitle() const
Get the title of a window.
Definition SDL3pp_video.h:1210
void Show()
Show a window.
Definition SDL3pp_video.h:1765
void SetBordered(bool bordered)
Set the border state of a window.
Definition SDL3pp_video.h:1705
WindowRef GetParent() const
Get parent of a window.
Definition SDL3pp_video.h:1034
const SDL_Rect * GetMouseRect() const
Get the mouse confinement rectangle of a window.
Definition SDL3pp_video.h:2220
void SetAlwaysOnTop(bool on_top)
Set the window to always be above the others.
Definition SDL3pp_video.h:1748
bool GetKeyboardGrab() const
Get a window's keyboard grab mode.
Definition SDL3pp_video.h:2165
WindowID GetID() const
Get the numeric ID of a window.
Definition SDL3pp_video.h:1020
void GetAspectRatio(float *min_aspect, float *max_aspect) const
Get the size of a window's client area.
Definition SDL3pp_video.h:1526
void SetHitTest(HitTest callback, void *callback_data)
Provide a callback that decides if a window region has special properties.
Definition SDL3pp_video.h:2436
void DestroySurface()
Destroy the surface associated with the window.
Definition SDL3pp_video.h:2096
void SetSurfaceVSync(int vsync)
Toggle VSync for the window surface.
Definition SDL3pp_video.h:2011
int GetSurfaceVSync() const
Get VSync for the window surface.
Definition SDL3pp_video.h:2028
void SetFullscreen(bool fullscreen)
Request that the window's fullscreen state be changed.
Definition SDL3pp_video.h:1914
void SetParent(WindowRef parent)
Set the window as a child of a parent window.
Definition SDL3pp_video.h:2291
void SetTitle(StringParam title)
Set the title of a window.
Definition SDL3pp_video.h:1193
void SetShape(SurfaceRef shape)
Set the shape of a transparent window.
Definition SDL3pp_video.h:2465
Point GetSize() const
Get the size of a window's client area.
Definition SDL3pp_video.h:1414
Unsafe Handle to window.
Definition SDL3pp_video.h:2909
constexpr WindowUnsafe(Window &&other)
Constructs WindowUnsafe from Window.
Definition SDL3pp_video.h:2915
Handle to an owned window.
Definition SDL3pp_video.h:2572
static Window Create(StringParam title, const SDL_Point &size, WindowFlags flags=0)
Create a window with the specified dimensions and flags.
Definition SDL3pp_video.h:2662
void Destroy()
Destroy a window.
Definition SDL3pp_video.h:2885
static Window CreateWithProperties(PropertiesRef props)
Create a window with the specified properties.
Definition SDL3pp_video.h:2862
static Window CreatePopup(WindowRef parent, const SDL_Point &offset, const SDL_Point &size, WindowFlags flags=0)
Create a child popup window of the specified parent window.
Definition SDL3pp_video.h:2730