From 1d677927e73e2d66591738777f6a1559527dbab2 Mon Sep 17 00:00:00 2001 From: Alexander Pickering Date: Tue, 31 Jul 2018 16:42:13 -0400 Subject: Added an editbox Added bindings to Irrlicht's EditBox gui element. --- src/client/lua_api/video/iimage.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/client/lua_api/video') diff --git a/src/client/lua_api/video/iimage.cpp b/src/client/lua_api/video/iimage.cpp index aa51d29..9fb6ec2 100644 --- a/src/client/lua_api/video/iimage.cpp +++ b/src/client/lua_api/video/iimage.cpp @@ -47,7 +47,7 @@ int newiimagefromfile(lua_State* L){ img = loader->loadImage(f); } if(!hasloaded){ - lua_pushstring(L,"Failed to load file"); + lua_pushstring(L,"Failed to load file, no image loader for this type."); lua_error(L); } if(!img){ @@ -78,8 +78,20 @@ int setiimagepixel(lua_State* L){ return 0; } +//getpixel({self},{x,y}) +int getiimagepixel(lua_State* L){ + long x,y; + popvector2i(L,&x,&y); + lua_getfield(L,-1,"image"); + IImage* img = (IImage*)lua_touserdata(L,-1); + SColor color = img->getPixel(x,y); + pushvector4i(L,color.getRed(), color.getBlue(), color.getGreen(), color.getAlpha()); + return 1; +} + static const luaL_reg iimage_m[] = { - {"setPixel", setiimagepixel}, + {"setpixel", setiimagepixel}, + {"getpixel", getiimagepixel}, {0,0}, }; -- cgit v1.2.3-70-g09d2