Merge with menu_navi

--HG--
branch : yubo
hg/yubo
Inky 5 years ago
commit 26aef169b1

@ -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();

@ -938,7 +938,9 @@ namespace NLGUI
sint32 i = 0; sint32 i = 0;
// direction // direction
if (eventDesc.getKey() == KeyNEXT) i++; if (eventDesc.getKey() == KeyNEXT) i++;
if (eventDesc.getKey() == KeyPRIOR) i--; else if (eventDesc.getKey() == KeyPRIOR) i--;
else
return false;
if (_Vertical) if (_Vertical)
moveTrackY(-(i * _TargetStepY)); moveTrackY(-(i * _TargetStepY));

@ -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";

@ -4632,6 +4632,9 @@ class CHandlerOutgameNaviGetKeys : public IActionHandler
if (Driver->AsyncListener.isKeyPushed(KeyI)) event = 5; if (Driver->AsyncListener.isKeyPushed(KeyI)) event = 5;
if (Driver->AsyncListener.isKeyPushed(KeyP)) event = 6; if (Driver->AsyncListener.isKeyPushed(KeyP)) event = 6;
if (Driver->AsyncListener.isKeyPushed(KeyE)) event = 7; if (Driver->AsyncListener.isKeyPushed(KeyE)) event = 7;
if (Driver->AsyncListener.isKeyPushed(KeyLEFT)) event = 8;
if (Driver->AsyncListener.isKeyPushed(KeyRIGHT)) event = 9;
if (Driver->AsyncListener.isKeyPushed(KeyTAB)) event = 10;
std::string id = "create"; std::string id = "create";
if (pCaller->getId() == "ui:outgame:charsel") if (pCaller->getId() == "ui:outgame:charsel")

Loading…
Cancel
Save