diff --git a/assets/bg_textures_config.json b/assets/bg_textures_config.json index 3c21a02..ec94617 100755 --- a/assets/bg_textures_config.json +++ b/assets/bg_textures_config.json @@ -1,4 +1,6 @@ { +"useDebugBackgrounds": "true", + "TextureList": { "bg_1": "022259762-alien-world", diff --git a/assets/galaxy_ptree.json b/assets/galaxy_ptree.json index 74a9e24..bca974b 100755 --- a/assets/galaxy_ptree.json +++ b/assets/galaxy_ptree.json @@ -19,19 +19,19 @@ "scale": 0.1, "levels": [ { - "name": "level_1" + "name": "level1" }, { - "name": "level_2" + "name": "level2" }, { - "name": "level_3" + "name": "level3" }, { - "name": "level_4" + "name": "level4" }, { - "name": "level_5" + "name": "level5" } ] }, @@ -45,10 +45,10 @@ "scale": 0.18, "levels": [ { - "name": "level_6" + "name": "level6" }, { - "name": "level_7" + "name": "level7" } ] }, @@ -62,19 +62,19 @@ "scale": 0.12, "levels": [ { - "name": "level_8" + "name": "level8" }, { - "name": "level_9" + "name": "level9" }, { - "name": "level_10" + "name": "level10" }, { - "name": "level_11" + "name": "level11" }, { - "name": "level_12" + "name": "level12" } ] } diff --git a/assets/level_background/debug/022259762-alien-world.jpeg b/assets/level_background/debug/022259762-alien-world.jpeg new file mode 100755 index 0000000..5363540 Binary files /dev/null and b/assets/level_background/debug/022259762-alien-world.jpeg differ diff --git a/assets/level_background/debug/029655296-mountains-landscape.jpeg b/assets/level_background/debug/029655296-mountains-landscape.jpeg new file mode 100755 index 0000000..2e3df71 Binary files /dev/null and b/assets/level_background/debug/029655296-mountains-landscape.jpeg differ diff --git a/assets/level_background/debug/033635584-fantastic-landscape.jpeg b/assets/level_background/debug/033635584-fantastic-landscape.jpeg new file mode 100755 index 0000000..3f7f0db Binary files /dev/null and b/assets/level_background/debug/033635584-fantastic-landscape.jpeg differ diff --git a/assets/level_background/debug/033635584-fantastic-landscape.tif b/assets/level_background/debug/033635584-fantastic-landscape.tif new file mode 100755 index 0000000..8c1c9ae Binary files /dev/null and b/assets/level_background/debug/033635584-fantastic-landscape.tif differ diff --git a/assets/level_background/debug/037162994-sunset-illeo.jpeg b/assets/level_background/debug/037162994-sunset-illeo.jpeg new file mode 100755 index 0000000..94f3cc1 Binary files /dev/null and b/assets/level_background/debug/037162994-sunset-illeo.jpeg differ diff --git a/assets/level_background/debug/038904975-dying-world.jpeg b/assets/level_background/debug/038904975-dying-world.jpeg new file mode 100755 index 0000000..ead1640 Binary files /dev/null and b/assets/level_background/debug/038904975-dying-world.jpeg differ diff --git a/assets/level_background/debug/039839543-fantastic-landscape.jpeg b/assets/level_background/debug/039839543-fantastic-landscape.jpeg new file mode 100755 index 0000000..9a535e1 Binary files /dev/null and b/assets/level_background/debug/039839543-fantastic-landscape.jpeg differ diff --git a/assets/level_background/debug/040712579-fantastic-landscape.jpeg b/assets/level_background/debug/040712579-fantastic-landscape.jpeg new file mode 100755 index 0000000..ccb40d0 Binary files /dev/null and b/assets/level_background/debug/040712579-fantastic-landscape.jpeg differ diff --git a/assets/level_background/debug/040712589-fantastic-landscape.jpeg b/assets/level_background/debug/040712589-fantastic-landscape.jpeg new file mode 100755 index 0000000..d9ed4be Binary files /dev/null and b/assets/level_background/debug/040712589-fantastic-landscape.jpeg differ diff --git a/assets/level_background/debug/040892807-fantastic-landscape.jpeg b/assets/level_background/debug/040892807-fantastic-landscape.jpeg new file mode 100755 index 0000000..0970411 Binary files /dev/null and b/assets/level_background/debug/040892807-fantastic-landscape.jpeg differ diff --git a/assets/level_background/debug/040892815-fantastic-landscape.jpeg b/assets/level_background/debug/040892815-fantastic-landscape.jpeg new file mode 100755 index 0000000..3b3fc3b Binary files /dev/null and b/assets/level_background/debug/040892815-fantastic-landscape.jpeg differ diff --git a/assets/level_background/debug/041515701-fantastic-landscape.jpeg b/assets/level_background/debug/041515701-fantastic-landscape.jpeg new file mode 100755 index 0000000..a27a4cf Binary files /dev/null and b/assets/level_background/debug/041515701-fantastic-landscape.jpeg differ diff --git a/assets/level_background/debug/047196154-venus-landscape.jpeg b/assets/level_background/debug/047196154-venus-landscape.jpeg new file mode 100755 index 0000000..f3cc9ce Binary files /dev/null and b/assets/level_background/debug/047196154-venus-landscape.jpeg differ diff --git a/assets/level_background/debug/053070150-moon-landscape.jpeg b/assets/level_background/debug/053070150-moon-landscape.jpeg new file mode 100755 index 0000000..93c1aa7 Binary files /dev/null and b/assets/level_background/debug/053070150-moon-landscape.jpeg differ diff --git a/assets/level_background/debug/058104293-red-planet-saturn-moon.jpeg b/assets/level_background/debug/058104293-red-planet-saturn-moon.jpeg new file mode 100755 index 0000000..da18f1d Binary files /dev/null and b/assets/level_background/debug/058104293-red-planet-saturn-moon.jpeg differ diff --git a/assets/level_background/debug/060594794-sunset-alien-planet-and-20km-g.jpeg b/assets/level_background/debug/060594794-sunset-alien-planet-and-20km-g.jpeg new file mode 100755 index 0000000..1eb0163 Binary files /dev/null and b/assets/level_background/debug/060594794-sunset-alien-planet-and-20km-g.jpeg differ diff --git a/assets/level_background/debug/065090581-exoplanet-exploration.jpeg b/assets/level_background/debug/065090581-exoplanet-exploration.jpeg new file mode 100755 index 0000000..644b8c6 Binary files /dev/null and b/assets/level_background/debug/065090581-exoplanet-exploration.jpeg differ diff --git a/assets/level_background/debug/065743048-exoplanet-exploration-3d-rende.jpeg b/assets/level_background/debug/065743048-exoplanet-exploration-3d-rende.jpeg new file mode 100755 index 0000000..672afc0 Binary files /dev/null and b/assets/level_background/debug/065743048-exoplanet-exploration-3d-rende.jpeg differ diff --git a/assets/level_background/debug/068717925-lava-landscape-3d-illustration.jpeg b/assets/level_background/debug/068717925-lava-landscape-3d-illustration.jpeg new file mode 100755 index 0000000..f9879d9 Binary files /dev/null and b/assets/level_background/debug/068717925-lava-landscape-3d-illustration.jpeg differ diff --git a/assets/level_background/debug/081085895-flying-over-mountains-sunny-da.jpeg b/assets/level_background/debug/081085895-flying-over-mountains-sunny-da.jpeg new file mode 100755 index 0000000..0e3a73b Binary files /dev/null and b/assets/level_background/debug/081085895-flying-over-mountains-sunny-da.jpeg differ diff --git a/assets/level_background/debug/088515499-mars-red-planet-landscape-moun.jpeg b/assets/level_background/debug/088515499-mars-red-planet-landscape-moun.jpeg new file mode 100755 index 0000000..6311f3c Binary files /dev/null and b/assets/level_background/debug/088515499-mars-red-planet-landscape-moun.jpeg differ diff --git a/game/galaxy_menu.cpp b/game/galaxy_menu.cpp index fa85454..ca7fbda 100755 --- a/game/galaxy_menu.cpp +++ b/game/galaxy_menu.cpp @@ -44,21 +44,22 @@ bool GalaxyMenu::InitGalaxyMenu(std::string config_json, float scale) { star.scale = stars_pt.second.get("scale", 0.0f); star.texture = stars_pt.second.get("texture", "error"); star.position = Eigen::Vector2f(stars_pt.second.get("position.x_coord", 0.0f), stars_pt.second.get("position.y_coord", 0.0f)); + /*..Levels..*/ BOOST_FOREACH(auto levels_pt, stars_pt.second.get_child("levels")) { std::string levelName = levels_pt.second.get("name", "empty"); - star.selectionMenu.levels.push_back(levelName); TGameLevel lvl; - lvl.FillWithFile(ST::PathToResources + "level" + levelName.substr(levelName.find("_") + 1) + ".txt"); - star.selectionMenu.gameLevels.push_back(lvl); + lvl.FillWithFile(ST::PathToResources + levelName + ".txt"); + star.selectionMenu.gameLevels.push_back(lvl); } galax.Stars.push_back(star); } galaxies.push_back(galax); } + return true; } catch (boost::property_tree::ptree_error) { @@ -137,7 +138,7 @@ void GalaxyMenu::UpdateGalaxyMenu(float s_width, float s_height, size_t dt) { for (int i = 0; i < galaxies.size(); i++) { for (int j = 0; j < galaxies[i].Stars.size(); j++) { float button_x_dim = ((1.f - (galaxies[i].Stars[j].selectionMenu.border_x_offset * 2 + (galaxies[i].Stars[j].selectionMenu.columns - 1)*galaxies[i].Stars[j].selectionMenu.buttons_offset)) / galaxies[i].Stars[j].selectionMenu.columns); // relative size - int rows_count = (int)ceil((float)galaxies[i].Stars[j].selectionMenu.levels.size() / (float)galaxies[i].Stars[j].selectionMenu.columns); + int rows_count = (int)ceil((float)galaxies[i].Stars[j].selectionMenu.gameLevels.size() / (float)galaxies[i].Stars[j].selectionMenu.columns); galaxies[i].Stars[j].selectionMenu.params = std::make_pair( Eigen::Vector2f( gameScreenCenter(0) + (galaxies[i].Stars[j].selectionMenu.offset(0) * gameScreenWidth / 2), @@ -165,7 +166,7 @@ void GalaxyMenu::UpdateGalaxyMenu(float s_width, float s_height, size_t dt) { // buttons std::vector> buttons_params; std::vector> interior_params; - int levelsCount = galaxies[i].Stars[j].selectionMenu.levels.size(); + int levelsCount = galaxies[i].Stars[j].selectionMenu.gameLevels.size(); buttons_params.resize(levelsCount); interior_params.resize(levelsCount); for (int v = 0; v < interior_params.size(); v++) { @@ -426,13 +427,13 @@ void GalaxyMenu::InteractWithGalaxy(size_t dt) { if (totalTapShift(0) == 0.f && totalTapShift(1) == 0.f) { // OnTapDown->OnTapUp - int lvl = findLevelButtonByPos(lastTapPos); - if (lvl != -1) { + auto lvl = findLevelByButtonPos(lastTapPos); + if (lvl != nullptr) { // then if level is available, load it starIndex = -1; menuState = 0; planetHoverIndex = -1; - Application->GoFromMenuToGame(lvl-1); + Application->GoFromMenuToGame(lvl); } else if (!checkMenuBound(lastTapPos)) { // back to state 0 @@ -653,26 +654,32 @@ void GalaxyMenu::drawSelectionMenu(int index) { ); // buttons - for (int j = 0; j < galaxies[0].Stars[i].selectionMenu.buttons.size(); j++) { - std::string levelNum; - size_t itr = galaxies[0].Stars[i].selectionMenu.levels[j].find("_"); - for (int z = itr + 1; z < galaxies[0].Stars[i].selectionMenu.levels[j].size(); z++) { - levelNum += galaxies[0].Stars[i].selectionMenu.levels[j][z]; - } - glBindTexture(GL_TEXTURE_2D, SE::ResourceManager->TexList["shutterstock" + levelNum]); + int j = 0; + for (auto &button : galaxies[0].Stars[i].selectionMenu.buttons) + { + + //std::string levelName = "shutterstock" + galaxies[0].Stars[i].selectionMenu.levels[j].substr(itr + 1); + + //glBindTexture(GL_TEXTURE_2D, SE::ResourceManager->TexList[levelName]); + + std::string &levelName = galaxies[0].Stars[i].selectionMenu.gameLevels[j].levelName; + std::string levelPrerender = galaxies[0].Stars[i].selectionMenu.gameLevels[j].levelName + "_prerender"; + + glBindTexture(GL_TEXTURE_2D, SE::ResourceManager->TexList[levelPrerender]); + SE::Renderer->DrawRect( Eigen::Vector2f( - galaxies[0].Stars[i].selectionMenu.buttons[j].first(0) - galaxies[0].Stars[i].selectionMenu.buttons[j].second(0) / 2, - galaxies[0].Stars[i].selectionMenu.buttons[j].first(1) - galaxies[0].Stars[i].selectionMenu.buttons[j].second(1) / 2 + button.first(0) - button.second(0) / 2, + button.first(1) - button.second(1) / 2 ), Eigen::Vector2f( - galaxies[0].Stars[i].selectionMenu.buttons[j].first(0) + galaxies[0].Stars[i].selectionMenu.buttons[j].second(0) / 2, - galaxies[0].Stars[i].selectionMenu.buttons[j].first(1) + galaxies[0].Stars[i].selectionMenu.buttons[j].second(1) / 2 + button.first(0) + button.second(0) / 2, + button.first(1) + button.second(1) / 2 ) ); // DrawRect /*..draw level interior..*/ - drawLevelInterior(i,j); + //drawLevelInterior(i,j); /*std::list>::iterator colorBlockIterator; for (colorBlockIterator = galaxies[0].Stars[i].selectionMenu.levelInterior[j].BlockInstansingList.ColorBlockList.begin(); colorBlockIterator != galaxies[0].Stars[i].selectionMenu.levelInterior[j].BlockInstansingList.ColorBlockList.end(); ++colorBlockIterator) @@ -682,12 +689,14 @@ void GalaxyMenu::drawSelectionMenu(int index) { Renderer->DrawTriangleList(colorBlockIterator->second); }*/ + + ++j; } } } -int GalaxyMenu::findLevelButtonByPos(Eigen::Vector2f pos) { +TGameLevel* GalaxyMenu::findLevelByButtonPos(Eigen::Vector2f pos) { for (int i = 0; i < galaxies[galaxyIndex].Stars[starIndex].selectionMenu.buttons.size(); i++) { float x_l = galaxies[galaxyIndex].Stars[starIndex].selectionMenu.buttons[i].first(0) - galaxies[galaxyIndex].Stars[starIndex].selectionMenu.buttons[i].second(0)*0.5f; float x_r = galaxies[galaxyIndex].Stars[starIndex].selectionMenu.buttons[i].first(0) + galaxies[galaxyIndex].Stars[starIndex].selectionMenu.buttons[i].second(0)*0.5f; @@ -696,16 +705,11 @@ int GalaxyMenu::findLevelButtonByPos(Eigen::Vector2f pos) { if (pos(0) >= x_l && pos(0) <= x_r) { if (pos(1) >= y_b && pos(1) <= y_t) { - std::string lvlname = galaxies[galaxyIndex].Stars[starIndex].selectionMenu.levels[i]; - std::string lvlNum; - for (int z = lvlname.find("_")+1; z < lvlname.size(); z++) { - lvlNum+=lvlname[z]; - } - return atoi(lvlNum.c_str()); + return &galaxies[galaxyIndex].Stars[starIndex].selectionMenu.gameLevels[i]; } } } - return -1; + return nullptr; } bool GalaxyMenu::checkMenuBound(Eigen::Vector2f pos) { diff --git a/game/galaxy_menu.h b/game/galaxy_menu.h index 514247d..0b2e9bb 100755 --- a/game/galaxy_menu.h +++ b/game/galaxy_menu.h @@ -79,7 +79,7 @@ private: void takeInFocus(int g_index, int s_index = -1); int findGalaxyByPos(Eigen::Vector2f pos); int findPlanetByPos(Eigen::Vector2f pos); - int findLevelButtonByPos(Eigen::Vector2f pos); + TGameLevel* findLevelByButtonPos(Eigen::Vector2f pos); bool checkMenuBound(Eigen::Vector2f pos); /*..draw methodes..*/ diff --git a/game/galaxy_objects.h b/game/galaxy_objects.h index a1a594f..d8a393b 100755 --- a/game/galaxy_objects.h +++ b/game/galaxy_objects.h @@ -11,7 +11,6 @@ class LevelSelection { public: /*..LEVELS..*/ - std::vector levels; // levels names, uses gameLevels init /*..levels interior info..*/ std::vector gameLevels; std::vector> levelInterior; diff --git a/game/gamecode.cpp b/game/gamecode.cpp old mode 100644 new mode 100755 index a49dbcc..ced3b5d --- a/game/gamecode.cpp +++ b/game/gamecode.cpp @@ -15,6 +15,7 @@ const int CONST_LEVELSTATE_LOADING = 4; const int CONST_LEVELSTATE_NODRAW = 5; const int CONST_LEVELSTATE_FINISH_FREEZE = 6; const int CONST_LEVELSTATE_FINISHED = 7; +const int CONST_LEVELSTATE_SNAPSHOTTING = 8; const float CONST_TIMER_LOADING = 150.f; @@ -681,6 +682,9 @@ void TGameLevel::ReloadLevel() void TGameLevel::FillWithFile(const std::string& filename) { *SE::Console << "TGameLevel::FillWithFile"; + + levelName = GetFileNameWithoutExt(filename); + LevelFileName = filename; ReloadLevel(); } @@ -762,6 +766,21 @@ void TGameLevel::drawOutline() { ); } +void TGameLevel::DrawSnapshot(const std::string& assignedShutterstock, const std::string& assignedSnapshotFrameBuffer) +{ + BkgTexture = assignedShutterstock; + LevelScreenTexture = assignedShutterstock; + InitLevel(); + + int prevState = LevelState; + LevelState = CONST_LEVELSTATE_SNAPSHOTTING; + Draw(); + LevelState = prevState; + + prerenderedImage = + ResourceManager->FrameManager.GetFrameTextureCopy(assignedSnapshotFrameBuffer, levelName + "_prerender"); +} + void TGameLevel::Draw() { *SE::Console << "TGameLevel::Draw"; @@ -942,7 +961,7 @@ void TGameLevel::Draw() } - if (!pause) + if (!pause && LevelState != CONST_LEVELSTATE_SNAPSHOTTING) { RenderUniform1f("Transparency", 1.f); glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[CONST_BACK_BTN_TEXTURE]); diff --git a/game/gamecode.h b/game/gamecode.h old mode 100644 new mode 100755 index bdd4523..4dbca41 --- a/game/gamecode.h +++ b/game/gamecode.h @@ -129,8 +129,12 @@ protected: std::string BkgTexture; std::string LevelScreenTexture; std::string LevelFileName; + + GLuint prerenderedImage; Vector2f ReflectorPos; + + std::string levelName; int LevelState; bool PrevLevelStateIsStandby; @@ -199,6 +203,7 @@ public: bool IsLoaded(); virtual void Draw(); + void DrawSnapshot(const std::string& assignedShutterstock, const std::string& assignedSnapshotFrameBuffer); void SetPause(); bool IsPaused(); diff --git a/game/main_code.cpp b/game/main_code.cpp old mode 100644 new mode 100755 index 7429111..dc6e31d --- a/game/main_code.cpp +++ b/game/main_code.cpp @@ -282,19 +282,26 @@ void TMyApplication::LoadResources() TextureNamesToLoad.push_back(std::pair("shutterstock12.png", "shutterstock12")); */ +#ifdef NDEBUG + bool useDebugBackgrounds = false; +#else + bool useDebugBackgrounds = Textures_pt.get("useDebugBackgrounds", false); +#endif + + std::string backgroundPath = useDebugBackgrounds ? "level_background/debug/" : "level_background/"; - TextureNamesToLoad.push_back(std::pair("level_background/" + Textures_pt.get("TextureList.bg_1") + bg_ext, "shutterstock1")); - TextureNamesToLoad.push_back(std::pair("level_background/" + Textures_pt.get("TextureList.bg_2") + bg_ext, "shutterstock2")); - TextureNamesToLoad.push_back(std::pair("level_background/" + Textures_pt.get("TextureList.bg_3") + bg_ext, "shutterstock3")); - TextureNamesToLoad.push_back(std::pair("level_background/" + Textures_pt.get("TextureList.bg_4") + bg_ext, "shutterstock4")); - TextureNamesToLoad.push_back(std::pair("level_background/" + Textures_pt.get("TextureList.bg_5") + bg_ext, "shutterstock5")); - TextureNamesToLoad.push_back(std::pair("level_background/" + Textures_pt.get("TextureList.bg_6") + bg_ext, "shutterstock6")); - TextureNamesToLoad.push_back(std::pair("level_background/" + Textures_pt.get("TextureList.bg_7") + bg_ext, "shutterstock7")); - TextureNamesToLoad.push_back(std::pair("level_background/" + Textures_pt.get("TextureList.bg_8") + bg_ext, "shutterstock8")); - TextureNamesToLoad.push_back(std::pair("level_background/" + Textures_pt.get("TextureList.bg_9") + bg_ext, "shutterstock9")); - TextureNamesToLoad.push_back(std::pair("level_background/" + Textures_pt.get("TextureList.bg_10") + bg_ext, "shutterstock10")); - TextureNamesToLoad.push_back(std::pair("level_background/" + Textures_pt.get("TextureList.bg_11") + bg_ext, "shutterstock11")); - TextureNamesToLoad.push_back(std::pair("level_background/" + Textures_pt.get("TextureList.bg_12") + bg_ext, "shutterstock12")); + TextureNamesToLoad.push_back(std::pair(backgroundPath + Textures_pt.get("TextureList.bg_1") + bg_ext, "shutterstock1")); + TextureNamesToLoad.push_back(std::pair(backgroundPath + Textures_pt.get("TextureList.bg_2") + bg_ext, "shutterstock2")); + TextureNamesToLoad.push_back(std::pair(backgroundPath + Textures_pt.get("TextureList.bg_3") + bg_ext, "shutterstock3")); + TextureNamesToLoad.push_back(std::pair(backgroundPath + Textures_pt.get("TextureList.bg_4") + bg_ext, "shutterstock4")); + TextureNamesToLoad.push_back(std::pair(backgroundPath + Textures_pt.get("TextureList.bg_5") + bg_ext, "shutterstock5")); + TextureNamesToLoad.push_back(std::pair(backgroundPath + Textures_pt.get("TextureList.bg_6") + bg_ext, "shutterstock6")); + TextureNamesToLoad.push_back(std::pair(backgroundPath + Textures_pt.get("TextureList.bg_7") + bg_ext, "shutterstock7")); + TextureNamesToLoad.push_back(std::pair(backgroundPath + Textures_pt.get("TextureList.bg_8") + bg_ext, "shutterstock8")); + TextureNamesToLoad.push_back(std::pair(backgroundPath + Textures_pt.get("TextureList.bg_9") + bg_ext, "shutterstock9")); + TextureNamesToLoad.push_back(std::pair(backgroundPath + Textures_pt.get("TextureList.bg_10") + bg_ext, "shutterstock10")); + TextureNamesToLoad.push_back(std::pair(backgroundPath + Textures_pt.get("TextureList.bg_11") + bg_ext, "shutterstock11")); + TextureNamesToLoad.push_back(std::pair(backgroundPath + Textures_pt.get("TextureList.bg_12") + bg_ext, "shutterstock12")); /*..galaxies and stars/planets Init..*/ // tmp std::vector galaxies; @@ -436,6 +443,21 @@ void TMyApplication::InnerUpdate(size_t dt) } else { + + 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"); + } + } + + Renderer->SwitchToScreen(); + GameState = CONST_GAMESTATE_MENU; ApplySignalsToMenu(); OnDrawSignal.disconnect(boost::bind(&TGameLoading::Draw, boost::ref(GameLoading))); @@ -447,7 +469,7 @@ void TMyApplication::InnerUpdate(size_t dt) else if (GameState == CONST_GAMESTATE_LEVEL) { *SE::Console << "3CONST_GAMESTATE_LEVEL"; - GameLevel.Update(dt); + GameLevel->Update(dt); EffectsUpdate(dt); } else if (GameState == CONST_GAMESTATE_MENU) @@ -459,8 +481,8 @@ void TMyApplication::InnerUpdate(size_t dt) else if (GameState == CONST_GAMESTATE_FROM_MENU_TO_LEVEL) { *SE::Console << "5CONST_GAMESTATE_FROM_MENU_TO_LEVEL"; - GameLevel.Update(dt); - if (GameLevel.IsLoaded()) + GameLevel->Update(dt); + if (GameLevel->IsLoaded()) { //*SE::Console << "5CONST_GAMESTATE_FROM_MENU_TO_LEVEL"; GameState = CONST_GAMESTATE_LEVEL; @@ -505,16 +527,15 @@ void TMyApplication::InnerUpdate(size_t dt) } -void TMyApplication::GoFromMenuToGame(int level) +void TMyApplication::GoFromMenuToGame(TGameLevel* level) { //#ifndef TARGET_IOS // ResourceManager->SoundManager.PlayMusicLooped("level1ogg.ogg"); //#endif - - GameLevel.FillWithFile(ST::PathToResources + "level"+tostr(level+1)+".txt"); - GameLevel.SetLoading("shutterstock" + tostr(level+1), "shutterstock" + tostr(level + 1)); + GameLevel = level; + GameLevel->SetLoading(level->BkgTexture, level->LevelScreenTexture); GameState = CONST_GAMESTATE_FROM_MENU_TO_LEVEL; - OnDrawSignal.connect(1, boost::bind(&TGameLevel::Draw, boost::ref(GameLevel))); + OnDrawSignal.connect(1, boost::bind(&TGameLevel::Draw, boost::ref(*GameLevel))); DisapplySignalsToMenu(); @@ -709,8 +730,8 @@ void TMyApplication::SetButtonsAction () { auto backBtn = ResourceManager->newGuiManager.findWidgetByName("backButton"); if (backBtn) { backBtn->onMouseDownSignal.connect([this, backBtn](Vector2f pos, int touchNumber) { - this->GameLevel.SetPause(); - this->GameLevel.PrevLevelStateIsStandby = true; + this->GameLevel->SetPause(); + this->GameLevel->PrevLevelStateIsStandby = true; }); } } \ No newline at end of file diff --git a/game/main_code.h b/game/main_code.h old mode 100644 new mode 100755 index f5fd63a..2abfe7d --- a/game/main_code.h +++ b/game/main_code.h @@ -98,7 +98,7 @@ protected: ParticleEffect lvlFirework; // Level finished effect TGameMenu Menu; - TGameLevel GameLevel; + TGameLevel* GameLevel; TGameCredits GameCredits; TGameLoading GameLoading; @@ -139,7 +139,7 @@ public: virtual void InnerUpdate(size_t dt); - void GoFromMenuToGame(int level); + void GoFromMenuToGame(TGameLevel* level); void GoFromGameToMenu(); void GoFromMenuToCredits(); void GoFromCreditsToMenu();