minor changes

This commit is contained in:
Emil Kabirov 2018-06-10 00:51:32 +05:00
parent 74e947b6f3
commit ae352e0590
4 changed files with 16 additions and 12 deletions

View File

@ -28,6 +28,8 @@ bool GalaxyMenu::InitGalaxyMenu(std::string config_json, float scale) {
boost::property_tree::ptree error_pt; boost::property_tree::ptree error_pt;
error_pt.put("error", "something goes wrong at InitGalaxyMenu"); error_pt.put("error", "something goes wrong at InitGalaxyMenu");
int levelIndex = 1;
/*..Init Menu..*/ /*..Init Menu..*/
BOOST_FOREACH(auto menu_pt, config_pt.get_child("Space", error_pt)) { BOOST_FOREACH(auto menu_pt, config_pt.get_child("Space", error_pt)) {
Galaxy galax; Galaxy galax;
@ -52,6 +54,7 @@ bool GalaxyMenu::InitGalaxyMenu(std::string config_json, float scale) {
TGameLevel lvl; TGameLevel lvl;
lvl.FillWithFile(ST::PathToResources + levelName + ".txt"); lvl.FillWithFile(ST::PathToResources + levelName + ".txt");
lvl.setBackground("shutterstock" + std::to_string(levelIndex++));
star.selectionMenu.gameLevels.push_back(lvl); star.selectionMenu.gameLevels.push_back(lvl);
} }

View File

@ -679,6 +679,12 @@ void TGameLevel::ReloadLevel()
} }
void TGameLevel::setBackground(const std::string& textureName)
{
BkgTexture = textureName;
LevelScreenTexture = textureName;
}
void TGameLevel::FillWithFile(const std::string& filename) void TGameLevel::FillWithFile(const std::string& filename)
{ {
*SE::Console << "TGameLevel::FillWithFile"; *SE::Console << "TGameLevel::FillWithFile";
@ -697,11 +703,9 @@ void TGameLevel::SetStandBy()
LevelState = CONST_LEVELSTATE_STANDBY; LevelState = CONST_LEVELSTATE_STANDBY;
} }
void TGameLevel::SetLoading(const std::string& bkg, const std::string& levelscreen) void TGameLevel::SetLoading()
{ {
*SE::Console << "TGameLevel::SetLoading"; *SE::Console << "TGameLevel::SetLoading";
BkgTexture = bkg;
LevelScreenTexture = levelscreen;
InitLevel(); InitLevel();
StateTimer = CONST_TIMER_LOADING; StateTimer = CONST_TIMER_LOADING;
LevelState = CONST_LEVELSTATE_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(); InitLevel();
int prevState = LevelState; int prevState = LevelState;

View File

@ -194,16 +194,17 @@ public:
~TGameLevel(); ~TGameLevel();
void FillWithFile(const std::string& filename); void FillWithFile(const std::string& filename);
void setBackground(const std::string& assignedShutterstock);
//void SetLevelScale(); //void SetLevelScale();
//Vector2f GetLevelScale(); //Vector2f GetLevelScale();
void SetStandBy(); void SetStandBy();
void SetLoading(const std::string& bkg, const std::string& levelscreen); void SetLoading();
bool IsLoaded(); bool IsLoaded();
virtual void Draw(); virtual void Draw();
void DrawSnapshot(const std::string& assignedShutterstock, const std::string& assignedSnapshotFrameBuffer); void DrawSnapshot(const std::string& assignedSnapshotFrameBuffer);
void SetPause(); void SetPause();
bool IsPaused(); bool IsPaused();

View File

@ -446,13 +446,11 @@ void TMyApplication::InnerUpdate(size_t dt)
Renderer->SwitchToFrameBuffer("LevelBuffer"); Renderer->SwitchToFrameBuffer("LevelBuffer");
int levelIndex = 1;
for (auto &star : Menu.GalaxMenu.galaxies[0].Stars) for (auto &star : Menu.GalaxMenu.galaxies[0].Stars)
{ {
for (auto &level : star.selectionMenu.gameLevels) 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"); // ResourceManager->SoundManager.PlayMusicLooped("level1ogg.ogg");
//#endif //#endif
GameLevel = level; GameLevel = level;
GameLevel->SetLoading(level->BkgTexture, level->LevelScreenTexture); GameLevel->SetLoading();
GameState = CONST_GAMESTATE_FROM_MENU_TO_LEVEL; 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)));