v0.1.8
|
A class capable of creating windows and manipulating them. More...
#include <Window.hpp>
Public Member Functions | |
Window () | |
Default constructor. | |
virtual | ~Window () |
Deconstructor. | |
void | Create (const WindowStyle &style) |
Creates a window based on the given style. More... | |
void | Close () |
Destroys the window. | |
void | HandleMessages () |
Handles system messages and updates input. More... | |
void | SetStyle (const WindowStyle &style) |
Updates a window's style. More... | |
WindowStyle | GetStyle () const |
Gets some information about the window. More... | |
void | SetTitle (const String &title) |
Sets the title of the window. More... | |
String | GetTitle () const |
Gets the title of the window. More... | |
void | SetBackgroundColor (const Color &color) |
Sets the background color of the window. More... | |
Color | GetBackgroundColor () const |
Gets the background color of the window. More... | |
void | SetWidth (UInt32 width) |
Sets the width of the window, excluding the border. More... | |
UInt32 | GetWidth () const |
Gets the width of the window, excluding the border. More... | |
void | SetHeight (UInt32 height) |
Sets the height of the window, excluding the border. More... | |
UInt32 | GetHeight () const |
Gets the height of the window, excluding the border. More... | |
void | SetSize (const UCoord32 &size) const |
Sets the size of the window, excluding the border. More... | |
UCoord32 | GetSize () const |
Gets the size of the window, excluding the border. More... | |
void | SetPosition (const SCoord32 &position) |
Sets the position of the window on the screen. More... | |
SCoord32 | GetPosition () const |
Gets the position of the window on the screen. More... | |
void | SetResizable (Boolean resizable) |
Sets whether the window is resizable or not. More... | |
Boolean | GetResizable () const |
Gets whether the window is resizable or not. More... | |
void | SetAlwaysOnTop (Boolean alwaysOnTop) |
Sets whether the window is always on top. More... | |
Boolean | GetAlwaysOnTop () const |
Gets whether the window is always on top. More... | |
URect32 | GetFrameSize () const |
Gets the window's border extents (the frame around the window). More... | |
Boolean | IsOpen () const |
Checks if the window is still open. More... | |
Boolean | IsFocused () const |
Checks if the window currently has focus. More... | |
void | SetMousePosition (SCoord32 mousePosition) |
Sets the mouse position relative to the window. | |
void | SetCursorShow (bool show) |
Sets if the mouse is visible in the window or not. | |
Static Public Member Functions | |
static void | Update () |
Updates all windows in the current application. More... | |
Public Attributes | |
Event< WindowKeyButtonEvent > | onKeyButton |
Event< WindowMouseButtonEvent > | onMouseButton |
Event< WindowMouseMoveEvent > | onMouseMove |
Friends | |
class | OpenGL::Context |
A class capable of creating windows and manipulating them.
Internally this class can work very differently depending on the operating system. Direct calls are made to WinAPI on Microsoft Windows, Cocoa on Mac OS X, and X11 on linux and other unix platforms. Each window api is different, and windows behave differently depending on the desktop environment. Note also that certain X11 environments may wrongfully ignore essential messages resulting in some features not working – this is not an issue with CGUL, but instead with the environment itself.
void CGUL::Window::Create | ( | const WindowStyle & | style | ) |
Creates a window based on the given style.
See the tutorial on create_window.
CGUL::Boolean CGUL::Window::GetAlwaysOnTop | ( | ) | const |
Gets whether the window is always on top.
CGUL::Color CGUL::Window::GetBackgroundColor | ( | ) | const |
Gets the background color of the window.
CGUL::URect32 CGUL::Window::GetFrameSize | ( | ) | const |
Gets the window's border extents (the frame around the window).
CGUL::UInt32 CGUL::Window::GetHeight | ( | ) | const |
Gets the height of the window, excluding the border.
CGUL::SCoord32 CGUL::Window::GetPosition | ( | ) | const |
Gets the position of the window on the screen.
CGUL::Boolean CGUL::Window::GetResizable | ( | ) | const |
Gets whether the window is resizable or not.
CGUL::UCoord32 CGUL::Window::GetSize | ( | ) | const |
Gets the size of the window, excluding the border.
CGUL::WindowStyle CGUL::Window::GetStyle | ( | ) | const |
Gets some information about the window.
CGUL::String CGUL::Window::GetTitle | ( | ) | const |
Gets the title of the window.
CGUL::UInt32 CGUL::Window::GetWidth | ( | ) | const |
Gets the width of the window, excluding the border.
void CGUL::Window::HandleMessages | ( | ) |
Handles system messages and updates input.
This method acts a little bit differently on each operating system. It is important to call this every tick for every window.
CGUL::Boolean CGUL::Window::IsFocused | ( | ) | const |
Checks if the window currently has focus.
bool CGUL::Window::IsOpen | ( | ) | const |
Checks if the window is still open.
void CGUL::Window::SetAlwaysOnTop | ( | Boolean | alwaysOnTop | ) |
Sets whether the window is always on top.
alwaysOnTop | True for always on top, false otherwise. |
void CGUL::Window::SetBackgroundColor | ( | const Color & | color | ) |
Sets the background color of the window.
color | The new background color. |
void CGUL::Window::SetHeight | ( | UInt32 | height | ) |
Sets the height of the window, excluding the border.
height | The new height of the window. |
void CGUL::Window::SetPosition | ( | const SCoord32 & | position | ) |
Sets the position of the window on the screen.
position | The new position of the window. |
void CGUL::Window::SetResizable | ( | Boolean | resizable | ) |
Sets whether the window is resizable or not.
resizable | True for resizable, false otherwise. |
void CGUL::Window::SetSize | ( | const UCoord32 & | size | ) | const |
Sets the size of the window, excluding the border.
void CGUL::Window::SetStyle | ( | const WindowStyle & | style | ) |
Updates a window's style.
style | The style structure. |
This method will reset all elements within the WindowStyle, not only those which have changed. It can be used to "backup" a window at a given state and then reset to it later. Alternatively, it is possible to grab the current style with GetStyle and then modify individual elements, and pass it back into SetStyle.
void CGUL::Window::SetTitle | ( | const String & | title | ) |
Sets the title of the window.
title | The new title string. |
void CGUL::Window::SetWidth | ( | UInt32 | width | ) |
Sets the width of the window, excluding the border.
width | The new width of the window. |
|
static |
Updates all windows in the current application.
The operating system usually handles windows under the same application in bulk. For this reason, it is only necessary to call update once for every window. It is still important to update a window's input manually, however.