From 3d2fed872d370b40f0aab6b37e00ff3e95184797 Mon Sep 17 00:00:00 2001 From: Alma Dejus Date: Mon, 27 Nov 2023 13:19:33 +0100 Subject: [PATCH] fixed warnings --- src/Menus.cc | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/Menus.cc b/src/Menus.cc index 53accbe..9fa2cf2 100644 --- a/src/Menus.cc +++ b/src/Menus.cc @@ -4,9 +4,11 @@ #include "States.h" #include "Context.h" #include "constants.h" + + // Start menu -------------------------------------------- -Start_menu::Start_menu() : texture{}, texture2{}, sprite{}, mouse_l{}, mouse_r{}, start_game{false}, exit_game{false}, - scoreboard{false}, menu_index{1}, starttext{}, scoreboardtext{}, quittext{}, font{} +Start_menu::Start_menu() : texture{}, texture2{}, sprite{}, mouse_l{}, mouse_r{}, starttext{}, scoreboardtext{}, + quittext{}, font{}, start_game{false}, exit_game{false}, scoreboard{false}, menu_index{1} { //sprite texture.loadFromFile("assets/meny_bild.png"); @@ -141,7 +143,7 @@ void Start_menu::handle_input(sf::Event& event) break; } - else; + else { menu_index -= 1; } @@ -153,7 +155,7 @@ void Start_menu::handle_input(sf::Event& event) break; } - else; + else { menu_index += 1; } @@ -171,8 +173,8 @@ void Start_menu::handle_input(sf::Event& event) // Pause menu -------------------------------------------- -Pause_menu::Pause_menu() : texture{}, texture2{}, sprite{}, resume_game{false}, menu{false}, exit_game{false}, - resumetext{}, startmenutext{}, quittext{}, mouse_r{}, mouse_l{}, font{}, menu_index{1} +Pause_menu::Pause_menu() : texture{}, texture2{}, sprite{}, mouse_l{}, mouse_r{}, resumetext{}, startmenutext{}, + quittext{}, font{}, resume_game{false}, exit_game{false}, menu{false}, menu_index{1} { texture.loadFromFile("assets/Pause_bild.png"); sprite.setTexture(texture);; @@ -195,7 +197,9 @@ Pause_menu::Pause_menu() : texture{}, texture2{}, sprite{}, resume_game{false}, // load textfont if ( !font.loadFromFile ("assets/fonts/Philosopher-Regular.ttf") ) - throw std::invalid_argument ("Unable to load font"); + { + throw std::invalid_argument ("Unable to load font"); + } // Resume text @@ -304,7 +308,7 @@ void Pause_menu::handle_input(sf::Event& event) break; } - else; + else { menu_index -= 1; } @@ -316,7 +320,7 @@ void Pause_menu::handle_input(sf::Event& event) break; } - else; + else { menu_index += 1; } @@ -334,8 +338,8 @@ void Pause_menu::handle_input(sf::Event& event) // Scoreboard menu -------------------------------------------- -Scoreboard_menu::Scoreboard_menu() : /*texture{},*/ texture2{}, /*sprite{},*/ menu{false}, exit_game{false}, - startmenutext{}, quittext{}, mouse_r{}, mouse_l{}, font{}, menu_index{1} +Scoreboard_menu::Scoreboard_menu() : /*texture{},*/ texture2{}, /*sprite{},*/ mouse_l{}, mouse_r{}, startmenutext{}, + quittext{}, font{}, exit_game{false}, menu{false}, menu_index{1} { // Add background later /* @@ -448,7 +452,7 @@ void Scoreboard_menu::handle_input(sf::Event& event) break; } - else; + else { menu_index -= 1; } @@ -460,7 +464,7 @@ void Scoreboard_menu::handle_input(sf::Event& event) break; } - else; + else { menu_index += 1; } @@ -478,8 +482,8 @@ void Scoreboard_menu::handle_input(sf::Event& event) // GameOver menu -------------------------------------------- -GameOver_menu::GameOver_menu() : /*texture{},*/ texture2{}, /*sprite{},*/ menu{false}, exit_game{false}, - startmenutext{}, quittext{}, mouse_r{}, mouse_l{}, font{}, menu_index{1} +GameOver_menu::GameOver_menu() : /*texture{},*/ texture2{}, /*sprite{},*/ mouse_l{}, mouse_r{}, startmenutext{}, + quittext{}, font{}, exit_game{false}, menu{false}, menu_index{1} { // Add background later /* @@ -592,7 +596,7 @@ void GameOver_menu::handle_input(sf::Event& event) break; } - else; + else { menu_index -= 1; } @@ -604,7 +608,7 @@ void GameOver_menu::handle_input(sf::Event& event) break; } - else; + else { menu_index += 1; } -- 2.30.2