SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL3pp_video.h
1#ifndef SDL3PP_VIDEO_H_
2#define SDL3PP_VIDEO_H_
3
4#include <SDL3/SDL_video.h>
5#include "SDL3pp_properties.h"
6#include "SDL3pp_rect.h"
7#include "SDL3pp_surface.h"
8
9namespace SDL {
10
36
38using DisplayID = SDL_DisplayID;
39
40// Forward decl
41struct Display;
42
43// Forward decl
44struct WindowBase;
45
46// Forward decl
47struct Window;
48
50using WindowRaw = SDL_Window*;
51
58
59// Forward decl
60struct GLContext;
61
63using GLContextRaw = SDL_GLContext;
64
65// Forward decl
66struct GLContextScoped;
67
74
75// Forward decl
76struct RendererBase;
77
78// Forward decl
79struct Renderer;
80
87
93using DisplayOrientation = SDL_DisplayOrientation;
94
96 SDL_ORIENTATION_UNKNOWN;
97
102constexpr DisplayOrientation ORIENTATION_LANDSCAPE = SDL_ORIENTATION_LANDSCAPE;
103
109 SDL_ORIENTATION_LANDSCAPE_FLIPPED;
110
112 SDL_ORIENTATION_PORTRAIT;
113
115 SDL_ORIENTATION_PORTRAIT_FLIPPED;
117
129using DisplayMode = SDL_DisplayMode;
130
142{
143 DisplayID m_displayID;
144
145public:
151 constexpr Display(DisplayID displayID = {}) noexcept
152 : m_displayID(displayID)
153 {
154 }
155
161 constexpr operator DisplayID() const noexcept { return m_displayID; }
162
176 static Display GetPrimary();
177
192 static Display GetForPoint(const PointRaw& point);
193
209 static Display GetForRect(const RectRaw& rect);
210
247
260 const char* GetName() const;
261
278 Rect GetBounds() const;
279
302 Rect GetUsableBounds() const;
303
317
331
356 float GetContentScale() const;
357
380
407 float refresh_rate,
408 bool include_high_density_modes) const;
409
428 const DisplayMode& GetDesktopMode() const;
429
448 const DisplayMode& GetCurrentMode() const;
449};
450
458using WindowID = SDL_WindowID;
459
460namespace prop::Global {
461
476constexpr auto VIDEO_WAYLAND_WL_DISPLAY_POINTER =
477 SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER;
478
479} // namespace prop::Global
480
486using SystemTheme = SDL_SystemTheme;
487
489 SDL_SYSTEM_THEME_UNKNOWN;
490
492 SDL_SYSTEM_THEME_LIGHT;
493
495 SDL_SYSTEM_THEME_DARK;
496
506using DisplayModeData = SDL_DisplayModeData;
507
527
529 SDL_WINDOW_FULLSCREEN;
530
532 SDL_WINDOW_OPENGL;
533
535 SDL_WINDOW_OCCLUDED;
536
541constexpr WindowFlags WINDOW_HIDDEN = SDL_WINDOW_HIDDEN;
542
544 SDL_WINDOW_BORDERLESS;
545
547 SDL_WINDOW_RESIZABLE;
548
550 SDL_WINDOW_MINIMIZED;
551
553 SDL_WINDOW_MAXIMIZED;
554
556 SDL_WINDOW_MOUSE_GRABBED;
557
559 SDL_WINDOW_INPUT_FOCUS;
560
562 SDL_WINDOW_MOUSE_FOCUS;
563
565 SDL_WINDOW_EXTERNAL;
566
567constexpr WindowFlags WINDOW_MODAL = SDL_WINDOW_MODAL;
568
570constexpr WindowFlags WINDOW_HIGH_PIXEL_DENSITY = SDL_WINDOW_HIGH_PIXEL_DENSITY;
571
573constexpr WindowFlags WINDOW_MOUSE_CAPTURE = SDL_WINDOW_MOUSE_CAPTURE;
574
576 SDL_WINDOW_MOUSE_RELATIVE_MODE;
577
579 SDL_WINDOW_ALWAYS_ON_TOP;
580
585constexpr WindowFlags WINDOW_UTILITY = SDL_WINDOW_UTILITY;
586
591constexpr WindowFlags WINDOW_TOOLTIP = SDL_WINDOW_TOOLTIP;
592
594constexpr WindowFlags WINDOW_POPUP_MENU = SDL_WINDOW_POPUP_MENU;
595
597 SDL_WINDOW_KEYBOARD_GRABBED;
598
599#if SDL_VERSION_ATLEAST(3, 4, 0)
600
602constexpr WindowFlags WINDOW_FILL_DOCUMENT = SDL_WINDOW_FILL_DOCUMENT;
603
604#endif // SDL_VERSION_ATLEAST(3, 4, 0)
605
607 SDL_WINDOW_VULKAN;
608
610 SDL_WINDOW_METAL;
611
613 SDL_WINDOW_TRANSPARENT;
614
616 SDL_WINDOW_NOT_FOCUSABLE;
617
623using FlashOperation = SDL_FlashOperation;
624
626 SDL_FLASH_CANCEL;
627
629 SDL_FLASH_BRIEFLY;
630
632 SDL_FLASH_UNTIL_FOCUSED;
633
644using HitTestResult = SDL_HitTestResult;
645
647 SDL_HITTEST_NORMAL;
648
650 SDL_HITTEST_DRAGGABLE;
651
653 SDL_HITTEST_RESIZE_TOPLEFT;
655
657 SDL_HITTEST_RESIZE_TOP;
658
660 SDL_HITTEST_RESIZE_TOPRIGHT;
662
664 SDL_HITTEST_RESIZE_RIGHT;
665
668 SDL_HITTEST_RESIZE_BOTTOMRIGHT;
669
671 SDL_HITTEST_RESIZE_BOTTOM;
672
674 SDL_HITTEST_RESIZE_BOTTOMLEFT;
676
678 SDL_HITTEST_RESIZE_LEFT;
679
690using HitTest = HitTestResult(SDLCALL*)(WindowRaw win,
691 const PointRaw* area,
692 void* data);
693
708
714using EGLSurface = SDL_EGLSurface;
715
716#if SDL_VERSION_ATLEAST(3, 4, 0)
717
723using ProgressState = SDL_ProgressState;
724
726constexpr ProgressState PROGRESS_STATE_INVALID = SDL_PROGRESS_STATE_INVALID;
727
729 SDL_PROGRESS_STATE_NONE;
730
733 SDL_PROGRESS_STATE_INDETERMINATE;
735
737 SDL_PROGRESS_STATE_NORMAL;
738
740 SDL_PROGRESS_STATE_PAUSED;
741
745constexpr ProgressState PROGRESS_STATE_ERROR = SDL_PROGRESS_STATE_ERROR;
746
747#endif // SDL_VERSION_ATLEAST(3, 4, 0)
748
754struct WindowBase : ResourceBaseT<WindowRaw>
755{
757
776 void Destroy();
777
794 static WindowRef FromID(WindowID id);
795
808 static WindowRef GetGrabbed();
809
824 Display GetDisplay() const;
825
842 float GetPixelDensity() const;
843
865 float GetDisplayScale() const;
866
899
913 const DisplayMode& GetFullscreenMode() const;
914
926
938
954 WindowID GetID() const;
955
968 WindowRef GetParent() const;
969
1095
1114 WindowFlags GetFlags() const;
1115
1130 void SetTitle(StringParam title);
1131
1144 const char* GetTitle() const;
1145
1169 void SetIcon(SurfaceRef icon);
1170
1206 void SetPosition(const PointRaw& p);
1207
1229 void GetPosition(int* x, int* y) const;
1230
1249 Point GetPosition() const;
1250
1283 void SetSize(const PointRaw& size);
1284
1305 void GetSize(int* w, int* h) const;
1306
1327 Point GetSize() const;
1328
1340 void SetRect(Rect rect);
1341
1355 Rect GetRect() const;
1356
1373 Rect GetSafeArea() const;
1374
1411 void SetAspectRatio(float min_aspect, float max_aspect);
1412
1428 void GetAspectRatio(float* min_aspect, float* max_aspect) const;
1429
1462 void GetBordersSize(int* top, int* left, int* bottom, int* right) const;
1463
1480 void GetSizeInPixels(int* w, int* h) const;
1481
1496 Point GetSizeInPixels() const;
1497
1511 void SetMinimumSize(const PointRaw& p);
1512
1529 void GetMinimumSize(int* w, int* h) const;
1530
1544 void SetMaximumSize(const PointRaw& p);
1545
1562 void GetMaximumSize(int* w, int* h) const;
1563
1582 void SetBordered(bool bordered);
1583
1602 void SetResizable(bool resizable);
1603
1619 void SetAlwaysOnTop(bool on_top);
1620
1621#if SDL_VERSION_ATLEAST(3, 4, 0)
1622
1650 void SetFillDocument(bool fill);
1651
1652#endif // SDL_VERSION_ATLEAST(3, 4, 0)
1653
1666 void Show();
1667
1680 void Hide();
1681
1698 void Raise();
1699
1730 void Maximize();
1731
1757 void Minimize();
1758
1785 void Restore();
1786
1815 void SetFullscreen(bool fullscreen);
1816
1844 bool Sync();
1845
1858 bool HasSurface() const;
1859
1887
1910 void SetSurfaceVSync(int vsync);
1911
1925 int GetSurfaceVSync() const;
1926
1944 void UpdateSurface();
1945
1971
1984 void DestroySurface();
1985
2015 void SetKeyboardGrab(bool grabbed);
2016
2033 void SetMouseGrab(bool grabbed);
2034
2046 bool GetKeyboardGrab() const;
2047
2062 bool GetMouseGrab() const;
2063
2082 void SetMouseRect(const RectRaw& rect);
2083
2098 const RectRaw* GetMouseRect() const;
2099
2117 void SetOpacity(float opacity);
2118
2134 float GetOpacity() const;
2135
2166 void SetParent(WindowRef parent);
2167
2184 void SetModal(bool modal);
2185
2196 void SetFocusable(bool focusable);
2197
2217 void ShowSystemMenu(const PointRaw& p);
2218
2259 void SetHitTest(HitTest callback, void* callback_data);
2260
2302 void SetHitTest(HitTestCB callback);
2303
2328 void SetShape(SurfaceRef shape);
2329
2340 void Flash(FlashOperation operation);
2341
2342#if SDL_VERSION_ATLEAST(3, 4, 0)
2343
2355 void SetProgressState(ProgressState state);
2356
2368
2380 void SetProgressValue(float value);
2381
2392 float GetProgressValue();
2393
2394#endif // SDL_VERSION_ATLEAST(3, 4, 0)
2395
2424
2439 void MakeCurrent(GLContext context);
2440
2452
2469 void GL_Swap();
2470
2495 void StartTextInput();
2496
2546
2558 bool IsTextInputActive() const;
2559
2573 void StopTextInput();
2574
2587 void ClearComposition();
2588
2608 void SetTextInputArea(const RectRaw& rect, int cursor);
2609
2627 void GetTextInputArea(RectRaw* rect, int* cursor) const;
2628
2640 bool IsScreenKeyboardShown() const;
2641
2660 void WarpMouse(const FPointRaw& p);
2661
2686 void SetRelativeMouseMode(bool enabled);
2687
2699 bool GetRelativeMouseMode() const;
2700
2711 RendererRef GetRenderer() const;
2712};
2713
2724{
2725 using WindowBase::WindowBase;
2726
2734 constexpr explicit Window(WindowRaw resource) noexcept
2735 : WindowBase(resource)
2736 {
2737 }
2738
2740 constexpr Window(Window&& other) noexcept
2741 : Window(other.release())
2742 {
2743 }
2744
2830 Window(StringParam title, const PointRaw& size, WindowFlags flags = 0);
2831
2903 Window(WindowRef parent,
2904 const PointRaw& offset,
2905 const PointRaw& size,
2906 WindowFlags flags = 0);
2907
3052 Window(PropertiesRef props);
3053
3055 ~Window() { SDL_DestroyWindow(get()); }
3056
3058 constexpr Window& operator=(Window&& other) noexcept
3059 {
3060 swap(*this, other);
3061 return *this;
3062 }
3063};
3064
3075constexpr int WINDOWPOS_UNDEFINED_MASK = SDL_WINDOWPOS_UNDEFINED_MASK;
3076
3090{
3091 return SDL_WINDOWPOS_UNDEFINED_DISPLAY(X);
3092}
3093
3103constexpr int WINDOWPOS_UNDEFINED = SDL_WINDOWPOS_UNDEFINED;
3104
3114constexpr bool WINDOWPOS_ISUNDEFINED(int X)
3115{
3116 return SDL_WINDOWPOS_ISUNDEFINED(X);
3117}
3118
3129constexpr int WINDOWPOS_CENTERED_MASK = SDL_WINDOWPOS_CENTERED_MASK;
3130
3143constexpr int WINDOWPOS_CENTERED_DISPLAY(int X)
3144{
3145 return SDL_WINDOWPOS_CENTERED_DISPLAY(X);
3146}
3147
3157constexpr int WINDOWPOS_CENTERED = SDL_WINDOWPOS_CENTERED;
3158
3168constexpr bool WINDOWPOS_ISCENTERED(int X)
3169{
3170 return SDL_WINDOWPOS_ISCENTERED(X);
3171}
3172
3185struct GLContext : ResourceBaseT<GLContextRaw>
3186{
3188
3218
3220 constexpr operator GLContextRaw() const noexcept { return get(); }
3221
3231 void Destroy();
3232
3247 void MakeCurrent(WindowRef window);
3248};
3249
3251struct GLContextScoped : GLContext
3252{
3254
3255 constexpr GLContextScoped(const GLContextScoped& other) = delete;
3256
3258 constexpr GLContextScoped(GLContextScoped&& other) noexcept
3259 : GLContext(other.release())
3260 {
3261 }
3262
3264 constexpr GLContextScoped(GLContext&& other) noexcept
3265 : GLContext(std::move(other).release())
3266 {
3267 }
3268
3270 ~GLContextScoped() { SDL_GL_DestroyContext(release()); }
3271};
3272
3278using EGLDisplay = SDL_EGLDisplay;
3279
3285using EGLConfig = SDL_EGLConfig;
3286
3292using EGLAttrib = SDL_EGLAttrib;
3293
3299using EGLint = SDL_EGLint;
3300
3324using EGLAttribArrayCallback = EGLAttrib*(SDLCALL*)(void* userdata);
3325
3355using EGLIntArrayCallback = EGLint*(SDLCALL*)(void* userdata,
3356 EGLDisplay display,
3357 EGLConfig config);
3358
3376using GLAttr = SDL_GLAttr;
3377
3382constexpr GLAttr GL_RED_SIZE = SDL_GL_RED_SIZE;
3383
3388constexpr GLAttr GL_GREEN_SIZE = SDL_GL_GREEN_SIZE;
3389
3394constexpr GLAttr GL_BLUE_SIZE = SDL_GL_BLUE_SIZE;
3395
3400constexpr GLAttr GL_ALPHA_SIZE = SDL_GL_ALPHA_SIZE;
3401
3403constexpr GLAttr GL_BUFFER_SIZE = SDL_GL_BUFFER_SIZE;
3404
3409constexpr GLAttr GL_DOUBLEBUFFER = SDL_GL_DOUBLEBUFFER;
3410
3412constexpr GLAttr GL_DEPTH_SIZE = SDL_GL_DEPTH_SIZE;
3413
3415constexpr GLAttr GL_STENCIL_SIZE = SDL_GL_STENCIL_SIZE;
3416
3421constexpr GLAttr GL_ACCUM_RED_SIZE = SDL_GL_ACCUM_RED_SIZE;
3422
3427constexpr GLAttr GL_ACCUM_GREEN_SIZE = SDL_GL_ACCUM_GREEN_SIZE;
3428
3433constexpr GLAttr GL_ACCUM_BLUE_SIZE = SDL_GL_ACCUM_BLUE_SIZE;
3434
3439constexpr GLAttr GL_ACCUM_ALPHA_SIZE = SDL_GL_ACCUM_ALPHA_SIZE;
3440
3442 SDL_GL_STEREO;
3443
3445constexpr GLAttr GL_MULTISAMPLEBUFFERS = SDL_GL_MULTISAMPLEBUFFERS;
3446
3451constexpr GLAttr GL_MULTISAMPLESAMPLES = SDL_GL_MULTISAMPLESAMPLES;
3452
3457constexpr GLAttr GL_ACCELERATED_VISUAL = SDL_GL_ACCELERATED_VISUAL;
3458
3460 SDL_GL_RETAINED_BACKING;
3461
3463 SDL_GL_CONTEXT_MAJOR_VERSION;
3464
3466 SDL_GL_CONTEXT_MINOR_VERSION;
3467
3472constexpr GLAttr GL_CONTEXT_FLAGS = SDL_GL_CONTEXT_FLAGS;
3473
3478constexpr GLAttr GL_CONTEXT_PROFILE_MASK = SDL_GL_CONTEXT_PROFILE_MASK;
3479
3481 SDL_GL_SHARE_WITH_CURRENT_CONTEXT;
3482
3487constexpr GLAttr GL_FRAMEBUFFER_SRGB_CAPABLE = SDL_GL_FRAMEBUFFER_SRGB_CAPABLE;
3488
3493constexpr GLAttr GL_CONTEXT_RELEASE_BEHAVIOR = SDL_GL_CONTEXT_RELEASE_BEHAVIOR;
3494
3500 SDL_GL_CONTEXT_RESET_NOTIFICATION;
3501
3503 SDL_GL_CONTEXT_NO_ERROR;
3504
3505constexpr GLAttr GL_FLOATBUFFERS = SDL_GL_FLOATBUFFERS;
3506
3507constexpr GLAttr GL_EGL_PLATFORM = SDL_GL_EGL_PLATFORM;
3508
3515
3517 SDL_GL_CONTEXT_PROFILE_CORE;
3518
3520 SDL_GL_CONTEXT_PROFILE_COMPATIBILITY;
3522
3524 SDL_GL_CONTEXT_PROFILE_ES;
3525
3532
3534 SDL_GL_CONTEXT_DEBUG_FLAG;
3535
3537 SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG;
3538
3540 SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG;
3541
3543 SDL_GL_CONTEXT_RESET_ISOLATION_FLAG;
3544
3551
3553 SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE;
3554
3556 SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH;
3557
3564
3566 SDL_GL_CONTEXT_RESET_NO_NOTIFICATION;
3567
3569 SDL_GL_CONTEXT_RESET_LOSE_CONTEXT;
3570
3582inline int GetNumVideoDrivers() { return SDL_GetNumVideoDrivers(); }
3583
3604inline const char* GetVideoDriver(int index)
3605{
3606 return SDL_GetVideoDriver(index);
3607}
3608
3626inline const char* GetCurrentVideoDriver()
3627{
3628 return SDL_GetCurrentVideoDriver();
3629}
3630
3640inline SystemTheme GetSystemTheme() { return SDL_GetSystemTheme(); }
3641
3653{
3654 int count = 0;
3655 auto data = SDL_GetDisplays(&count);
3656 return OwnArray<DisplayID>{data, size_t(count)};
3657}
3658
3673{
3674 return CheckError(SDL_GetPrimaryDisplay());
3675}
3676
3678
3716{
3717 return CheckError(SDL_GetDisplayProperties(displayID));
3718}
3719
3721{
3722 return SDL::GetDisplayProperties(m_displayID);
3723}
3724
3730namespace prop::Display {
3731
3732constexpr auto HDR_ENABLED_BOOLEAN =
3733 SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN;
3734
3736 SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER;
3738
3739#if SDL_VERSION_ATLEAST(3, 4, 0)
3740
3742 SDL_PROP_DISPLAY_WAYLAND_WL_OUTPUT_POINTER;
3743
3745 SDL_PROP_DISPLAY_WINDOWS_HMONITOR_POINTER;
3746
3747#endif // SDL_VERSION_ATLEAST(3, 4, 0)
3748
3749} // namespace prop::Display
3750
3764inline const char* GetDisplayName(DisplayID displayID)
3765{
3766 return SDL_GetDisplayName(displayID);
3767}
3768
3769inline const char* Display::GetName() const
3770{
3771 return SDL::GetDisplayName(m_displayID);
3772}
3773
3792{
3793 Rect bounds;
3794 SDL_GetDisplayBounds(displayID, &bounds);
3795 return bounds;
3796}
3797
3799{
3800 return SDL::GetDisplayBounds(m_displayID);
3801}
3802
3826{
3827 Rect bounds;
3828 SDL_GetDisplayUsableBounds(displayID, &bounds);
3829 return bounds;
3830}
3831
3833{
3834 return SDL::GetDisplayUsableBounds(m_displayID);
3835}
3836
3851{
3852 return SDL_GetNaturalDisplayOrientation(displayID);
3853}
3854
3859
3874{
3875 return SDL_GetCurrentDisplayOrientation(displayID);
3876}
3877
3882
3908inline float GetDisplayContentScale(DisplayID displayID)
3909{
3910 return SDL_GetDisplayContentScale(displayID);
3911}
3912
3913inline float Display::GetContentScale() const
3914{
3915 return SDL::GetDisplayContentScale(m_displayID);
3916}
3917
3941{
3942 int count = 0;
3943 auto data = CheckError(SDL_GetFullscreenDisplayModes(displayID, &count));
3944 return OwnArray<DisplayMode*>{data, size_t(count)};
3945}
3946
3948{
3949 return SDL::GetFullscreenDisplayModes(m_displayID);
3950}
3951
3979 Display displayID,
3980 const PointRaw& size,
3981 float refresh_rate,
3982 bool include_high_density_modes)
3983{
3984 DisplayMode mode;
3985 CheckError(SDL_GetClosestFullscreenDisplayMode(displayID,
3986 size.x,
3987 size.y,
3988 refresh_rate,
3989 include_high_density_modes,
3990 &mode));
3991 return mode;
3992}
3993
3995 const PointRaw& size,
3996 float refresh_rate,
3997 bool include_high_density_modes) const
3998{
4000 m_displayID, size, refresh_rate, include_high_density_modes);
4001}
4002
4023{
4024 return *SDL_GetDesktopDisplayMode(displayID);
4025}
4026
4028{
4029 return SDL::GetDesktopDisplayMode(m_displayID);
4030}
4031
4052{
4053 return *SDL_GetCurrentDisplayMode(displayID);
4054}
4055
4057{
4058 return SDL::GetCurrentDisplayMode(m_displayID);
4059}
4060
4076{
4077 return SDL_GetDisplayForPoint(&point);
4078}
4079
4081{
4082 return SDL::GetDisplayForPoint(point);
4083}
4084
4101{
4102 return CheckError(SDL_GetDisplayForRect(&rect));
4103}
4104
4106{
4107 return SDL::GetDisplayForRect(rect);
4108}
4109
4126{
4127 return CheckError(SDL_GetDisplayForWindow(window));
4128}
4129
4131{
4132 return SDL::GetDisplayForWindow(get());
4133}
4134
4153{
4154 return SDL_GetWindowPixelDensity(window);
4155}
4156
4158{
4160}
4161
4184{
4185 return SDL_GetWindowDisplayScale(window);
4186}
4187
4189{
4191}
4192
4226{
4227 CheckError(SDL_SetWindowFullscreenMode(window, mode));
4228}
4229
4234
4250{
4251 return *SDL_GetWindowFullscreenMode(window);
4252}
4253
4255{
4257}
4258
4271{
4272 size_t size;
4273 return OwnPtr<void>{CheckError(SDL_GetWindowICCProfile(window, &size))};
4274}
4275
4277{
4278 return SDL::GetWindowICCProfile(get());
4279}
4280
4293{
4294 return CheckError(SDL_GetWindowPixelFormat(window));
4295}
4296
4298{
4300}
4301
4313{
4314 int count = 0;
4315 auto data = CheckError(SDL_GetWindows(&count));
4316 return OwnArray<WindowRef>{reinterpret_cast<WindowRef*>(data), size_t(count)};
4317}
4318
4404 const PointRaw& size,
4405 WindowFlags flags)
4406{
4407 return Window(std::move(title), size, flags);
4408}
4409
4411 const PointRaw& size,
4412 WindowFlags flags)
4413 : Window(SDL_CreateWindow(title, size.x, size.y, flags))
4414{
4415}
4416
4418 const PointRaw& offset,
4419 const PointRaw& size,
4420 WindowFlags flags)
4421 : Window(
4422 SDL_CreatePopupWindow(parent, offset.x, offset.y, size.x, size.y, flags))
4423{
4424}
4425
4427 : Window(SDL_CreateWindowWithProperties(props))
4428{
4429}
4430
4503 const PointRaw& offset,
4504 const PointRaw& size,
4505 WindowFlags flags)
4506{
4507 return Window(parent, offset, size, flags);
4508}
4509
4654{
4655 return Window(props);
4656}
4657
4664
4666 SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN;
4667
4668constexpr auto BORDERLESS_BOOLEAN =
4669 SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN;
4670
4671#if SDL_VERSION_ATLEAST(3, 2, 18)
4672
4674 SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN;
4675
4676#endif // SDL_VERSION_ATLEAST(3, 2, 18)
4677
4678constexpr auto FOCUSABLE_BOOLEAN =
4679 SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN;
4680
4682 SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN;
4685
4686constexpr auto FLAGS_NUMBER =
4687 SDL_PROP_WINDOW_CREATE_FLAGS_NUMBER;
4688
4689constexpr auto FULLSCREEN_BOOLEAN =
4690 SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN;
4691
4692constexpr auto HEIGHT_NUMBER =
4693 SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER;
4694
4695constexpr auto HIDDEN_BOOLEAN =
4696 SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN;
4697
4699 SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN;
4701
4702constexpr auto MAXIMIZED_BOOLEAN =
4703 SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN;
4704
4705constexpr auto MENU_BOOLEAN =
4706 SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN;
4707
4708constexpr auto METAL_BOOLEAN =
4709 SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN;
4710
4711constexpr auto MINIMIZED_BOOLEAN =
4712 SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN;
4713
4714constexpr auto MODAL_BOOLEAN =
4715 SDL_PROP_WINDOW_CREATE_MODAL_BOOLEAN;
4716
4718 SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN;
4719
4720constexpr auto OPENGL_BOOLEAN =
4721 SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN;
4722
4723constexpr auto PARENT_POINTER =
4724 SDL_PROP_WINDOW_CREATE_PARENT_POINTER;
4725
4726constexpr auto RESIZABLE_BOOLEAN =
4727 SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN;
4728
4729constexpr auto TITLE_STRING =
4730 SDL_PROP_WINDOW_CREATE_TITLE_STRING;
4731
4732constexpr auto TRANSPARENT_BOOLEAN =
4733 SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN;
4734
4735constexpr auto TOOLTIP_BOOLEAN =
4736 SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN;
4737
4738constexpr auto UTILITY_BOOLEAN =
4739 SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN;
4740
4741constexpr auto VULKAN_BOOLEAN =
4742 SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN;
4743
4744constexpr auto WIDTH_NUMBER =
4745 SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER;
4746
4747constexpr auto X_NUMBER = SDL_PROP_WINDOW_CREATE_X_NUMBER;
4748
4749constexpr auto Y_NUMBER = SDL_PROP_WINDOW_CREATE_Y_NUMBER;
4750
4751constexpr auto COCOA_WINDOW_POINTER =
4752 SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER;
4753
4754constexpr auto COCOA_VIEW_POINTER =
4755 SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER;
4756
4757#if SDL_VERSION_ATLEAST(3, 4, 0)
4758
4759constexpr auto WINDOWSCENE_POINTER =
4760 SDL_PROP_WINDOW_CREATE_WINDOWSCENE_POINTER;
4761
4762#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4763
4765 SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN;
4769
4771 SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN;
4774
4776 SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER;
4778
4779constexpr auto WIN32_HWND_POINTER =
4780 SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER;
4781
4783 SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER;
4786
4787constexpr auto X11_WINDOW_NUMBER =
4788 SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER;
4789
4790#if SDL_VERSION_ATLEAST(3, 4, 0)
4791
4793 SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_CANVAS_ID_STRING;
4795
4797 SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING;
4801
4802#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4803
4804} // namespace prop::Window::Create
4805
4823{
4824 return CheckError(SDL_GetWindowID(window));
4825}
4826
4827inline WindowID WindowBase::GetID() const { return SDL::GetWindowID(get()); }
4828
4846{
4847 return SDL_GetWindowFromID(id);
4848}
4849
4851{
4852 return SDL::GetWindowFromID(id);
4853}
4854
4869{
4870 return SDL_GetWindowParent(window);
4871}
4872
4874{
4875 return SDL::GetWindowParent(get());
4876}
4877
5003{
5004 return CheckError(SDL_GetWindowProperties(window));
5005}
5006
5008{
5009 return SDL::GetWindowProperties(get());
5010}
5011
5023namespace prop::Window {
5024
5025constexpr auto SHAPE_POINTER =
5026 SDL_PROP_WINDOW_SHAPE_POINTER;
5027
5028constexpr auto HDR_ENABLED_BOOLEAN =
5029 SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN;
5030
5032 SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT;
5033
5034constexpr auto HDR_HEADROOM_FLOAT =
5035 SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT;
5036
5038 SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER;
5039
5041 SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER;
5042
5043constexpr auto UIKIT_WINDOW_POINTER =
5044 SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER;
5045
5047 SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER;
5049
5051 SDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER;
5053
5055 SDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER;
5057
5059 SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER;
5062
5064 SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER;
5066
5067constexpr auto KMSDRM_DRM_FD_NUMBER =
5068 SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER;
5069
5071 SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER;
5072
5073constexpr auto COCOA_WINDOW_POINTER =
5074 SDL_PROP_WINDOW_COCOA_WINDOW_POINTER;
5075
5077 SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER;
5079
5080#if SDL_VERSION_ATLEAST(3, 4, 0)
5081
5083 SDL_PROP_WINDOW_OPENVR_OVERLAY_ID_NUMBER;
5084
5085#else
5086
5087constexpr auto OPENVR_OVERLAY_ID_NUMBER = SDL_PROP_WINDOW_OPENVR_OVERLAY_ID;
5088
5089#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5090
5092 SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER;
5093
5095 SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER;
5096
5098 SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER;
5099
5100constexpr auto WIN32_HWND_POINTER =
5101 SDL_PROP_WINDOW_WIN32_HWND_POINTER;
5102
5103constexpr auto WIN32_HDC_POINTER =
5104 SDL_PROP_WINDOW_WIN32_HDC_POINTER;
5105
5107 SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER;
5108
5110 SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER;
5111
5113 SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER;
5114
5116 SDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTER;
5117
5119 SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER;
5121
5123 SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER;
5125
5127 SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER;
5129
5131 SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING;
5135
5137 SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER;
5138
5140 SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER;
5142
5143constexpr auto X11_DISPLAY_POINTER =
5144 SDL_PROP_WINDOW_X11_DISPLAY_POINTER;
5145
5146constexpr auto X11_SCREEN_NUMBER =
5147 SDL_PROP_WINDOW_X11_SCREEN_NUMBER;
5148
5149constexpr auto X11_WINDOW_NUMBER =
5150 SDL_PROP_WINDOW_X11_WINDOW_NUMBER;
5151
5152#if SDL_VERSION_ATLEAST(3, 4, 0)
5153
5155 SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING;
5157
5159 SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING;
5161
5162#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5163
5164} // namespace prop::Window
5165
5186{
5187 return SDL_GetWindowFlags(window);
5188}
5189
5191{
5192 return SDL::GetWindowFlags(get());
5193}
5194
5210inline void SetWindowTitle(WindowRef window, StringParam title)
5211{
5212 CheckError(SDL_SetWindowTitle(window, title));
5213}
5214
5216{
5217 SDL::SetWindowTitle(get(), std::move(title));
5218}
5219
5232inline const char* GetWindowTitle(WindowRef window)
5233{
5234 return SDL_GetWindowTitle(window);
5235}
5236
5237inline const char* WindowBase::GetTitle() const
5238{
5239 return SDL::GetWindowTitle(get());
5240}
5241
5265inline void SetWindowIcon(WindowRef window, SurfaceRef icon)
5266{
5267 CheckError(SDL_SetWindowIcon(window, icon));
5268}
5269
5271{
5272 SDL::SetWindowIcon(get(), icon);
5273}
5274
5310inline void SetWindowPosition(WindowRef window, const PointRaw& p)
5311{
5312 CheckError(SDL_SetWindowPosition(window, p.x, p.y));
5313}
5314
5316{
5318}
5319
5342inline void GetWindowPosition(WindowRef window, int* x, int* y)
5343{
5344 CheckError(SDL_GetWindowPosition(window, x, y));
5345}
5346
5367{
5368 Point p;
5369 GetWindowPosition(window, &p.x, &p.y);
5370 return p;
5371}
5372
5373inline void WindowBase::GetPosition(int* x, int* y) const
5374{
5375 SDL::GetWindowPosition(get(), x, y);
5376}
5377
5379{
5380 return SDL::GetWindowPosition(get());
5381}
5382
5416inline void SetWindowSize(WindowRef window, const PointRaw& size)
5417{
5418 CheckError(SDL_SetWindowSize(window, size.x, size.y));
5419}
5420
5421inline void WindowBase::SetSize(const PointRaw& size)
5422{
5423 SDL::SetWindowSize(get(), size);
5424}
5425
5447inline void GetWindowSize(WindowRef window, int* w, int* h)
5448{
5449 CheckError(SDL_GetWindowSize(window, w, h));
5450}
5451
5473{
5474 Point p;
5475 GetWindowSize(window, &p.x, &p.y);
5476 return p;
5477}
5478
5479inline void WindowBase::GetSize(int* w, int* h) const
5480{
5481 SDL::GetWindowSize(get(), w, h);
5482}
5483
5485
5498inline void SetWindowRect(WindowRef window, Rect rect)
5499{
5500 SetWindowPosition(window, rect.GetTopLeft());
5501 SetWindowSize(window, rect.GetSize());
5502}
5503
5504inline void WindowBase::SetRect(Rect rect) { SDL::SetWindowRect(get(), rect); }
5505
5521{
5522 return Rect{GetWindowPosition(window), GetWindowSize(window)};
5523}
5524
5525inline Rect WindowBase::GetRect() const { return SDL::GetWindowRect(get()); }
5526
5545{
5546 Rect rect;
5547 CheckError(SDL_GetWindowSafeArea(window, &rect));
5548 return rect;
5549}
5550
5552{
5553 return SDL::GetWindowSafeArea(get());
5554}
5555
5594 float min_aspect,
5595 float max_aspect)
5596{
5597 CheckError(SDL_SetWindowAspectRatio(window, min_aspect, max_aspect));
5598}
5599
5600inline void WindowBase::SetAspectRatio(float min_aspect, float max_aspect)
5601{
5602 SDL::SetWindowAspectRatio(get(), min_aspect, max_aspect);
5603}
5604
5622 float* min_aspect,
5623 float* max_aspect)
5624{
5625 CheckError(SDL_GetWindowAspectRatio(window, min_aspect, max_aspect));
5626}
5627
5628inline void WindowBase::GetAspectRatio(float* min_aspect,
5629 float* max_aspect) const
5630{
5631 SDL::GetWindowAspectRatio(get(), min_aspect, max_aspect);
5632}
5633
5668 int* top,
5669 int* left,
5670 int* bottom,
5671 int* right)
5672{
5673 CheckError(SDL_GetWindowBordersSize(window, top, left, bottom, right));
5674}
5675
5676inline void WindowBase::GetBordersSize(int* top,
5677 int* left,
5678 int* bottom,
5679 int* right) const
5680{
5681 SDL::GetWindowBordersSize(get(), top, left, bottom, right);
5682}
5683
5701inline void GetWindowSizeInPixels(WindowRef window, int* w, int* h)
5702{
5703 CheckError(SDL_GetWindowSizeInPixels(window, w, h));
5704}
5705
5722{
5723 Point p;
5724 GetWindowSizeInPixels(window, &p.x, &p.y);
5725 return p;
5726}
5727
5728inline void WindowBase::GetSizeInPixels(int* w, int* h) const
5729{
5731}
5732
5734{
5736}
5737
5752inline void SetWindowMinimumSize(WindowRef window, const PointRaw& p)
5753{
5754 CheckError(SDL_SetWindowMinimumSize(window, p.x, p.y));
5755}
5756
5758{
5760}
5761
5779inline void GetWindowMinimumSize(WindowRef window, int* w, int* h)
5780{
5781 CheckError(SDL_GetWindowMinimumSize(window, w, h));
5782}
5783
5784inline void WindowBase::GetMinimumSize(int* w, int* h) const
5785{
5787}
5788
5803inline void SetWindowMaximumSize(WindowRef window, const PointRaw& p)
5804{
5805 CheckError(SDL_SetWindowMaximumSize(window, p.x, p.y));
5806}
5807
5809{
5811}
5812
5830inline void GetWindowMaximumSize(WindowRef window, int* w, int* h)
5831{
5832 CheckError(SDL_GetWindowMaximumSize(window, w, h));
5833}
5834
5835inline void WindowBase::GetMaximumSize(int* w, int* h) const
5836{
5838}
5839
5859inline void SetWindowBordered(WindowRef window, bool bordered)
5860{
5861 CheckError(SDL_SetWindowBordered(window, bordered));
5862}
5863
5864inline void WindowBase::SetBordered(bool bordered)
5865{
5866 SDL::SetWindowBordered(get(), bordered);
5867}
5868
5888inline void SetWindowResizable(WindowRef window, bool resizable)
5889{
5890 CheckError(SDL_SetWindowResizable(window, resizable));
5891}
5892
5893inline void WindowBase::SetResizable(bool resizable)
5894{
5895 SDL::SetWindowResizable(get(), resizable);
5896}
5897
5914inline void SetWindowAlwaysOnTop(WindowRef window, bool on_top)
5915{
5916 CheckError(SDL_SetWindowAlwaysOnTop(window, on_top));
5917}
5918
5919inline void WindowBase::SetAlwaysOnTop(bool on_top)
5920{
5921 SDL::SetWindowAlwaysOnTop(get(), on_top);
5922}
5923
5924#if SDL_VERSION_ATLEAST(3, 4, 0)
5925
5954inline void SetWindowFillDocument(WindowRef window, bool fill)
5955{
5956 CheckError(SDL_SetWindowFillDocument(window, fill));
5957}
5958
5959inline void WindowBase::SetFillDocument(bool fill)
5960{
5962}
5963
5964#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5965
5979inline void ShowWindow(WindowRef window) { CheckError(SDL_ShowWindow(window)); }
5980
5982
5996inline void HideWindow(WindowRef window) { CheckError(SDL_HideWindow(window)); }
5997
5999
6016inline void RaiseWindow(WindowRef window)
6017{
6018 CheckError(SDL_RaiseWindow(window));
6019}
6020
6022
6054inline void MaximizeWindow(WindowRef window)
6055{
6056 CheckError(SDL_MaximizeWindow(window));
6057}
6058
6060
6087inline void MinimizeWindow(WindowRef window)
6088{
6089 CheckError(SDL_MinimizeWindow(window));
6090}
6091
6093
6121inline void RestoreWindow(WindowRef window)
6122{
6123 CheckError(SDL_RestoreWindow(window));
6124}
6125
6127
6157inline void SetWindowFullscreen(WindowRef window, bool fullscreen)
6158{
6159 CheckError(SDL_SetWindowFullscreen(window, fullscreen));
6160}
6161
6162inline void WindowBase::SetFullscreen(bool fullscreen)
6163{
6164 SDL::SetWindowFullscreen(get(), fullscreen);
6165}
6166
6196inline bool SyncWindow(WindowRef window) { return SDL_SyncWindow(window); }
6197
6198inline bool WindowBase::Sync() { return SDL::SyncWindow(get()); }
6199
6213inline bool WindowHasSurface(WindowRef window)
6214{
6215 return SDL_WindowHasSurface(window);
6216}
6217
6218inline bool WindowBase::HasSurface() const
6219{
6220 return SDL::WindowHasSurface(get());
6221}
6222
6251{
6252 return Surface::borrow(CheckError(SDL_GetWindowSurface(window)));
6253}
6254
6256
6280inline void SetWindowSurfaceVSync(WindowRef window, int vsync)
6281{
6282 CheckError(SDL_SetWindowSurfaceVSync(window, vsync));
6283}
6284
6285inline void WindowBase::SetSurfaceVSync(int vsync)
6286{
6288}
6289
6291constexpr int WINDOW_SURFACE_VSYNC_DISABLED = SDL_WINDOW_SURFACE_VSYNC_DISABLED;
6292
6294constexpr int WINDOW_SURFACE_VSYNC_ADAPTIVE = SDL_WINDOW_SURFACE_VSYNC_ADAPTIVE;
6295
6311{
6312 int vsync;
6313 CheckError(SDL_GetWindowSurfaceVSync(window, &vsync));
6314 return vsync;
6315}
6316
6318{
6320}
6321
6341{
6342 CheckError(SDL_UpdateWindowSurface(window));
6343}
6344
6346
6374{
6375 CheckError(SDL_UpdateWindowSurfaceRects(
6376 window, rects.data(), narrowS32(rects.size())));
6377}
6378
6383
6398{
6399 CheckError(SDL_DestroyWindowSurface(window));
6400}
6401
6403
6433inline void SetWindowKeyboardGrab(WindowRef window, bool grabbed)
6434{
6435 CheckError(SDL_SetWindowKeyboardGrab(window, grabbed));
6436}
6437
6438inline void WindowBase::SetKeyboardGrab(bool grabbed)
6439{
6440 SDL::SetWindowKeyboardGrab(get(), grabbed);
6441}
6442
6460inline void SetWindowMouseGrab(WindowRef window, bool grabbed)
6461{
6462 CheckError(SDL_SetWindowMouseGrab(window, grabbed));
6463}
6464
6465inline void WindowBase::SetMouseGrab(bool grabbed)
6466{
6467 SDL::SetWindowMouseGrab(get(), grabbed);
6468}
6469
6483{
6484 return SDL_GetWindowKeyboardGrab(window);
6485}
6486
6488{
6490}
6491
6508{
6509 return SDL_GetWindowMouseGrab(window);
6510}
6511
6512inline bool WindowBase::GetMouseGrab() const
6513{
6514 return SDL::GetWindowMouseGrab(get());
6515}
6516
6529inline WindowRef GetGrabbedWindow() { return SDL_GetGrabbedWindow(); }
6530
6532
6552inline void SetWindowMouseRect(WindowRef window, const RectRaw& rect)
6553{
6554 CheckError(SDL_SetWindowMouseRect(window, &rect));
6555}
6556
6557inline void WindowBase::SetMouseRect(const RectRaw& rect)
6558{
6560}
6561
6578{
6579 return SDL_GetWindowMouseRect(window);
6580}
6581
6583{
6584 return SDL::GetWindowMouseRect(get());
6585}
6586
6605inline void SetWindowOpacity(WindowRef window, float opacity)
6606{
6607 CheckError(SDL_SetWindowOpacity(window, opacity));
6608}
6609
6610inline void WindowBase::SetOpacity(float opacity)
6611{
6612 SDL::SetWindowOpacity(get(), opacity);
6613}
6614
6631inline float GetWindowOpacity(WindowRef window)
6632{
6633 return SDL_GetWindowOpacity(window);
6634}
6635
6636inline float WindowBase::GetOpacity() const
6637{
6638 return SDL::GetWindowOpacity(get());
6639}
6640
6672inline void SetWindowParent(WindowRef window, WindowRef parent)
6673{
6674 CheckError(SDL_SetWindowParent(window, parent));
6675}
6676
6678{
6679 SDL::SetWindowParent(get(), parent);
6680}
6681
6699inline void SetWindowModal(WindowRef window, bool modal)
6700{
6701 CheckError(SDL_SetWindowModal(window, modal));
6702}
6703
6704inline void WindowBase::SetModal(bool modal)
6705{
6706 SDL::SetWindowModal(get(), modal);
6707}
6708
6720inline void SetWindowFocusable(WindowRef window, bool focusable)
6721{
6722 CheckError(SDL_SetWindowFocusable(window, focusable));
6723}
6724
6725inline void WindowBase::SetFocusable(bool focusable)
6726{
6727 SDL::SetWindowFocusable(get(), focusable);
6728}
6729
6750inline void ShowWindowSystemMenu(WindowRef window, const PointRaw& p)
6751{
6752 CheckError(SDL_ShowWindowSystemMenu(window, p.x, p.y));
6753}
6754
6756{
6758}
6759
6801inline void SetWindowHitTest(WindowRef window,
6802 HitTest callback,
6803 void* callback_data)
6804{
6805 CheckError(SDL_SetWindowHitTest(window, callback, callback_data));
6806}
6807
6848inline void SetWindowHitTest(WindowRef window, HitTestCB callback)
6849{
6850 SetWindowHitTest(window, callback.wrapper, callback.data);
6851}
6852
6853inline void WindowBase::SetHitTest(HitTest callback, void* callback_data)
6854{
6855 SDL::SetWindowHitTest(get(), callback, callback_data);
6856}
6857
6859{
6860 SDL::SetWindowHitTest(get(), callback);
6861}
6862
6887inline void SetWindowShape(WindowRef window, SurfaceRef shape)
6888{
6889 CheckError(SDL_SetWindowShape(window, shape));
6890}
6891
6893{
6894 SDL::SetWindowShape(get(), shape);
6895}
6896
6908inline void FlashWindow(WindowRef window, FlashOperation operation)
6909{
6910 CheckError(SDL_FlashWindow(window, operation));
6911}
6912
6913inline void WindowBase::Flash(FlashOperation operation)
6914{
6915 SDL::FlashWindow(get(), operation);
6916}
6917
6918#if SDL_VERSION_ATLEAST(3, 4, 0)
6919
6933{
6934 CheckError(SDL_SetWindowProgressState(window, state));
6935}
6936
6938{
6940}
6941
6954{
6955 return SDL_GetWindowProgressState(window);
6956}
6957
6962
6975inline void SetWindowProgressValue(WindowRef window, float value)
6976{
6977 CheckError(SDL_SetWindowProgressValue(window, value));
6978}
6979
6980inline void WindowBase::SetProgressValue(float value)
6981{
6983}
6984
6997{
6998 return SDL_GetWindowProgressValue(window);
6999}
7000
7002{
7004}
7005
7006#endif // SDL_VERSION_ATLEAST(3, 4, 0)
7007
7027inline void DestroyWindow(WindowRaw window) { SDL_DestroyWindow(window); }
7028
7030
7047inline bool ScreenSaverEnabled() { return SDL_ScreenSaverEnabled(); }
7048
7061inline void EnableScreenSaver() { CheckError(SDL_EnableScreenSaver()); }
7062
7081inline void DisableScreenSaver() { CheckError(SDL_DisableScreenSaver()); }
7082
7105{
7106 CheckError(SDL_GL_LoadLibrary(path));
7107}
7108
7163{
7164 return SDL_GL_GetProcAddress(proc);
7165}
7166
7185{
7186 return SDL_EGL_GetProcAddress(proc);
7187}
7188
7198inline void GL_UnloadLibrary() { SDL_GL_UnloadLibrary(); }
7199
7221{
7222 return SDL_GL_ExtensionSupported(extension);
7223}
7224
7235inline void GL_ResetAttributes() { SDL_GL_ResetAttributes(); }
7236
7257inline void GL_SetAttribute(GLAttr attr, int value)
7258{
7259 CheckError(SDL_GL_SetAttribute(attr, value));
7260}
7261
7276inline void GL_GetAttribute(GLAttr attr, int* value)
7277{
7278 CheckError(SDL_GL_GetAttribute(attr, value));
7279}
7280
7310{
7311 return GLContext(window);
7312}
7313
7315
7317 : GLContext(SDL_GL_CreateContext(window))
7318{
7319}
7320
7336inline void GL_MakeCurrent(WindowRef window, GLContext context)
7337{
7338 CheckError(SDL_GL_MakeCurrent(window, context));
7339}
7340
7342{
7343 SDL::GL_MakeCurrent(get(), context);
7344}
7345
7347{
7348 GL_MakeCurrent(window, get());
7349}
7350
7363{
7364 return CheckError(SDL_GL_GetCurrentWindow());
7365}
7366
7379inline GLContext GL_GetCurrentContext() { return SDL_GL_GetCurrentContext(); }
7380
7392{
7393 return SDL_EGL_GetCurrentDisplay();
7394}
7395
7406inline EGLConfig EGL_GetCurrentConfig() { return SDL_EGL_GetCurrentConfig(); }
7407
7420{
7421 return SDL_EGL_GetWindowSurface(window);
7422}
7423
7428
7450 EGLAttribArrayCallback platformAttribCallback,
7451 EGLIntArrayCallback surfaceAttribCallback,
7452 EGLIntArrayCallback contextAttribCallback,
7453 void* userdata)
7454{
7455 SDL_EGL_SetAttributeCallbacks(platformAttribCallback,
7456 surfaceAttribCallback,
7457 contextAttribCallback,
7458 userdata);
7459}
7460
7489inline void GL_SetSwapInterval(int interval)
7490{
7491 CheckError(SDL_GL_SetSwapInterval(interval));
7492}
7493
7512inline void GL_GetSwapInterval(int* interval)
7513{
7514 CheckError(SDL_GL_GetSwapInterval(interval));
7515}
7516
7534inline void GL_SwapWindow(WindowRef window)
7535{
7536 CheckError(SDL_GL_SwapWindow(window));
7537}
7538
7540
7554{
7555 CheckError(SDL_GL_DestroyContext(context));
7556}
7557
7559
7561
7562} // namespace SDL
7563
7564#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:142
constexpr Display(DisplayID displayID={}) noexcept
Wraps Display.
Definition SDL3pp_video.h:151
Optional-like shim for references.
Definition SDL3pp_optionalRef.h:20
Base class for SDL memory allocated array wrap.
Definition SDL3pp_ownPtr.h:44
Pixel format.
Definition SDL3pp_pixels.h:361
constexpr RawPointer release() noexcept
Retrieves underlying resource pointer and clear this.
Definition SDL3pp_resource.h:57
friend constexpr void swap(ResourceBaseT &lhs, ResourceBaseT &rhs) noexcept
Definition SDL3pp_resource.h:65
constexpr RawPointer get() const noexcept
Definition SDL3pp_resource.h:54
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
span-like for empty-derived structs
Definition SDL3pp_spanRef.h:24
constexpr T * data() const
Retrieves contained data.
Definition SDL3pp_spanRef.h:75
constexpr size_t size() const
Retrieves contained size.
Definition SDL3pp_spanRef.h:69
Helpers to use C++ strings parameters.
Definition SDL3pp_strings.h:43
constexpr void CheckError(bool result)
Check and throw if returned value from SDL is an error.
Definition SDL3pp_error.h:199
void StopTextInput()
Stop receiving any text input events in a window.
Definition SDL3pp_keyboard.h:621
bool IsScreenKeyboardShown() const
Check whether the screen keyboard is shown for given window.
Definition SDL3pp_keyboard.h:736
void SetTextInputArea(const RectRaw &rect, int cursor)
Set the area used to type Unicode text input.
Definition SDL3pp_keyboard.h:668
void StartTextInputWithProperties(PropertiesRef props)
Start accepting Unicode text input events in a window, with properties describing the input.
Definition SDL3pp_keyboard.h:541
bool IsTextInputActive() const
Check whether or not Unicode text input events are enabled for a window.
Definition SDL3pp_keyboard.h:596
void StartTextInput()
Start accepting Unicode text input events in a window.
Definition SDL3pp_keyboard.h:417
void GetTextInputArea(RectRaw *rect, int *cursor) const
Get the area used to type Unicode text input.
Definition SDL3pp_keyboard.h:696
void ClearComposition()
Dismiss the composition window/IME without disabling the subsystem.
Definition SDL3pp_keyboard.h:641
void WarpMouse(const FPointRaw &p)
Move the mouse cursor to the given position within the window.
Definition SDL3pp_mouse.h:692
bool GetRelativeMouseMode() const
Query whether relative mouse mode is enabled for a window.
Definition SDL3pp_mouse.h:818
void SetRelativeMouseMode(bool enabled)
Set relative mouse mode for a window.
Definition SDL3pp_mouse.h:796
std::unique_ptr< T, PtrDeleter > OwnPtr
Handle to an owned SDL memory allocated pointer.
Definition SDL3pp_ownPtr.h:33
ResourceRefT< PropertiesBase > PropertiesRef
Reference for Properties.
Definition SDL3pp_properties.h:53
SDL_Rect RectRaw
Alias to raw representation for Rect.
Definition SDL3pp_rect.h:34
SDL_FPoint FPointRaw
Alias to raw representation for FPoint.
Definition SDL3pp_rect.h:28
SDL_Point PointRaw
Alias to raw representation for Point.
Definition SDL3pp_rect.h:22
RendererRef GetRenderer() const
Get the renderer associated with a window.
Definition SDL3pp_render.h:3981
void(SDLCALL *)() FunctionPointer
A generic function pointer.
Definition SDL3pp_stdinc.h:6255
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition SDL3pp_stdinc.h:296
::Uint64 Uint64
An unsigned 64-bit integer type.
Definition SDL3pp_stdinc.h:326
ResourceRefT< SurfaceBase > SurfaceRef
Reference for Surface.
Definition SDL3pp_surface.h:57
void DisableScreenSaver()
Prevent the screen from being blanked by a screen saver.
Definition SDL3pp_video.h:7081
constexpr GLContextFlag GL_CONTEXT_RESET_ISOLATION_FLAG
RESET_ISOLATION_FLAG.
Definition SDL3pp_video.h:3542
Rect GetBounds() const
Get the desktop area represented by a display.
Definition SDL3pp_video.h:3798
void SetSurfaceVSync(int vsync)
Toggle VSync for the window surface.
Definition SDL3pp_video.h:6285
Uint32 GLContextFlag
Possible flags to be set for the GL_CONTEXT_FLAGS attribute.
Definition SDL3pp_video.h:3531
void Maximize()
Request that the window be made as large as possible.
Definition SDL3pp_video.h:6059
constexpr int WINDOWPOS_CENTERED
Used to indicate that the window position should be centered.
Definition SDL3pp_video.h:3157
constexpr GLAttr GL_CONTEXT_RELEASE_BEHAVIOR
sets context the release behavior.
Definition SDL3pp_video.h:3493
void SetKeyboardGrab(bool grabbed)
Set a window's keyboard grab mode.
Definition SDL3pp_video.h:6438
ProgressState GetWindowProgressState(WindowRef window)
Get the state of the progress bar for the given window’s taskbar icon.
Definition SDL3pp_video.h:6953
EGLAttrib *(SDLCALL *)(void *userdata) EGLAttribArrayCallback
EGL platform attribute initialization callback.
Definition SDL3pp_video.h:3324
void SetWindowOpacity(WindowRef window, float opacity)
Set the opacity for a window.
Definition SDL3pp_video.h:6605
float GetWindowProgressValue(WindowRef window)
Get the value of the progress bar for the given window’s taskbar icon.
Definition SDL3pp_video.h:6996
void GL_SetSwapInterval(int interval)
Set the swap interval for the current OpenGL context.
Definition SDL3pp_video.h:7489
constexpr HitTestResult HITTEST_DRAGGABLE
Region can drag entire window.
Definition SDL3pp_video.h:649
float GetPixelDensity() const
Get the pixel density of a window.
Definition SDL3pp_video.h:4157
constexpr HitTestResult HITTEST_RESIZE_BOTTOMLEFT
Region is the resizable bottom-left corner border.
Definition SDL3pp_video.h:673
DisplayOrientation GetNaturalDisplayOrientation(DisplayID displayID)
Get the orientation of a display when it is unrotated.
Definition SDL3pp_video.h:3850
void GL_DestroyContext(GLContextRaw context)
Delete an OpenGL context.
Definition SDL3pp_video.h:7553
constexpr FlashOperation FLASH_CANCEL
Cancel any window flash state.
Definition SDL3pp_video.h:625
void SetResizable(bool resizable)
Set the user-resizable state of a window.
Definition SDL3pp_video.h:5893
DisplayMode GetClosestFullscreenDisplayMode(Display displayID, const PointRaw &size, float refresh_rate, bool include_high_density_modes)
Get the closest match to the requested display mode.
Definition SDL3pp_video.h:3978
void SetWindowMouseGrab(WindowRef window, bool grabbed)
Set a window's mouse grab mode.
Definition SDL3pp_video.h:6460
Surface GetSurface()
Get the SDL surface associated with the window.
Definition SDL3pp_video.h:6255
OwnArray< DisplayMode * > GetFullscreenModes() const
Get a list of fullscreen display modes available on a display.
Definition SDL3pp_video.h:3947
void SetWindowProgressState(WindowRef window, ProgressState state)
Sets the state of the progress bar for the given window’s taskbar icon.
Definition SDL3pp_video.h:6932
constexpr bool WINDOWPOS_ISUNDEFINED(int X)
A macro to test if the window position is marked as "undefined.".
Definition SDL3pp_video.h:3114
constexpr SystemTheme SYSTEM_THEME_LIGHT
Light colored system theme.
Definition SDL3pp_video.h:491
constexpr WindowFlags WINDOW_MAXIMIZED
window is maximized
Definition SDL3pp_video.h:552
const char * GetWindowTitle(WindowRef window)
Get the title of a window.
Definition SDL3pp_video.h:5232
void SetWindowMinimumSize(WindowRef window, const PointRaw &p)
Set the minimum size of a window's client area.
Definition SDL3pp_video.h:5752
void EnableScreenSaver()
Allow the screen to be blanked by a screen saver.
Definition SDL3pp_video.h:7061
void GL_GetSwapInterval(int *interval)
Get the swap interval for the current OpenGL context.
Definition SDL3pp_video.h:7512
WindowRef GetWindowParent(WindowRef window)
Get parent of a window.
Definition SDL3pp_video.h:4868
void ShowWindow(WindowRef window)
Show a window.
Definition SDL3pp_video.h:5979
constexpr GLAttr GL_FRAMEBUFFER_SRGB_CAPABLE
requests sRGB-capable visual if 1.
Definition SDL3pp_video.h:3487
constexpr GLAttr GL_MULTISAMPLESAMPLES
the number of samples used around the current pixel used for multisample anti-aliasing.
Definition SDL3pp_video.h:3451
constexpr SystemTheme SYSTEM_THEME_DARK
Dark colored system theme.
Definition SDL3pp_video.h:494
SDL_EGLint EGLint
An EGL integer attribute, used when creating an EGL surface.
Definition SDL3pp_video.h:3299
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:585
constexpr WindowFlags WINDOW_MOUSE_FOCUS
window has mouse focus
Definition SDL3pp_video.h:561
constexpr GLAttr GL_STENCIL_SIZE
the minimum number of bits in the stencil buffer; defaults to 0.
Definition SDL3pp_video.h:3415
ProgressState GetProgressState()
Get the state of the progress bar for the given window’s taskbar icon.
Definition SDL3pp_video.h:6958
Uint32 GLContextReleaseFlag
Possible values to be set for the GL_CONTEXT_RELEASE_BEHAVIOR attribute.
Definition SDL3pp_video.h:3550
GLContext GLContextRef
Reference for GLContext.
Definition SDL3pp_video.h:73
void SetMouseGrab(bool grabbed)
Set a window's mouse grab mode.
Definition SDL3pp_video.h:6465
void SetWindowProgressValue(WindowRef window, float value)
Sets the value of the progress bar for the given window’s taskbar icon.
Definition SDL3pp_video.h:6975
HitTestResult(SDLCALL *)(WindowRaw win, const PointRaw *area, void *data) HitTest
Callback used for hit-testing.
Definition SDL3pp_video.h:690
void SetWindowIcon(WindowRef window, SurfaceRef icon)
Set the icon for a window.
Definition SDL3pp_video.h:5265
PropertiesRef GetProperties() const
Get the properties associated with a display.
Definition SDL3pp_video.h:3720
void SetFocusable(bool focusable)
Set whether the window may have input focus.
Definition SDL3pp_video.h:6725
constexpr WindowFlags WINDOW_TRANSPARENT
window with transparent buffer
Definition SDL3pp_video.h:612
SDL_GLContext GLContextRaw
Alias to raw representation for GLContext.
Definition SDL3pp_video.h:63
MakeTrailingCallback< HitTestResult(WindowRaw win, const PointRaw *area)> HitTestCB
Callback used for hit-testing.
Definition SDL3pp_video.h:706
DisplayMode GetClosestFullscreenMode(const PointRaw &size, float refresh_rate, bool include_high_density_modes) const
Get the closest match to the requested display mode.
Definition SDL3pp_video.h:3994
static WindowRef FromID(WindowID id)
Get a window from a stored ID.
Definition SDL3pp_video.h:4850
const RectRaw * GetWindowMouseRect(WindowRef window)
Get the mouse confinement rectangle of a window.
Definition SDL3pp_video.h:6577
const DisplayMode & GetDesktopDisplayMode(DisplayID displayID)
Get information about the desktop's display mode.
Definition SDL3pp_video.h:4022
void GetWindowSizeInPixels(WindowRef window, int *w, int *h)
Get the size of a window's client area, in pixels.
Definition SDL3pp_video.h:5701
FunctionPointer EGL_GetProcAddress(StringParam proc)
Get an EGL library function by name.
Definition SDL3pp_video.h:7184
constexpr GLProfile GL_CONTEXT_PROFILE_CORE
OpenGL Core Profile context.
Definition SDL3pp_video.h:3516
void SetWindowTitle(WindowRef window, StringParam title)
Set the title of a window.
Definition SDL3pp_video.h:5210
float GetWindowDisplayScale(WindowRef window)
Get the content display scale relative to a window's pixel size.
Definition SDL3pp_video.h:4183
constexpr DisplayOrientation ORIENTATION_UNKNOWN
The display orientation can't be determined.
Definition SDL3pp_video.h:95
constexpr int WINDOWPOS_UNDEFINED_MASK
A magic value used with WINDOWPOS_UNDEFINED.
Definition SDL3pp_video.h:3075
PixelFormat GetWindowPixelFormat(WindowRef window)
Get the pixel format associated with the window.
Definition SDL3pp_video.h:4292
EGLSurface EGL_GetWindowSurface(WindowRef window)
Get the EGL surface associated with the window.
Definition SDL3pp_video.h:7419
void SetModal(bool modal)
Toggle the state of the window as modal.
Definition SDL3pp_video.h:6704
const char * GetTitle() const
Get the title of a window.
Definition SDL3pp_video.h:5237
ResourceRefT< RendererBase > RendererRef
Reference for Renderer.
Definition SDL3pp_video.h:86
constexpr int WINDOW_SURFACE_VSYNC_ADAPTIVE
Constant to enable adaptive vsync.
Definition SDL3pp_video.h:6294
constexpr HitTestResult HITTEST_RESIZE_TOPRIGHT
Region is the resizable top-right corner border.
Definition SDL3pp_video.h:659
constexpr GLAttr GL_CONTEXT_MAJOR_VERSION
OpenGL context major version.
Definition SDL3pp_video.h:3462
constexpr HitTestResult HITTEST_NORMAL
Region is normal. No special properties.
Definition SDL3pp_video.h:646
void SetWindowShape(WindowRef window, SurfaceRef shape)
Set the shape of a transparent window.
Definition SDL3pp_video.h:6887
void UpdateSurfaceRects(SpanRef< const RectRaw > rects)
Copy areas of the window surface to the screen.
Definition SDL3pp_video.h:6379
Rect GetSafeArea() const
Get the safe area for this window.
Definition SDL3pp_video.h:5551
constexpr ProgressState PROGRESS_STATE_PAUSED
The progress bar is shown in a paused state.
Definition SDL3pp_video.h:739
Uint64 WindowFlags
The flags on a window.
Definition SDL3pp_video.h:526
constexpr GLContextFlag GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
FORWARD_COMPATIBLE_FLAG.
Definition SDL3pp_video.h:3536
constexpr int WINDOWPOS_UNDEFINED_DISPLAY(int X)
Used to indicate that you don't care what the window position is.
Definition SDL3pp_video.h:3089
PropertiesRef GetProperties() const
Get the properties associated with a window.
Definition SDL3pp_video.h:5007
WindowRef GL_GetCurrentWindow()
Get the currently active OpenGL window.
Definition SDL3pp_video.h:7362
constexpr GLAttr GL_RETAINED_BACKING
not used (deprecated).
Definition SDL3pp_video.h:3459
Rect GetDisplayUsableBounds(Display displayID)
Get the usable desktop area represented by a display, in screen coordinates.
Definition SDL3pp_video.h:3825
void SetWindowFillDocument(WindowRef window, bool fill)
Set the window to fill the current document space (Emscripten only).
Definition SDL3pp_video.h:5954
float GetOpacity() const
Get the opacity of a window.
Definition SDL3pp_video.h:6636
void SetWindowHitTest(WindowRef window, HitTest callback, void *callback_data)
Provide a callback that decides if a window region has special properties.
Definition SDL3pp_video.h:6801
Display GetDisplay() const
Get the display associated with a window.
Definition SDL3pp_video.h:4130
constexpr HitTestResult HITTEST_RESIZE_RIGHT
Region is the resizable right border.
Definition SDL3pp_video.h:663
float GetContentScale() const
Get the content scale of a display.
Definition SDL3pp_video.h:3913
int GetSurfaceVSync() const
Get VSync for the window surface.
Definition SDL3pp_video.h:6317
constexpr FlashOperation FLASH_BRIEFLY
Flash the window briefly to get attention.
Definition SDL3pp_video.h:628
bool WindowHasSurface(WindowRef window)
Return whether the window has a surface associated with it.
Definition SDL3pp_video.h:6213
void GL_UnloadLibrary()
Unload the OpenGL library previously loaded by GL_LoadLibrary().
Definition SDL3pp_video.h:7198
void MakeCurrent(GLContext context)
Set up an OpenGL context for rendering into an OpenGL window.
Definition SDL3pp_video.h:7341
void SetWindowPosition(WindowRef window, const PointRaw &p)
Request that the window's position be set.
Definition SDL3pp_video.h:5310
constexpr GLAttr GL_STEREO
whether the output is stereo 3D; defaults to off.
Definition SDL3pp_video.h:3441
void Destroy()
Destroy a window.
Definition SDL3pp_video.h:7029
constexpr GLAttr GL_CONTEXT_MINOR_VERSION
OpenGL context minor version.
Definition SDL3pp_video.h:3465
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:5600
constexpr GLAttr GL_CONTEXT_PROFILE_MASK
type of GL context (Core, Compatibility, ES).
Definition SDL3pp_video.h:3478
void Raise()
Request that a window be raised above other windows and gain the input focus.
Definition SDL3pp_video.h:6021
DisplayOrientation GetCurrentDisplayOrientation(DisplayID displayID)
Get the orientation of a display.
Definition SDL3pp_video.h:3873
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:3382
void SetFullscreenMode(OptionalRef< const DisplayMode > mode)
Set the display mode to use when a window is visible and fullscreen.
Definition SDL3pp_video.h:4230
SDL_SystemTheme SystemTheme
System theme.
Definition SDL3pp_video.h:486
void SetWindowResizable(WindowRef window, bool resizable)
Set the user-resizable state of a window.
Definition SDL3pp_video.h:5888
Display GetDisplayForRect(const RectRaw &rect)
Get the display primarily containing a rect.
Definition SDL3pp_video.h:4100
constexpr WindowFlags WINDOW_MOUSE_GRABBED
window has grabbed mouse input
Definition SDL3pp_video.h:555
bool ScreenSaverEnabled()
Check whether the screensaver is currently enabled.
Definition SDL3pp_video.h:7047
void DestroyWindowSurface(WindowRef window)
Destroy the surface associated with the window.
Definition SDL3pp_video.h:6397
void MakeCurrent(WindowRef window)
Set up an OpenGL context for rendering into an OpenGL window.
Definition SDL3pp_video.h:7346
Display GetDisplayForPoint(const PointRaw &point)
Get the display containing a point.
Definition SDL3pp_video.h:4075
void Show()
Show a window.
Definition SDL3pp_video.h:5981
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:3388
FunctionPointer GL_GetProcAddress(StringParam proc)
Get an OpenGL function by name.
Definition SDL3pp_video.h:7162
void SetWindowSurfaceVSync(WindowRef window, int vsync)
Toggle VSync for the window surface.
Definition SDL3pp_video.h:6280
constexpr GLAttr GL_CONTEXT_RESET_NOTIFICATION
set context reset notification.
Definition SDL3pp_video.h:3499
Window CreateWindow(StringParam title, const PointRaw &size, WindowFlags flags)
Create a window with the specified dimensions and flags.
Definition SDL3pp_video.h:4403
WindowFlags GetWindowFlags(WindowRef window)
Get the window flags.
Definition SDL3pp_video.h:5185
constexpr GLProfile GL_CONTEXT_PROFILE_COMPATIBILITY
OpenGL Compatibility Profile context.
Definition SDL3pp_video.h:3519
float GetDisplayContentScale(DisplayID displayID)
Get the content scale of a display.
Definition SDL3pp_video.h:3908
Uint32 GLProfile
Possible values to be set for the GL_CONTEXT_PROFILE_MASK attribute.
Definition SDL3pp_video.h:3514
void Restore()
Request that the size and position of a minimized or maximized window be restored.
Definition SDL3pp_video.h:6126
SDL_EGLConfig EGLConfig
Opaque type for an EGL config.
Definition SDL3pp_video.h:3285
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:7449
const DisplayMode & GetCurrentDisplayMode(DisplayID displayID)
Get information about the current display mode.
Definition SDL3pp_video.h:4051
void UpdateWindowSurfaceRects(WindowRef window, SpanRef< const RectRaw > rects)
Copy areas of the window surface to the screen.
Definition SDL3pp_video.h:6372
Rect GetDisplayBounds(Display displayID)
Get the desktop area represented by a display.
Definition SDL3pp_video.h:3791
constexpr WindowFlags WINDOW_METAL
window usable for Metal view
Definition SDL3pp_video.h:609
constexpr WindowFlags WINDOW_MINIMIZED
window is minimized
Definition SDL3pp_video.h:549
void RestoreWindow(WindowRef window)
Request that the size and position of a minimized or maximized window be restored.
Definition SDL3pp_video.h:6121
SDL_EGLDisplay EGLDisplay
Opaque type for an EGL display.
Definition SDL3pp_video.h:3278
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:3439
constexpr int WINDOW_SURFACE_VSYNC_DISABLED
Constant to disable vsync.
Definition SDL3pp_video.h:6291
void GL_SwapWindow(WindowRef window)
Update a window with OpenGL rendering.
Definition SDL3pp_video.h:7534
constexpr DisplayOrientation ORIENTATION_PORTRAIT
The display is in portrait mode.
Definition SDL3pp_video.h:111
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:3421
OwnArray< DisplayMode * > GetFullscreenDisplayModes(Display displayID)
Get a list of fullscreen display modes available on a display.
Definition SDL3pp_video.h:3940
SDL_GLAttr GLAttr
An enumeration of OpenGL configuration attributes.
Definition SDL3pp_video.h:3376
constexpr WindowFlags WINDOW_HIGH_PIXEL_DENSITY
window uses high pixel density back buffer if possible
Definition SDL3pp_video.h:570
Uint32 GLContextResetNotification
Possible values to be set GL_CONTEXT_RESET_NOTIFICATION attribute.
Definition SDL3pp_video.h:3563
SDL_Window * WindowRaw
Alias to raw representation for Window.
Definition SDL3pp_video.h:50
constexpr ProgressState PROGRESS_STATE_INVALID
An invalid progress state indicating an error; check GetError().
Definition SDL3pp_video.h:726
constexpr GLAttr GL_CONTEXT_FLAGS
some combination of 0 or more of elements of the GLContextFlag enumeration; defaults to 0.
Definition SDL3pp_video.h:3472
void SetProgressState(ProgressState state)
Sets the state of the progress bar for the given window’s taskbar icon.
Definition SDL3pp_video.h:6937
constexpr GLProfile GL_CONTEXT_PROFILE_ES
GLX_CONTEXT_ES2_PROFILE_BIT_EXT.
Definition SDL3pp_video.h:3523
void GetMaximumSize(int *w, int *h) const
Get the maximum size of a window's client area.
Definition SDL3pp_video.h:5835
constexpr GLAttr GL_DOUBLEBUFFER
whether the output is single or double buffered; defaults to double buffering on.
Definition SDL3pp_video.h:3409
void SetWindowMaximumSize(WindowRef window, const PointRaw &p)
Set the maximum size of a window's client area.
Definition SDL3pp_video.h:5803
Display GetPrimaryDisplay()
Return the primary display.
Definition SDL3pp_video.h:3672
void Hide()
Hide a window.
Definition SDL3pp_video.h:5998
constexpr HitTestResult HITTEST_RESIZE_LEFT
Region is the resizable left border.
Definition SDL3pp_video.h:677
void GL_Swap()
Update a window with OpenGL rendering.
Definition SDL3pp_video.h:7539
Point GetPosition() const
Get the position of a window.
Definition SDL3pp_video.h:5378
void GetWindowMaximumSize(WindowRef window, int *w, int *h)
Get the maximum size of a window's client area.
Definition SDL3pp_video.h:5830
SDL_HitTestResult HitTestResult
Possible return values from the HitTest callback.
Definition SDL3pp_video.h:644
void GL_GetAttribute(GLAttr attr, int *value)
Get the actual value for an attribute from the current context.
Definition SDL3pp_video.h:7276
bool GetMouseGrab() const
Get a window's mouse grab mode.
Definition SDL3pp_video.h:6512
PropertiesRef GetDisplayProperties(DisplayID displayID)
Get the properties associated with a display.
Definition SDL3pp_video.h:3715
SDL_FlashOperation FlashOperation
Window flash operation.
Definition SDL3pp_video.h:623
SDL_WindowID WindowID
This is a unique ID for a window.
Definition SDL3pp_video.h:458
EGLSurface GetEGLSurface()
Get the EGL surface associated with the window.
Definition SDL3pp_video.h:7424
void SetShape(SurfaceRef shape)
Set the shape of a transparent window.
Definition SDL3pp_video.h:6892
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:5676
SDL_EGLAttrib EGLAttrib
An EGL attribute, used when creating an EGL context.
Definition SDL3pp_video.h:3292
constexpr WindowFlags WINDOW_FILL_DOCUMENT
window is in fill-document mode (Emscripten only), since SDL 3.4.0
Definition SDL3pp_video.h:602
void HideWindow(WindowRef window)
Hide a window.
Definition SDL3pp_video.h:5996
void GL_SetAttribute(GLAttr attr, int value)
Set an OpenGL window attribute before window creation.
Definition SDL3pp_video.h:7257
const char * GetCurrentVideoDriver()
Get the name of the currently initialized video driver.
Definition SDL3pp_video.h:3626
GLContext CreateGLContext()
Create an OpenGL context for an OpenGL window, and make it current.
Definition SDL3pp_video.h:7314
constexpr GLAttr GL_MULTISAMPLEBUFFERS
the number of buffers used for multisample anti-aliasing; defaults to 0.
Definition SDL3pp_video.h:3445
PropertiesRef GetWindowProperties(WindowRef window)
Get the properties associated with a window.
Definition SDL3pp_video.h:5002
void ShowWindowSystemMenu(WindowRef window, const PointRaw &p)
Display the system-level window menu.
Definition SDL3pp_video.h:6750
const RectRaw * GetMouseRect() const
Get the mouse confinement rectangle of a window.
Definition SDL3pp_video.h:6582
const DisplayMode & GetCurrentMode() const
Get information about the current display mode.
Definition SDL3pp_video.h:4056
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:3400
constexpr WindowFlags WINDOW_MODAL
window is modal
Definition SDL3pp_video.h:567
int GetNumVideoDrivers()
Get the number of video drivers compiled into SDL.
Definition SDL3pp_video.h:3582
bool Sync()
Block until any pending window state is finalized.
Definition SDL3pp_video.h:6198
Point GetSizeInPixels() const
Get the size of a window's client area, in pixels.
Definition SDL3pp_video.h:5733
void SetWindowKeyboardGrab(WindowRef window, bool grabbed)
Set a window's keyboard grab mode.
Definition SDL3pp_video.h:6433
bool GL_ExtensionSupported(StringParam extension)
Check if an OpenGL extension is supported for the current context.
Definition SDL3pp_video.h:7220
void SetWindowSize(WindowRef window, const PointRaw &size)
Request that the size of a window's client area be set.
Definition SDL3pp_video.h:5416
constexpr WindowFlags WINDOW_INPUT_FOCUS
window has input focus
Definition SDL3pp_video.h:558
Display GetDisplayForWindow(WindowRef window)
Get the display associated with a window.
Definition SDL3pp_video.h:4125
void UpdateSurface()
Copy the window surface to the screen.
Definition SDL3pp_video.h:6345
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:3427
constexpr GLContextFlag GL_CONTEXT_DEBUG_FLAG
DEBUG_FLAG.
Definition SDL3pp_video.h:3533
WindowID GetWindowID(WindowRef window)
Get the numeric ID of a window.
Definition SDL3pp_video.h:4822
void GetAspectRatio(float *min_aspect, float *max_aspect) const
Get the aspect ratio of a window's client area.
Definition SDL3pp_video.h:5628
const char * GetName() const
Get the name of a display in UTF-8 encoding.
Definition SDL3pp_video.h:3769
void SetMaximumSize(const PointRaw &p)
Set the maximum size of a window's client area.
Definition SDL3pp_video.h:5808
void SetWindowAspectRatio(WindowRef window, float min_aspect, float max_aspect)
Request that the aspect ratio of a window's client area be set.
Definition SDL3pp_video.h:5593
DisplayOrientation GetNaturalOrientation() const
Get the orientation of a display when it is unrotated.
Definition SDL3pp_video.h:3855
void SetPosition(const PointRaw &p)
Request that the window's position be set.
Definition SDL3pp_video.h:5315
bool GetWindowKeyboardGrab(WindowRef window)
Get a window's keyboard grab mode.
Definition SDL3pp_video.h:6482
bool GetWindowMouseGrab(WindowRef window)
Get a window's mouse grab mode.
Definition SDL3pp_video.h:6507
EGLint *(SDLCALL *)(void *userdata, EGLDisplay display, EGLConfig config) EGLIntArrayCallback
EGL surface/context attribute initialization callback types.
Definition SDL3pp_video.h:3355
constexpr HitTestResult HITTEST_RESIZE_TOP
Region is the resizable top border.
Definition SDL3pp_video.h:656
SDL_DisplayID DisplayID
Alias to raw representation for Display.
Definition SDL3pp_video.h:38
const char * GetVideoDriver(int index)
Get the name of a built in video driver.
Definition SDL3pp_video.h:3604
SDL_DisplayModeData DisplayModeData
Internal display mode data.
Definition SDL3pp_video.h:506
void RaiseWindow(WindowRef window)
Request that a window be raised above other windows and gain the input focus.
Definition SDL3pp_video.h:6016
void SetFullscreen(bool fullscreen)
Request that the window's fullscreen state be changed.
Definition SDL3pp_video.h:6162
float GetWindowPixelDensity(WindowRef window)
Get the pixel density of a window.
Definition SDL3pp_video.h:4152
constexpr int WINDOWPOS_CENTERED_DISPLAY(int X)
Used to indicate that the window position should be centered.
Definition SDL3pp_video.h:3143
void DestroySurface()
Destroy the surface associated with the window.
Definition SDL3pp_video.h:6402
const char * GetDisplayName(DisplayID displayID)
Get the name of a display in UTF-8 encoding.
Definition SDL3pp_video.h:3764
void ShowSystemMenu(const PointRaw &p)
Display the system-level window menu.
Definition SDL3pp_video.h:6755
PixelFormat GetPixelFormat() const
Get the pixel format associated with the window.
Definition SDL3pp_video.h:4297
constexpr WindowFlags WINDOW_VULKAN
window usable for Vulkan surface
Definition SDL3pp_video.h:606
void SetSize(const PointRaw &size)
Request that the size of a window's client area be set.
Definition SDL3pp_video.h:5421
constexpr HitTestResult HITTEST_RESIZE_TOPLEFT
Region is the resizable top-left corner border.
Definition SDL3pp_video.h:652
SDL_DisplayOrientation DisplayOrientation
Display orientation values; the way a display is rotated.
Definition SDL3pp_video.h:93
constexpr HitTestResult HITTEST_RESIZE_BOTTOMRIGHT
Region is the resizable bottom-right corner border.
Definition SDL3pp_video.h:667
constexpr SystemTheme SYSTEM_THEME_UNKNOWN
Unknown system theme.
Definition SDL3pp_video.h:488
void SetAlwaysOnTop(bool on_top)
Set the window to always be above the others.
Definition SDL3pp_video.h:5919
constexpr WindowFlags WINDOW_KEYBOARD_GRABBED
window has grabbed keyboard input
Definition SDL3pp_video.h:596
void SetWindowAlwaysOnTop(WindowRef window, bool on_top)
Set the window to always be above the others.
Definition SDL3pp_video.h:5914
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:3394
constexpr GLAttr GL_EGL_PLATFORM
GL_EGL_PLATFORM.
Definition SDL3pp_video.h:3507
WindowRef GetParent() const
Get parent of a window.
Definition SDL3pp_video.h:4873
constexpr WindowFlags WINDOW_BORDERLESS
no window decoration
Definition SDL3pp_video.h:543
const DisplayMode & GetDesktopMode() const
Get information about the desktop's display mode.
Definition SDL3pp_video.h:4027
void SetWindowModal(WindowRef window, bool modal)
Toggle the state of the window as modal.
Definition SDL3pp_video.h:6699
void SetRect(Rect rect)
Request the window's position and size to be set.
Definition SDL3pp_video.h:5504
static WindowRef GetGrabbed()
Get the window that currently has an input grab enabled.
Definition SDL3pp_video.h:6531
void GetWindowAspectRatio(WindowRef window, float *min_aspect, float *max_aspect)
Get the aspect ratio of a window's client area.
Definition SDL3pp_video.h:5621
Window CreatePopupWindow(WindowRef parent, const PointRaw &offset, const PointRaw &size, WindowFlags flags)
Create a child popup window of the specified parent window.
Definition SDL3pp_video.h:4502
void SetWindowMouseRect(WindowRef window, const RectRaw &rect)
Confines the cursor to the specified area of a window.
Definition SDL3pp_video.h:6552
void SetHitTest(HitTest callback, void *callback_data)
Provide a callback that decides if a window region has special properties.
Definition SDL3pp_video.h:6853
void GL_MakeCurrent(WindowRef window, GLContext context)
Set up an OpenGL context for rendering into an OpenGL window.
Definition SDL3pp_video.h:7336
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:591
void GetMinimumSize(int *w, int *h) const
Get the minimum size of a window's client area.
Definition SDL3pp_video.h:5784
constexpr WindowFlags WINDOW_MOUSE_CAPTURE
window has mouse captured (unrelated to MOUSE_GRABBED)
Definition SDL3pp_video.h:573
Rect GetWindowRect(WindowRef window)
Get the position and client size of a window.
Definition SDL3pp_video.h:5520
WindowRef GetGrabbedWindow()
Get the window that currently has an input grab enabled.
Definition SDL3pp_video.h:6529
SDL_ProgressState ProgressState
Window progress state.
Definition SDL3pp_video.h:723
constexpr GLAttr GL_BUFFER_SIZE
the minimum number of bits for frame buffer size; defaults to 0.
Definition SDL3pp_video.h:3403
constexpr DisplayOrientation ORIENTATION_LANDSCAPE
The display is in landscape mode, with the right side up, relative to portrait mode.
Definition SDL3pp_video.h:102
WindowFlags GetFlags() const
Get the window flags.
Definition SDL3pp_video.h:5190
constexpr DisplayOrientation ORIENTATION_PORTRAIT_FLIPPED
The display is in portrait mode, upside down.
Definition SDL3pp_video.h:114
void GetWindowBordersSize(WindowRef window, int *top, int *left, int *bottom, int *right)
Get the size of a window's borders (decorations) around the client area.
Definition SDL3pp_video.h:5667
constexpr WindowFlags WINDOW_OPENGL
window usable with OpenGL context
Definition SDL3pp_video.h:531
void SetBordered(bool bordered)
Set the border state of a window.
Definition SDL3pp_video.h:5864
constexpr ProgressState PROGRESS_STATE_NONE
No progress bar is shown.
Definition SDL3pp_video.h:728
constexpr GLAttr GL_CONTEXT_NO_ERROR
GL_CONTEXT_NO_ERROR.
Definition SDL3pp_video.h:3502
void SetWindowFullscreenMode(WindowRef window, OptionalRef< const DisplayMode > mode)
Set the display mode to use when a window is visible and fullscreen.
Definition SDL3pp_video.h:4224
float GetDisplayScale() const
Get the content display scale relative to a window's pixel size.
Definition SDL3pp_video.h:4188
Rect GetWindowSafeArea(WindowRef window)
Get the safe area for this window.
Definition SDL3pp_video.h:5544
constexpr GLContextFlag GL_CONTEXT_ROBUST_ACCESS_FLAG
ROBUST_ACCESS_FLAG.
Definition SDL3pp_video.h:3539
constexpr DisplayOrientation ORIENTATION_LANDSCAPE_FLIPPED
The display is in landscape mode, with the left side up, relative to portrait mode.
Definition SDL3pp_video.h:108
constexpr int WINDOWPOS_UNDEFINED
Used to indicate that you don't care what the window position/display is.
Definition SDL3pp_video.h:3103
void SetMouseRect(const RectRaw &rect)
Confines the cursor to the specified area of a window.
Definition SDL3pp_video.h:6557
void SetFillDocument(bool fill)
Set the window to fill the current document space (Emscripten only).
Definition SDL3pp_video.h:5959
SDL_EGLSurface EGLSurface
Opaque type for an EGL surface.
Definition SDL3pp_video.h:714
const DisplayMode & GetFullscreenMode() const
Query the display mode to use when a window is visible at fullscreen.
Definition SDL3pp_video.h:4254
Window CreateWindowWithProperties(PropertiesRef props)
Create a window with the specified properties.
Definition SDL3pp_video.h:4653
constexpr WindowFlags WINDOW_MOUSE_RELATIVE_MODE
window has relative mode enabled
Definition SDL3pp_video.h:575
constexpr ProgressState PROGRESS_STATE_NORMAL
The progress bar is shown in a normal state.
Definition SDL3pp_video.h:736
constexpr WindowFlags WINDOW_OCCLUDED
window is occluded
Definition SDL3pp_video.h:534
WindowID GetID() const
Get the numeric ID of a window.
Definition SDL3pp_video.h:4827
void SetIcon(SurfaceRef icon)
Set the icon for a window.
Definition SDL3pp_video.h:5270
constexpr FlashOperation FLASH_UNTIL_FOCUSED
Flash the window until it gets focus.
Definition SDL3pp_video.h:631
void SetMinimumSize(const PointRaw &p)
Set the minimum size of a window's client area.
Definition SDL3pp_video.h:5757
static Display GetForPoint(const PointRaw &point)
Get the display containing a point.
Definition SDL3pp_video.h:4080
const DisplayMode & GetWindowFullscreenMode(WindowRef window)
Query the display mode to use when a window is visible at fullscreen.
Definition SDL3pp_video.h:4249
float GetProgressValue()
Get the value of the progress bar for the given window’s taskbar icon.
Definition SDL3pp_video.h:7001
OwnPtr< void > GetWindowICCProfile(WindowRef window)
Get the raw ICC profile data for the screen the window is currently on.
Definition SDL3pp_video.h:4270
void GetWindowPosition(WindowRef window, int *x, int *y)
Get the position of a window.
Definition SDL3pp_video.h:5342
void Minimize()
Request that the window be minimized to an iconic representation.
Definition SDL3pp_video.h:6092
SystemTheme GetSystemTheme()
Get the current system theme.
Definition SDL3pp_video.h:3640
void SetTitle(StringParam title)
Set the title of a window.
Definition SDL3pp_video.h:5215
static Display GetForRect(const RectRaw &rect)
Get the display primarily containing a rect.
Definition SDL3pp_video.h:4105
DisplayOrientation GetCurrentOrientation() const
Get the orientation of a display.
Definition SDL3pp_video.h:3878
void GetWindowMinimumSize(WindowRef window, int *w, int *h)
Get the minimum size of a window's client area.
Definition SDL3pp_video.h:5779
constexpr WindowFlags WINDOW_NOT_FOCUSABLE
window should not be focusable
Definition SDL3pp_video.h:615
constexpr ProgressState PROGRESS_STATE_ERROR
The progress bar is shown in a state indicating the application had an error.
Definition SDL3pp_video.h:745
constexpr GLContextResetNotification GL_CONTEXT_RESET_NO_NOTIFICATION
NO_NOTIFICATION.
Definition SDL3pp_video.h:3565
void FlashWindow(WindowRef window, FlashOperation operation)
Request a window to demand attention from the user.
Definition SDL3pp_video.h:6908
Surface GetWindowSurface(WindowRef window)
Get the SDL surface associated with the window.
Definition SDL3pp_video.h:6250
int GetWindowSurfaceVSync(WindowRef window)
Get VSync for the window surface.
Definition SDL3pp_video.h:6310
bool SyncWindow(WindowRef window)
Block until any pending window state is finalized.
Definition SDL3pp_video.h:6196
constexpr GLAttr GL_FLOATBUFFERS
GL_FLOATBUFFERS.
Definition SDL3pp_video.h:3505
void SetWindowRect(WindowRef window, Rect rect)
Request the window's position and size to be set.
Definition SDL3pp_video.h:5498
Point GetSize() const
Get the size of a window's client area.
Definition SDL3pp_video.h:5484
void SetWindowParent(WindowRef window, WindowRef parent)
Set the window as a child of a parent window.
Definition SDL3pp_video.h:6672
void SetWindowBordered(WindowRef window, bool bordered)
Set the border state of a window.
Definition SDL3pp_video.h:5859
GLContext GL_GetCurrentContext()
Get the currently active OpenGL context.
Definition SDL3pp_video.h:7379
constexpr WindowFlags WINDOW_RESIZABLE
window can be resized
Definition SDL3pp_video.h:546
bool GetKeyboardGrab() const
Get a window's keyboard grab mode.
Definition SDL3pp_video.h:6487
OwnArray< WindowRef > GetWindows()
Get a list of valid windows.
Definition SDL3pp_video.h:4312
constexpr WindowFlags WINDOW_POPUP_MENU
window should be treated as a popup menu, requires a parent window
Definition SDL3pp_video.h:594
void SetOpacity(float opacity)
Set the opacity for a window.
Definition SDL3pp_video.h:6610
GLContext(WindowRef window)
Create an OpenGL context for an OpenGL window, and make it current.
Definition SDL3pp_video.h:7316
constexpr GLContextResetNotification GL_CONTEXT_RESET_LOSE_CONTEXT
LOSE_CONTEXT.
Definition SDL3pp_video.h:3568
void GL_ResetAttributes()
Reset all previously set OpenGL context attributes to their default values.
Definition SDL3pp_video.h:7235
void Destroy()
Delete an OpenGL context.
Definition SDL3pp_video.h:7558
constexpr WindowFlags WINDOW_EXTERNAL
window not created by SDL
Definition SDL3pp_video.h:564
SDL_DisplayMode DisplayMode
The structure that defines a display mode.
Definition SDL3pp_video.h:129
ResourceRefT< WindowBase > WindowRef
Reference for Window.
Definition SDL3pp_video.h:57
OwnArray< DisplayID > GetDisplays()
Get a list of currently connected displays.
Definition SDL3pp_video.h:3652
constexpr WindowFlags WINDOW_ALWAYS_ON_TOP
window should always be above others
Definition SDL3pp_video.h:578
void MaximizeWindow(WindowRef window)
Request that the window be made as large as possible.
Definition SDL3pp_video.h:6054
void MinimizeWindow(WindowRef window)
Request that the window be minimized to an iconic representation.
Definition SDL3pp_video.h:6087
constexpr WindowFlags WINDOW_HIDDEN
window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; ShowWindow() is ...
Definition SDL3pp_video.h:541
constexpr GLAttr GL_SHARE_WITH_CURRENT_CONTEXT
OpenGL context sharing; defaults to 0.
Definition SDL3pp_video.h:3480
void GetWindowSize(WindowRef window, int *w, int *h)
Get the size of a window's client area.
Definition SDL3pp_video.h:5447
EGLConfig EGL_GetCurrentConfig()
Get the currently active EGL config.
Definition SDL3pp_video.h:7406
static Display GetPrimary()
Return the primary display.
Definition SDL3pp_video.h:3677
constexpr HitTestResult HITTEST_RESIZE_BOTTOM
Region is the resizable bottom border.
Definition SDL3pp_video.h:670
Rect GetUsableBounds() const
Get the usable desktop area represented by a display, in screen coordinates.
Definition SDL3pp_video.h:3832
void SetWindowFullscreen(WindowRef window, bool fullscreen)
Request that the window's fullscreen state be changed.
Definition SDL3pp_video.h:6157
void Flash(FlashOperation operation)
Request a window to demand attention from the user.
Definition SDL3pp_video.h:6913
void DestroyWindow(WindowRaw window)
Destroy a window.
Definition SDL3pp_video.h:7027
void SetParent(WindowRef parent)
Set the window as a child of a parent window.
Definition SDL3pp_video.h:6677
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:3433
WindowRef GetWindowFromID(WindowID id)
Get a window from a stored ID.
Definition SDL3pp_video.h:4845
constexpr WindowFlags WINDOW_FULLSCREEN
window is in fullscreen mode
Definition SDL3pp_video.h:528
OwnPtr< void > GetICCProfile() const
Get the raw ICC profile data for the screen the window is currently on.
Definition SDL3pp_video.h:4276
constexpr GLContextReleaseFlag GL_CONTEXT_RELEASE_BEHAVIOR_NONE
BEHAVIOR_NONE.
Definition SDL3pp_video.h:3552
void SetWindowFocusable(WindowRef window, bool focusable)
Set whether the window may have input focus.
Definition SDL3pp_video.h:6720
void UpdateWindowSurface(WindowRef window)
Copy the window surface to the screen.
Definition SDL3pp_video.h:6340
void GL_LoadLibrary(StringParam path)
Dynamically load an OpenGL library.
Definition SDL3pp_video.h:7104
constexpr GLAttr GL_DEPTH_SIZE
the minimum number of bits in the depth buffer; defaults to 16.
Definition SDL3pp_video.h:3412
void SetProgressValue(float value)
Sets the value of the progress bar for the given window’s taskbar icon.
Definition SDL3pp_video.h:6980
constexpr int WINDOWPOS_CENTERED_MASK
A magic value used with WINDOWPOS_CENTERED.
Definition SDL3pp_video.h:3129
EGLDisplay EGL_GetCurrentDisplay()
Get the currently active EGL display.
Definition SDL3pp_video.h:7391
constexpr ProgressState PROGRESS_STATE_INDETERMINATE
The progress bar is shown in a indeterminate state.
Definition SDL3pp_video.h:732
constexpr GLContextReleaseFlag GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH
BEHAVIOR_FLUSH.
Definition SDL3pp_video.h:3555
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:3457
Rect GetRect() const
Get the position and client size of a window.
Definition SDL3pp_video.h:5525
float GetWindowOpacity(WindowRef window)
Get the opacity of a window.
Definition SDL3pp_video.h:6631
GLContext GL_CreateContext(WindowRef window)
Create an OpenGL context for an OpenGL window, and make it current.
Definition SDL3pp_video.h:7309
constexpr bool WINDOWPOS_ISCENTERED(int X)
A macro to test if the window position is marked as "centered.".
Definition SDL3pp_video.h:3168
bool HasSurface() const
Return whether the window has a surface associated with it.
Definition SDL3pp_video.h:6218
Properties for Display.
Definition SDL3pp_video.h:3730
constexpr auto KMSDRM_PANEL_ORIENTATION_NUMBER
Number for kmsdrm panel orientation.
Definition SDL3pp_video.h:3735
constexpr auto WINDOWS_HMONITOR_POINTER
Pointer to windows hmonitor.
Definition SDL3pp_video.h:3744
constexpr auto HDR_ENABLED_BOOLEAN
Hdr enabled enabled.
Definition SDL3pp_video.h:3732
constexpr auto WAYLAND_WL_OUTPUT_POINTER
Pointer to wayland wl output.
Definition SDL3pp_video.h:3741
Properties for Window creation.
Definition SDL3pp_video.h:4663
constexpr auto WINDOWSCENE_POINTER
Pointer to windowscene.
Definition SDL3pp_video.h:4759
constexpr auto WIN32_PIXEL_FORMAT_HWND_POINTER
Pointer to win32 pixel format hwnd.
Definition SDL3pp_video.h:4782
constexpr auto X_NUMBER
Number for x.
Definition SDL3pp_video.h:4747
constexpr auto COCOA_VIEW_POINTER
Pointer to cocoa view.
Definition SDL3pp_video.h:4754
constexpr auto WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN
Enable wayland surface role custom.
Definition SDL3pp_video.h:4764
constexpr auto UTILITY_BOOLEAN
Enable utility.
Definition SDL3pp_video.h:4738
constexpr auto FULLSCREEN_BOOLEAN
Enable fullscreen.
Definition SDL3pp_video.h:4689
constexpr auto HIGH_PIXEL_DENSITY_BOOLEAN
Enable high pixel density.
Definition SDL3pp_video.h:4698
constexpr auto COCOA_WINDOW_POINTER
Pointer to cocoa window.
Definition SDL3pp_video.h:4751
constexpr auto Y_NUMBER
Number for y.
Definition SDL3pp_video.h:4749
constexpr auto OPENGL_BOOLEAN
Enable opengl.
Definition SDL3pp_video.h:4720
constexpr auto VULKAN_BOOLEAN
Enable vulkan.
Definition SDL3pp_video.h:4741
constexpr auto PARENT_POINTER
Pointer to parent.
Definition SDL3pp_video.h:4723
constexpr auto X11_WINDOW_NUMBER
Number for x11 window.
Definition SDL3pp_video.h:4787
constexpr auto MAXIMIZED_BOOLEAN
Enable maximized.
Definition SDL3pp_video.h:4702
constexpr auto CONSTRAIN_POPUP_BOOLEAN
Enable constrain popup.
Definition SDL3pp_video.h:4673
constexpr auto WIN32_HWND_POINTER
Pointer to win32 hwnd.
Definition SDL3pp_video.h:4779
constexpr auto TITLE_STRING
String for title.
Definition SDL3pp_video.h:4729
constexpr auto HEIGHT_NUMBER
Number for height.
Definition SDL3pp_video.h:4692
constexpr auto EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN
Enable external graphics context.
Definition SDL3pp_video.h:4681
constexpr auto WAYLAND_CREATE_EGL_WINDOW_BOOLEAN
Enable wayland create egl window.
Definition SDL3pp_video.h:4770
constexpr auto TRANSPARENT_BOOLEAN
Enable transparent.
Definition SDL3pp_video.h:4732
constexpr auto MINIMIZED_BOOLEAN
Enable minimized.
Definition SDL3pp_video.h:4711
constexpr auto HIDDEN_BOOLEAN
Enable hidden.
Definition SDL3pp_video.h:4695
constexpr auto MOUSE_GRABBED_BOOLEAN
Enable mouse grabbed.
Definition SDL3pp_video.h:4717
constexpr auto ALWAYS_ON_TOP_BOOLEAN
Enable always on top.
Definition SDL3pp_video.h:4665
constexpr auto FLAGS_NUMBER
Number for flags.
Definition SDL3pp_video.h:4686
constexpr auto EMSCRIPTEN_CANVAS_ID_STRING
String for emscripten canvas id.
Definition SDL3pp_video.h:4792
constexpr auto EMSCRIPTEN_KEYBOARD_ELEMENT_STRING
String for emscripten keyboard element.
Definition SDL3pp_video.h:4796
constexpr auto TOOLTIP_BOOLEAN
Enable tooltip.
Definition SDL3pp_video.h:4735
constexpr auto MENU_BOOLEAN
Enable menu.
Definition SDL3pp_video.h:4705
constexpr auto WIDTH_NUMBER
Number for width.
Definition SDL3pp_video.h:4744
constexpr auto WAYLAND_WL_SURFACE_POINTER
Pointer to wayland wl surface.
Definition SDL3pp_video.h:4775
constexpr auto METAL_BOOLEAN
Enable metal.
Definition SDL3pp_video.h:4708
constexpr auto RESIZABLE_BOOLEAN
Enable resizable.
Definition SDL3pp_video.h:4726
constexpr auto MODAL_BOOLEAN
Enable modal.
Definition SDL3pp_video.h:4714
constexpr auto BORDERLESS_BOOLEAN
Enable borderless.
Definition SDL3pp_video.h:4668
constexpr auto FOCUSABLE_BOOLEAN
Enable focusable.
Definition SDL3pp_video.h:4678
Properties for Window.
Definition SDL3pp_video.h:4663
constexpr auto WIN32_HWND_POINTER
Pointer to win32 hwnd.
Definition SDL3pp_video.h:5100
constexpr auto HDR_ENABLED_BOOLEAN
Hdr enabled enabled.
Definition SDL3pp_video.h:5028
constexpr auto ANDROID_SURFACE_POINTER
Pointer to android surface.
Definition SDL3pp_video.h:5040
constexpr auto UIKIT_OPENGL_RENDERBUFFER_NUMBER
Number for uikit opengl renderbuffer.
Definition SDL3pp_video.h:5054
constexpr auto ANDROID_WINDOW_POINTER
Pointer to android window.
Definition SDL3pp_video.h:5037
constexpr auto KMSDRM_DEVICE_INDEX_NUMBER
Number for kmsdrm device index.
Definition SDL3pp_video.h:5063
constexpr auto HDR_HEADROOM_FLOAT
Float for hdr headroom.
Definition SDL3pp_video.h:5034
constexpr auto WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING
String for wayland xdg toplevel export handle.
Definition SDL3pp_video.h:5130
constexpr auto EMSCRIPTEN_KEYBOARD_ELEMENT_STRING
String for emscripten keyboard element.
Definition SDL3pp_video.h:5158
constexpr auto UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER
Number for uikit opengl resolve framebuffer.
Definition SDL3pp_video.h:5058
constexpr auto OPENVR_OVERLAY_ID_NUMBER
Number for openvr overlay id.
Definition SDL3pp_video.h:5082
constexpr auto WAYLAND_EGL_WINDOW_POINTER
Pointer to wayland egl window.
Definition SDL3pp_video.h:5118
constexpr auto SDR_WHITE_LEVEL_FLOAT
Float for sdr white level.
Definition SDL3pp_video.h:5031
constexpr auto WIN32_HDC_POINTER
Pointer to win32 hdc.
Definition SDL3pp_video.h:5103
constexpr auto WAYLAND_VIEWPORT_POINTER
Pointer to wayland viewport.
Definition SDL3pp_video.h:5115
constexpr auto VIVANTE_DISPLAY_POINTER
Pointer to vivante display.
Definition SDL3pp_video.h:5091
constexpr auto EMSCRIPTEN_CANVAS_ID_STRING
String for emscripten canvas id.
Definition SDL3pp_video.h:5154
constexpr auto VIVANTE_WINDOW_POINTER
Pointer to vivante window.
Definition SDL3pp_video.h:5094
constexpr auto UIKIT_METAL_VIEW_TAG_NUMBER
Number for uikit metal view tag.
Definition SDL3pp_video.h:5046
constexpr auto SHAPE_POINTER
Pointer to shape.
Definition SDL3pp_video.h:5025
constexpr auto WAYLAND_XDG_TOPLEVEL_POINTER
Pointer to wayland xdg toplevel.
Definition SDL3pp_video.h:5126
constexpr auto UIKIT_WINDOW_POINTER
Pointer to uikit window.
Definition SDL3pp_video.h:5043
constexpr auto WAYLAND_SURFACE_POINTER
Pointer to wayland surface.
Definition SDL3pp_video.h:5112
constexpr auto VIVANTE_SURFACE_POINTER
Pointer to vivante surface.
Definition SDL3pp_video.h:5097
constexpr auto WAYLAND_XDG_POSITIONER_POINTER
Pointer to wayland xdg positioner.
Definition SDL3pp_video.h:5139
constexpr auto UIKIT_OPENGL_FRAMEBUFFER_NUMBER
Number for uikit opengl framebuffer.
Definition SDL3pp_video.h:5050
constexpr auto COCOA_WINDOW_POINTER
Pointer to cocoa window.
Definition SDL3pp_video.h:5073
constexpr auto WAYLAND_DISPLAY_POINTER
Pointer to wayland display.
Definition SDL3pp_video.h:5109
constexpr auto X11_WINDOW_NUMBER
Number for x11 window.
Definition SDL3pp_video.h:5149
constexpr auto WAYLAND_XDG_POPUP_POINTER
Pointer to wayland xdg popup.
Definition SDL3pp_video.h:5136
constexpr auto X11_SCREEN_NUMBER
Number for x11 screen.
Definition SDL3pp_video.h:5146
constexpr auto KMSDRM_GBM_DEVICE_POINTER
Pointer to kmsdrm gbm device.
Definition SDL3pp_video.h:5070
constexpr auto COCOA_METAL_VIEW_TAG_NUMBER
Number for cocoa metal view tag.
Definition SDL3pp_video.h:5076
constexpr auto X11_DISPLAY_POINTER
Pointer to x11 display.
Definition SDL3pp_video.h:5143
constexpr auto WAYLAND_XDG_SURFACE_POINTER
Pointer to wayland xdg surface.
Definition SDL3pp_video.h:5122
constexpr auto KMSDRM_DRM_FD_NUMBER
Number for kmsdrm drm fd.
Definition SDL3pp_video.h:5067
constexpr auto WIN32_INSTANCE_POINTER
Pointer to win32 instance.
Definition SDL3pp_video.h:5106
Main include header for the SDL3pp library.
Sint32 narrowS32(T value)
Narrows to Sint32.
Definition SDL3pp_stdinc.h:6263
RAII owning version GLContext.
Definition SDL3pp_video.h:3252
constexpr GLContextScoped(GLContextScoped &&other) noexcept
Move constructor.
Definition SDL3pp_video.h:3258
GLContext(WindowRef window)
Create an OpenGL context for an OpenGL window, and make it current.
Definition SDL3pp_video.h:7316
constexpr GLContextScoped(GLContext &&other) noexcept
Move constructor.
Definition SDL3pp_video.h:3264
~GLContextScoped()
Destructor.
Definition SDL3pp_video.h:3270
An opaque handle to an OpenGL context.
Definition SDL3pp_video.h:3186
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
Definition SDL3pp_callbackWrapper.h:197
The structure that defines a point (using integers).
Definition SDL3pp_rect.h:97
A rectangle, with the origin at the upper left (using integers).
Definition SDL3pp_rect.h:706
constexpr Point GetTopLeft() const
Get top left corner of the rect.
Definition SDL3pp_rect.h:970
constexpr Point GetSize() const
Get size of the rect.
Definition SDL3pp_rect.h:1023
Base class to Renderer.
Definition SDL3pp_render.h:221
A structure representing rendering state.
Definition SDL3pp_render.h:2087
A non-owning reference wrapper for a given resource.
Definition SDL3pp_resource.h:93
A collection of pixels used in software blitting.
Definition SDL3pp_surface.h:1677
static Surface borrow(SurfaceRaw resource)
Safely borrows the from SurfaceRaw.
Definition SDL3pp_surface.h:1844
Base class to Window.
Definition SDL3pp_video.h:755
constexpr ResourceBaseT()=default
Default constructor, creates null/invalid resource.
The struct used as an opaque handle to a window.
Definition SDL3pp_video.h:2724
constexpr Window(WindowRaw resource) noexcept
Constructs from raw Window.
Definition SDL3pp_video.h:2734
constexpr Window & operator=(Window &&other) noexcept
Assignment operator.
Definition SDL3pp_video.h:3058
~Window()
Destructor.
Definition SDL3pp_video.h:3055
constexpr Window(Window &&other) noexcept
Move constructor.
Definition SDL3pp_video.h:2740