rolmodl
C++ API for the Simple Directmedia Library 2 (SDL2)
|
Go to the documentation of this file.
8 #include "forwarddecl/Win.hpp"
10 #include "forwarddecl/Geom.hpp"
11 #include "forwarddecl/PixelFmt.hpp"
12 #include "forwarddecl/Base.hpp"
35 return (data_ & static_cast<uint32_t>(SDL_WINDOW_FULLSCREEN)) != 0;
39 return (data_ & static_cast<uint32_t>(SDL_WINDOW_FULLSCREEN_DESKTOP)) != 0;
44 return (data_ & static_cast<uint32_t>(SDL_WINDOW_MINIMIZED)) != 0;
48 return (data_ & static_cast<uint32_t>(SDL_WINDOW_MAXIMIZED)) != 0;
54 return (data_ & static_cast<uint32_t>(SDL_WINDOW_OPENGL)) != 0;
58 return (data_ & static_cast<uint32_t>(SDL_WINDOW_HIDDEN)) != 0;
62 return (data_ & static_cast<uint32_t>(SDL_WINDOW_BORDERLESS)) != 0;
66 return (data_ & static_cast<uint32_t>(SDL_WINDOW_RESIZABLE)) != 0;
70 return (data_ & static_cast<uint32_t>(SDL_WINDOW_INPUT_GRABBED)) != 0;
74 return (data_ & static_cast<uint32_t>(SDL_WINDOW_ALLOW_HIGHDPI)) != 0;
80 return Flags(data_ | static_cast<uint32_t>(SDL_WINDOW_FULLSCREEN));
84 return Flags(data_ | static_cast<uint32_t>(SDL_WINDOW_FULLSCREEN_DESKTOP));
89 return Flags(data_ | static_cast<uint32_t>(SDL_WINDOW_MINIMIZED));
93 return Flags(data_ | static_cast<uint32_t>(SDL_WINDOW_MAXIMIZED));
99 return Flags(data_ | static_cast<uint32_t>(SDL_WINDOW_OPENGL));
103 return Flags(data_ | static_cast<uint32_t>(SDL_WINDOW_HIDDEN));
107 return Flags(data_ | static_cast<uint32_t>(SDL_WINDOW_BORDERLESS));
111 return Flags(data_ | static_cast<uint32_t>(SDL_WINDOW_RESIZABLE));
115 return Flags(data_ | static_cast<uint32_t>(SDL_WINDOW_INPUT_GRABBED));
119 return Flags(data_ | static_cast<uint32_t>(SDL_WINDOW_ALLOW_HIGHDPI));
125 return Flags(data_ & ~static_cast<uint32_t>(SDL_WINDOW_FULLSCREEN));
129 return Flags(data_ & ~static_cast<uint32_t>(SDL_WINDOW_FULLSCREEN_DESKTOP));
134 return Flags(data_ & ~static_cast<uint32_t>(SDL_WINDOW_MINIMIZED));
138 return Flags(data_ & ~static_cast<uint32_t>(SDL_WINDOW_MAXIMIZED));
143 return Flags(data_ & ~static_cast<uint32_t>(SDL_WINDOW_OPENGL));
147 return Flags(data_ & ~static_cast<uint32_t>(SDL_WINDOW_HIDDEN));
151 return Flags(data_ & ~static_cast<uint32_t>(SDL_WINDOW_BORDERLESS));
155 return Flags(data_ & ~static_cast<uint32_t>(SDL_WINDOW_RESIZABLE));
159 return Flags(data_ & ~static_cast<uint32_t>(SDL_WINDOW_INPUT_GRABBED));
163 return Flags(data_ & ~static_cast<uint32_t>(SDL_WINDOW_ALLOW_HIGHDPI));
167 constexpr uint32_t
raw() const noexcept {
172 explicit constexpr
Flags(
const uint32_t data) noexcept :
193 int top()
const noexcept;
195 int l()
const noexcept;
197 int bot()
const noexcept;
199 int r()
const noexcept;
202 int top_, l_, bot_, r_;
246 const SDL_Window*
unsafeRaw()
const noexcept;
251 void hide() noexcept;
254 void show() noexcept;
257 void raise() noexcept;
292 const char*
title() noexcept;
295 void setTitle(
const char* str) noexcept;
339 using Win_Base::Win_Base;
constexpr bool isHighDPI() const noexcept
Test whether this configuration corresponds to a window with preference for high DPI display....
geom::Size maxSize() noexcept
Get the current maximum window size.
void setMaxSize(const geom::Size s) noexcept
Set the maximum window size.
void show() noexcept
Show the window.
void hide() noexcept
Hide the window.
Window decoration (border) sizes snapshot.
constexpr bool isHidden() const noexcept
Test whether this configuration corresponds to a hidden window. The SDL flag equivalent is SDL_WINDOW...
geom::Size size() noexcept
Get the current window size.
constexpr Flags withoutFullscreen() const noexcept
Create a version of this configuration that corresponds to a window that is not fullscreen....
constexpr Flags withMaximized() const noexcept
Create a version of this configuration that corresponds to a maximized window. The SDL flag equivalen...
constexpr bool isOpengl() const noexcept
Test whether this configuration corresponds to a window usable with OpenGL. The SDL flag equivalent i...
Display information snapshot.
constexpr bool isBorderless() const noexcept
Test whether this configuration corresponds to a borderless window. The SDL flag equivalent is SDL_WI...
int dimensions data type. The value is in pixels. Semantically different from rolmodl::geom::Pos.
constexpr Flags withoutInputGrabbed() const noexcept
Create a version of this configuration that corresponds to a window that has not grabbed input focus....
void maximize() noexcept
Maximize the window setting its size to the largest that will fit on screen.
SDL_Window * unsafeRaw() noexcept
Get the underlying SDL_Window*. Unsafe because this value might be nullptr and using it with some SDL...
constexpr Flags withoutHighDPI() const noexcept
Create a version of this configuration that corresponds to a window with no preference for high DPI d...
Window class for use with accelerated rendering (rolmodl::Ren).
uint32_t unsafeId()
Get the underlying SDL window id. Unsafe because this can be used to make a pointer to the underlying...
constexpr Flags withFullscreenDesktop() const noexcept
Create a version of this configuration that corresponds to a desktop-resolution fullscreen window....
void setPos(const geom::Pos p) noexcept
Set the window screen position.
sys::Display display()
Get the display information snapshot for the display that contains this window's center.
BorderSizes(Win_Base &w)
Initialize from the current decoration (border) sizes for window w.
constexpr Flags withoutResizable() const noexcept
Create a version of this configuration that corresponds to a window that is not resizable....
constexpr Flags withResizable() const noexcept
Create a version of this configuration that corresponds to a resizable window. The SDL flag equivalen...
Window configuration (flags) container.
pixelfmt::Id pixelFmt()
Get the window pixel format.
Win_Base & operator=(const Win_Base &that)=delete
Copying rolmodl windows is not allowed because their lifetime is tied to the underlying SDL_Window's....
~Win_Base() noexcept
Free the underlying SDL_Window.
int r() const noexcept
Get the recorded right border size.
constexpr Flags withOpengl() const noexcept
Create a version of this configuration that corresponds to a window usable with OpenGL....
geom::Size minSize() noexcept
Get the current minimum window size.
int top() const noexcept
Get the recorded top border size.
constexpr Flags withMinimized() const noexcept
Create a version of this configuration that corresponds to a minimized window. The SDL flag equivalen...
constexpr Flags() noexcept
Create a configuration corresponding to a default window.
constexpr Flags withHighDPI() const noexcept
Create a version of this configuration that corresponds to a window with preference for high DPI disp...
void setOpacity(const float v)
Set the window opacity.
float opacity()
Get the window opacity.
void moveMouseIn(const geom::Pos p) noexcept
Move the mouse pointer to a position relative to this window.
geom::Pos pos() noexcept
Get the window screen position.
constexpr Flags withoutMinimized() const noexcept
Create a version of this configuration that corresponds to a window that is not minimized....
void setMinSize(const geom::Size s) noexcept
Set the minimum window size.
void minimize() noexcept
Minimize the window hiding it in the start menu or dock or an equivalent.
constexpr Flags withoutOpengl() const noexcept
Create a version of this configuration that corresponds to a window that is not usable with OpenGL....
int point data type. The value is in pixels. Semantically different from rolmodl::geom::Size.
constexpr Flags withHidden() const noexcept
Create a version of this configuration that corresponds to a hidden window. The SDL flag equivalent i...
constexpr Flags withoutBorderless() const noexcept
Create a version of this configuration that corresponds to a window that is not borderless....
constexpr bool isResizable() const noexcept
Test whether this configuration corresponds to a resizable window. The SDL flag equivalent is SDL_WIN...
constexpr Flags withoutMaximized() const noexcept
Create a version of this configuration that corresponds to a window that is not maximized....
unsigned int unsafeDisplayIndex()
Get the index of the display that contains this window's center. Unsafe because storing this index ca...
Common window class. Use rolmodl::Win for use with accelerated rendering (rolmodl::Ren) and rolmodl::...
constexpr Flags withInputGrabbed() const noexcept
Create a version of this configuration that corresponds to a window that has grabbed input focus....
void setSize(const geom::Size s) noexcept
Set the window size.
constexpr bool isFullscreen() const noexcept
Test whether this configuration corresponds to a fullscreen window. The SDL flag equivalent is SDL_WI...
int bot() const noexcept
Get the recorded bottom border size.
void setTitle(const char *str) noexcept
Set the window title. str is in UTF-8.
constexpr bool isInputGrabbed() const noexcept
Test whether this configuration corresponds to a window that has grabbed input focus....
friend void swap(Win_Base &a, Win_Base &b) noexcept
Exchange the underlying SDL_Window with that.
constexpr Flags withFullscreen() const noexcept
Create a version of this configuration that corresponds to a fullscreen window. The SDL flag equivale...
constexpr Flags withoutHidden() const noexcept
Create a version of this configuration that corresponds to a window that is not hidden....
const char * title() noexcept
Get the window title in UTF-8. Will be an empty string if there is no title.
constexpr Flags withBorderless() const noexcept
Create a version of this configuration that corresponds to a borderless window. The SDL flag equivale...
constexpr Flags withoutFullscreenDesktop() const noexcept
Create a version of this configuration that corresponds to a window that is not display-resolution fu...
constexpr bool isMaximized() const noexcept
Test whether this configuration corresponds to a maximized window. The SDL flag equivalent is SDL_WIN...
constexpr bool isMinimized() const noexcept
Test whether this configuration corresponds to a minimized window. The SDL flag equivalent is SDL_WIN...
constexpr bool isFullscreenDesktop() const noexcept
Test whether this configuration corresponds to a desktop-resolution fullscreen window....
int l() const noexcept
Get the recorded left border size.
constexpr uint32_t raw() const noexcept
Return the underlying bitfield representation of this configuration.
void restore() noexcept
Restore the window to the size and screen position it had before being maximized or minimized.