Changed: export reflect texture(pushed, over) on CCtrlTextButton element

--HG--
branch : menu_navi
hg/feature/menu-navi
Inky 5 years ago
parent 6fdbdc9ed1
commit 8006dbeabe

@ -124,6 +124,16 @@ namespace NLGUI
void setTexturePushed(const std::string &l, const std::string &m, const std::string &r); void setTexturePushed(const std::string &l, const std::string &m, const std::string &r);
void setTextureOver(const std::string &l, const std::string &m, const std::string &r); void setTextureOver(const std::string &l, const std::string &m, const std::string &r);
// lua
void setTextureLua (const std::string &name);
void setTexturePushedLua (const std::string &name);
void setTextureOverLua (const std::string &name);
// return texture _l.tga
std::string getTexture () const;
std::string getTexturePushed () const;
std::string getTextureOver() const;
int luaGetViewText(CLuaState &ls); int luaGetViewText(CLuaState &ls);
REFLECT_EXPORT_START(CCtrlTextButton, CCtrlBaseButton) REFLECT_EXPORT_START(CCtrlTextButton, CCtrlBaseButton)
@ -134,6 +144,9 @@ namespace NLGUI
REFLECT_SINT32("wmin", getWMin, setWMin) REFLECT_SINT32("wmin", getWMin, setWMin)
REFLECT_SINT32("hmin", getHMin, setHMin) REFLECT_SINT32("hmin", getHMin, setHMin)
REFLECT_LUA_METHOD("getViewText", luaGetViewText) REFLECT_LUA_METHOD("getViewText", luaGetViewText)
REFLECT_STRING("texture", getTexture, setTextureLua);
REFLECT_STRING("texture_pushed", getTexturePushed, setTexturePushedLua);
REFLECT_STRING("texture_over", getTextureOver, setTextureOverLua);
REFLECT_EXPORT_END REFLECT_EXPORT_END
void onRemoved(); void onRemoved();

@ -1074,6 +1074,69 @@ namespace NLGUI
// *************************************************************************** // ***************************************************************************
void CCtrlTextButton::setTextureLua(const std::string &name)
{
_TextureIdNormal[0].setTexture(std::string(name + "_l.tga").c_str());
_TextureIdNormal[1].setTexture(std::string(name + "_m.tga").c_str());
_TextureIdNormal[2].setTexture(std::string(name + "_r.tga").c_str());
}
// ***************************************************************************
void CCtrlTextButton::setTexturePushedLua(const std::string &name)
{
_TextureIdPushed[0].setTexture(std::string(name + "_l.tga").c_str());
_TextureIdPushed[1].setTexture(std::string(name + "_m.tga").c_str());
_TextureIdPushed[2].setTexture(std::string(name + "_r.tga").c_str());
}
// ***************************************************************************
void CCtrlTextButton::setTextureOverLua(const std::string &name)
{
_TextureIdOver[0].setTexture(std::string(name + "_l.tga").c_str());
_TextureIdOver[1].setTexture(std::string(name + "_m.tga").c_str());
_TextureIdOver[2].setTexture(std::string(name + "_r.tga").c_str());
}
// ***************************************************************************
std::string CCtrlTextButton::getTexture() const
{
std::string tx = CViewRenderer::getInstance()->getTextureNameFromId(_TextureIdNormal[0]);
std::string::size_type i = tx.rfind("_l.tga");
if (i != std::string::npos)
tx = tx.substr(0, i);
return tx;
}
// ***************************************************************************
std::string CCtrlTextButton::getTexturePushed() const
{
std::string tx = CViewRenderer::getInstance()->getTextureNameFromId(_TextureIdOver[0]);
std::string::size_type i = tx.rfind("_l.tga");
if (i != std::string::npos)
tx = tx.substr(0, i);
return tx;
}
// ***************************************************************************
std::string CCtrlTextButton::getTextureOver() const
{
std::string tx = CViewRenderer::getInstance()->getTextureNameFromId(_TextureIdPushed[0]);
std::string::size_type i = tx.rfind("_l.tga");
if (i != std::string::npos)
tx = tx.substr(0, i);
return tx;
}
// ***************************************************************************
int CCtrlTextButton::luaGetViewText(CLuaState &ls) int CCtrlTextButton::luaGetViewText(CLuaState &ls)
{ {
const char *funcName = "getViewText"; const char *funcName = "getViewText";

Loading…
Cancel
Save