aboutsummaryrefslogtreecommitdiffstats
path: root/src/screen.cpp
blob: fbefc5ea96a055fbb8372bf0c9bda3da5c8e2a67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "screen.h"

#include <ncurses.h>

void
Screen::addWindow(const std::string &key, std::shared_ptr<Boxii::Window> value)
{
    m_windows.emplace(key, value);
    m_order.push_back(std::weak_ptr<Boxii::Window>(value));
}

void
Screen::render()
{
    for(auto it = m_order.begin(); it != m_order.end(); it++){
        if(auto obs = it->lock()){
            if(m_redraw) obs->setRedraw();
            obs->refresh();
        }else{
            m_order.erase(it--);
        }
    }
    m_redraw = false;
}