lua logs fade out individually
This commit is contained in:
parent
a801f0a0b4
commit
46eda12479
@ -192,7 +192,6 @@ GameView::GameView():
|
|||||||
recordingIndex(0),
|
recordingIndex(0),
|
||||||
toolTipPresence(0),
|
toolTipPresence(0),
|
||||||
currentSaveType(0),
|
currentSaveType(0),
|
||||||
lastLogEntry(0.0f),
|
|
||||||
lastMenu(-1)
|
lastMenu(-1)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1647,8 +1646,6 @@ void GameView::OnTick(float dt)
|
|||||||
toolTipPresence = 0;
|
toolTipPresence = 0;
|
||||||
}
|
}
|
||||||
c->Update();
|
c->Update();
|
||||||
if(lastLogEntry > -0.1f)
|
|
||||||
lastLogEntry -= 0.16*dt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1823,8 +1820,7 @@ void GameView::NotifyZoomChanged(GameModel * sender)
|
|||||||
|
|
||||||
void GameView::NotifyLogChanged(GameModel * sender, string entry)
|
void GameView::NotifyLogChanged(GameModel * sender, string entry)
|
||||||
{
|
{
|
||||||
logEntries.push_front(entry);
|
logEntries.push_front(std::pair<std::string, int>(entry, 600));
|
||||||
lastLogEntry = 100.0f;
|
|
||||||
if (logEntries.size() > 20)
|
if (logEntries.size() > 20)
|
||||||
logEntries.pop_back();
|
logEntries.pop_back();
|
||||||
}
|
}
|
||||||
@ -2076,20 +2072,24 @@ void GameView::OnDraw()
|
|||||||
Client::Ref().WriteFile(data, filename.str());
|
Client::Ref().WriteFile(data, filename.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (logEntries.size())
|
||||||
|
{
|
||||||
int startX = 20;
|
int startX = 20;
|
||||||
int startY = YRES-20;
|
int startY = YRES-20;
|
||||||
int startAlpha;
|
deque<std::pair<std::string, int>>::iterator iter;
|
||||||
if(lastLogEntry>0.1f && logEntries.size())
|
for(iter = logEntries.begin(); iter != logEntries.end(); iter++)
|
||||||
{
|
{
|
||||||
startAlpha = 2.55f*lastLogEntry;
|
string message = (*iter).first;
|
||||||
deque<string>::iterator iter;
|
int alpha = std::min((*iter).second, 255);
|
||||||
for(iter = logEntries.begin(); iter != logEntries.end() && startAlpha>0; iter++)
|
if (alpha <= 0) //erase this and everything older
|
||||||
{
|
{
|
||||||
string message = (*iter);
|
logEntries.erase(iter, logEntries.end());
|
||||||
|
break;
|
||||||
|
}
|
||||||
startY -= 14;
|
startY -= 14;
|
||||||
g->fillrect(startX-3, startY-3, Graphics::textwidth((char*)message.c_str())+6, 14, 0, 0, 0, 100);
|
g->fillrect(startX-3, startY-3, Graphics::textwidth((char*)message.c_str())+6, 14, 0, 0, 0, 100);
|
||||||
g->drawtext(startX, startY, message.c_str(), 255, 255, 255, startAlpha);
|
g->drawtext(startX, startY, message.c_str(), 255, 255, 255, alpha);
|
||||||
startAlpha-=14;
|
(*iter).second -= 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,8 +77,7 @@ private:
|
|||||||
vector<ui::Button*> menuButtons;
|
vector<ui::Button*> menuButtons;
|
||||||
vector<ToolButton*> toolButtons;
|
vector<ToolButton*> toolButtons;
|
||||||
vector<ui::Component*> notificationComponents;
|
vector<ui::Component*> notificationComponents;
|
||||||
deque<string> logEntries;
|
deque<std::pair<std::string, int>> logEntries;
|
||||||
float lastLogEntry;
|
|
||||||
ui::Button * scrollBar;
|
ui::Button * scrollBar;
|
||||||
ui::Button * searchButton;
|
ui::Button * searchButton;
|
||||||
ui::Button * reloadButton;
|
ui::Button * reloadButton;
|
||||||
|
Loading…
Reference in New Issue
Block a user