This commit is contained in:
2024-02-24 08:42:42 -05:00
parent 9f0a511022
commit 5696dd4ed8
2 changed files with 6 additions and 13 deletions

View File

@@ -158,11 +158,9 @@ namespace ReWindow
RWindow(const std::string& title, int width, int height);
RWindow(const std::string& title, int width, int height, RenderingAPI renderer);
static Vector2 GetMouseCoordinates()
Vector2 GetMouseCoordinates() const
{
if (singleton != nullptr)
return singleton->getCursorPos();
return Vector2::NaN;
return getCursorPos();
}
@@ -230,7 +228,9 @@ namespace ReWindow
RenderingAPI renderer;
bool open = false;
bool resizable;
static RWindow* singleton;
//You can't do this because you can't initialize a static member inside the class constructor.
//static RWindow* singleton;
};

View File

@@ -33,23 +33,16 @@ namespace ReWindow {
title = "ReWindow Application";
width = 640;
height = 480;
RWindow::singleton = this;
}
RWindow::RWindow(const std::string& title, int width, int height) : flags(false,false,false,false) {
this->title = title;
this->width = width;
this->height = height;
RWindow::singleton = this;
}
RWindow::RWindow(const std::string& title, int width, int height, RenderingAPI renderer) :
title(title), width(width), height(height), renderer(renderer)
{
RWindow::singleton = this;
}
title(title), width(width), height(height), renderer(renderer) {}
void RWindow::raise() const { XRaiseWindow(display, window); }
void RWindow::lower() const { XLowerWindow(display, window); }