![]() |
TinyLib 0.1.1
|
#include <Window.h>
Public Member Functions | |
| Window (Vec2i={800, 600}, const char *="Window", LONG style=WS_OVERLAPPEDWINDOW) | |
| Create a new window, all parameters are optional. | |
| ~Window () | |
| Clean up window resources. | |
| void | create (Vec2i={800, 600}, const char *="Window", LONG style=WS_OVERLAPPEDWINDOW) |
| Recreate the window. | |
| bool | isOpen () |
| Check if the window is open. | |
| void | draw (Rectangle &rectangle) |
| Draw a rectangle to the screen. | |
| void | draw (Text &text) |
| Draw text to the screen. | |
| void | close () |
| Close this window. | |
| void | clear (Color color=Color(255, 255, 255, 255)) |
| Clear the window. | |
| Vec2i | getSize () const |
| Get size of the window. | |
| void | setSize (Vec2i) |
| Set the size of the window. | |
| void | setTitle (const char *title) |
| Change the window title. | |
| void | setPosition (Vec2i) |
| Set the window's position on screen. | |
| void | move (Vec2i) |
| Move the window from current position. | |
| Vec2i | getPosition () const |
| Get the current position of the window. | |
| void | display () |
| Display what you've drawn to the window. | |
| void | limitFPS (u32 fps) |
| Caps the framerate to given value, 0 for unlimited. | |
| bit | checkEvent (u8 event) |
| Check if a window event activated this frame. | |
| tl::Window::Window | ( | Vec2i | size = {800, 600}, |
| const char * | title = "Window", | ||
| LONG | style = WS_OVERLAPPEDWINDOW ) |
Create a new window, all parameters are optional.
| size | The width, height of this window in pixels. |
| title | The title of the window. |
| style | Additional window style flags. |
Size is optional, default is 800x600. Title is optional, default is "Window". Style is optional, default is tl::Style::Default.
Definition at line 53 of file Window.cpp.
| tl::Window::~Window | ( | ) |
Clean up window resources.
Definition at line 60 of file Window.cpp.
Check if a window event activated this frame.
| event | Window event to check. |
Events are an enum defined in Window.h, tl::Event.
Definition at line 250 of file Window.cpp.
Clear the window.
| color | Color to clear window with. |
Definition at line 167 of file Window.cpp.
| void tl::Window::close | ( | ) |
Close this window.
Definition at line 158 of file Window.cpp.
| void tl::Window::create | ( | Vec2i | size = {800, 600}, |
| const char * | title = "Window", | ||
| LONG | style = WS_OVERLAPPEDWINDOW ) |
Recreate the window.
| size | The width, height of this window in pixels. |
| title | The title of the window. |
| style | Additional window style flags. |
All parameters are optional, any you don't provide will stay the same.
Definition at line 73 of file Window.cpp.
| void tl::Window::display | ( | ) |
Display what you've drawn to the window.
Definition at line 174 of file Window.cpp.
| void tl::Window::draw | ( | Rectangle & | rectangle | ) |
Draw a rectangle to the screen.
| rectangle | The rectangle to draw. |
Definition at line 143 of file Window.cpp.
| void tl::Window::draw | ( | Text & | text | ) |
Draw text to the screen.
| text | The text you want to draw. |
Definition at line 151 of file Window.cpp.
| Vec2i tl::Window::getPosition | ( | ) | const |
Get the current position of the window.
Definition at line 224 of file Window.cpp.
| Vec2i tl::Window::getSize | ( | ) | const |
| bool tl::Window::isOpen | ( | ) |
Check if the window is open.
This method also makes sure the program doesn't go past the FPS cap if set with Window::limitFPS().
Definition at line 115 of file Window.cpp.
| void tl::Window::limitFPS | ( | u32 | fps | ) |
Caps the framerate to given value, 0 for unlimited.
| fps | Framerate cap. |
FPS cap is enforced in Window::isOpen().
Definition at line 236 of file Window.cpp.
| void tl::Window::move | ( | Vec2i | pos | ) |
Move the window from current position.
| pos | Move the window by x, y. |
Definition at line 216 of file Window.cpp.
| void tl::Window::setPosition | ( | Vec2i | pos | ) |
Set the window's position on screen.
| pos | New x, y position for the window. |
Definition at line 208 of file Window.cpp.
| void tl::Window::setSize | ( | Vec2i | size | ) |
Set the size of the window.
| size | Set the width, height of this window. |
Definition at line 192 of file Window.cpp.
| void tl::Window::setTitle | ( | const char * | title | ) |