From ae352e0590f126fd653f65ddfae4881a9363b9ae Mon Sep 17 00:00:00 2001 From: Emil Kabirov Date: Sun, 10 Jun 2018 00:51:32 +0500 Subject: [PATCH] minor changes --- game/galaxy_menu.cpp | 3 +++ game/gamecode.cpp | 14 ++++++++------ game/gamecode.h | 5 +++-- game/main_code.cpp | 6 ++---- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/game/galaxy_menu.cpp b/game/galaxy_menu.cpp index ca7fbda..69dcb57 100755 --- a/game/galaxy_menu.cpp +++ b/game/galaxy_menu.cpp @@ -28,6 +28,8 @@ bool GalaxyMenu::InitGalaxyMenu(std::string config_json, float scale) { boost::property_tree::ptree error_pt; error_pt.put("error", "something goes wrong at InitGalaxyMenu"); + int levelIndex = 1; + /*..Init Menu..*/ BOOST_FOREACH(auto menu_pt, config_pt.get_child("Space", error_pt)) { Galaxy galax; @@ -52,6 +54,7 @@ bool GalaxyMenu::InitGalaxyMenu(std::string config_json, float scale) { TGameLevel lvl; lvl.FillWithFile(ST::PathToResources + levelName + ".txt"); + lvl.setBackground("shutterstock" + std::to_string(levelIndex++)); star.selectionMenu.gameLevels.push_back(lvl); } diff --git a/game/gamecode.cpp b/game/gamecode.cpp index ced3b5d..32e30f3 100755 --- a/game/gamecode.cpp +++ b/game/gamecode.cpp @@ -677,6 +677,12 @@ void TGameLevel::ReloadLevel() ReloadBlockInstansingList(); +} + +void TGameLevel::setBackground(const std::string& textureName) +{ + BkgTexture = textureName; + LevelScreenTexture = textureName; } void TGameLevel::FillWithFile(const std::string& filename) @@ -697,11 +703,9 @@ void TGameLevel::SetStandBy() LevelState = CONST_LEVELSTATE_STANDBY; } -void TGameLevel::SetLoading(const std::string& bkg, const std::string& levelscreen) +void TGameLevel::SetLoading() { *SE::Console << "TGameLevel::SetLoading"; - BkgTexture = bkg; - LevelScreenTexture = levelscreen; InitLevel(); StateTimer = CONST_TIMER_LOADING; LevelState = CONST_LEVELSTATE_LOADING; @@ -766,10 +770,8 @@ void TGameLevel::drawOutline() { ); } -void TGameLevel::DrawSnapshot(const std::string& assignedShutterstock, const std::string& assignedSnapshotFrameBuffer) +void TGameLevel::DrawSnapshot(const std::string& assignedSnapshotFrameBuffer) { - BkgTexture = assignedShutterstock; - LevelScreenTexture = assignedShutterstock; InitLevel(); int prevState = LevelState; diff --git a/game/gamecode.h b/game/gamecode.h index 4dbca41..405c700 100755 --- a/game/gamecode.h +++ b/game/gamecode.h @@ -194,16 +194,17 @@ public: ~TGameLevel(); void FillWithFile(const std::string& filename); + void setBackground(const std::string& assignedShutterstock); //void SetLevelScale(); //Vector2f GetLevelScale(); void SetStandBy(); - void SetLoading(const std::string& bkg, const std::string& levelscreen); + void SetLoading(); bool IsLoaded(); virtual void Draw(); - void DrawSnapshot(const std::string& assignedShutterstock, const std::string& assignedSnapshotFrameBuffer); + void DrawSnapshot(const std::string& assignedSnapshotFrameBuffer); void SetPause(); bool IsPaused(); diff --git a/game/main_code.cpp b/game/main_code.cpp index dc6e31d..71d85b8 100755 --- a/game/main_code.cpp +++ b/game/main_code.cpp @@ -446,13 +446,11 @@ void TMyApplication::InnerUpdate(size_t dt) Renderer->SwitchToFrameBuffer("LevelBuffer"); - int levelIndex = 1; - for (auto &star : Menu.GalaxMenu.galaxies[0].Stars) { for (auto &level : star.selectionMenu.gameLevels) { - level.DrawSnapshot("shutterstock" + std::to_string(levelIndex++), "LevelBuffer"); + level.DrawSnapshot("LevelBuffer"); } } @@ -533,7 +531,7 @@ void TMyApplication::GoFromMenuToGame(TGameLevel* level) // ResourceManager->SoundManager.PlayMusicLooped("level1ogg.ogg"); //#endif GameLevel = level; - GameLevel->SetLoading(level->BkgTexture, level->LevelScreenTexture); + GameLevel->SetLoading(); GameState = CONST_GAMESTATE_FROM_MENU_TO_LEVEL; OnDrawSignal.connect(1, boost::bind(&TGameLevel::Draw, boost::ref(*GameLevel)));