aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/gui/iguiimage.cpp
diff options
context:
space:
mode:
authorAlexander Pickering <alex@cogarr.net>2018-09-10 23:11:08 -0400
committerAlexander Pickering <alex@cogarr.net>2018-09-10 23:11:08 -0400
commitc38d5eca7091fc7f0206ed0c746622022b2ae508 (patch)
tree8c01d4a941b4152675354b8b7a46c0906e9fb40c /src/client/lua_api/gui/iguiimage.cpp
parentb3c0d2ead1f384b35615be562c5f06804e8990cb (diff)
downloadbrokengine-c38d5eca7091fc7f0206ed0c746622022b2ae508.tar.gz
brokengine-c38d5eca7091fc7f0206ed0c746622022b2ae508.tar.bz2
brokengine-c38d5eca7091fc7f0206ed0c746622022b2ae508.zip
Added documentation
Also added treeview guielemnt Also added ifilesystem guielement Also added io library
Diffstat (limited to 'src/client/lua_api/gui/iguiimage.cpp')
-rw-r--r--src/client/lua_api/gui/iguiimage.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/client/lua_api/gui/iguiimage.cpp b/src/client/lua_api/gui/iguiimage.cpp
index 5ad8ba3..1d0f4dc 100644
--- a/src/client/lua_api/gui/iguiimage.cpp
+++ b/src/client/lua_api/gui/iguiimage.cpp
@@ -17,16 +17,35 @@ extern "C" {
#include "../../callbackhandeler.hpp"
#include <shared/lua_api/common.hpp>
+/***
+@module gui
+*/
using namespace irr;
using namespace gui;
extern IrrlichtDevice* device;
extern IGUIEnvironment* env;
-//new({startx,starty},alpha,{itexture}) -> {guielement}
+/***
+@function newiguiimage()
+Creates a new guielement with an image.
+The size of the iguielement is the same as the itexture used for it's creation.
+@tparam vector2d position The upper-left hand corner of the element.
+it is offset from the upper-left of the parent element.
+@tparam number alpha The transparency of the element.
+@tparam itexture texture The texture to display on this element.
+@tparam ?iguielement parent The parent element of the button.
+@treturn iguifileopendialog The button element
+*/
+//newiguiimage({startx,starty},alpha,{itexture}[,parent]) -> {guielement}
static int newiguiimage(lua_State* L){
//printf("Creating iguiimage\n");
-
+ IGUIElement *parent = NULL;
+ if(lua_gettop(L) > 3){
+ lua_getfield(L,-1,"guielement");
+ parent = (IGUIElement*)lua_touserdata(L,-1);
+ lua_pop(L,2);
+ }
lua_getfield(L,-1,"texture");//{startx,starty},alpha,{itexture},*itexture
video::ITexture* tex = (video::ITexture*)lua_touserdata(L,-1);
lua_pop(L,2);//{startx,starty},alpha,
@@ -38,7 +57,7 @@ static int newiguiimage(lua_State* L){
popvector2i(L,&sx,&sy);
IGUIEnvironment* env = device->getGUIEnvironment();
- IGUIImage* img = env->addImage(tex,core::position2d<s32>(sx,sy),usealpha,0,-1,L"");
+ IGUIImage* img = env->addImage(tex,core::position2d<s32>(sx,sy),usealpha,parent,-1,L"");
img->setImage(tex);
lua_newtable(L);