diff --git a/src/gui/lua/lua_cc_picture.cpp b/src/gui/lua/lua_cc_picture.cpp index 926bb520f..b383bd79b 100644 --- a/src/gui/lua/lua_cc_picture.cpp +++ b/src/gui/lua/lua_cc_picture.cpp @@ -57,6 +57,8 @@ void CLuaInstCCPicture::CCPictureRegister(lua_State *L) { "hide", CLuaInstCCPicture::CCPictureHide }, { "setPicture", CLuaInstCCPicture::CCPictureSetPicture }, { "setCenterPos", CLuaInstCCPicture::CCPictureSetCenterPos }, + { "getHeight", CLuaInstCCPicture::CCPictureGetHeight }, + { "getWidth", CLuaInstCCPicture::CCPictureGetWidth }, { "__gc", CLuaInstCCPicture::CCPictureDelete }, { NULL, NULL } }; @@ -126,6 +128,26 @@ int CLuaInstCCPicture::CCPictureNew(lua_State *L) return 1; } +int CLuaInstCCPicture::CCPictureGetHeight(lua_State *L) +{ + CLuaCCPicture *D = CCPictureCheck(L, 1); + if (!D) return 0; + + int h = D->cp->getHeight(); + lua_pushinteger(L, h); + return 1; +} + +int CLuaInstCCPicture::CCPictureGetWidth(lua_State *L) +{ + CLuaCCPicture *D = CCPictureCheck(L, 1); + if (!D) return 0; + + int w = D->cp->getWidth(); + lua_pushinteger(L, w); + return 1; +} + int CLuaInstCCPicture::CCPicturePaint(lua_State *L) { lua_assert(lua_istable(L,1)); diff --git a/src/gui/lua/lua_cc_picture.h b/src/gui/lua/lua_cc_picture.h index 2fb7c3e14..8bbc697ad 100644 --- a/src/gui/lua/lua_cc_picture.h +++ b/src/gui/lua/lua_cc_picture.h @@ -46,6 +46,8 @@ class CLuaInstCCPicture static int CCPictureHide(lua_State *L); static int CCPictureSetPicture(lua_State *L); static int CCPictureSetCenterPos(lua_State *L); + static int CCPictureGetHeight(lua_State *L); + static int CCPictureGetWidth(lua_State *L); static int CCPictureDelete(lua_State *L); };