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 Window;
45
47using WindowRaw = SDL_Window*;
48
55
56// Forward decl
57struct GLContext;
58
60using GLContextRaw = SDL_GLContext;
61
62// Forward decl
63struct GLContextScoped;
64
67
68struct Renderer;
69
76
82using DisplayOrientation = SDL_DisplayOrientation;
83
85 SDL_ORIENTATION_UNKNOWN;
86
91constexpr DisplayOrientation ORIENTATION_LANDSCAPE = SDL_ORIENTATION_LANDSCAPE;
92
98 SDL_ORIENTATION_LANDSCAPE_FLIPPED;
99
101 SDL_ORIENTATION_PORTRAIT;
102
104 SDL_ORIENTATION_PORTRAIT_FLIPPED;
106
118using DisplayMode = SDL_DisplayMode;
119
131{
132 DisplayID m_displayID;
133
134public:
140 constexpr Display(DisplayID displayID = {}) noexcept
141 : m_displayID(displayID)
142 {
143 }
144
150 constexpr operator DisplayID() const noexcept { return m_displayID; }
151
165 static Display GetPrimary();
166
181 static Display GetForPoint(const PointRaw& point);
182
198 static Display GetForRect(const RectRaw& rect);
199
236
249 const char* GetName() const;
250
267 Rect GetBounds() const;
268
291 Rect GetUsableBounds() const;
292
306
320
345 float GetContentScale() const;
346
369
396 float refresh_rate,
397 bool include_high_density_modes) const;
398
417 const DisplayMode& GetDesktopMode() const;
418
437 const DisplayMode& GetCurrentMode() const;
438};
439
447using WindowID = SDL_WindowID;
448
449namespace prop::Global {
450
465constexpr auto VIDEO_WAYLAND_WL_DISPLAY_POINTER =
466 SDL_PROP_GLOBAL_VIDEO_WAYLAND_WL_DISPLAY_POINTER;
467
468} // namespace prop::Global
469
475using SystemTheme = SDL_SystemTheme;
476
478 SDL_SYSTEM_THEME_UNKNOWN;
479
481 SDL_SYSTEM_THEME_LIGHT;
482
484 SDL_SYSTEM_THEME_DARK;
485
495using DisplayModeData = SDL_DisplayModeData;
496
516
518 SDL_WINDOW_FULLSCREEN;
519
521 SDL_WINDOW_OPENGL;
522
524 SDL_WINDOW_OCCLUDED;
525
530constexpr WindowFlags WINDOW_HIDDEN = SDL_WINDOW_HIDDEN;
531
533 SDL_WINDOW_BORDERLESS;
534
536 SDL_WINDOW_RESIZABLE;
537
539 SDL_WINDOW_MINIMIZED;
540
542 SDL_WINDOW_MAXIMIZED;
543
545 SDL_WINDOW_MOUSE_GRABBED;
546
548 SDL_WINDOW_INPUT_FOCUS;
549
551 SDL_WINDOW_MOUSE_FOCUS;
552
554 SDL_WINDOW_EXTERNAL;
555
556constexpr WindowFlags WINDOW_MODAL = SDL_WINDOW_MODAL;
557
559constexpr WindowFlags WINDOW_HIGH_PIXEL_DENSITY = SDL_WINDOW_HIGH_PIXEL_DENSITY;
560
562constexpr WindowFlags WINDOW_MOUSE_CAPTURE = SDL_WINDOW_MOUSE_CAPTURE;
563
565 SDL_WINDOW_MOUSE_RELATIVE_MODE;
566
568 SDL_WINDOW_ALWAYS_ON_TOP;
569
574constexpr WindowFlags WINDOW_UTILITY = SDL_WINDOW_UTILITY;
575
580constexpr WindowFlags WINDOW_TOOLTIP = SDL_WINDOW_TOOLTIP;
581
583constexpr WindowFlags WINDOW_POPUP_MENU = SDL_WINDOW_POPUP_MENU;
584
586 SDL_WINDOW_KEYBOARD_GRABBED;
587
588#if SDL_VERSION_ATLEAST(3, 4, 0)
589
591constexpr WindowFlags WINDOW_FILL_DOCUMENT = SDL_WINDOW_FILL_DOCUMENT;
592
593#endif // SDL_VERSION_ATLEAST(3, 4, 0)
594
596 SDL_WINDOW_VULKAN;
597
599 SDL_WINDOW_METAL;
600
602 SDL_WINDOW_TRANSPARENT;
603
605 SDL_WINDOW_NOT_FOCUSABLE;
606
612using FlashOperation = SDL_FlashOperation;
613
615 SDL_FLASH_CANCEL;
616
618 SDL_FLASH_BRIEFLY;
619
621 SDL_FLASH_UNTIL_FOCUSED;
622
633using HitTestResult = SDL_HitTestResult;
634
636 SDL_HITTEST_NORMAL;
637
639 SDL_HITTEST_DRAGGABLE;
640
642 SDL_HITTEST_RESIZE_TOPLEFT;
644
646 SDL_HITTEST_RESIZE_TOP;
647
649 SDL_HITTEST_RESIZE_TOPRIGHT;
651
653 SDL_HITTEST_RESIZE_RIGHT;
654
657 SDL_HITTEST_RESIZE_BOTTOMRIGHT;
658
660 SDL_HITTEST_RESIZE_BOTTOM;
661
663 SDL_HITTEST_RESIZE_BOTTOMLEFT;
665
667 SDL_HITTEST_RESIZE_LEFT;
668
679using HitTest = HitTestResult(SDLCALL*)(WindowRaw win,
680 const PointRaw* area,
681 void* data);
682
697
703using EGLSurface = SDL_EGLSurface;
704
705#if SDL_VERSION_ATLEAST(3, 4, 0)
706
712using ProgressState = SDL_ProgressState;
713
715constexpr ProgressState PROGRESS_STATE_INVALID = SDL_PROGRESS_STATE_INVALID;
716
718 SDL_PROGRESS_STATE_NONE;
719
722 SDL_PROGRESS_STATE_INDETERMINATE;
724
726 SDL_PROGRESS_STATE_NORMAL;
727
729 SDL_PROGRESS_STATE_PAUSED;
730
734constexpr ProgressState PROGRESS_STATE_ERROR = SDL_PROGRESS_STATE_ERROR;
735
736#endif // SDL_VERSION_ATLEAST(3, 4, 0)
737
747struct Window : ResourceBase<WindowRaw>
748{
750
758 constexpr explicit Window(WindowRaw resource) noexcept
759 : ResourceBase(resource)
760 {
761 }
762
764 constexpr Window(const Window& other) = delete;
765
767 constexpr Window(Window&& other) noexcept
768 : Window(other.release())
769 {
770 }
771
772 constexpr Window(const WindowRef& other) = delete;
773
774 constexpr Window(WindowRef&& other) = delete;
775
793 Window(StringParam title,
794 const PointRaw& size,
795 WindowFlags window_flags,
796 RendererRef* renderer);
797
883 Window(StringParam title, const PointRaw& size, WindowFlags flags = 0);
884
956 Window(WindowRef parent,
957 const PointRaw& offset,
958 const PointRaw& size,
959 WindowFlags flags = 0);
960
1105 Window(PropertiesRef props);
1106
1108 ~Window() { SDL_DestroyWindow(get()); }
1109
1111 constexpr Window& operator=(Window&& other) noexcept
1112 {
1113 swap(*this, other);
1114 return *this;
1115 }
1116
1118 Window& operator=(const Window& other) = delete;
1119
1138 void Destroy();
1139
1156 static WindowRef FromID(WindowID id);
1157
1170 static WindowRef GetGrabbed();
1171
1186 Display GetDisplay() const;
1187
1204 float GetPixelDensity() const;
1205
1227 float GetDisplayScale() const;
1228
1261
1275 const DisplayMode& GetFullscreenMode() const;
1276
1288
1300
1316 WindowID GetID() const;
1317
1330 WindowRef GetParent() const;
1331
1457
1476 WindowFlags GetFlags() const;
1477
1492 void SetTitle(StringParam title);
1493
1506 const char* GetTitle() const;
1507
1531 void SetIcon(SurfaceRef icon);
1532
1568 void SetPosition(const PointRaw& p);
1569
1591 void GetPosition(int* x, int* y) const;
1592
1612 Point GetPosition() const;
1613
1646 void SetSize(const PointRaw& size);
1647
1668 void GetSize(int* w, int* h) const;
1669
1690 Point GetSize() const;
1691
1703 void SetRect(Rect rect);
1704
1718 Rect GetRect() const;
1719
1736 Rect GetSafeArea() const;
1737
1774 void SetAspectRatio(float min_aspect, float max_aspect);
1775
1791 void GetAspectRatio(float* min_aspect, float* max_aspect) const;
1792
1825 void GetBordersSize(int* top, int* left, int* bottom, int* right) const;
1826
1844 void GetSizeInPixels(int* w, int* h) const;
1845
1861 Point GetSizeInPixels() const;
1862
1876 void SetMinimumSize(const PointRaw& p);
1877
1894 void GetMinimumSize(int* w, int* h) const;
1895
1909 void SetMaximumSize(const PointRaw& p);
1910
1927 void GetMaximumSize(int* w, int* h) const;
1928
1947 void SetBordered(bool bordered);
1948
1967 void SetResizable(bool resizable);
1968
1984 void SetAlwaysOnTop(bool on_top);
1985
1986#if SDL_VERSION_ATLEAST(3, 4, 0)
1987
2015 void SetFillDocument(bool fill);
2016
2017#endif // SDL_VERSION_ATLEAST(3, 4, 0)
2018
2031 void Show();
2032
2045 void Hide();
2046
2063 void Raise();
2064
2095 void Maximize();
2096
2122 void Minimize();
2123
2150 void Restore();
2151
2180 void SetFullscreen(bool fullscreen);
2181
2209 bool Sync();
2210
2223 bool HasSurface() const;
2224
2252
2275 void SetSurfaceVSync(int vsync);
2276
2290 int GetSurfaceVSync() const;
2291
2309 void UpdateSurface();
2310
2336
2349 void DestroySurface();
2350
2380 void SetKeyboardGrab(bool grabbed);
2381
2398 void SetMouseGrab(bool grabbed);
2399
2411 bool GetKeyboardGrab() const;
2412
2427 bool GetMouseGrab() const;
2428
2447 void SetMouseRect(const RectRaw& rect);
2448
2463 const RectRaw* GetMouseRect() const;
2464
2482 void SetOpacity(float opacity);
2483
2499 float GetOpacity() const;
2500
2531 void SetParent(WindowRef parent);
2532
2549 void SetModal(bool modal);
2550
2561 void SetFocusable(bool focusable);
2562
2582 void ShowSystemMenu(const PointRaw& p);
2583
2624 void SetHitTest(HitTest callback, void* callback_data);
2625
2667 void SetHitTest(HitTestCB callback);
2668
2693 void SetShape(SurfaceRef shape);
2694
2705 void Flash(FlashOperation operation);
2706
2707#if SDL_VERSION_ATLEAST(3, 4, 0)
2708
2720 void SetProgressState(ProgressState state);
2721
2733
2745 void SetProgressValue(float value);
2746
2757 float GetProgressValue();
2758
2759#endif // SDL_VERSION_ATLEAST(3, 4, 0)
2760
2789
2804 void MakeCurrent(GLContext context);
2805
2817
2834 void GL_Swap();
2835
2860 void StartTextInput();
2861
2910 void StartTextInput(PropertiesRef props);
2911
2923 bool IsTextInputActive() const;
2924
2939 void StopTextInput();
2940
2953 void ClearComposition();
2954
2974 void SetTextInputArea(const RectRaw& rect, int cursor);
2975
2993 void GetTextInputArea(RectRaw* rect, int* cursor);
2994
3006 bool IsScreenKeyboardShown() const;
3007
3026 void WarpMouse(const FPointRaw& p);
3027
3052 void SetRelativeMouseMode(bool enabled);
3053
3065 bool GetRelativeMouseMode() const;
3066
3077 RendererRef GetRenderer() const;
3078};
3079
3090constexpr int WINDOWPOS_UNDEFINED_MASK = SDL_WINDOWPOS_UNDEFINED_MASK;
3091
3105{
3106 return SDL_WINDOWPOS_UNDEFINED_DISPLAY(X);
3107}
3108
3118constexpr int WINDOWPOS_UNDEFINED = SDL_WINDOWPOS_UNDEFINED;
3119
3129constexpr bool WINDOWPOS_ISUNDEFINED(int X)
3130{
3131 return SDL_WINDOWPOS_ISUNDEFINED(X);
3132}
3133
3144constexpr int WINDOWPOS_CENTERED_MASK = SDL_WINDOWPOS_CENTERED_MASK;
3145
3158constexpr int WINDOWPOS_CENTERED_DISPLAY(int X)
3159{
3160 return SDL_WINDOWPOS_CENTERED_DISPLAY(X);
3161}
3162
3172constexpr int WINDOWPOS_CENTERED = SDL_WINDOWPOS_CENTERED;
3173
3183constexpr bool WINDOWPOS_ISCENTERED(int X)
3184{
3185 return SDL_WINDOWPOS_ISCENTERED(X);
3186}
3187
3200struct GLContext : ResourceBase<GLContextRaw>
3201{
3203
3233
3235 constexpr operator GLContextRaw() const noexcept { return get(); }
3236
3246 void Destroy();
3247
3262 void MakeCurrent(WindowRef window);
3263};
3264
3266struct GLContextScoped : GLContext
3267{
3269
3270 constexpr GLContextScoped(const GLContextScoped& other) = delete;
3271
3273 constexpr GLContextScoped(GLContextScoped&& other) noexcept
3274 : GLContext(other.release())
3275 {
3276 }
3277
3279 constexpr GLContextScoped(GLContext&& other) noexcept
3280 : GLContext(std::move(other).release())
3281 {
3282 }
3283
3285 ~GLContextScoped() { SDL_GL_DestroyContext(release()); }
3286};
3287
3293using EGLDisplay = SDL_EGLDisplay;
3294
3300using EGLConfig = SDL_EGLConfig;
3301
3307using EGLAttrib = SDL_EGLAttrib;
3308
3314using EGLint = SDL_EGLint;
3315
3339using EGLAttribArrayCallback = EGLAttrib*(SDLCALL*)(void* userdata);
3340
3370using EGLIntArrayCallback = EGLint*(SDLCALL*)(void* userdata,
3371 EGLDisplay display,
3372 EGLConfig config);
3373
3391using GLAttr = SDL_GLAttr;
3392
3397constexpr GLAttr GL_RED_SIZE = SDL_GL_RED_SIZE;
3398
3403constexpr GLAttr GL_GREEN_SIZE = SDL_GL_GREEN_SIZE;
3404
3409constexpr GLAttr GL_BLUE_SIZE = SDL_GL_BLUE_SIZE;
3410
3415constexpr GLAttr GL_ALPHA_SIZE = SDL_GL_ALPHA_SIZE;
3416
3418constexpr GLAttr GL_BUFFER_SIZE = SDL_GL_BUFFER_SIZE;
3419
3424constexpr GLAttr GL_DOUBLEBUFFER = SDL_GL_DOUBLEBUFFER;
3425
3427constexpr GLAttr GL_DEPTH_SIZE = SDL_GL_DEPTH_SIZE;
3428
3430constexpr GLAttr GL_STENCIL_SIZE = SDL_GL_STENCIL_SIZE;
3431
3436constexpr GLAttr GL_ACCUM_RED_SIZE = SDL_GL_ACCUM_RED_SIZE;
3437
3442constexpr GLAttr GL_ACCUM_GREEN_SIZE = SDL_GL_ACCUM_GREEN_SIZE;
3443
3448constexpr GLAttr GL_ACCUM_BLUE_SIZE = SDL_GL_ACCUM_BLUE_SIZE;
3449
3454constexpr GLAttr GL_ACCUM_ALPHA_SIZE = SDL_GL_ACCUM_ALPHA_SIZE;
3455
3457 SDL_GL_STEREO;
3458
3460constexpr GLAttr GL_MULTISAMPLEBUFFERS = SDL_GL_MULTISAMPLEBUFFERS;
3461
3466constexpr GLAttr GL_MULTISAMPLESAMPLES = SDL_GL_MULTISAMPLESAMPLES;
3467
3472constexpr GLAttr GL_ACCELERATED_VISUAL = SDL_GL_ACCELERATED_VISUAL;
3473
3475 SDL_GL_RETAINED_BACKING;
3476
3478 SDL_GL_CONTEXT_MAJOR_VERSION;
3479
3481 SDL_GL_CONTEXT_MINOR_VERSION;
3482
3487constexpr GLAttr GL_CONTEXT_FLAGS = SDL_GL_CONTEXT_FLAGS;
3488
3493constexpr GLAttr GL_CONTEXT_PROFILE_MASK = SDL_GL_CONTEXT_PROFILE_MASK;
3494
3496 SDL_GL_SHARE_WITH_CURRENT_CONTEXT;
3497
3502constexpr GLAttr GL_FRAMEBUFFER_SRGB_CAPABLE = SDL_GL_FRAMEBUFFER_SRGB_CAPABLE;
3503
3508constexpr GLAttr GL_CONTEXT_RELEASE_BEHAVIOR = SDL_GL_CONTEXT_RELEASE_BEHAVIOR;
3509
3515 SDL_GL_CONTEXT_RESET_NOTIFICATION;
3516
3518 SDL_GL_CONTEXT_NO_ERROR;
3519
3520constexpr GLAttr GL_FLOATBUFFERS = SDL_GL_FLOATBUFFERS;
3521
3522constexpr GLAttr GL_EGL_PLATFORM = SDL_GL_EGL_PLATFORM;
3523
3530
3532 SDL_GL_CONTEXT_PROFILE_CORE;
3533
3535 SDL_GL_CONTEXT_PROFILE_COMPATIBILITY;
3537
3539 SDL_GL_CONTEXT_PROFILE_ES;
3540
3547
3549 SDL_GL_CONTEXT_DEBUG_FLAG;
3550
3552 SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG;
3553
3555 SDL_GL_CONTEXT_ROBUST_ACCESS_FLAG;
3556
3558 SDL_GL_CONTEXT_RESET_ISOLATION_FLAG;
3559
3566
3568 SDL_GL_CONTEXT_RELEASE_BEHAVIOR_NONE;
3569
3571 SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH;
3572
3579
3581 SDL_GL_CONTEXT_RESET_NO_NOTIFICATION;
3582
3584 SDL_GL_CONTEXT_RESET_LOSE_CONTEXT;
3585
3597inline int GetNumVideoDrivers() { return SDL_GetNumVideoDrivers(); }
3598
3619inline const char* GetVideoDriver(int index)
3620{
3621 return SDL_GetVideoDriver(index);
3622}
3623
3641inline const char* GetCurrentVideoDriver()
3642{
3643 return SDL_GetCurrentVideoDriver();
3644}
3645
3655inline SystemTheme GetSystemTheme() { return SDL_GetSystemTheme(); }
3656
3668{
3669 int count = 0;
3670 auto data = SDL_GetDisplays(&count);
3671 return OwnArray<DisplayID>{data, size_t(count)};
3672}
3673
3688{
3689 return CheckError(SDL_GetPrimaryDisplay());
3690}
3691
3693
3731{
3732 return {CheckError(SDL_GetDisplayProperties(displayID))};
3733}
3734
3736{
3737 return SDL::GetDisplayProperties(m_displayID);
3738}
3739
3745namespace prop::Display {
3746
3747constexpr auto HDR_ENABLED_BOOLEAN = SDL_PROP_DISPLAY_HDR_ENABLED_BOOLEAN;
3748
3749constexpr auto KMSDRM_PANEL_ORIENTATION_NUMBER =
3750 SDL_PROP_DISPLAY_KMSDRM_PANEL_ORIENTATION_NUMBER;
3751
3752#if SDL_VERSION_ATLEAST(3, 4, 0)
3753
3754constexpr auto WAYLAND_WL_OUTPUT_POINTER =
3755 SDL_PROP_DISPLAY_WAYLAND_WL_OUTPUT_POINTER;
3756
3757constexpr auto WINDOWS_HMONITOR_POINTER =
3758 SDL_PROP_DISPLAY_WINDOWS_HMONITOR_POINTER;
3759
3760#endif // SDL_VERSION_ATLEAST(3, 4, 0)
3761
3762} // namespace prop::Display
3763
3777inline const char* GetDisplayName(DisplayID displayID)
3778{
3779 return SDL_GetDisplayName(displayID);
3780}
3781
3782inline const char* Display::GetName() const
3783{
3784 return SDL::GetDisplayName(m_displayID);
3785}
3786
3805{
3806 Rect bounds;
3807 SDL_GetDisplayBounds(displayID, &bounds);
3808 return bounds;
3809}
3810
3812{
3813 return SDL::GetDisplayBounds(m_displayID);
3814}
3815
3839{
3840 Rect bounds;
3841 SDL_GetDisplayUsableBounds(displayID, &bounds);
3842 return bounds;
3843}
3844
3846{
3847 return SDL::GetDisplayUsableBounds(m_displayID);
3848}
3849
3864{
3865 return SDL_GetNaturalDisplayOrientation(displayID);
3866}
3867
3872
3887{
3888 return SDL_GetCurrentDisplayOrientation(displayID);
3889}
3890
3895
3921inline float GetDisplayContentScale(DisplayID displayID)
3922{
3923 return SDL_GetDisplayContentScale(displayID);
3924}
3925
3926inline float Display::GetContentScale() const
3927{
3928 return SDL::GetDisplayContentScale(m_displayID);
3929}
3930
3954{
3955 int count = 0;
3956 auto data = CheckError(SDL_GetFullscreenDisplayModes(displayID, &count));
3957 return OwnArray<DisplayMode*>{data, size_t(count)};
3958}
3959
3961{
3962 return SDL::GetFullscreenDisplayModes(m_displayID);
3963}
3964
3992 Display displayID,
3993 const PointRaw& size,
3994 float refresh_rate,
3995 bool include_high_density_modes)
3996{
3997 DisplayMode mode;
3998 CheckError(SDL_GetClosestFullscreenDisplayMode(displayID,
3999 size.x,
4000 size.y,
4001 refresh_rate,
4002 include_high_density_modes,
4003 &mode));
4004 return mode;
4005}
4006
4008 const PointRaw& size,
4009 float refresh_rate,
4010 bool include_high_density_modes) const
4011{
4013 m_displayID, size, refresh_rate, include_high_density_modes);
4014}
4015
4036{
4037 return *SDL_GetDesktopDisplayMode(displayID);
4038}
4039
4041{
4042 return SDL::GetDesktopDisplayMode(m_displayID);
4043}
4044
4065{
4066 return *SDL_GetCurrentDisplayMode(displayID);
4067}
4068
4070{
4071 return SDL::GetCurrentDisplayMode(m_displayID);
4072}
4073
4089{
4090 return SDL_GetDisplayForPoint(&point);
4091}
4092
4094{
4095 return SDL::GetDisplayForPoint(point);
4096}
4097
4114{
4115 return CheckError(SDL_GetDisplayForRect(&rect));
4116}
4117
4119{
4120 return SDL::GetDisplayForRect(rect);
4121}
4122
4139{
4140 return CheckError(SDL_GetDisplayForWindow(window));
4141}
4142
4144{
4145 return SDL::GetDisplayForWindow(get());
4146}
4147
4166{
4167 return SDL_GetWindowPixelDensity(window);
4168}
4169
4170inline float Window::GetPixelDensity() const
4171{
4173}
4174
4197{
4198 return SDL_GetWindowDisplayScale(window);
4199}
4200
4201inline float Window::GetDisplayScale() const
4202{
4204}
4205
4239{
4240 CheckError(SDL_SetWindowFullscreenMode(window, mode));
4241}
4242
4247
4263{
4264 return *SDL_GetWindowFullscreenMode(window);
4265}
4266
4268{
4270}
4271
4284{
4285 size_t size;
4286 return OwnPtr<void>{CheckError(SDL_GetWindowICCProfile(window, &size))};
4287}
4288
4290{
4291 return SDL::GetWindowICCProfile(get());
4292}
4293
4306{
4307 return CheckError(SDL_GetWindowPixelFormat(window));
4308}
4309
4311{
4313}
4314
4326{
4327 int count = 0;
4328 auto data = CheckError(SDL_GetWindows(&count));
4329 return OwnArray<WindowRef>{reinterpret_cast<WindowRef*>(data), size_t(count)};
4330}
4331
4417 const PointRaw& size,
4418 WindowFlags flags)
4419{
4420 return Window(std::move(title), size, flags);
4421}
4422
4424 const PointRaw& size,
4425 WindowFlags flags)
4426 : Window(SDL_CreateWindow(title, size.x, size.y, flags))
4427{
4428}
4429
4431 const PointRaw& offset,
4432 const PointRaw& size,
4433 WindowFlags flags)
4434 : Window(
4435 SDL_CreatePopupWindow(parent, offset.x, offset.y, size.x, size.y, flags))
4436{
4437}
4438
4440 : Window(SDL_CreateWindowWithProperties(props))
4441{
4442}
4443
4516 const PointRaw& offset,
4517 const PointRaw& size,
4518 WindowFlags flags)
4519{
4520 return Window(parent, offset, size, flags);
4521}
4522
4667{
4668 return Window(props);
4669}
4670
4682namespace prop::Window {
4683
4684constexpr auto CREATE_ALWAYS_ON_TOP_BOOLEAN =
4685 SDL_PROP_WINDOW_CREATE_ALWAYS_ON_TOP_BOOLEAN;
4686
4687constexpr auto CREATE_BORDERLESS_BOOLEAN =
4688 SDL_PROP_WINDOW_CREATE_BORDERLESS_BOOLEAN;
4689
4690#if SDL_VERSION_ATLEAST(3, 2, 18)
4691
4692constexpr auto CREATE_CONSTRAIN_POPUP_BOOLEAN =
4693 SDL_PROP_WINDOW_CREATE_CONSTRAIN_POPUP_BOOLEAN;
4694
4695#endif // SDL_VERSION_ATLEAST(3, 2, 18)
4696
4697constexpr auto CREATE_FOCUSABLE_BOOLEAN =
4698 SDL_PROP_WINDOW_CREATE_FOCUSABLE_BOOLEAN;
4699
4700constexpr auto CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN =
4701 SDL_PROP_WINDOW_CREATE_EXTERNAL_GRAPHICS_CONTEXT_BOOLEAN;
4702
4703constexpr auto CREATE_FLAGS_NUMBER = SDL_PROP_WINDOW_CREATE_FLAGS_NUMBER;
4704
4705constexpr auto CREATE_FULLSCREEN_BOOLEAN =
4706 SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN;
4707
4708constexpr auto CREATE_HEIGHT_NUMBER = SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER;
4709
4710constexpr auto CREATE_HIDDEN_BOOLEAN = SDL_PROP_WINDOW_CREATE_HIDDEN_BOOLEAN;
4711
4712constexpr auto CREATE_HIGH_PIXEL_DENSITY_BOOLEAN =
4713 SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN;
4714
4715constexpr auto CREATE_MAXIMIZED_BOOLEAN =
4716 SDL_PROP_WINDOW_CREATE_MAXIMIZED_BOOLEAN;
4717
4718constexpr auto CREATE_MENU_BOOLEAN = SDL_PROP_WINDOW_CREATE_MENU_BOOLEAN;
4719
4720constexpr auto CREATE_METAL_BOOLEAN = SDL_PROP_WINDOW_CREATE_METAL_BOOLEAN;
4721
4722constexpr auto CREATE_MINIMIZED_BOOLEAN =
4723 SDL_PROP_WINDOW_CREATE_MINIMIZED_BOOLEAN;
4724
4725constexpr auto CREATE_MODAL_BOOLEAN = SDL_PROP_WINDOW_CREATE_MODAL_BOOLEAN;
4726
4727constexpr auto CREATE_MOUSE_GRABBED_BOOLEAN =
4728 SDL_PROP_WINDOW_CREATE_MOUSE_GRABBED_BOOLEAN;
4729
4730constexpr auto CREATE_OPENGL_BOOLEAN = SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN;
4731
4732constexpr auto CREATE_PARENT_POINTER = SDL_PROP_WINDOW_CREATE_PARENT_POINTER;
4733
4734constexpr auto CREATE_RESIZABLE_BOOLEAN =
4735 SDL_PROP_WINDOW_CREATE_RESIZABLE_BOOLEAN;
4736
4737constexpr auto CREATE_TITLE_STRING = SDL_PROP_WINDOW_CREATE_TITLE_STRING;
4738
4739constexpr auto CREATE_TRANSPARENT_BOOLEAN =
4740 SDL_PROP_WINDOW_CREATE_TRANSPARENT_BOOLEAN;
4741
4742constexpr auto CREATE_TOOLTIP_BOOLEAN = SDL_PROP_WINDOW_CREATE_TOOLTIP_BOOLEAN;
4743
4744constexpr auto CREATE_UTILITY_BOOLEAN = SDL_PROP_WINDOW_CREATE_UTILITY_BOOLEAN;
4745
4746constexpr auto CREATE_VULKAN_BOOLEAN = SDL_PROP_WINDOW_CREATE_VULKAN_BOOLEAN;
4747
4748constexpr auto CREATE_WIDTH_NUMBER = SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER;
4749
4750constexpr auto CREATE_X_NUMBER = SDL_PROP_WINDOW_CREATE_X_NUMBER;
4751
4752constexpr auto CREATE_Y_NUMBER = SDL_PROP_WINDOW_CREATE_Y_NUMBER;
4753
4754constexpr auto CREATE_COCOA_WINDOW_POINTER =
4755 SDL_PROP_WINDOW_CREATE_COCOA_WINDOW_POINTER;
4756
4757constexpr auto CREATE_COCOA_VIEW_POINTER =
4758 SDL_PROP_WINDOW_CREATE_COCOA_VIEW_POINTER;
4759
4760#if SDL_VERSION_ATLEAST(3, 4, 0)
4761
4762constexpr auto CREATE_WINDOWSCENE_POINTER =
4763 SDL_PROP_WINDOW_CREATE_WINDOWSCENE_POINTER;
4764
4765#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4766
4767constexpr auto CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN =
4768 SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN;
4769
4770constexpr auto CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN =
4771 SDL_PROP_WINDOW_CREATE_WAYLAND_CREATE_EGL_WINDOW_BOOLEAN;
4772
4773constexpr auto CREATE_WAYLAND_WL_SURFACE_POINTER =
4774 SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER;
4775
4776constexpr auto CREATE_WIN32_HWND_POINTER =
4777 SDL_PROP_WINDOW_CREATE_WIN32_HWND_POINTER;
4778
4779constexpr auto CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER =
4780 SDL_PROP_WINDOW_CREATE_WIN32_PIXEL_FORMAT_HWND_POINTER;
4781
4782constexpr auto CREATE_X11_WINDOW_NUMBER =
4783 SDL_PROP_WINDOW_CREATE_X11_WINDOW_NUMBER;
4784
4785#if SDL_VERSION_ATLEAST(3, 4, 0)
4786
4787constexpr auto CREATE_EMSCRIPTEN_CANVAS_ID_STRING =
4788 SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_CANVAS_ID_STRING;
4789
4790constexpr auto CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING =
4791 SDL_PROP_WINDOW_CREATE_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING;
4792
4793#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4794
4795constexpr auto SHAPE_POINTER = SDL_PROP_WINDOW_SHAPE_POINTER;
4796
4797constexpr auto HDR_ENABLED_BOOLEAN = SDL_PROP_WINDOW_HDR_ENABLED_BOOLEAN;
4798
4799constexpr auto SDR_WHITE_LEVEL_FLOAT = SDL_PROP_WINDOW_SDR_WHITE_LEVEL_FLOAT;
4800
4801constexpr auto HDR_HEADROOM_FLOAT = SDL_PROP_WINDOW_HDR_HEADROOM_FLOAT;
4802
4803constexpr auto ANDROID_WINDOW_POINTER = SDL_PROP_WINDOW_ANDROID_WINDOW_POINTER;
4804
4805constexpr auto ANDROID_SURFACE_POINTER =
4806 SDL_PROP_WINDOW_ANDROID_SURFACE_POINTER;
4807
4808constexpr auto UIKIT_WINDOW_POINTER = SDL_PROP_WINDOW_UIKIT_WINDOW_POINTER;
4809
4810constexpr auto UIKIT_METAL_VIEW_TAG_NUMBER =
4811 SDL_PROP_WINDOW_UIKIT_METAL_VIEW_TAG_NUMBER;
4812
4813constexpr auto UIKIT_OPENGL_FRAMEBUFFER_NUMBER =
4814 SDL_PROP_WINDOW_UIKIT_OPENGL_FRAMEBUFFER_NUMBER;
4815
4816constexpr auto UIKIT_OPENGL_RENDERBUFFER_NUMBER =
4817 SDL_PROP_WINDOW_UIKIT_OPENGL_RENDERBUFFER_NUMBER;
4818
4819constexpr auto UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER =
4820 SDL_PROP_WINDOW_UIKIT_OPENGL_RESOLVE_FRAMEBUFFER_NUMBER;
4821
4822constexpr auto KMSDRM_DEVICE_INDEX_NUMBER =
4823 SDL_PROP_WINDOW_KMSDRM_DEVICE_INDEX_NUMBER;
4824
4825constexpr auto KMSDRM_DRM_FD_NUMBER = SDL_PROP_WINDOW_KMSDRM_DRM_FD_NUMBER;
4826
4827constexpr auto KMSDRM_GBM_DEVICE_POINTER =
4828 SDL_PROP_WINDOW_KMSDRM_GBM_DEVICE_POINTER;
4829
4830constexpr auto COCOA_WINDOW_POINTER = SDL_PROP_WINDOW_COCOA_WINDOW_POINTER;
4831
4832constexpr auto COCOA_METAL_VIEW_TAG_NUMBER =
4833 SDL_PROP_WINDOW_COCOA_METAL_VIEW_TAG_NUMBER;
4834
4835#if SDL_VERSION_ATLEAST(3, 4, 0)
4836
4837constexpr auto OPENVR_OVERLAY_ID_NUMBER =
4838 SDL_PROP_WINDOW_OPENVR_OVERLAY_ID_NUMBER;
4839
4840#else
4841
4842constexpr auto OPENVR_OVERLAY_ID_NUMBER = SDL_PROP_WINDOW_OPENVR_OVERLAY_ID;
4843
4844#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4845
4846constexpr auto VIVANTE_DISPLAY_POINTER =
4847 SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER;
4848
4849constexpr auto VIVANTE_WINDOW_POINTER = SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER;
4850
4851constexpr auto VIVANTE_SURFACE_POINTER =
4852 SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER;
4853
4854constexpr auto WIN32_HWND_POINTER = SDL_PROP_WINDOW_WIN32_HWND_POINTER;
4855
4856constexpr auto WIN32_HDC_POINTER = SDL_PROP_WINDOW_WIN32_HDC_POINTER;
4857
4858constexpr auto WIN32_INSTANCE_POINTER = SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER;
4859
4860constexpr auto WAYLAND_DISPLAY_POINTER =
4861 SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER;
4862
4863constexpr auto WAYLAND_SURFACE_POINTER =
4864 SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER;
4865
4866constexpr auto WAYLAND_VIEWPORT_POINTER =
4867 SDL_PROP_WINDOW_WAYLAND_VIEWPORT_POINTER;
4868
4869constexpr auto WAYLAND_EGL_WINDOW_POINTER =
4870 SDL_PROP_WINDOW_WAYLAND_EGL_WINDOW_POINTER;
4871
4872constexpr auto WAYLAND_XDG_SURFACE_POINTER =
4873 SDL_PROP_WINDOW_WAYLAND_XDG_SURFACE_POINTER;
4874
4875constexpr auto WAYLAND_XDG_TOPLEVEL_POINTER =
4876 SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_POINTER;
4877
4878constexpr auto WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING =
4879 SDL_PROP_WINDOW_WAYLAND_XDG_TOPLEVEL_EXPORT_HANDLE_STRING;
4880
4881constexpr auto WAYLAND_XDG_POPUP_POINTER =
4882 SDL_PROP_WINDOW_WAYLAND_XDG_POPUP_POINTER;
4883
4884constexpr auto WAYLAND_XDG_POSITIONER_POINTER =
4885 SDL_PROP_WINDOW_WAYLAND_XDG_POSITIONER_POINTER;
4886
4887constexpr auto X11_DISPLAY_POINTER = SDL_PROP_WINDOW_X11_DISPLAY_POINTER;
4888
4889constexpr auto X11_SCREEN_NUMBER = SDL_PROP_WINDOW_X11_SCREEN_NUMBER;
4890
4891constexpr auto X11_WINDOW_NUMBER = SDL_PROP_WINDOW_X11_WINDOW_NUMBER;
4892
4893#if SDL_VERSION_ATLEAST(3, 4, 0)
4894
4895constexpr auto EMSCRIPTEN_CANVAS_ID_STRING =
4896 SDL_PROP_WINDOW_EMSCRIPTEN_CANVAS_ID_STRING;
4897
4898constexpr auto EMSCRIPTEN_KEYBOARD_ELEMENT_STRING =
4899 SDL_PROP_WINDOW_EMSCRIPTEN_KEYBOARD_ELEMENT_STRING;
4900
4901#endif // SDL_VERSION_ATLEAST(3, 4, 0)
4902
4903} // namespace prop::Window
4904
4922{
4923 return CheckError(SDL_GetWindowID(window));
4924}
4925
4926inline WindowID Window::GetID() const { return SDL::GetWindowID(get()); }
4927
4945{
4946 return {SDL_GetWindowFromID(id)};
4947}
4948
4950{
4951 return SDL::GetWindowFromID(id);
4952}
4953
4968{
4969 return SDL_GetWindowParent(window);
4970}
4971
4973{
4974 return SDL::GetWindowParent(get());
4975}
4976
5102{
5103 return {CheckError(SDL_GetWindowProperties(window))};
5104}
5105
5107{
5108 return SDL::GetWindowProperties(get());
5109}
5110
5131{
5132 return SDL_GetWindowFlags(window);
5133}
5134
5136{
5137 return SDL::GetWindowFlags(get());
5138}
5139
5155inline void SetWindowTitle(WindowRef window, StringParam title)
5156{
5157 CheckError(SDL_SetWindowTitle(window, title));
5158}
5159
5161{
5162 SDL::SetWindowTitle(get(), std::move(title));
5163}
5164
5177inline const char* GetWindowTitle(WindowRef window)
5178{
5179 return SDL_GetWindowTitle(window);
5180}
5181
5182inline const char* Window::GetTitle() const
5183{
5184 return SDL::GetWindowTitle(get());
5185}
5186
5210inline void SetWindowIcon(WindowRef window, SurfaceRef icon)
5211{
5212 CheckError(SDL_SetWindowIcon(window, icon));
5213}
5214
5216{
5217 SDL::SetWindowIcon(get(), icon);
5218}
5219
5255inline void SetWindowPosition(WindowRef window, const PointRaw& p)
5256{
5257 CheckError(SDL_SetWindowPosition(window, p.x, p.y));
5258}
5259
5260inline void Window::SetPosition(const PointRaw& p)
5261{
5263}
5264
5287inline void GetWindowPosition(WindowRef window, int* x, int* y)
5288{
5289 CheckError(SDL_GetWindowPosition(window, x, y));
5290}
5291
5312{
5313 Point p;
5314 GetWindowPosition(window, &p.x, &p.y);
5315 return p;
5316}
5317
5318inline void Window::GetPosition(int* x, int* y) const
5319{
5320 SDL::GetWindowPosition(get(), x, y);
5321}
5322
5324{
5325 return SDL::GetWindowPosition(get());
5326}
5327
5361inline void SetWindowSize(WindowRef window, const PointRaw& size)
5362{
5363 CheckError(SDL_SetWindowSize(window, size.x, size.y));
5364}
5365
5366inline void Window::SetSize(const PointRaw& size)
5367{
5368 SDL::SetWindowSize(get(), size);
5369}
5370
5392inline void GetWindowSize(WindowRef window, int* w, int* h)
5393{
5394 CheckError(SDL_GetWindowSize(window, w, h));
5395}
5396
5418{
5419 Point p;
5420 GetWindowSize(window, &p.x, &p.y);
5421 return p;
5422}
5423
5424inline void Window::GetSize(int* w, int* h) const
5425{
5426 SDL::GetWindowSize(get(), w, h);
5427}
5428
5429inline Point Window::GetSize() const { return SDL::GetWindowSize(get()); }
5430
5443inline void SetWindowRect(WindowRef window, Rect rect)
5444{
5445 SetWindowPosition(window, rect.GetTopLeft());
5446 SetWindowSize(window, rect.GetSize());
5447}
5448
5449inline void Window::SetRect(Rect rect) { SDL::SetWindowRect(get(), rect); }
5450
5466{
5467 return Rect{GetWindowPosition(window), GetWindowSize(window)};
5468}
5469
5470inline Rect Window::GetRect() const { return SDL::GetWindowRect(get()); }
5471
5490{
5491 Rect rect;
5492 CheckError(SDL_GetWindowSafeArea(window, &rect));
5493 return rect;
5494}
5495
5497{
5498 return SDL::GetWindowSafeArea(get());
5499}
5500
5539 float min_aspect,
5540 float max_aspect)
5541{
5542 CheckError(SDL_SetWindowAspectRatio(window, min_aspect, max_aspect));
5543}
5544
5545inline void Window::SetAspectRatio(float min_aspect, float max_aspect)
5546{
5547 SDL::SetWindowAspectRatio(get(), min_aspect, max_aspect);
5548}
5549
5567 float* min_aspect,
5568 float* max_aspect)
5569{
5570 CheckError(SDL_GetWindowAspectRatio(window, min_aspect, max_aspect));
5571}
5572
5573inline void Window::GetAspectRatio(float* min_aspect, float* max_aspect) const
5574{
5575 SDL::GetWindowAspectRatio(get(), min_aspect, max_aspect);
5576}
5577
5612 int* top,
5613 int* left,
5614 int* bottom,
5615 int* right)
5616{
5617 CheckError(SDL_GetWindowBordersSize(window, top, left, bottom, right));
5618}
5619
5620inline void Window::GetBordersSize(int* top,
5621 int* left,
5622 int* bottom,
5623 int* right) const
5624{
5625 SDL::GetWindowBordersSize(get(), top, left, bottom, right);
5626}
5627
5645inline void GetWindowSizeInPixels(WindowRef window, int* w, int* h)
5646{
5647 CheckError(SDL_GetWindowSizeInPixels(window, w, h));
5648}
5649
5666{
5667 Point p;
5668 GetWindowSizeInPixels(window, &p.x, &p.y);
5669 return p;
5670}
5671
5672inline void Window::GetSizeInPixels(int* w, int* h) const
5673{
5675}
5676
5678{
5680}
5681
5696inline void SetWindowMinimumSize(WindowRef window, const PointRaw& p)
5697{
5698 CheckError(SDL_SetWindowMinimumSize(window, p.x, p.y));
5699}
5700
5702{
5704}
5705
5723inline void GetWindowMinimumSize(WindowRef window, int* w, int* h)
5724{
5725 CheckError(SDL_GetWindowMinimumSize(window, w, h));
5726}
5727
5728inline void Window::GetMinimumSize(int* w, int* h) const
5729{
5731}
5732
5747inline void SetWindowMaximumSize(WindowRef window, const PointRaw& p)
5748{
5749 CheckError(SDL_SetWindowMaximumSize(window, p.x, p.y));
5750}
5751
5753{
5755}
5756
5774inline void GetWindowMaximumSize(WindowRef window, int* w, int* h)
5775{
5776 CheckError(SDL_GetWindowMaximumSize(window, w, h));
5777}
5778
5779inline void Window::GetMaximumSize(int* w, int* h) const
5780{
5782}
5783
5803inline void SetWindowBordered(WindowRef window, bool bordered)
5804{
5805 CheckError(SDL_SetWindowBordered(window, bordered));
5806}
5807
5808inline void Window::SetBordered(bool bordered)
5809{
5810 SDL::SetWindowBordered(get(), bordered);
5811}
5812
5832inline void SetWindowResizable(WindowRef window, bool resizable)
5833{
5834 CheckError(SDL_SetWindowResizable(window, resizable));
5835}
5836
5837inline void Window::SetResizable(bool resizable)
5838{
5839 SDL::SetWindowResizable(get(), resizable);
5840}
5841
5858inline void SetWindowAlwaysOnTop(WindowRef window, bool on_top)
5859{
5860 CheckError(SDL_SetWindowAlwaysOnTop(window, on_top));
5861}
5862
5863inline void Window::SetAlwaysOnTop(bool on_top)
5864{
5865 SDL::SetWindowAlwaysOnTop(get(), on_top);
5866}
5867
5868#if SDL_VERSION_ATLEAST(3, 4, 0)
5869
5898inline void SetWindowFillDocument(WindowRef window, bool fill)
5899{
5900 CheckError(SDL_SetWindowFillDocument(window, fill));
5901}
5902
5903inline void Window::SetFillDocument(bool fill)
5904{
5906}
5907
5908#endif // SDL_VERSION_ATLEAST(3, 4, 0)
5909
5923inline void ShowWindow(WindowRef window) { CheckError(SDL_ShowWindow(window)); }
5924
5925inline void Window::Show() { SDL::ShowWindow(get()); }
5926
5940inline void HideWindow(WindowRef window) { CheckError(SDL_HideWindow(window)); }
5941
5942inline void Window::Hide() { SDL::HideWindow(get()); }
5943
5960inline void RaiseWindow(WindowRef window)
5961{
5962 CheckError(SDL_RaiseWindow(window));
5963}
5964
5966
5998inline void MaximizeWindow(WindowRef window)
5999{
6000 CheckError(SDL_MaximizeWindow(window));
6001}
6002
6004
6031inline void MinimizeWindow(WindowRef window)
6032{
6033 CheckError(SDL_MinimizeWindow(window));
6034}
6035
6037
6065inline void RestoreWindow(WindowRef window)
6066{
6067 CheckError(SDL_RestoreWindow(window));
6068}
6069
6071
6101inline void SetWindowFullscreen(WindowRef window, bool fullscreen)
6102{
6103 CheckError(SDL_SetWindowFullscreen(window, fullscreen));
6104}
6105
6106inline void Window::SetFullscreen(bool fullscreen)
6107{
6108 SDL::SetWindowFullscreen(get(), fullscreen);
6109}
6110
6140inline bool SyncWindow(WindowRef window) { return SDL_SyncWindow(window); }
6141
6142inline bool Window::Sync() { return SDL::SyncWindow(get()); }
6143
6157inline bool WindowHasSurface(WindowRef window)
6158{
6159 return SDL_WindowHasSurface(window);
6160}
6161
6162inline bool Window::HasSurface() const { return SDL::WindowHasSurface(get()); }
6163
6192{
6193 return Surface::Borrow(CheckError(SDL_GetWindowSurface(window)));
6194}
6195
6197
6221inline void SetWindowSurfaceVSync(WindowRef window, int vsync)
6222{
6223 CheckError(SDL_SetWindowSurfaceVSync(window, vsync));
6224}
6225
6226inline void Window::SetSurfaceVSync(int vsync)
6227{
6229}
6230
6232constexpr int WINDOW_SURFACE_VSYNC_DISABLED = SDL_WINDOW_SURFACE_VSYNC_DISABLED;
6233
6235constexpr int WINDOW_SURFACE_VSYNC_ADAPTIVE = SDL_WINDOW_SURFACE_VSYNC_ADAPTIVE;
6236
6250{
6251 int vsync;
6252 CheckError(SDL_GetWindowSurfaceVSync(window, &vsync));
6253 return vsync;
6254}
6255
6256inline int Window::GetSurfaceVSync() const
6257{
6259}
6260
6280{
6281 CheckError(SDL_UpdateWindowSurface(window));
6282}
6283
6285
6313{
6314 CheckError(SDL_UpdateWindowSurfaceRects(
6315 window, rects.data(), narrowS32(rects.size())));
6316}
6317
6322
6337{
6338 CheckError(SDL_DestroyWindowSurface(window));
6339}
6340
6342
6372inline void SetWindowKeyboardGrab(WindowRef window, bool grabbed)
6373{
6374 CheckError(SDL_SetWindowKeyboardGrab(window, grabbed));
6375}
6376
6377inline void Window::SetKeyboardGrab(bool grabbed)
6378{
6379 SDL::SetWindowKeyboardGrab(get(), grabbed);
6380}
6381
6399inline void SetWindowMouseGrab(WindowRef window, bool grabbed)
6400{
6401 CheckError(SDL_SetWindowMouseGrab(window, grabbed));
6402}
6403
6404inline void Window::SetMouseGrab(bool grabbed)
6405{
6406 SDL::SetWindowMouseGrab(get(), grabbed);
6407}
6408
6422{
6423 return SDL_GetWindowKeyboardGrab(window);
6424}
6425
6426inline bool Window::GetKeyboardGrab() const
6427{
6429}
6430
6447{
6448 return SDL_GetWindowMouseGrab(window);
6449}
6450
6451inline bool Window::GetMouseGrab() const
6452{
6453 return SDL::GetWindowMouseGrab(get());
6454}
6455
6468inline WindowRef GetGrabbedWindow() { return {SDL_GetGrabbedWindow()}; }
6469
6471
6491inline void SetWindowMouseRect(WindowRef window, const RectRaw& rect)
6492{
6493 CheckError(SDL_SetWindowMouseRect(window, &rect));
6494}
6495
6496inline void Window::SetMouseRect(const RectRaw& rect)
6497{
6499}
6500
6517{
6518 return SDL_GetWindowMouseRect(window);
6519}
6520
6521inline const RectRaw* Window::GetMouseRect() const
6522{
6523 return SDL::GetWindowMouseRect(get());
6524}
6525
6544inline void SetWindowOpacity(WindowRef window, float opacity)
6545{
6546 CheckError(SDL_SetWindowOpacity(window, opacity));
6547}
6548
6549inline void Window::SetOpacity(float opacity)
6550{
6551 SDL::SetWindowOpacity(get(), opacity);
6552}
6553
6570inline float GetWindowOpacity(WindowRef window)
6571{
6572 return SDL_GetWindowOpacity(window);
6573}
6574
6575inline float Window::GetOpacity() const { return SDL::GetWindowOpacity(get()); }
6576
6608inline void SetWindowParent(WindowRef window, WindowRef parent)
6609{
6610 CheckError(SDL_SetWindowParent(window, parent));
6611}
6612
6613inline void Window::SetParent(WindowRef parent)
6614{
6615 SDL::SetWindowParent(get(), parent);
6616}
6617
6635inline void SetWindowModal(WindowRef window, bool modal)
6636{
6637 CheckError(SDL_SetWindowModal(window, modal));
6638}
6639
6640inline void Window::SetModal(bool modal) { SDL::SetWindowModal(get(), modal); }
6641
6653inline void SetWindowFocusable(WindowRef window, bool focusable)
6654{
6655 CheckError(SDL_SetWindowFocusable(window, focusable));
6656}
6657
6658inline void Window::SetFocusable(bool focusable)
6659{
6660 SDL::SetWindowFocusable(get(), focusable);
6661}
6662
6683inline void ShowWindowSystemMenu(WindowRef window, const PointRaw& p)
6684{
6685 CheckError(SDL_ShowWindowSystemMenu(window, p.x, p.y));
6686}
6687
6689{
6691}
6692
6734inline void SetWindowHitTest(WindowRef window,
6735 HitTest callback,
6736 void* callback_data)
6737{
6738 CheckError(SDL_SetWindowHitTest(window, callback, callback_data));
6739}
6740
6781inline void SetWindowHitTest(WindowRef window, HitTestCB callback)
6782{
6783 SetWindowHitTest(window, callback.wrapper, callback.data);
6784}
6785
6786inline void Window::SetHitTest(HitTest callback, void* callback_data)
6787{
6788 SDL::SetWindowHitTest(get(), callback, callback_data);
6789}
6790
6791inline void Window::SetHitTest(HitTestCB callback)
6792{
6793 SDL::SetWindowHitTest(get(), callback);
6794}
6795
6820inline void SetWindowShape(WindowRef window, SurfaceRef shape)
6821{
6822 CheckError(SDL_SetWindowShape(window, shape));
6823}
6824
6826{
6827 SDL::SetWindowShape(get(), shape);
6828}
6829
6841inline void FlashWindow(WindowRef window, FlashOperation operation)
6842{
6843 CheckError(SDL_FlashWindow(window, operation));
6844}
6845
6846inline void Window::Flash(FlashOperation operation)
6847{
6848 SDL::FlashWindow(get(), operation);
6849}
6850
6851#if SDL_VERSION_ATLEAST(3, 4, 0)
6852
6866{
6867 CheckError(SDL_SetWindowProgressState(window, state));
6868}
6869
6871{
6873}
6874
6887{
6888 return SDL_GetWindowProgressState(window);
6889}
6890
6895
6908inline void SetWindowProgressValue(WindowRef window, float value)
6909{
6910 CheckError(SDL_SetWindowProgressValue(window, value));
6911}
6912
6913inline void Window::SetProgressValue(float value)
6914{
6916}
6917
6930{
6931 return SDL_GetWindowProgressValue(window);
6932}
6933
6935{
6937}
6938
6939#endif // SDL_VERSION_ATLEAST(3, 4, 0)
6940
6960inline void DestroyWindow(WindowRaw window) { SDL_DestroyWindow(window); }
6961
6963
6980inline bool ScreenSaverEnabled() { return SDL_ScreenSaverEnabled(); }
6981
6994inline void EnableScreenSaver() { CheckError(SDL_EnableScreenSaver()); }
6995
7014inline void DisableScreenSaver() { CheckError(SDL_DisableScreenSaver()); }
7015
7038{
7039 CheckError(SDL_GL_LoadLibrary(path));
7040}
7041
7096{
7097 return SDL_GL_GetProcAddress(proc);
7098}
7099
7118{
7119 return SDL_EGL_GetProcAddress(proc);
7120}
7121
7131inline void GL_UnloadLibrary() { SDL_GL_UnloadLibrary(); }
7132
7154{
7155 return SDL_GL_ExtensionSupported(extension);
7156}
7157
7168inline void GL_ResetAttributes() { SDL_GL_ResetAttributes(); }
7169
7190inline void GL_SetAttribute(GLAttr attr, int value)
7191{
7192 CheckError(SDL_GL_SetAttribute(attr, value));
7193}
7194
7209inline void GL_GetAttribute(GLAttr attr, int* value)
7210{
7211 CheckError(SDL_GL_GetAttribute(attr, value));
7212}
7213
7243{
7244 return GLContext(window);
7245}
7246
7248
7250 : GLContext(SDL_GL_CreateContext(window))
7251{
7252}
7253
7269inline void GL_MakeCurrent(WindowRef window, GLContext context)
7270{
7271 CheckError(SDL_GL_MakeCurrent(window, context.get()));
7272}
7273
7274inline void Window::MakeCurrent(GLContext context)
7275{
7276 SDL::GL_MakeCurrent(get(), context);
7277}
7278
7280{
7281 SDL::GL_MakeCurrent(window, get());
7282}
7283
7296{
7297 return {CheckError(SDL_GL_GetCurrentWindow())};
7298}
7299
7312inline GLContext GL_GetCurrentContext() { return SDL_GL_GetCurrentContext(); }
7313
7325{
7326 return SDL_EGL_GetCurrentDisplay();
7327}
7328
7339inline EGLConfig EGL_GetCurrentConfig() { return SDL_EGL_GetCurrentConfig(); }
7340
7353{
7354 return SDL_EGL_GetWindowSurface(window);
7355}
7356
7361
7383 EGLAttribArrayCallback platformAttribCallback,
7384 EGLIntArrayCallback surfaceAttribCallback,
7385 EGLIntArrayCallback contextAttribCallback,
7386 void* userdata)
7387{
7388 SDL_EGL_SetAttributeCallbacks(platformAttribCallback,
7389 surfaceAttribCallback,
7390 contextAttribCallback,
7391 userdata);
7392}
7393
7422inline void GL_SetSwapInterval(int interval)
7423{
7424 CheckError(SDL_GL_SetSwapInterval(interval));
7425}
7426
7445inline void GL_GetSwapInterval(int* interval)
7446{
7447 CheckError(SDL_GL_GetSwapInterval(interval));
7448}
7449
7467inline void GL_SwapWindow(WindowRef window)
7468{
7469 CheckError(SDL_GL_SwapWindow(window));
7470}
7471
7473
7487{
7488 CheckError(SDL_GL_DestroyContext(context));
7489}
7490
7492
7494
7495} // namespace SDL
7496
7497#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:131
constexpr Display(DisplayID displayID={}) noexcept
Wraps Display.
Definition SDL3pp_video.h:140
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:358
constexpr RawPointer get() const noexcept
Definition SDL3pp_resource.h:53
constexpr RawPointer release() noexcept
Retrieves underlying resource pointer and clear this.
Definition SDL3pp_resource.h:56
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
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 GetTextInputArea(RectRaw *rect, int *cursor)
Get the area used to type Unicode text input.
Definition SDL3pp_keyboard.h:350
void ClearComposition()
Dismiss the composition window/IME without disabling the subsystem.
Definition SDL3pp_keyboard.h:340
void StartTextInput()
Start accepting Unicode text input events in a window.
Definition SDL3pp_keyboard.h:226
bool IsTextInputActive() const
Check whether or not Unicode text input events are enabled for a window.
Definition SDL3pp_keyboard.h:333
void StopTextInput()
Stop receiving any text input events in a window.
Definition SDL3pp_keyboard.h:338
bool IsScreenKeyboardShown() const
Check whether the screen keyboard is shown for given window.
Definition SDL3pp_keyboard.h:373
void SetTextInputArea(const RectRaw &rect, int cursor)
Set the area used to type Unicode text input.
Definition SDL3pp_keyboard.h:345
bool GetRelativeMouseMode() const
Query whether relative mouse mode is enabled for a window.
Definition SDL3pp_mouse.h:743
void SetRelativeMouseMode(bool enabled)
Set relative mouse mode for a window.
Definition SDL3pp_mouse.h:738
void WarpMouse(const FPointRaw &p)
Move the mouse cursor to the given position within the window.
Definition SDL3pp_mouse.h:664
std::unique_ptr< T, PtrDeleter > OwnPtr
Handle to an owned SDL memory allocated pointer.
Definition SDL3pp_ownPtr.h:33
ResourceRef< Properties > PropertiesRef
Reference for Properties.
Definition SDL3pp_properties.h:54
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:4059
void(SDLCALL *)() FunctionPointer
A generic function pointer.
Definition SDL3pp_stdinc.h:6249
::Uint32 Uint32
An unsigned 32-bit integer type.
Definition SDL3pp_stdinc.h:290
::Uint64 Uint64
An unsigned 64-bit integer type.
Definition SDL3pp_stdinc.h:320
ResourceRef< Surface > SurfaceRef
Reference for Surface.
Definition SDL3pp_surface.h:54
void SetProgressState(ProgressState state)
Sets the state of the progress bar for the given window’s taskbar icon.
Definition SDL3pp_video.h:6870
ResourceRef< Window > WindowRef
Reference for Window.
Definition SDL3pp_video.h:54
void DisableScreenSaver()
Prevent the screen from being blanked by a screen saver.
Definition SDL3pp_video.h:7014
constexpr GLContextFlag GL_CONTEXT_RESET_ISOLATION_FLAG
RESET_ISOLATION_FLAG.
Definition SDL3pp_video.h:3557
Rect GetBounds() const
Get the desktop area represented by a display.
Definition SDL3pp_video.h:3811
void GetMaximumSize(int *w, int *h) const
Get the maximum size of a window's client area.
Definition SDL3pp_video.h:5779
Uint32 GLContextFlag
Possible flags to be set for the GL_CONTEXT_FLAGS attribute.
Definition SDL3pp_video.h:3546
float GetPixelDensity() const
Get the pixel density of a window.
Definition SDL3pp_video.h:4170
void SetHitTest(HitTest callback, void *callback_data)
Provide a callback that decides if a window region has special properties.
Definition SDL3pp_video.h:6786
constexpr int WINDOWPOS_CENTERED
Used to indicate that the window position should be centered.
Definition SDL3pp_video.h:3172
constexpr GLAttr GL_CONTEXT_RELEASE_BEHAVIOR
sets context the release behavior.
Definition SDL3pp_video.h:3508
void GetMinimumSize(int *w, int *h) const
Get the minimum size of a window's client area.
Definition SDL3pp_video.h:5728
ProgressState GetWindowProgressState(WindowRef window)
Get the state of the progress bar for the given window’s taskbar icon.
Definition SDL3pp_video.h:6886
EGLAttrib *(SDLCALL *)(void *userdata) EGLAttribArrayCallback
EGL platform attribute initialization callback.
Definition SDL3pp_video.h:3339
void SetWindowOpacity(WindowRef window, float opacity)
Set the opacity for a window.
Definition SDL3pp_video.h:6544
float GetWindowProgressValue(WindowRef window)
Get the value of the progress bar for the given window’s taskbar icon.
Definition SDL3pp_video.h:6929
void SetFocusable(bool focusable)
Set whether the window may have input focus.
Definition SDL3pp_video.h:6658
void GL_SetSwapInterval(int interval)
Set the swap interval for the current OpenGL context.
Definition SDL3pp_video.h:7422
constexpr HitTestResult HITTEST_DRAGGABLE
Region can drag entire window.
Definition SDL3pp_video.h:638
constexpr HitTestResult HITTEST_RESIZE_BOTTOMLEFT
Region is the resizable bottom-left corner border.
Definition SDL3pp_video.h:662
DisplayOrientation GetNaturalDisplayOrientation(DisplayID displayID)
Get the orientation of a display when it is unrotated.
Definition SDL3pp_video.h:3863
void GL_DestroyContext(GLContextRaw context)
Delete an OpenGL context.
Definition SDL3pp_video.h:7486
constexpr FlashOperation FLASH_CANCEL
Cancel any window flash state.
Definition SDL3pp_video.h:614
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:3991
void SetWindowMouseGrab(WindowRef window, bool grabbed)
Set a window's mouse grab mode.
Definition SDL3pp_video.h:6399
void UpdateSurface()
Copy the window surface to the screen.
Definition SDL3pp_video.h:6284
OwnArray< DisplayMode * > GetFullscreenModes() const
Get a list of fullscreen display modes available on a display.
Definition SDL3pp_video.h:3960
void SetWindowProgressState(WindowRef window, ProgressState state)
Sets the state of the progress bar for the given window’s taskbar icon.
Definition SDL3pp_video.h:6865
constexpr bool WINDOWPOS_ISUNDEFINED(int X)
A macro to test if the window position is marked as "undefined.".
Definition SDL3pp_video.h:3129
constexpr SystemTheme SYSTEM_THEME_LIGHT
Light colored system theme.
Definition SDL3pp_video.h:480
constexpr WindowFlags WINDOW_MAXIMIZED
window is maximized
Definition SDL3pp_video.h:541
const char * GetWindowTitle(WindowRef window)
Get the title of a window.
Definition SDL3pp_video.h:5177
void SetWindowMinimumSize(WindowRef window, const PointRaw &p)
Set the minimum size of a window's client area.
Definition SDL3pp_video.h:5696
void EnableScreenSaver()
Allow the screen to be blanked by a screen saver.
Definition SDL3pp_video.h:6994
void SetRect(Rect rect)
Request the window's position and size to be set.
Definition SDL3pp_video.h:5449
void GL_GetSwapInterval(int *interval)
Get the swap interval for the current OpenGL context.
Definition SDL3pp_video.h:7445
WindowRef GetWindowParent(WindowRef window)
Get parent of a window.
Definition SDL3pp_video.h:4967
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:5545
void SetShape(SurfaceRef shape)
Set the shape of a transparent window.
Definition SDL3pp_video.h:6825
void SetMinimumSize(const PointRaw &p)
Set the minimum size of a window's client area.
Definition SDL3pp_video.h:5701
void ShowWindow(WindowRef window)
Show a window.
Definition SDL3pp_video.h:5923
constexpr GLAttr GL_FRAMEBUFFER_SRGB_CAPABLE
requests sRGB-capable visual if 1.
Definition SDL3pp_video.h:3502
constexpr GLAttr GL_MULTISAMPLESAMPLES
the number of samples used around the current pixel used for multisample anti-aliasing.
Definition SDL3pp_video.h:3466
constexpr SystemTheme SYSTEM_THEME_DARK
Dark colored system theme.
Definition SDL3pp_video.h:483
WindowID GetID() const
Get the numeric ID of a window.
Definition SDL3pp_video.h:4926
float GetDisplayScale() const
Get the content display scale relative to a window's pixel size.
Definition SDL3pp_video.h:4201
SDL_EGLint EGLint
An EGL integer attribute, used when creating an EGL surface.
Definition SDL3pp_video.h:3314
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:574
constexpr WindowFlags WINDOW_MOUSE_FOCUS
window has mouse focus
Definition SDL3pp_video.h:550
constexpr GLAttr GL_STENCIL_SIZE
the minimum number of bits in the stencil buffer; defaults to 0.
Definition SDL3pp_video.h:3430
Uint32 GLContextReleaseFlag
Possible values to be set for the GL_CONTEXT_RELEASE_BEHAVIOR attribute.
Definition SDL3pp_video.h:3565
void Restore()
Request that the size and position of a minimized or maximized window be restored.
Definition SDL3pp_video.h:6070
GLContext GLContextRef
Alias to GLContext for non owning parameters.
Definition SDL3pp_video.h:66
void SetWindowProgressValue(WindowRef window, float value)
Sets the value of the progress bar for the given window’s taskbar icon.
Definition SDL3pp_video.h:6908
EGLSurface GetEGLSurface()
Get the EGL surface associated with the window.
Definition SDL3pp_video.h:7357
HitTestResult(SDLCALL *)(WindowRaw win, const PointRaw *area, void *data) HitTest
Callback used for hit-testing.
Definition SDL3pp_video.h:679
void SetWindowIcon(WindowRef window, SurfaceRef icon)
Set the icon for a window.
Definition SDL3pp_video.h:5210
PropertiesRef GetProperties() const
Get the properties associated with a display.
Definition SDL3pp_video.h:3735
constexpr WindowFlags WINDOW_TRANSPARENT
window with transparent buffer
Definition SDL3pp_video.h:601
void DestroySurface()
Destroy the surface associated with the window.
Definition SDL3pp_video.h:6341
Point GetSize() const
Get the size of a window's client area.
Definition SDL3pp_video.h:5429
SDL_GLContext GLContextRaw
Alias to raw representation for GLContext.
Definition SDL3pp_video.h:60
MakeTrailingCallback< HitTestResult(WindowRaw win, const PointRaw *area)> HitTestCB
Callback used for hit-testing.
Definition SDL3pp_video.h:695
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:4007
const RectRaw * GetWindowMouseRect(WindowRef window)
Get the mouse confinement rectangle of a window.
Definition SDL3pp_video.h:6516
const DisplayMode & GetDesktopDisplayMode(DisplayID displayID)
Get information about the desktop's display mode.
Definition SDL3pp_video.h:4035
void GetWindowSizeInPixels(WindowRef window, int *w, int *h)
Get the size of a window's client area, in pixels.
Definition SDL3pp_video.h:5645
FunctionPointer EGL_GetProcAddress(StringParam proc)
Get an EGL library function by name.
Definition SDL3pp_video.h:7117
constexpr GLProfile GL_CONTEXT_PROFILE_CORE
OpenGL Core Profile context.
Definition SDL3pp_video.h:3531
void SetWindowTitle(WindowRef window, StringParam title)
Set the title of a window.
Definition SDL3pp_video.h:5155
float GetWindowDisplayScale(WindowRef window)
Get the content display scale relative to a window's pixel size.
Definition SDL3pp_video.h:4196
constexpr DisplayOrientation ORIENTATION_UNKNOWN
The display orientation can't be determined.
Definition SDL3pp_video.h:84
constexpr int WINDOWPOS_UNDEFINED_MASK
A magic value used with WINDOWPOS_UNDEFINED.
Definition SDL3pp_video.h:3090
PixelFormat GetWindowPixelFormat(WindowRef window)
Get the pixel format associated with the window.
Definition SDL3pp_video.h:4305
EGLSurface EGL_GetWindowSurface(WindowRef window)
Get the EGL surface associated with the window.
Definition SDL3pp_video.h:7352
static WindowRef GetGrabbed()
Get the window that currently has an input grab enabled.
Definition SDL3pp_video.h:6470
constexpr int WINDOW_SURFACE_VSYNC_ADAPTIVE
Constant to enable adaptive vsync.
Definition SDL3pp_video.h:6235
constexpr HitTestResult HITTEST_RESIZE_TOPRIGHT
Region is the resizable top-right corner border.
Definition SDL3pp_video.h:648
constexpr GLAttr GL_CONTEXT_MAJOR_VERSION
OpenGL context major version.
Definition SDL3pp_video.h:3477
constexpr HitTestResult HITTEST_NORMAL
Region is normal. No special properties.
Definition SDL3pp_video.h:635
void GL_Swap()
Update a window with OpenGL rendering.
Definition SDL3pp_video.h:7472
void SetWindowShape(WindowRef window, SurfaceRef shape)
Set the shape of a transparent window.
Definition SDL3pp_video.h:6820
void SetPosition(const PointRaw &p)
Request that the window's position be set.
Definition SDL3pp_video.h:5260
constexpr ProgressState PROGRESS_STATE_PAUSED
The progress bar is shown in a paused state.
Definition SDL3pp_video.h:728
Surface GetSurface()
Get the SDL surface associated with the window.
Definition SDL3pp_video.h:6196
Uint64 WindowFlags
The flags on a window.
Definition SDL3pp_video.h:515
constexpr GLContextFlag GL_CONTEXT_FORWARD_COMPATIBLE_FLAG
FORWARD_COMPATIBLE_FLAG.
Definition SDL3pp_video.h:3551
constexpr int WINDOWPOS_UNDEFINED_DISPLAY(int X)
Used to indicate that you don't care what the window position is.
Definition SDL3pp_video.h:3104
WindowRef GL_GetCurrentWindow()
Get the currently active OpenGL window.
Definition SDL3pp_video.h:7295
constexpr GLAttr GL_RETAINED_BACKING
not used (deprecated).
Definition SDL3pp_video.h:3474
Rect GetDisplayUsableBounds(Display displayID)
Get the usable desktop area represented by a display, in screen coordinates.
Definition SDL3pp_video.h:3838
Display GetDisplay() const
Get the display associated with a window.
Definition SDL3pp_video.h:4143
void SetWindowFillDocument(WindowRef window, bool fill)
Set the window to fill the current document space (Emscripten only).
Definition SDL3pp_video.h:5898
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:6734
constexpr HitTestResult HITTEST_RESIZE_RIGHT
Region is the resizable right border.
Definition SDL3pp_video.h:652
float GetContentScale() const
Get the content scale of a display.
Definition SDL3pp_video.h:3926
float GetOpacity() const
Get the opacity of a window.
Definition SDL3pp_video.h:6575
constexpr FlashOperation FLASH_BRIEFLY
Flash the window briefly to get attention.
Definition SDL3pp_video.h:617
void SetFillDocument(bool fill)
Set the window to fill the current document space (Emscripten only).
Definition SDL3pp_video.h:5903
bool WindowHasSurface(WindowRef window)
Return whether the window has a surface associated with it.
Definition SDL3pp_video.h:6157
void GL_UnloadLibrary()
Unload the OpenGL library previously loaded by GL_LoadLibrary().
Definition SDL3pp_video.h:7131
void SetWindowPosition(WindowRef window, const PointRaw &p)
Request that the window's position be set.
Definition SDL3pp_video.h:5255
constexpr GLAttr GL_STEREO
whether the output is stereo 3D; defaults to off.
Definition SDL3pp_video.h:3456
constexpr GLAttr GL_CONTEXT_MINOR_VERSION
OpenGL context minor version.
Definition SDL3pp_video.h:3480
constexpr GLAttr GL_CONTEXT_PROFILE_MASK
type of GL context (Core, Compatibility, ES).
Definition SDL3pp_video.h:3493
DisplayOrientation GetCurrentDisplayOrientation(DisplayID displayID)
Get the orientation of a display.
Definition SDL3pp_video.h:3886
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:3397
SDL_SystemTheme SystemTheme
System theme.
Definition SDL3pp_video.h:475
void SetWindowResizable(WindowRef window, bool resizable)
Set the user-resizable state of a window.
Definition SDL3pp_video.h:5832
Display GetDisplayForRect(const RectRaw &rect)
Get the display primarily containing a rect.
Definition SDL3pp_video.h:4113
constexpr WindowFlags WINDOW_MOUSE_GRABBED
window has grabbed mouse input
Definition SDL3pp_video.h:544
bool ScreenSaverEnabled()
Check whether the screensaver is currently enabled.
Definition SDL3pp_video.h:6980
void DestroyWindowSurface(WindowRef window)
Destroy the surface associated with the window.
Definition SDL3pp_video.h:6336
void MakeCurrent(WindowRef window)
Set up an OpenGL context for rendering into an OpenGL window.
Definition SDL3pp_video.h:7279
Display GetDisplayForPoint(const PointRaw &point)
Get the display containing a point.
Definition SDL3pp_video.h:4088
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:3403
FunctionPointer GL_GetProcAddress(StringParam proc)
Get an OpenGL function by name.
Definition SDL3pp_video.h:7095
void SetWindowSurfaceVSync(WindowRef window, int vsync)
Toggle VSync for the window surface.
Definition SDL3pp_video.h:6221
constexpr GLAttr GL_CONTEXT_RESET_NOTIFICATION
set context reset notification.
Definition SDL3pp_video.h:3514
Window CreateWindow(StringParam title, const PointRaw &size, WindowFlags flags)
Create a window with the specified dimensions and flags.
Definition SDL3pp_video.h:4416
WindowFlags GetWindowFlags(WindowRef window)
Get the window flags.
Definition SDL3pp_video.h:5130
constexpr GLProfile GL_CONTEXT_PROFILE_COMPATIBILITY
OpenGL Compatibility Profile context.
Definition SDL3pp_video.h:3534
float GetDisplayContentScale(DisplayID displayID)
Get the content scale of a display.
Definition SDL3pp_video.h:3921
Uint32 GLProfile
Possible values to be set for the GL_CONTEXT_PROFILE_MASK attribute.
Definition SDL3pp_video.h:3529
SDL_EGLConfig EGLConfig
Opaque type for an EGL config.
Definition SDL3pp_video.h:3300
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:7382
GLContext CreateGLContext()
Create an OpenGL context for an OpenGL window, and make it current.
Definition SDL3pp_video.h:7247
const DisplayMode & GetCurrentDisplayMode(DisplayID displayID)
Get information about the current display mode.
Definition SDL3pp_video.h:4064
void Flash(FlashOperation operation)
Request a window to demand attention from the user.
Definition SDL3pp_video.h:6846
void UpdateWindowSurfaceRects(WindowRef window, SpanRef< const RectRaw > rects)
Copy areas of the window surface to the screen.
Definition SDL3pp_video.h:6311
Rect GetDisplayBounds(Display displayID)
Get the desktop area represented by a display.
Definition SDL3pp_video.h:3804
constexpr WindowFlags WINDOW_METAL
window usable for Metal view
Definition SDL3pp_video.h:598
constexpr WindowFlags WINDOW_MINIMIZED
window is minimized
Definition SDL3pp_video.h:538
void RestoreWindow(WindowRef window)
Request that the size and position of a minimized or maximized window be restored.
Definition SDL3pp_video.h:6065
SDL_EGLDisplay EGLDisplay
Opaque type for an EGL display.
Definition SDL3pp_video.h:3293
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:3454
constexpr int WINDOW_SURFACE_VSYNC_DISABLED
Constant to disable vsync.
Definition SDL3pp_video.h:6232
bool GetMouseGrab() const
Get a window's mouse grab mode.
Definition SDL3pp_video.h:6451
void GL_SwapWindow(WindowRef window)
Update a window with OpenGL rendering.
Definition SDL3pp_video.h:7467
constexpr DisplayOrientation ORIENTATION_PORTRAIT
The display is in portrait mode.
Definition SDL3pp_video.h:100
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:3436
OwnArray< DisplayMode * > GetFullscreenDisplayModes(Display displayID)
Get a list of fullscreen display modes available on a display.
Definition SDL3pp_video.h:3953
SDL_GLAttr GLAttr
An enumeration of OpenGL configuration attributes.
Definition SDL3pp_video.h:3391
void SetKeyboardGrab(bool grabbed)
Set a window's keyboard grab mode.
Definition SDL3pp_video.h:6377
ProgressState GetProgressState()
Get the state of the progress bar for the given window’s taskbar icon.
Definition SDL3pp_video.h:6891
constexpr WindowFlags WINDOW_HIGH_PIXEL_DENSITY
window uses high pixel density back buffer if possible
Definition SDL3pp_video.h:559
Uint32 GLContextResetNotification
Possible values to be set GL_CONTEXT_RESET_NOTIFICATION attribute.
Definition SDL3pp_video.h:3578
SDL_Window * WindowRaw
Alias to raw representation for Window.
Definition SDL3pp_video.h:47
float GetProgressValue()
Get the value of the progress bar for the given window’s taskbar icon.
Definition SDL3pp_video.h:6934
constexpr ProgressState PROGRESS_STATE_INVALID
An invalid progress state indicating an error; check GetError().
Definition SDL3pp_video.h:715
constexpr GLAttr GL_CONTEXT_FLAGS
some combination of 0 or more of elements of the GLContextFlag enumeration; defaults to 0.
Definition SDL3pp_video.h:3487
void SetAlwaysOnTop(bool on_top)
Set the window to always be above the others.
Definition SDL3pp_video.h:5863
constexpr GLProfile GL_CONTEXT_PROFILE_ES
GLX_CONTEXT_ES2_PROFILE_BIT_EXT.
Definition SDL3pp_video.h:3538
constexpr GLAttr GL_DOUBLEBUFFER
whether the output is single or double buffered; defaults to double buffering on.
Definition SDL3pp_video.h:3424
void SetWindowMaximumSize(WindowRef window, const PointRaw &p)
Set the maximum size of a window's client area.
Definition SDL3pp_video.h:5747
Display GetPrimaryDisplay()
Return the primary display.
Definition SDL3pp_video.h:3687
constexpr HitTestResult HITTEST_RESIZE_LEFT
Region is the resizable left border.
Definition SDL3pp_video.h:666
Point GetPosition() const
Get the position of a window.
Definition SDL3pp_video.h:5323
void GetWindowMaximumSize(WindowRef window, int *w, int *h)
Get the maximum size of a window's client area.
Definition SDL3pp_video.h:5774
SDL_HitTestResult HitTestResult
Possible return values from the HitTest callback.
Definition SDL3pp_video.h:633
void GL_GetAttribute(GLAttr attr, int *value)
Get the actual value for an attribute from the current context.
Definition SDL3pp_video.h:7209
void Show()
Show a window.
Definition SDL3pp_video.h:5925
void MakeCurrent(GLContext context)
Set up an OpenGL context for rendering into an OpenGL window.
Definition SDL3pp_video.h:7274
PropertiesRef GetDisplayProperties(DisplayID displayID)
Get the properties associated with a display.
Definition SDL3pp_video.h:3730
SDL_FlashOperation FlashOperation
Window flash operation.
Definition SDL3pp_video.h:612
SDL_WindowID WindowID
This is a unique ID for a window.
Definition SDL3pp_video.h:447
void Minimize()
Request that the window be minimized to an iconic representation.
Definition SDL3pp_video.h:6036
SDL_EGLAttrib EGLAttrib
An EGL attribute, used when creating an EGL context.
Definition SDL3pp_video.h:3307
constexpr WindowFlags WINDOW_FILL_DOCUMENT
window is in fill-document mode (Emscripten only), since SDL 3.4.0
Definition SDL3pp_video.h:591
void HideWindow(WindowRef window)
Hide a window.
Definition SDL3pp_video.h:5940
void GL_SetAttribute(GLAttr attr, int value)
Set an OpenGL window attribute before window creation.
Definition SDL3pp_video.h:7190
void SetSize(const PointRaw &size)
Request that the size of a window's client area be set.
Definition SDL3pp_video.h:5366
const char * GetCurrentVideoDriver()
Get the name of the currently initialized video driver.
Definition SDL3pp_video.h:3641
Point GetSizeInPixels() const
Get the size of a window's client area, in pixels.
Definition SDL3pp_video.h:5677
constexpr GLAttr GL_MULTISAMPLEBUFFERS
the number of buffers used for multisample anti-aliasing; defaults to 0.
Definition SDL3pp_video.h:3460
PropertiesRef GetWindowProperties(WindowRef window)
Get the properties associated with a window.
Definition SDL3pp_video.h:5101
void ShowWindowSystemMenu(WindowRef window, const PointRaw &p)
Display the system-level window menu.
Definition SDL3pp_video.h:6683
PropertiesRef GetProperties() const
Get the properties associated with a window.
Definition SDL3pp_video.h:5106
void ShowSystemMenu(const PointRaw &p)
Display the system-level window menu.
Definition SDL3pp_video.h:6688
const DisplayMode & GetCurrentMode() const
Get information about the current display mode.
Definition SDL3pp_video.h:4069
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:3415
constexpr WindowFlags WINDOW_MODAL
window is modal
Definition SDL3pp_video.h:556
int GetNumVideoDrivers()
Get the number of video drivers compiled into SDL.
Definition SDL3pp_video.h:3597
void SetWindowKeyboardGrab(WindowRef window, bool grabbed)
Set a window's keyboard grab mode.
Definition SDL3pp_video.h:6372
bool GL_ExtensionSupported(StringParam extension)
Check if an OpenGL extension is supported for the current context.
Definition SDL3pp_video.h:7153
void SetWindowSize(WindowRef window, const PointRaw &size)
Request that the size of a window's client area be set.
Definition SDL3pp_video.h:5361
constexpr WindowFlags WINDOW_INPUT_FOCUS
window has input focus
Definition SDL3pp_video.h:547
Display GetDisplayForWindow(WindowRef window)
Get the display associated with a window.
Definition SDL3pp_video.h:4138
int GetSurfaceVSync() const
Get VSync for the window surface.
Definition SDL3pp_video.h:6256
void SetOpacity(float opacity)
Set the opacity for a window.
Definition SDL3pp_video.h:6549
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:3442
constexpr GLContextFlag GL_CONTEXT_DEBUG_FLAG
DEBUG_FLAG.
Definition SDL3pp_video.h:3548
WindowID GetWindowID(WindowRef window)
Get the numeric ID of a window.
Definition SDL3pp_video.h:4921
const char * GetName() const
Get the name of a display in UTF-8 encoding.
Definition SDL3pp_video.h:3782
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:5538
void SetBordered(bool bordered)
Set the border state of a window.
Definition SDL3pp_video.h:5808
DisplayOrientation GetNaturalOrientation() const
Get the orientation of a display when it is unrotated.
Definition SDL3pp_video.h:3868
void SetTitle(StringParam title)
Set the title of a window.
Definition SDL3pp_video.h:5160
bool GetWindowKeyboardGrab(WindowRef window)
Get a window's keyboard grab mode.
Definition SDL3pp_video.h:6421
bool GetWindowMouseGrab(WindowRef window)
Get a window's mouse grab mode.
Definition SDL3pp_video.h:6446
EGLint *(SDLCALL *)(void *userdata, EGLDisplay display, EGLConfig config) EGLIntArrayCallback
EGL surface/context attribute initialization callback types.
Definition SDL3pp_video.h:3370
constexpr HitTestResult HITTEST_RESIZE_TOP
Region is the resizable top border.
Definition SDL3pp_video.h:645
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:3619
SDL_DisplayModeData DisplayModeData
Internal display mode data.
Definition SDL3pp_video.h:495
void RaiseWindow(WindowRef window)
Request that a window be raised above other windows and gain the input focus.
Definition SDL3pp_video.h:5960
float GetWindowPixelDensity(WindowRef window)
Get the pixel density of a window.
Definition SDL3pp_video.h:4165
constexpr int WINDOWPOS_CENTERED_DISPLAY(int X)
Used to indicate that the window position should be centered.
Definition SDL3pp_video.h:3158
void Maximize()
Request that the window be made as large as possible.
Definition SDL3pp_video.h:6003
const char * GetDisplayName(DisplayID displayID)
Get the name of a display in UTF-8 encoding.
Definition SDL3pp_video.h:3777
constexpr WindowFlags WINDOW_VULKAN
window usable for Vulkan surface
Definition SDL3pp_video.h:595
Rect GetRect() const
Get the position and client size of a window.
Definition SDL3pp_video.h:5470
constexpr HitTestResult HITTEST_RESIZE_TOPLEFT
Region is the resizable top-left corner border.
Definition SDL3pp_video.h:641
SDL_DisplayOrientation DisplayOrientation
Display orientation values; the way a display is rotated.
Definition SDL3pp_video.h:82
constexpr HitTestResult HITTEST_RESIZE_BOTTOMRIGHT
Region is the resizable bottom-right corner border.
Definition SDL3pp_video.h:656
constexpr SystemTheme SYSTEM_THEME_UNKNOWN
Unknown system theme.
Definition SDL3pp_video.h:477
constexpr WindowFlags WINDOW_KEYBOARD_GRABBED
window has grabbed keyboard input
Definition SDL3pp_video.h:585
void SetWindowAlwaysOnTop(WindowRef window, bool on_top)
Set the window to always be above the others.
Definition SDL3pp_video.h:5858
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:3409
constexpr GLAttr GL_EGL_PLATFORM
GL_EGL_PLATFORM.
Definition SDL3pp_video.h:3522
constexpr WindowFlags WINDOW_BORDERLESS
no window decoration
Definition SDL3pp_video.h:532
const DisplayMode & GetDesktopMode() const
Get information about the desktop's display mode.
Definition SDL3pp_video.h:4040
void SetWindowModal(WindowRef window, bool modal)
Toggle the state of the window as modal.
Definition SDL3pp_video.h:6635
void GetWindowAspectRatio(WindowRef window, float *min_aspect, float *max_aspect)
Get the aspect ratio of a window's client area.
Definition SDL3pp_video.h:5566
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:4515
void SetWindowMouseRect(WindowRef window, const RectRaw &rect)
Confines the cursor to the specified area of a window.
Definition SDL3pp_video.h:6491
void GL_MakeCurrent(WindowRef window, GLContext context)
Set up an OpenGL context for rendering into an OpenGL window.
Definition SDL3pp_video.h:7269
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:580
constexpr WindowFlags WINDOW_MOUSE_CAPTURE
window has mouse captured (unrelated to MOUSE_GRABBED)
Definition SDL3pp_video.h:562
Rect GetWindowRect(WindowRef window)
Get the position and client size of a window.
Definition SDL3pp_video.h:5465
WindowRef GetGrabbedWindow()
Get the window that currently has an input grab enabled.
Definition SDL3pp_video.h:6468
SDL_ProgressState ProgressState
Window progress state.
Definition SDL3pp_video.h:712
constexpr GLAttr GL_BUFFER_SIZE
the minimum number of bits for frame buffer size; defaults to 0.
Definition SDL3pp_video.h:3418
constexpr DisplayOrientation ORIENTATION_LANDSCAPE
The display is in landscape mode, with the right side up, relative to portrait mode.
Definition SDL3pp_video.h:91
constexpr DisplayOrientation ORIENTATION_PORTRAIT_FLIPPED
The display is in portrait mode, upside down.
Definition SDL3pp_video.h:103
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:5611
constexpr WindowFlags WINDOW_OPENGL
window usable with OpenGL context
Definition SDL3pp_video.h:520
bool GetKeyboardGrab() const
Get a window's keyboard grab mode.
Definition SDL3pp_video.h:6426
constexpr ProgressState PROGRESS_STATE_NONE
No progress bar is shown.
Definition SDL3pp_video.h:717
constexpr GLAttr GL_CONTEXT_NO_ERROR
GL_CONTEXT_NO_ERROR.
Definition SDL3pp_video.h:3517
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:4237
Rect GetWindowSafeArea(WindowRef window)
Get the safe area for this window.
Definition SDL3pp_video.h:5489
constexpr GLContextFlag GL_CONTEXT_ROBUST_ACCESS_FLAG
ROBUST_ACCESS_FLAG.
Definition SDL3pp_video.h:3554
constexpr DisplayOrientation ORIENTATION_LANDSCAPE_FLIPPED
The display is in landscape mode, with the left side up, relative to portrait mode.
Definition SDL3pp_video.h:97
constexpr int WINDOWPOS_UNDEFINED
Used to indicate that you don't care what the window position/display is.
Definition SDL3pp_video.h:3118
const char * GetTitle() const
Get the title of a window.
Definition SDL3pp_video.h:5182
SDL_EGLSurface EGLSurface
Opaque type for an EGL surface.
Definition SDL3pp_video.h:703
Window CreateWindowWithProperties(PropertiesRef props)
Create a window with the specified properties.
Definition SDL3pp_video.h:4666
constexpr WindowFlags WINDOW_MOUSE_RELATIVE_MODE
window has relative mode enabled
Definition SDL3pp_video.h:564
constexpr ProgressState PROGRESS_STATE_NORMAL
The progress bar is shown in a normal state.
Definition SDL3pp_video.h:725
constexpr WindowFlags WINDOW_OCCLUDED
window is occluded
Definition SDL3pp_video.h:523
constexpr FlashOperation FLASH_UNTIL_FOCUSED
Flash the window until it gets focus.
Definition SDL3pp_video.h:620
static Display GetForPoint(const PointRaw &point)
Get the display containing a point.
Definition SDL3pp_video.h:4093
const DisplayMode & GetWindowFullscreenMode(WindowRef window)
Query the display mode to use when a window is visible at fullscreen.
Definition SDL3pp_video.h:4262
void SetMouseRect(const RectRaw &rect)
Confines the cursor to the specified area of a window.
Definition SDL3pp_video.h:6496
OwnPtr< void > GetWindowICCProfile(WindowRef window)
Get the raw ICC profile data for the screen the window is currently on.
Definition SDL3pp_video.h:4283
void GetWindowPosition(WindowRef window, int *x, int *y)
Get the position of a window.
Definition SDL3pp_video.h:5287
void Destroy()
Destroy a window.
Definition SDL3pp_video.h:6962
SystemTheme GetSystemTheme()
Get the current system theme.
Definition SDL3pp_video.h:3655
static Display GetForRect(const RectRaw &rect)
Get the display primarily containing a rect.
Definition SDL3pp_video.h:4118
DisplayOrientation GetCurrentOrientation() const
Get the orientation of a display.
Definition SDL3pp_video.h:3891
OwnPtr< void > GetICCProfile() const
Get the raw ICC profile data for the screen the window is currently on.
Definition SDL3pp_video.h:4289
void GetWindowMinimumSize(WindowRef window, int *w, int *h)
Get the minimum size of a window's client area.
Definition SDL3pp_video.h:5723
static WindowRef FromID(WindowID id)
Get a window from a stored ID.
Definition SDL3pp_video.h:4949
void GetAspectRatio(float *min_aspect, float *max_aspect) const
Get the aspect ratio of a window's client area.
Definition SDL3pp_video.h:5573
constexpr WindowFlags WINDOW_NOT_FOCUSABLE
window should not be focusable
Definition SDL3pp_video.h:604
constexpr ProgressState PROGRESS_STATE_ERROR
The progress bar is shown in a state indicating the application had an error.
Definition SDL3pp_video.h:734
constexpr GLContextResetNotification GL_CONTEXT_RESET_NO_NOTIFICATION
NO_NOTIFICATION.
Definition SDL3pp_video.h:3580
void FlashWindow(WindowRef window, FlashOperation operation)
Request a window to demand attention from the user.
Definition SDL3pp_video.h:6841
Surface GetWindowSurface(WindowRef window)
Get the SDL surface associated with the window.
Definition SDL3pp_video.h:6191
int GetWindowSurfaceVSync(WindowRef window)
Get VSync for the window surface.
Definition SDL3pp_video.h:6249
bool SyncWindow(WindowRef window)
Block until any pending window state is finalized.
Definition SDL3pp_video.h:6140
constexpr GLAttr GL_FLOATBUFFERS
GL_FLOATBUFFERS.
Definition SDL3pp_video.h:3520
void SetWindowRect(WindowRef window, Rect rect)
Request the window's position and size to be set.
Definition SDL3pp_video.h:5443
void Raise()
Request that a window be raised above other windows and gain the input focus.
Definition SDL3pp_video.h:5965
void SetWindowParent(WindowRef window, WindowRef parent)
Set the window as a child of a parent window.
Definition SDL3pp_video.h:6608
void SetMaximumSize(const PointRaw &p)
Set the maximum size of a window's client area.
Definition SDL3pp_video.h:5752
void SetWindowBordered(WindowRef window, bool bordered)
Set the border state of a window.
Definition SDL3pp_video.h:5803
GLContext GL_GetCurrentContext()
Get the currently active OpenGL context.
Definition SDL3pp_video.h:7312
constexpr WindowFlags WINDOW_RESIZABLE
window can be resized
Definition SDL3pp_video.h:535
OwnArray< WindowRef > GetWindows()
Get a list of valid windows.
Definition SDL3pp_video.h:4325
PixelFormat GetPixelFormat() const
Get the pixel format associated with the window.
Definition SDL3pp_video.h:4310
constexpr WindowFlags WINDOW_POPUP_MENU
window should be treated as a popup menu, requires a parent window
Definition SDL3pp_video.h:583
void Hide()
Hide a window.
Definition SDL3pp_video.h:5942
GLContext(WindowRef window)
Create an OpenGL context for an OpenGL window, and make it current.
Definition SDL3pp_video.h:7249
constexpr GLContextResetNotification GL_CONTEXT_RESET_LOSE_CONTEXT
LOSE_CONTEXT.
Definition SDL3pp_video.h:3583
void SetModal(bool modal)
Toggle the state of the window as modal.
Definition SDL3pp_video.h:6640
void GL_ResetAttributes()
Reset all previously set OpenGL context attributes to their default values.
Definition SDL3pp_video.h:7168
void Destroy()
Delete an OpenGL context.
Definition SDL3pp_video.h:7491
constexpr WindowFlags WINDOW_EXTERNAL
window not created by SDL
Definition SDL3pp_video.h:553
void SetParent(WindowRef parent)
Set the window as a child of a parent window.
Definition SDL3pp_video.h:6613
SDL_DisplayMode DisplayMode
The structure that defines a display mode.
Definition SDL3pp_video.h:118
Rect GetSafeArea() const
Get the safe area for this window.
Definition SDL3pp_video.h:5496
WindowFlags GetFlags() const
Get the window flags.
Definition SDL3pp_video.h:5135
OwnArray< DisplayID > GetDisplays()
Get a list of currently connected displays.
Definition SDL3pp_video.h:3667
const RectRaw * GetMouseRect() const
Get the mouse confinement rectangle of a window.
Definition SDL3pp_video.h:6521
constexpr WindowFlags WINDOW_ALWAYS_ON_TOP
window should always be above others
Definition SDL3pp_video.h:567
void MaximizeWindow(WindowRef window)
Request that the window be made as large as possible.
Definition SDL3pp_video.h:5998
const DisplayMode & GetFullscreenMode() const
Query the display mode to use when a window is visible at fullscreen.
Definition SDL3pp_video.h:4267
void MinimizeWindow(WindowRef window)
Request that the window be minimized to an iconic representation.
Definition SDL3pp_video.h:6031
constexpr WindowFlags WINDOW_HIDDEN
window is neither mapped onto the desktop nor shown in the taskbar/dock/window list; Window....
Definition SDL3pp_video.h:530
constexpr GLAttr GL_SHARE_WITH_CURRENT_CONTEXT
OpenGL context sharing; defaults to 0.
Definition SDL3pp_video.h:3495
void GetWindowSize(WindowRef window, int *w, int *h)
Get the size of a window's client area.
Definition SDL3pp_video.h:5392
EGLConfig EGL_GetCurrentConfig()
Get the currently active EGL config.
Definition SDL3pp_video.h:7339
static Display GetPrimary()
Return the primary display.
Definition SDL3pp_video.h:3692
constexpr HitTestResult HITTEST_RESIZE_BOTTOM
Region is the resizable bottom border.
Definition SDL3pp_video.h:659
bool HasSurface() const
Return whether the window has a surface associated with it.
Definition SDL3pp_video.h:6162
Rect GetUsableBounds() const
Get the usable desktop area represented by a display, in screen coordinates.
Definition SDL3pp_video.h:3845
void SetWindowFullscreen(WindowRef window, bool fullscreen)
Request that the window's fullscreen state be changed.
Definition SDL3pp_video.h:6101
void SetResizable(bool resizable)
Set the user-resizable state of a window.
Definition SDL3pp_video.h:5837
void DestroyWindow(WindowRaw window)
Destroy a window.
Definition SDL3pp_video.h:6960
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:3448
void SetIcon(SurfaceRef icon)
Set the icon for a window.
Definition SDL3pp_video.h:5215
WindowRef GetWindowFromID(WindowID id)
Get a window from a stored ID.
Definition SDL3pp_video.h:4944
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:5620
constexpr WindowFlags WINDOW_FULLSCREEN
window is in fullscreen mode
Definition SDL3pp_video.h:517
void UpdateSurfaceRects(SpanRef< const RectRaw > rects)
Copy areas of the window surface to the screen.
Definition SDL3pp_video.h:6318
constexpr GLContextReleaseFlag GL_CONTEXT_RELEASE_BEHAVIOR_NONE
BEHAVIOR_NONE.
Definition SDL3pp_video.h:3567
void SetWindowFocusable(WindowRef window, bool focusable)
Set whether the window may have input focus.
Definition SDL3pp_video.h:6653
void UpdateWindowSurface(WindowRef window)
Copy the window surface to the screen.
Definition SDL3pp_video.h:6279
WindowRef GetParent() const
Get parent of a window.
Definition SDL3pp_video.h:4972
void GL_LoadLibrary(StringParam path)
Dynamically load an OpenGL library.
Definition SDL3pp_video.h:7037
bool Sync()
Block until any pending window state is finalized.
Definition SDL3pp_video.h:6142
void SetFullscreen(bool fullscreen)
Request that the window's fullscreen state be changed.
Definition SDL3pp_video.h:6106
ResourceRef< Renderer > RendererRef
Reference for Renderer.
Definition SDL3pp_video.h:75
void SetFullscreenMode(OptionalRef< const DisplayMode > mode)
Set the display mode to use when a window is visible and fullscreen.
Definition SDL3pp_video.h:4243
constexpr GLAttr GL_DEPTH_SIZE
the minimum number of bits in the depth buffer; defaults to 16.
Definition SDL3pp_video.h:3427
constexpr int WINDOWPOS_CENTERED_MASK
A magic value used with WINDOWPOS_CENTERED.
Definition SDL3pp_video.h:3144
EGLDisplay EGL_GetCurrentDisplay()
Get the currently active EGL display.
Definition SDL3pp_video.h:7324
void SetProgressValue(float value)
Sets the value of the progress bar for the given window’s taskbar icon.
Definition SDL3pp_video.h:6913
constexpr ProgressState PROGRESS_STATE_INDETERMINATE
The progress bar is shown in a indeterminate state.
Definition SDL3pp_video.h:721
void SetMouseGrab(bool grabbed)
Set a window's mouse grab mode.
Definition SDL3pp_video.h:6404
constexpr GLContextReleaseFlag GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH
BEHAVIOR_FLUSH.
Definition SDL3pp_video.h:3570
void SetSurfaceVSync(int vsync)
Toggle VSync for the window surface.
Definition SDL3pp_video.h:6226
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:3472
float GetWindowOpacity(WindowRef window)
Get the opacity of a window.
Definition SDL3pp_video.h:6570
GLContext GL_CreateContext(WindowRef window)
Create an OpenGL context for an OpenGL window, and make it current.
Definition SDL3pp_video.h:7242
constexpr bool WINDOWPOS_ISCENTERED(int X)
A macro to test if the window position is marked as "centered.".
Definition SDL3pp_video.h:3183
Properties for Display.
Definition SDL3pp_video.h:3745
Properties for Window.
Definition SDL3pp_video.h:4682
Main include header for the SDL3pp library.
Sint32 narrowS32(T value)
Narrows to Sint32.
Definition SDL3pp_stdinc.h:6257
RAII owning version GLContext.
Definition SDL3pp_video.h:3267
constexpr GLContextScoped(GLContextScoped &&other) noexcept
Move constructor.
Definition SDL3pp_video.h:3273
GLContext(WindowRef window)
Create an OpenGL context for an OpenGL window, and make it current.
Definition SDL3pp_video.h:7249
constexpr GLContextScoped(GLContext &&other) noexcept
Move constructor.
Definition SDL3pp_video.h:3279
~GLContextScoped()
Destructor.
Definition SDL3pp_video.h:3285
An opaque handle to an OpenGL context.
Definition SDL3pp_video.h:3201
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
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:859
constexpr Point GetTopLeft() const
Get top left corner of the rect.
Definition SDL3pp_rect.h:1110
constexpr Point GetSize() const
Get size of the rect.
Definition SDL3pp_rect.h:1142
A structure representing rendering state.
Definition SDL3pp_render.h:220
A non-owning reference wrapper for a given resource.
Definition SDL3pp_resource.h:156
A collection of pixels used in software blitting.
Definition SDL3pp_surface.h:172
static Surface Borrow(SurfaceRaw resource)
Safely borrows the from SurfaceRaw.
Definition SDL3pp_surface.h:340
The struct used as an opaque handle to a window.
Definition SDL3pp_video.h:748
constexpr Window(WindowRaw resource) noexcept
Constructs from raw Window.
Definition SDL3pp_video.h:758
constexpr Window & operator=(Window &&other) noexcept
Assignment operator.
Definition SDL3pp_video.h:1111
constexpr Window(const Window &other)=delete
Copy constructor.
constexpr ResourceBase(RawPointer resource)
Constructs from resource pointer.
Definition SDL3pp_resource.h:29
Window & operator=(const Window &other)=delete
Assignment operator.
~Window()
Destructor.
Definition SDL3pp_video.h:1108
constexpr Window(Window &&other) noexcept
Move constructor.
Definition SDL3pp_video.h:767