summaryrefslogtreecommitdiff
path: root/engine-ocean/Game/Systems/UI/ButtonAction/showwindowaction.cpp
blob: e6b97972e4dfe6814bc14be68c4b1c8bc07c02b1 (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
25
26
27
28
29
30
31
32
33
#include "showwindowaction.h"
#include "Game/Systems/UI/uisystem.h"
#include <map>

ShowWindowAction::ShowWindowAction(std::map<std::string, std::shared_ptr<UIScreen>>& all_screens,
                                   std::set<std::string>& shownScreens,
                                   const std::string screenName):
    m_screens(all_screens),
    m_shownScreens(shownScreens)
{
    m_screenName = screenName;
}



void ShowWindowAction::activate(){
    std::cout << "activated window show!!!" << std::endl;

    // add screen to be rendered, and also set it be the only one active
    //m_screens[m_screenName] = m_screen;
//    for (auto &screen : m_screens){
//        screen.second->isActive = false;
//    }

//    m_screens[m_screenName]->isActive = true;
    m_shownScreens.insert(m_screenName);
    m_screens[m_screenName]->isActive = true;

}

void ShowWindowAction::deactivate(){
    m_shownScreens.erase(m_screenName);
}