Cleaning the ScreenLog

This commit is contained in:
Alexander Bock
2015-12-23 17:18:59 -05:00
parent 465715f652
commit 52971caef5
3 changed files with 97 additions and 50 deletions
+16 -2
View File
@@ -635,7 +635,21 @@ void RenderEngine::render(const glm::mat4 &projectionMatrix, const glm::mat4 &vi
const int category_length = 20;
const int msg_length = 140;
std::chrono::seconds fade(5);
auto entries = _log->last(max);
auto entries = _log->entries();
auto lastEntries = entries.size() > max ? std::make_pair(entries.rbegin(), entries.rbegin() + max) : std::make_pair(entries.rbegin(), entries.rend());
// if (entries.size() > max)
//ScreenLog::const_range ScreenLog::last(size_t n) {
// if (_entries.size() > n) {
// return std::make_pair(_entries.rbegin(), _entries.rbegin() + n);
// } else {
// return std::make_pair(_entries.rbegin(), _entries.rend());
// }
//}
// auto entries = _log->last(max);
const glm::vec4 white(0.9, 0.9, 0.9, 1);
const glm::vec4 red(1, 0, 0, 1);
@@ -645,7 +659,7 @@ void RenderEngine::render(const glm::mat4 &projectionMatrix, const glm::mat4 &vi
size_t nr = 1;
auto now = std::chrono::steady_clock::now();
for (auto& it = entries.first; it != entries.second; ++it) {
for (auto& it = lastEntries.first; it != lastEntries.second; ++it) {
const ScreenLog::LogEntry* e = &(*it);
std::chrono::duration<double> diff = now - e->timeStamp;