Implement static GetMouseCoordinates() ?

This commit is contained in:
2024-02-22 00:31:04 -05:00
parent 28f904783f
commit ffe49e4c67
2 changed files with 23 additions and 7 deletions

View File

@@ -158,6 +158,14 @@ 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()
{
if (singleton != nullptr)
return singleton->getCursorPos();
return Vector2::NaN;
}
void setRenderer(RenderingAPI api);
void Open();
void Close();
@@ -222,7 +230,7 @@ namespace ReWindow
RenderingAPI renderer;
bool open = false;
bool resizable;
static RWindow* singleton;
};

View File

@@ -29,15 +29,27 @@ GLXContext glContext;
namespace ReWindow {
RWindow::RWindow() {
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;
}
void RWindow::raise() const { XRaiseWindow(display, window); }
void RWindow::lower() const { XLowerWindow(display, window); }
@@ -383,11 +395,7 @@ namespace ReWindow {
return false;
}
RWindow::RWindow() {
title = "ReWindow Application";
width = 640;
height = 480;
}
void RWindow::setRenderer(RenderingAPI api) {
renderer = api;