![]() |
R-Type
2
Doom but in better
|
Manages an SFML-based graphical window and handles rendering of ECS components. More...
#include <Window.hpp>
Public Member Functions | |
Window (const std::uint32_t entityId=0, const std::uint32_t windowWidth=800, const std::uint32_t windowHeight=600, const std::string &windowName="R-Type", unsigned int frameRateLimit=60) | |
Constructs a new Window object. | |
~Window () | |
Destroys the Window object. | |
void | setPosition (const std::pair< int, int > &position) |
Set the Position of the window. | |
void | setIcon (const GUI::ECS::Components::ImageComponent &icon) |
Set the Icon of the window. | |
void | setTitle (const std::string &title="R-Type") |
Set the Title of the window. | |
void | clear (const GUI::ECS::Systems::Colour &color=GUI::ECS::Systems::Colour::Black) |
Clears the window with the specified color. | |
void | display () |
Displays the contents of the window on the screen. | |
bool | isOpen () const |
Checks if the window is currently open. | |
void | close () |
Closes the window. | |
std::any | pollEvent () |
Polls for the next event in the window's event queue. | |
void | setFramerateLimit (const unsigned int framerateLimit) |
Sets the frame rate limit of the window. | |
void | setFullScreen (const bool fullScreen) |
Enables or disables fullscreen mode for the window. | |
const std::string | getInfo (const unsigned int indent=0) const |
This is a function meant for debugging purposes It will dump the current state of the variables upon call. It will dump them for itself and any of it's underlying classes. | |
const bool | getFullScreen () const |
Retrieves the current fullscreen mode of the window. | |
const std::string | getTitle () const |
Get the Title of the window. | |
const std::pair< int, int > | getDimensions () const |
Get the Dimensions of the window. | |
const std::pair< int, int > | getPosition () const |
Get the Position of the window. | |
void | draw (const GUI::ECS::Components::TextComponent &text) |
Renders a text component to the window. | |
void | draw (const GUI::ECS::Components::ShapeComponent &shape) |
Renders a shape component to the window. | |
void | draw (const GUI::ECS::Components::ImageComponent &image) |
Renders an image component to the window. | |
void | draw (const GUI::ECS::Components::SpriteComponent &sprite) |
Renders a sprite component to the window. | |
void | draw (const GUI::ECS::Components::ButtonComponent &button) |
Renders a button component to the window. | |
![]() | |
EntityNode (const size_t entityId=0) | |
virtual | ~EntityNode ()=default |
virtual size_t | getEntityNodeId () const |
Additional Inherited Members | |
![]() | |
size_t | _entityID |
Manages an SFML-based graphical window and handles rendering of ECS components.
Definition at line 67 of file Window.hpp.
GUI::ECS::Systems::Window::Window | ( | const std::uint32_t | entityId = 0, |
const std::uint32_t | windowWidth = 800, | ||
const std::uint32_t | windowHeight = 600, | ||
const std::string & | windowName = "R-Type", | ||
unsigned int | frameRateLimit = 60 ) |
Constructs a new Window object.
entityId | The unique ID of the entity associated with this window. |
windowWidth | The width of the window in pixels. |
windowHeight | The height of the window in pixels. |
windowName | The title of the window. |
frameRateLimit | The maximum frame rate for rendering. |
Definition at line 16 of file Window.cpp.
GUI::ECS::Systems::Window::~Window | ( | ) |
Destroys the Window object.
Definition at line 26 of file Window.cpp.
void GUI::ECS::Systems::Window::clear | ( | const GUI::ECS::Systems::Colour & | color = GUI::ECS::Systems::Colour::Black | ) |
Clears the window with the specified color.
color | The color to clear the window with. Defaults to black. |
Definition at line 65 of file Window.cpp.
void GUI::ECS::Systems::Window::close | ( | ) |
Closes the window.
Definition at line 90 of file Window.cpp.
void GUI::ECS::Systems::Window::display | ( | ) |
Displays the contents of the window on the screen.
Definition at line 80 of file Window.cpp.
void GUI::ECS::Systems::Window::draw | ( | const GUI::ECS::Components::ButtonComponent & | button | ) |
Renders a button component to the window.
button | The button component to render. |
Definition at line 284 of file Window.cpp.
void GUI::ECS::Systems::Window::draw | ( | const GUI::ECS::Components::ImageComponent & | image | ) |
Renders an image component to the window.
image | The image component to render. |
Definition at line 238 of file Window.cpp.
void GUI::ECS::Systems::Window::draw | ( | const GUI::ECS::Components::ShapeComponent & | shape | ) |
Renders a shape component to the window.
shape | The shape component to render. |
Definition at line 182 of file Window.cpp.
void GUI::ECS::Systems::Window::draw | ( | const GUI::ECS::Components::SpriteComponent & | sprite | ) |
Renders a sprite component to the window.
sprite | The sprite component to render. |
Definition at line 261 of file Window.cpp.
void GUI::ECS::Systems::Window::draw | ( | const GUI::ECS::Components::TextComponent & | text | ) |
Renders a text component to the window.
text | The text component to render. |
Definition at line 167 of file Window.cpp.
const std::pair< int, int > GUI::ECS::Systems::Window::getDimensions | ( | ) | const |
Get the Dimensions of the window.
Definition at line 137 of file Window.cpp.
const bool GUI::ECS::Systems::Window::getFullScreen | ( | ) | const |
Retrieves the current fullscreen mode of the window.
Definition at line 127 of file Window.cpp.
const std::string GUI::ECS::Systems::Window::getInfo | ( | const unsigned int | indent = 0 | ) | const |
This is a function meant for debugging purposes It will dump the current state of the variables upon call. It will dump them for itself and any of it's underlying classes.
indent | The level to which the class should be indented in the dump. |
Definition at line 149 of file Window.cpp.
const std::pair< int, int > GUI::ECS::Systems::Window::getPosition | ( | ) | const |
Get the Position of the window.
Definition at line 143 of file Window.cpp.
const std::string GUI::ECS::Systems::Window::getTitle | ( | ) | const |
bool GUI::ECS::Systems::Window::isOpen | ( | ) | const |
Checks if the window is currently open.
Definition at line 85 of file Window.cpp.
std::any GUI::ECS::Systems::Window::pollEvent | ( | ) |
Polls for the next event in the window's event queue.
std::any
containing the event, or an empty value if no event is available. Definition at line 95 of file Window.cpp.
void GUI::ECS::Systems::Window::setFramerateLimit | ( | const unsigned int | framerateLimit | ) |
Sets the frame rate limit of the window.
framerateLimit | The maximum number of frames per second. |
Definition at line 107 of file Window.cpp.
void GUI::ECS::Systems::Window::setFullScreen | ( | const bool | fullScreen | ) |
Enables or disables fullscreen mode for the window.
fullScreen | Whether to enable fullscreen mode. |
Definition at line 112 of file Window.cpp.
void GUI::ECS::Systems::Window::setIcon | ( | const GUI::ECS::Components::ImageComponent & | icon | ) |
Set the Icon of the window.
icon | A GUI::ECS::Components::ImageComponent of the window icon to be set. |
Definition at line 35 of file Window.cpp.
void GUI::ECS::Systems::Window::setPosition | ( | const std::pair< int, int > & | position | ) |
Set the Position of the window.
position | an std::pair<int, int> of the window position (x, y). |
Definition at line 28 of file Window.cpp.
void GUI::ECS::Systems::Window::setTitle | ( | const std::string & | title = "R-Type" | ) |