aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander M Pickering <alex@cogarr.net>2023-09-17 17:02:22 -0500
committerAlexander M Pickering <alex@cogarr.net>2023-09-17 17:02:22 -0500
commitf5da9002e801281a126e1de4e1844ca0d7ac5c66 (patch)
tree800afcef1cb9a6b225852f5aed80e73d18424d2d
parent57cca727edcc318e0270d52aea88d7aec214a3e1 (diff)
downloadbrokengine-f5da9002e801281a126e1de4e1844ca0d7ac5c66.tar.gz
brokengine-f5da9002e801281a126e1de4e1844ca0d7ac5c66.tar.bz2
brokengine-f5da9002e801281a126e1de4e1844ca0d7ac5c66.zip
Add a setimage method for iguibuttons
-rw-r--r--src/client/lua_api/gui/iguibutton.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/client/lua_api/gui/iguibutton.cpp b/src/client/lua_api/gui/iguibutton.cpp
index 999e667..ee5ac79 100644
--- a/src/client/lua_api/gui/iguibutton.cpp
+++ b/src/client/lua_api/gui/iguibutton.cpp
@@ -79,12 +79,30 @@ static int newiguibutton(lua_State* L){
return 1;
}
+/***
+Set the image of a button.
+@function iguibutton:setimage(tex)
+@tparam texture tex The texture to apply to this button.
+*/
+//setimage(self, itexture)
+int setimage_button(lua_State *L){
+ lua_getfield(L,-1,"texture");//{self},{image},image*
+ video::ITexture* tex = (video::ITexture*) lua_touserdata(L,-1);
+ lua_pop(L,2);//{self}
+ lua_getfield(L,-1,"guielement");//{self},iguielement*
+ IGUIButton *e = (IGUIButton*)lua_touserdata(L,-1);
+ lua_pop(L,2);//
+ e->setImage(tex);
+ return 0;
+}
+
static const luaL_Reg iguibutton_f[] = {
{"new", newiguibutton},
{0,0},
};
static const luaL_Reg iguibutton_m[] = {
+ {"setimage", setimage_button},
{0,0},
};