Rubeus::GraphicComponents::RWindowComponent class

A window component that bridges GLFW function calls to handle Rubeus game window.

Base classes

class Rubeus::RMasterComponent
A master component. Serves as parent class for all components.

Public static variables

static int MouseX
Mouse positions.

Constructors, destructors, conversion operators

RWindowComponent(const char* title, int width, int height, EWindowParameters windowMode = EWindowParameters::WINDOWED_MODE, EWindowParameters windowType = EWindowParameters::RESIZABLE_WINDOW, int setFPS = 1)
Constructor. Use enum EWindowParameters for windowMode and windowType.
~RWindowComponent()
Destructor.

Public functions

auto initWindow(const char* title, int width, int height, EWindowParameters windowMode = EWindowParameters::WINDOWED_MODE, EWindowParameters windowType = EWindowParameters::RESIZABLE_WINDOW) -> bool
Initializes the Rubeus game window. Use enum EWindowParameters for windowMode and windowType.
void clearWindow()
Clears the window with a color buffer.
void updateWindow()
Updates the window Polls GLFW for any changes Then swaps the buffers.
auto closed() -> bool
Queries if the window is closed.
void setWindowTitle(const char* title)
Sets window title.
auto getWidth() const -> const int&
Gets the width of this window.
auto getHeight() const -> const int&
Gets the height of this window.
void change_window_title(var data)
Changes the title of the window.
void get_loaded_image(var data)
Receive the reply to an earlier message sent with the command, change_window_title

Public variables

GLFWwindow* m_GLFWWindow
GLFW Window object.

Friends

void windowCloseCallback(GLFWwindow* window)
Callback, called when the window closes.
void windowResizeCallback(GLFWwindow* window, int width, int height)
Callback, called when the window resize.

Function documentation

Rubeus::GraphicComponents::RWindowComponent::RWindowComponent(const char* title, int width, int height, EWindowParameters windowMode = EWindowParameters::WINDOWED_MODE, EWindowParameters windowType = EWindowParameters::RESIZABLE_WINDOW, int setFPS = 1)

Constructor. Use enum EWindowParameters for windowMode and windowType.

Parameters
title The title of the window to be formed.
width The width of the window to be formed in pixels.
height The height of the window to be formed in pixels.
windowMode (Optional) The window mode. Default is windowed mode.
windowType (Optional) Type of the window. Default is resizable window.
setFPS The FPS. Default is 60fps. Use 0 for unbound FPS, 1 for 60 FPS, 2 for 30 FPS, and likewise

bool Rubeus::GraphicComponents::RWindowComponent::initWindow(const char* title, int width, int height, EWindowParameters windowMode = EWindowParameters::WINDOWED_MODE, EWindowParameters windowType = EWindowParameters::RESIZABLE_WINDOW)

Initializes the Rubeus game window. Use enum EWindowParameters for windowMode and windowType.

Parameters
title The title of the window to be formed.
width The width of the window to be formed.
height The height of the window to be formed.
windowMode (Optional) The window mode. Default is windowed mode
windowType (Optional) Type of the window. Default is resizable window
Returns True if it succeeds, false if it fails.

bool Rubeus::GraphicComponents::RWindowComponent::closed()

Queries if the window is closed.

Returns m_Closed.

void Rubeus::GraphicComponents::RWindowComponent::setWindowTitle(const char* title)

Sets window title.

Parameters
title The title.

const int& Rubeus::GraphicComponents::RWindowComponent::getWidth() const

Gets the width of this window.

Returns Width of this window.

const int& Rubeus::GraphicComponents::RWindowComponent::getHeight() const

Gets the height of this window.

Returns Height of this window.

void Rubeus::GraphicComponents::RWindowComponent::change_window_title(var data)

Changes the title of the window.

Parameters
data The title

void Rubeus::GraphicComponents::RWindowComponent::get_loaded_image(var data)

Receive the reply to an earlier message sent with the command, change_window_title

Parameters
data The image

void windowCloseCallback(GLFWwindow* window)

Callback, called when the window closes.

Parameters
window in/out Pointer to GLFWwindow object being closed.

void windowResizeCallback(GLFWwindow* window, int width, int height)

Callback, called when the window resize.

Parameters
window in/out Pointer to GLFWwindow object being resized.
width The width of the resized window.
height The height of the resized window.