mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Add love.window.getPointer, returns a SDL_Window* as lightuserdata.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user