aboutsummaryrefslogtreecommitdiff
path: root/src/client/lua_api/gui/iguilabel.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/iguilabel.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/iguilabel.cpp')
-rw-r--r--src/client/lua_api/gui/iguilabel.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/client/lua_api/gui/iguilabel.cpp b/src/client/lua_api/gui/iguilabel.cpp
index 92611b2..336f81c 100644
--- a/src/client/lua_api/gui/iguilabel.cpp
+++ b/src/client/lua_api/gui/iguilabel.cpp
@@ -17,12 +17,24 @@ extern "C" {
#include "../../callbackhandeler.hpp"
#include <shared/lua_api/common.hpp>
+/***
+@module gui
+*/
using namespace irr;
using namespace gui;
extern IrrlichtDevice* device;
-//gui.newguilabel({{sx,sy},{ex,ey}},"text"[,parent]) :: {guielement}
+/***
+@function newlabel()
+Creates a new label to display text.
+@tparam rect pos The position of the label, reletive to the upper-left of it's
+parent element, or the root window if parent is nil.
+@tparam string text The text to display on this label.
+@tparam ?iguielement parent The parent element of the button.
+@treturn iguilabel The label element
+*/
+//gui.newlabel({{sx,sy},{ex,ey}},"text"[,parent]) :: {guielement}
static int newiguilabel(lua_State* L){
printf("Createing label!\n");
int nargs = lua_gettop(L);
@@ -36,8 +48,9 @@ static int newiguilabel(lua_State* L){
const char* text = lua_tostring(L,-1);//{{sx,sy},{ex,ey}},"text"
int bls = strlen(text);
- wchar_t* text_w = (wchar_t*)malloc(sizeof(wchar_t)*bls);
+ wchar_t* text_w = (wchar_t*)malloc((sizeof(wchar_t)*bls) + 1);//+1 for null
mbstowcs(text_w,text,bls);
+ text_w[bls] = L'\0';
lua_pop(L,1);//{{sx,sy},{ex,ey}}
long sx, sy, ex, ey;