Add love.window.getPointer, returns a SDL_Window* as lightuserdata.

This commit is contained in:
Sasha Szpakowski
2024-01-08 21:09:40 -04:00
parent ecd9b007aa
commit 6feedc8222
4 changed files with 10 additions and 3 deletions
+1 -1
View File
@@ -217,7 +217,7 @@ public:
virtual double fromPixels(double x) const = 0;
virtual void fromPixels(double px, double py, double &wx, double &wy) const = 0;
virtual const void *getHandle() const = 0;
virtual void *getHandle() const = 0;
virtual bool showMessageBox(const std::string &title, const std::string &message, MessageBoxType type, bool attachtowindow) = 0;
virtual int showMessageBox(const MessageBoxData &data) = 0;
+1 -1
View File
@@ -1405,7 +1405,7 @@ void Window::fromPixels(double px, double py, double &wx, double &wy) const
wy = py / scale;
}
const void *Window::getHandle() const
void *Window::getHandle() const
{
return window;
}
+1 -1
View File
@@ -123,7 +123,7 @@ public:
double fromPixels(double x) const override;
void fromPixels(double px, double py, double &wx, double &wy) const override;
const void *getHandle() const override;
void *getHandle() const override;
bool showMessageBox(const std::string &title, const std::string &message, MessageBoxType type, bool attachtowindow) override;
int showMessageBox(const MessageBoxData &data) override;
+7
View File
@@ -647,6 +647,12 @@ int w_requestAttention(lua_State *L)
return 0;
}
int w_getPointer(lua_State *L)
{
lua_pushlightuserdata(L, instance()->getHandle());
return 1;
}
static const luaL_Reg functions[] =
{
{ "getDisplayCount", w_getDisplayCount },
@@ -688,6 +694,7 @@ static const luaL_Reg functions[] =
{ "isMinimized", w_isMinimized },
{ "showMessageBox", w_showMessageBox },
{ "requestAttention", w_requestAttention },
{ "getPointer", w_getPointer },
{ 0, 0 }
};