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;
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);
}

View File

@ -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;

View File

@ -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();

View File

@ -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)));