libSDL2pp
C++ bindings/wrapper for SDL2
|
GUI window object. More...
#include <SDL2pp/Window.hh>
Public Member Functions | |
Window (SDL_Window *window) | |
Construct from existing SDL_Window structure. | |
Window (const std::string &title, int x, int y, int w, int h, Uint32 flags) | |
Create window with specified title and dimensions. | |
virtual | ~Window () |
Destructor. | |
Window (Window &&other) noexcept | |
Move constructor. | |
Window & | operator= (Window &&other) noexcept |
Move assignment operator. | |
Window (const Window &other)=delete | |
Deleted copy constructor. | |
Window & | operator= (const Window &other)=delete |
Deleted assignment operator. | |
SDL_Window * | Get () const |
Get pointer to managed SDL_Window structure. | |
Point | GetSize () const |
Get dimensions of the window. | |
int | GetWidth () const |
Get width of the window. | |
int | GetHeight () const |
Get height of the window. | |
Point | GetDrawableSize () const |
Get drawable dimensions of the window. | |
int | GetDrawableWidth () const |
Get drawable width of the window. | |
int | GetDrawableHeight () const |
Get drawable height of the window. | |
Window & | SetTitle (const std::string &title) |
Set window title. | |
std::string | GetTitle () const |
Get window title. | |
Window & | Maximize () |
Make a window as large as possible. | |
Window & | Minimize () |
Minimize a window to an iconic representation. | |
Window & | Hide () |
Hide a window. | |
Window & | Restore () |
Restore the size and position of a minimized or maximized window. | |
Window & | Raise () |
Raise a window above other windows and set the input focus. | |
Window & | Show () |
Show a window. | |
Window & | SetFullscreen (Uint32 flags) |
Set a window's fullscreen state. | |
Window & | SetSize (int w, int h) |
Set the size of a window's client area. | |
Window & | SetSize (const Point &size) |
Set the size of a window's client area. | |
float | GetBrightness () const |
Get the brightness (gamma multiplier) for the display that owns a given window. | |
Window & | SetBrightness (float brightness) |
Set the brightness (gamma multiplier) for the display that owns a given window. | |
Point | GetPosition () const |
Get the position of a window. | |
Window & | SetPosition (int x, int y) |
Set the position of a window. | |
Window & | SetPosition (const Point &pos) |
Set the position of a window. | |
Point | GetMinimumSize () const |
Get the minimum size of a window's client area. | |
Window & | SetMinimumSize (int w, int h) |
Set the minimum size of a window's client area. | |
Window & | SetMinimumSize (const Point &size) |
Set the minimum size of a window's client area. | |
Point | GetMaximumSize () const |
Get the maximum size of a window's client area. | |
Window & | SetMaximumSize (int w, int h) |
Set the maximum size of a window's client area. | |
Window & | SetMaximumSize (const Point &size) |
Set the maximum size of a window's client area. | |
bool | GetGrab () const |
Get a window's input grab mode. | |
Window & | SetGrab (bool grabbed) |
Set a window's input grab mode. | |
int | GetDisplayIndex () const |
Get the index of the display associated with a window. | |
void | GetDisplayMode (SDL_DisplayMode &mode) const |
Get information about the display mode to use when a window is visible at fullscreen. | |
Uint32 | GetFlags () const |
Get the window flags. | |
Window & | SetIcon (const Surface &icon) |
Set the icon for a window. | |
Window & | SetBordered (bool bordered=true) |
Set the border state of a window. | |
Window & | SetOpacity (float opacity=1.0f) |
Set the opacity for a window. | |
float | GetOpacity () const |
Get the opacity of a window. | |
Window & | SetResizable (bool resizable=true) |
Set user-resizable state of a window. | |
GUI window object.
SDL2pp::Window is a wrapper around SDL_Window structure and related functions which take care of GUI window management.
Usage example:
|
explicit |
Construct from existing SDL_Window structure.
[in] | window | Existing SDL_Window to manage |
SDL2pp::Window::Window | ( | const std::string & | title, |
int | x, | ||
int | y, | ||
int | w, | ||
int | h, | ||
Uint32 | flags | ||
) |
Create window with specified title and dimensions.
[in] | title | Title of the windows, in UTF-8 encoding |
[in] | x | X position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED |
[in] | y | X position of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED |
[in] | w | Width of the window |
[in] | h | Height of the window |
[in] | flags | 0 or more SDL_WindowFlags OR'd together |
SDL2pp::Exception |
|
virtual |
Destructor.
|
noexcept |
Move constructor.
[in] | other | SDL2pp::Window object to move data from |
|
delete |
Deleted copy constructor.
This class is not copyable
SDL_Window * SDL2pp::Window::Get | ( | ) | const |
Get pointer to managed SDL_Window structure.
float SDL2pp::Window::GetBrightness | ( | ) | const |
Get the brightness (gamma multiplier) for the display that owns a given window.
int SDL2pp::Window::GetDisplayIndex | ( | ) | const |
Get the index of the display associated with a window.
SDL2pp::Exception |
void SDL2pp::Window::GetDisplayMode | ( | SDL_DisplayMode & | mode | ) | const |
Get information about the display mode to use when a window is visible at fullscreen.
[out] | mode | SDL_DisplayMode structure filled in with the fullscreen display mode |
SDL2pp::Exception |
int SDL2pp::Window::GetDrawableHeight | ( | ) | const |
Get drawable height of the window.
Point SDL2pp::Window::GetDrawableSize | ( | ) | const |
Get drawable dimensions of the window.
int SDL2pp::Window::GetDrawableWidth | ( | ) | const |
Get drawable width of the window.
Uint32 SDL2pp::Window::GetFlags | ( | ) | const |
Get the window flags.
bool SDL2pp::Window::GetGrab | ( | ) | const |
Get a window's input grab mode.
int SDL2pp::Window::GetHeight | ( | ) | const |
Get height of the window.
Point SDL2pp::Window::GetMaximumSize | ( | ) | const |
Get the maximum size of a window's client area.
Point SDL2pp::Window::GetMinimumSize | ( | ) | const |
Get the minimum size of a window's client area.
float SDL2pp::Window::GetOpacity | ( | ) | const |
Get the opacity of a window.
SDL2pp:Exception |
Point SDL2pp::Window::GetPosition | ( | ) | const |
Get the position of a window.
Point SDL2pp::Window::GetSize | ( | ) | const |
Get dimensions of the window.
std::string SDL2pp::Window::GetTitle | ( | ) | const |
Get window title.
int SDL2pp::Window::GetWidth | ( | ) | const |
Get width of the window.
Window & SDL2pp::Window::Hide | ( | ) |
Window & SDL2pp::Window::Maximize | ( | ) |
Make a window as large as possible.
Window & SDL2pp::Window::Minimize | ( | ) |
Minimize a window to an iconic representation.
Deleted assignment operator.
This class is not copyable
Move assignment operator.
[in] | other | SDL2pp::Window object to move data from |
Window & SDL2pp::Window::Raise | ( | ) |
Raise a window above other windows and set the input focus.
Window & SDL2pp::Window::Restore | ( | ) |
Restore the size and position of a minimized or maximized window.
Window & SDL2pp::Window::SetBordered | ( | bool | bordered = true | ) |
Set the border state of a window.
[in] | bordered | False to remove border, true to add border |
Window & SDL2pp::Window::SetBrightness | ( | float | brightness | ) |
Set the brightness (gamma multiplier) for the display that owns a given window.
[in] | brightness | Brightness value to set where 0.0 is completely dark and 1.0 is normal brightness |
SDL2pp::Exception |
Window & SDL2pp::Window::SetFullscreen | ( | Uint32 | flags | ) |
Set a window's fullscreen state.
[in] | flags | SDL_WINDOW_FULLSCREEN, SDL_WINDOW_FULLSCREEN_DESKTOP or 0 |
SDL2pp::Exception |
Window & SDL2pp::Window::SetGrab | ( | bool | grabbed | ) |
Set a window's input grab mode.
[in] | grabbed | True to grab input, false to release input |
Set the icon for a window.
[in] | icon | Surface containing the icon for the window |
Icon surface may be destroyed after calling this function
Set the maximum size of a window's client area.
[in] | size | Maximum area of the window in pixels |
Window & SDL2pp::Window::SetMaximumSize | ( | int | w, |
int | h | ||
) |
Set the maximum size of a window's client area.
[in] | w | Maximum width of the window in pixels |
[in] | h | Maximum height of the window in pixels |
Set the minimum size of a window's client area.
[in] | size | Minimum area of the window in pixels |
Window & SDL2pp::Window::SetMinimumSize | ( | int | w, |
int | h | ||
) |
Set the minimum size of a window's client area.
[in] | w | Minimum width of the window in pixels |
[in] | h | Minimum height of the window in pixels |
Window & SDL2pp::Window::SetOpacity | ( | float | opacity = 1.0f | ) |
Set the opacity for a window.
[in] | opacity | The opacity value (0.0f - transparent, 1.0f - opaque) |
SDL2pp::Exception |
Set the position of a window.
[in] | pos | Point representin position of the a window |
Window & SDL2pp::Window::SetPosition | ( | int | x, |
int | y | ||
) |
Set the position of a window.
[in] | x | X coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED |
[in] | y | Y coordinate of the window, SDL_WINDOWPOS_CENTERED, or SDL_WINDOWPOS_UNDEFINED |
Window & SDL2pp::Window::SetResizable | ( | bool | resizable = true | ) |
Set user-resizable state of a window.
[in] | resizable | True to allow resizing, false to disallow |
Set the size of a window's client area.
[in] | size | Point representing window dimensions |
Window & SDL2pp::Window::SetSize | ( | int | w, |
int | h | ||
) |
Set the size of a window's client area.
[in] | w | Width of the window in pixels |
[in] | h | Height of the window in pixels |
Window & SDL2pp::Window::SetTitle | ( | const std::string & | title | ) |
Set window title.
[in] | title | New window title in UTF-8 encoding |
Window & SDL2pp::Window::Show | ( | ) |