diff options
| author | Alexander Pickering <alex@cogarr.net> | 2018-07-31 16:42:13 -0400 |
|---|---|---|
| committer | Alexander Pickering <alex@cogarr.net> | 2018-07-31 16:42:13 -0400 |
| commit | 1d677927e73e2d66591738777f6a1559527dbab2 (patch) | |
| tree | a4a0190ac748191dd863c19440c82e8d4f5aa427 /src/client/lua_api/video/iimage.cpp | |
| parent | 11857adbdce423ca93980c884d3dc94a974f735f (diff) | |
| download | brokengine-1d677927e73e2d66591738777f6a1559527dbab2.tar.gz brokengine-1d677927e73e2d66591738777f6a1559527dbab2.tar.bz2 brokengine-1d677927e73e2d66591738777f6a1559527dbab2.zip | |
Added an editbox
Added bindings to Irrlicht's EditBox gui element.
Diffstat (limited to 'src/client/lua_api/video/iimage.cpp')
| -rw-r--r-- | src/client/lua_api/video/iimage.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
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}, }; |
