diff --git a/src/Client/Systems/Menus/Menu/ButtonCallbacks.cpp b/src/Client/Systems/Menus/Menu/ButtonCallbacks.cpp index 17d48a5c..be2c46e7 100644 --- a/src/Client/Systems/Menus/Menu/ButtonCallbacks.cpp +++ b/src/Client/Systems/Menus/Menu/ButtonCallbacks.cpp @@ -12,9 +12,9 @@ #include "B-luga/SceneManager.hpp" #include "B-luga/SystemManagers/SystemManagersDirector.hpp" #include "NitworkClient.hpp" +#include "Parallax.hpp" #include "ResourcesManager.hpp" #include "SelectLobbySystems.hpp" -#include "Parallax.hpp" #include "init.hpp" namespace Menu { @@ -199,10 +199,19 @@ namespace Menu { { auto ids = Registry::getInstance().getEntitiesByComponents({typeid(Types::Parallax)}); - switch(Systems::Parallax::ActualParallax::getInstance().getActualParallaxType()) { - case JsonType::DEFAULT_PARALLAX: Systems::Parallax::ActualParallax::getInstance().setActualParralaxType(JsonType::PARALLAX_2); break; - case JsonType::PARALLAX_2: Systems::Parallax::ActualParallax::getInstance().setActualParralaxType(JsonType::DEFAULT_PARALLAX); break; - default: Systems::Parallax::ActualParallax::getInstance().setActualParralaxType(JsonType::DEFAULT_PARALLAX); break; + switch (Systems::Parallax::ActualParallax::getInstance().getActualParallaxType()) { + case JsonType::DEFAULT_PARALLAX: + Systems::Parallax::ActualParallax::getInstance().setActualParralaxType( + JsonType::PARALLAX_2); + break; + case JsonType::PARALLAX_2: + Systems::Parallax::ActualParallax::getInstance().setActualParralaxType( + JsonType::DEFAULT_PARALLAX); + break; + default: + Systems::Parallax::ActualParallax::getInstance().setActualParralaxType( + JsonType::DEFAULT_PARALLAX); + break; } } } // namespace Callback diff --git a/src/Client/Systems/Menus/Menu/ButtonCallbacks.hpp b/src/Client/Systems/Menus/Menu/ButtonCallbacks.hpp index 2a2eb1bc..1e47978d 100644 --- a/src/Client/Systems/Menus/Menu/ButtonCallbacks.hpp +++ b/src/Client/Systems/Menus/Menu/ButtonCallbacks.hpp @@ -42,10 +42,10 @@ namespace Menu { {GO_SELECT_LOBBY, "goToSelectLobby" }, {CREATE_NORMAL, "onButtonCreateLobbyNormalClicked"}, {SEND_READY, "sendReadyPacket" }, - {GO_CREATE_SERVER, "goCreateServer" }, - {CREATE_SERVER, "createServer" }, - {GO_MENU, "goToMenu" }, - {CHANGE_PARALLAX, "changeParallax" } + {GO_CREATE_SERVER, "goCreateServer" }, + {CREATE_SERVER, "createServer" }, + {GO_MENU, "goToMenu" }, + {CHANGE_PARALLAX, "changeParallax" } }); void initConnection(); @@ -75,19 +75,25 @@ namespace Menu { void changeParallax(); const std::unordered_map> callbacks = { - {CallbackType::DEFAULT_CALLBACK, &defaultCallBack }, - {CallbackType::INIT_CONNECTION, &initConnection }, - {CallbackType::CONNECT, &connectLobbySelected }, - {CallbackType::CREATE, &onButtonGotoCreateLobbyClicked }, - {CallbackType::GO_SELECT_LOBBY, &gotToSelectLobby }, - {CallbackType::GO_BACK, &goBackPage }, - {CallbackType::GO_NEXT, &goNextPage }, - {CallbackType::CREATE_NORMAL, &onButtonCreateLobbyNormalClicked}, - {CallbackType::SEND_READY, &sendReadyPacket }, - {CallbackType::GO_CREATE_SERVER, &goCreateServer }, - {CallbackType::CREATE_SERVER, &createServer }, - {CallbackType::GO_MENU, &goMenu, }, - {CallbackType::CHANGE_PARALLAX, &changeParallax, }, + {CallbackType::DEFAULT_CALLBACK, &defaultCallBack}, + {CallbackType::INIT_CONNECTION, &initConnection}, + {CallbackType::CONNECT, &connectLobbySelected}, + {CallbackType::CREATE, &onButtonGotoCreateLobbyClicked}, + {CallbackType::GO_SELECT_LOBBY, &gotToSelectLobby}, + {CallbackType::GO_BACK, &goBackPage}, + {CallbackType::GO_NEXT, &goNextPage}, + {CallbackType::CREATE_NORMAL, &onButtonCreateLobbyNormalClicked}, + {CallbackType::SEND_READY, &sendReadyPacket}, + {CallbackType::GO_CREATE_SERVER, &goCreateServer}, + {CallbackType::CREATE_SERVER, &createServer}, + { + CallbackType::GO_MENU, + &goMenu, + }, + { + CallbackType::CHANGE_PARALLAX, + &changeParallax, + }, }; } // namespace Callback } // namespace Menu diff --git a/src/Client/Systems/Parallax/Parallax.cpp b/src/Client/Systems/Parallax/Parallax.cpp index 9ab1fca7..38426794 100644 --- a/src/Client/Systems/Parallax/Parallax.cpp +++ b/src/Client/Systems/Parallax/Parallax.cpp @@ -1,7 +1,7 @@ +#include "Parallax.hpp" #include #include "B-luga-graphics/GraphicsSystems.hpp" #include "B-luga/Json.hpp" -#include "Parallax.hpp" namespace Systems::Parallax { @@ -42,7 +42,8 @@ namespace Systems::Parallax { { std::lock_guard lock(Registry::getInstance().mutex); std::vector> parallaxData = Json::getInstance().getDataByJsonType( - ResourcesManager::getPathByJsonType(Parallax::ActualParallax::getInstance().getActualParallaxType()), + ResourcesManager::getPathByJsonType( + Parallax::ActualParallax::getInstance().getActualParallaxType()), "parallax"); for (auto &elem : parallaxData) {