diff --git a/src/modules/window/Window.h b/src/modules/window/Window.h index 9676dd455..3a53cba79 100644 --- a/src/modules/window/Window.h +++ b/src/modules/window/Window.h @@ -217,7 +217,7 @@ class Window : public Module 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; diff --git a/src/modules/window/sdl/Window.cpp b/src/modules/window/sdl/Window.cpp index 5205bcd7e..fa8be97d0 100644 --- a/src/modules/window/sdl/Window.cpp +++ b/src/modules/window/sdl/Window.cpp @@ -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; } diff --git a/src/modules/window/sdl/Window.h b/src/modules/window/sdl/Window.h index d97dbd38a..fd006958a 100644 --- a/src/modules/window/sdl/Window.h +++ b/src/modules/window/sdl/Window.h @@ -123,7 +123,7 @@ class Window final : public love::window::Window 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; diff --git a/src/modules/window/wrap_Window.cpp b/src/modules/window/wrap_Window.cpp index 60aea2993..cc1bd3bd1 100644 --- a/src/modules/window/wrap_Window.cpp +++ b/src/modules/window/wrap_Window.cpp @@ -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 } };