@@ -12,7 +12,9 @@ MainMenu_State::MainMenu_State(sf::RenderWindow *window,
1212}
1313
1414// Destructor
15- MainMenu_State::~MainMenu_State () {}
15+ MainMenu_State::~MainMenu_State () {
16+ // std::cout << "MainMenu Destructor called" << '\n';
17+ }
1618
1719void MainMenu_State::initColors () {
1820 BGN_COL = sf::Color (246 , 229 , 245 , 255 );
@@ -74,8 +76,8 @@ void MainMenu_State::initButtons() {
7476 int x = window_->getSize ().x / 2 ;
7577 int y = window_->getSize ().y / 2 - 150 ;
7678
77- testDDL_ = std::make_unique<gui::DropDownList>(
78- x, y, 250 , 50 , &font2_, " SELECT ALGORITHM" , algo_vec_, 4 );
79+ ddl_ = std::make_unique<gui::DropDownList>(x, y, 250 , 50 , &font2_,
80+ " SELECT ALGORITHM" , algo_vec_, 4 );
7981
8082 buttons_[" EXIT" ] = std::make_unique<gui::Button>(
8183 x, y + 410 , 150 , 50 , &font2_, " EXIT" , 20 , IDLE_COL, HOVER_COL,
@@ -87,10 +89,10 @@ void MainMenu_State::updateButtons(const float &dt) {
8789 it.second ->update (sf::Vector2f (mousePositionWindow_));
8890 }
8991
90- testDDL_ ->update (sf::Vector2f (mousePositionWindow_), dt);
92+ ddl_ ->update (sf::Vector2f (mousePositionWindow_), dt);
9193
92- if (testDDL_ ->hasActiveButton ()) {
93- std::string algo = testDDL_ ->getActiveButton ()->getText ();
94+ if (ddl_ ->hasActiveButton ()) {
95+ std::string algo = ddl_ ->getActiveButton ()->getText ();
9496
9597 int index = -1 ;
9698 for (auto i = 0 ; i < algo_vec_.size (); i++) {
@@ -120,6 +122,8 @@ void MainMenu_State::updateButtons(const float &dt) {
120122 default :
121123 break ;
122124 }
125+
126+ ddl_->makeButtonInActive ();
123127 }
124128
125129 // Quit the game
@@ -133,7 +137,7 @@ void MainMenu_State::renderButtons() {
133137 it.second ->render (window_);
134138 }
135139
136- testDDL_ ->render (window_);
140+ ddl_ ->render (window_);
137141}
138142
139143void MainMenu_State::renderBackground () {
@@ -147,7 +151,7 @@ void MainMenu_State::renderBackground() {
147151}
148152
149153void MainMenu_State::endState () {
150- std::cout << " Ending MainMenu State" << ' \n ' ;
154+ // std::cout << "Ending MainMenu State" << '\n';
151155}
152156
153157void MainMenu_State::updateKeybinds () { checkForQuit (); }
0 commit comments