Some fixes in entergame and widget clipping

This commit is contained in:
Eduardo Bart 2013-01-22 19:48:25 -02:00
parent ca4caf7991
commit 27d5506262
5 changed files with 16 additions and 9 deletions

View File

@ -261,12 +261,11 @@ function CharacterList.destroy()
end end
function CharacterList.show() function CharacterList.show()
if not loadBox and not errorBox and charactersWindow then if loadBox or errorBox or not charactersWindow then return end
charactersWindow:show() charactersWindow:show()
charactersWindow:raise() charactersWindow:raise()
charactersWindow:focus() charactersWindow:focus()
end end
end
function CharacterList.hide(showLogin) function CharacterList.hide(showLogin)
showLogin = showLogin or false showLogin = showLogin or false

View File

@ -147,6 +147,7 @@ function EnterGame.terminate()
end end
function EnterGame.show() function EnterGame.show()
if loadBox then return end
enterGame:show() enterGame:show()
enterGame:raise() enterGame:raise()
enterGame:focus() enterGame:focus()
@ -159,7 +160,7 @@ end
function EnterGame.openWindow() function EnterGame.openWindow()
if g_game.isOnline() then if g_game.isOnline() then
CharacterList.show() CharacterList.show()
elseif not CharacterList.isVisible() then elseif not g_game.isLogging() and not CharacterList.isVisible() then
EnterGame.show() EnterGame.show()
end end
end end
@ -223,6 +224,7 @@ end
function EnterGame.displayMotd() function EnterGame.displayMotd()
if not motdWindow or not motdWindow:isVisible() then if not motdWindow or not motdWindow:isVisible() then
motdWindow = displayInfoBox(tr('Message of the day'), G.motdMessage) motdWindow = displayInfoBox(tr('Message of the day'), G.motdMessage)
motdWindow.onOk = function() motdWindow = nil end
end end
end end

View File

@ -272,6 +272,7 @@ public:
bool checkBotProtection(); bool checkBotProtection();
bool isOnline() { return m_online; } bool isOnline() { return m_online; }
bool isLogging() { return !m_online && m_protocolGame; }
bool isDead() { return m_dead; } bool isDead() { return m_dead; }
bool isAttacking() { return !!m_attackingCreature; } bool isAttacking() { return !!m_attackingCreature; }
bool isFollowing() { return !!m_followingCreature; } bool isFollowing() { return !!m_followingCreature; }

View File

@ -212,6 +212,7 @@ void Client::registerLuaFunctions()
g_lua.bindSingletonFunction("g_game", "canReportBugs", &Game::canReportBugs, &g_game); g_lua.bindSingletonFunction("g_game", "canReportBugs", &Game::canReportBugs, &g_game);
g_lua.bindSingletonFunction("g_game", "checkBotProtection", &Game::checkBotProtection, &g_game); g_lua.bindSingletonFunction("g_game", "checkBotProtection", &Game::checkBotProtection, &g_game);
g_lua.bindSingletonFunction("g_game", "isOnline", &Game::isOnline, &g_game); g_lua.bindSingletonFunction("g_game", "isOnline", &Game::isOnline, &g_game);
g_lua.bindSingletonFunction("g_game", "isLogging", &Game::isLogging, &g_game);
g_lua.bindSingletonFunction("g_game", "isDead", &Game::isDead, &g_game); g_lua.bindSingletonFunction("g_game", "isDead", &Game::isDead, &g_game);
g_lua.bindSingletonFunction("g_game", "isAttacking", &Game::isAttacking, &g_game); g_lua.bindSingletonFunction("g_game", "isAttacking", &Game::isAttacking, &g_game);
g_lua.bindSingletonFunction("g_game", "isFollowing", &Game::isFollowing, &g_game); g_lua.bindSingletonFunction("g_game", "isFollowing", &Game::isFollowing, &g_game);

View File

@ -55,8 +55,11 @@ UIWidget::~UIWidget()
void UIWidget::draw(const Rect& visibleRect, Fw::DrawPane drawPane) void UIWidget::draw(const Rect& visibleRect, Fw::DrawPane drawPane)
{ {
if(m_clipping) Rect oldClipRect;
if(m_clipping) {
oldClipRect = g_painter->getClipRect();
g_painter->setClipRect(visibleRect); g_painter->setClipRect(visibleRect);
}
if(m_rotation != 0.0f) { if(m_rotation != 0.0f) {
g_painter->pushTransformMatrix(); g_painter->pushTransformMatrix();
@ -75,8 +78,9 @@ void UIWidget::draw(const Rect& visibleRect, Fw::DrawPane drawPane)
if(m_rotation != 0.0f) if(m_rotation != 0.0f)
g_painter->popTransformMatrix(); g_painter->popTransformMatrix();
if(m_clipping) if(m_clipping) {
g_painter->resetClipRect(); g_painter->setClipRect(oldClipRect);
}
} }
void UIWidget::drawSelf(Fw::DrawPane drawPane) void UIWidget::drawSelf(Fw::DrawPane drawPane)