rolmodl
C++ API for the Simple Directmedia Library 2 (SDL2)
|
Common window class. Use rolmodl::Win for use with accelerated rendering (rolmodl::Ren) and rolmodl::Win_SW for use with software rendering (rolmodl::SWTex). More...
#include <Win.hpp>
Public Member Functions | |
Win_Base (const char *title, const geom::Pos p, const geom::Size s, const win::Flags flags) | |
Initialize a window with title title , at the screen position p , of size s , with configuration flags . More... | |
Win_Base (const char *title, const geom::Size s, const win::Flags flags) | |
Initialize a window with title title , at the center of the screen, of size s , with configuration flags . More... | |
Win_Base (const char *title, const geom::Pos p, const geom::Size s) | |
Initialize a window with title title , at the screen position p , of size s , with the default configuration. More... | |
Win_Base (const char *title, const geom::Size s) | |
Initialize a window with title title , at the center of the screen, of size s , with the default configuration. More... | |
~Win_Base () noexcept | |
Free the underlying SDL_Window . More... | |
Win_Base (const Win_Base &that)=delete | |
Copying rolmodl windows is not allowed because their lifetime is tied to the underlying SDL_Window 's. Use references or some other pointer type instead. | |
Win_Base (Win_Base &&that) noexcept | |
Take over the underlying SDL_Window of that . | |
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. Use references or some other pointer type instead. | |
Win_Base & | operator= (Win_Base &&that) noexcept |
Take over the underlying SDL_Window of that . | |
SDL_Window * | unsafeRaw () noexcept |
Get the underlying SDL_Window* . Unsafe because this value might be nullptr and using it with some SDL functions can lead to rolmodl invariant violation. | |
const SDL_Window * | unsafeRaw () const noexcept |
Get the underlying SDL_Window* in a const context. Unsafe because this value might be nullptr and using it with some SDL functions can lead to rolmodl invariant violation. | |
void | hide () noexcept |
Hide the window. More... | |
void | show () noexcept |
Show the window. More... | |
void | raise () noexcept |
Place this window above all other windows and grab input focus. More... | |
void | maximize () noexcept |
Maximize the window setting its size to the largest that will fit on screen. More... | |
void | minimize () noexcept |
Minimize the window hiding it in the start menu or dock or an equivalent. More... | |
void | restore () noexcept |
Restore the window to the size and screen position it had before being maximized or minimized. More... | |
unsigned int | unsafeDisplayIndex () |
Get the index of the display that contains this window's center. Unsafe because storing this index can lead to an out-of-bounds error if the display is later disconnected. More... | |
sys::Display | display () |
Get the display information snapshot for the display that contains this window's center. More... | |
float | opacity () |
Get the window opacity. More... | |
void | setOpacity (const float v) |
Set the window opacity. More... | |
geom::Pos | pos () noexcept |
Get the window screen position. More... | |
void | setPos (const geom::Pos p) noexcept |
Set the window screen position. More... | |
const char * | title () noexcept |
Get the window title in UTF-8. Will be an empty string if there is no title. More... | |
void | setTitle (const char *str) noexcept |
Set the window title. str is in UTF-8. More... | |
geom::Size | size () noexcept |
Get the current window size. More... | |
void | setSize (const geom::Size s) noexcept |
Set the window size. More... | |
geom::Size | maxSize () noexcept |
Get the current maximum window size. More... | |
void | setMaxSize (const geom::Size s) noexcept |
Set the maximum window size. More... | |
geom::Size | minSize () noexcept |
Get the current minimum window size. More... | |
void | setMinSize (const geom::Size s) noexcept |
Set the minimum window size. More... | |
uint32_t | unsafeId () |
Get the underlying SDL window id. Unsafe because this can be used to make a pointer to the underlying window that escapes the window's lifetime. More... | |
pixelfmt::Id | pixelFmt () |
Get the window pixel format. More... | |
void | moveMouseIn (const geom::Pos p) noexcept |
Move the mouse pointer to a position relative to this window. More... | |
Friends | |
void | swap (Win_Base &a, Win_Base &b) noexcept |
Exchange the underlying SDL_Window with that . | |
Common window class. Use rolmodl::Win for use with accelerated rendering (rolmodl::Ren) and rolmodl::Win_SW for use with software rendering (rolmodl::SWTex).
Wrapper around SDL_Window
.
rolmodl::Win_Base::Win_Base | ( | const char * | title, |
const geom::Pos | p, | ||
const geom::Size | s, | ||
const win::Flags | flags | ||
) |
Initialize a window with title title
, at the screen position p
, of size s
, with configuration flags
.
rolmodl::Win_Base::Win_Base | ( | const char * | title, |
const geom::Size | s, | ||
const win::Flags | flags | ||
) |
Initialize a window with title title
, at the center of the screen, of size s
, with configuration flags
.
rolmodl::Win_Base::Win_Base | ( | const char * | title, |
const geom::Pos | p, | ||
const geom::Size | s | ||
) |
Initialize a window with title title
, at the screen position p
, of size s
, with the default configuration.
rolmodl::Win_Base::Win_Base | ( | const char * | title, |
const geom::Size | s | ||
) |
Initialize a window with title title
, at the center of the screen, of size s
, with the default configuration.
|
noexcept |
Free the underlying SDL_Window
.
|
noexcept |
|
noexcept |
|
noexcept |
Place this window above all other windows and grab input focus.
Definition at line 113 of file Win.cpp.
References unsafeRaw().
|
noexcept |
Maximize the window setting its size to the largest that will fit on screen.
Definition at line 117 of file Win.cpp.
References unsafeRaw().
|
noexcept |
Minimize the window hiding it in the start menu or dock or an equivalent.
Definition at line 120 of file Win.cpp.
References unsafeRaw().
|
noexcept |
Restore the window to the size and screen position it had before being maximized or minimized.
Definition at line 123 of file Win.cpp.
References unsafeRaw().
unsigned int rolmodl::Win_Base::unsafeDisplayIndex | ( | ) |
Get the index of the display that contains this window's center. Unsafe because storing this index can lead to an out-of-bounds error if the display is later disconnected.
Definition at line 127 of file Win.cpp.
References rolmodl::detail::throwOnErr(), and unsafeRaw().
Referenced by display().
sys::Display rolmodl::Win_Base::display | ( | ) |
Get the display information snapshot for the display that contains this window's center.
Definition at line 130 of file Win.cpp.
References rolmodl::sys::display::unsafe::byIndex(), and unsafeDisplayIndex().
float rolmodl::Win_Base::opacity | ( | ) |
Get the window opacity.
Definition at line 134 of file Win.cpp.
References rolmodl::detail::throwOnErr(), and unsafeRaw().
void rolmodl::Win_Base::setOpacity | ( | const float | v | ) |
Set the window opacity.
Definition at line 139 of file Win.cpp.
References rolmodl::detail::throwOnErr(), and unsafeRaw().
|
noexcept |
|
noexcept |
Set the window screen position.
|
noexcept |
Get the window title in UTF-8. Will be an empty string if there is no title.
Definition at line 152 of file Win.cpp.
References unsafeRaw().
|
noexcept |
Set the window title. str
is in UTF-8.
|
noexcept |
|
noexcept |
Set the window size.
|
noexcept |
Get the current maximum window size.
Definition at line 169 of file Win.cpp.
References unsafeRaw().
|
noexcept |
Set the maximum window size.
|
noexcept |
Get the current minimum window size.
Definition at line 178 of file Win.cpp.
References unsafeRaw().
|
noexcept |
Set the minimum window size.
uint32_t rolmodl::Win_Base::unsafeId | ( | ) |
Get the underlying SDL window id. Unsafe because this can be used to make a pointer to the underlying window that escapes the window's lifetime.
Definition at line 90 of file Win.cpp.
References unsafeRaw().
pixelfmt::Id rolmodl::Win_Base::pixelFmt | ( | ) |
|
noexcept |
Move the mouse pointer to a position relative to this window.