added levels snapshoting, quick debug loading, some level name refactoring
@ -1,4 +1,6 @@
|
||||
{
|
||||
"useDebugBackgrounds": "true",
|
||||
|
||||
"TextureList":
|
||||
{
|
||||
"bg_1": "022259762-alien-world",
|
||||
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
BIN
assets/level_background/debug/022259762-alien-world.jpeg
Executable file
After Width: | Height: | Size: 72 KiB |
BIN
assets/level_background/debug/029655296-mountains-landscape.jpeg
Executable file
After Width: | Height: | Size: 82 KiB |
BIN
assets/level_background/debug/033635584-fantastic-landscape.jpeg
Executable file
After Width: | Height: | Size: 78 KiB |
BIN
assets/level_background/debug/033635584-fantastic-landscape.tif
Executable file
BIN
assets/level_background/debug/037162994-sunset-illeo.jpeg
Executable file
After Width: | Height: | Size: 180 KiB |
BIN
assets/level_background/debug/038904975-dying-world.jpeg
Executable file
After Width: | Height: | Size: 201 KiB |
BIN
assets/level_background/debug/039839543-fantastic-landscape.jpeg
Executable file
After Width: | Height: | Size: 144 KiB |
BIN
assets/level_background/debug/040712579-fantastic-landscape.jpeg
Executable file
After Width: | Height: | Size: 113 KiB |
BIN
assets/level_background/debug/040712589-fantastic-landscape.jpeg
Executable file
After Width: | Height: | Size: 82 KiB |
BIN
assets/level_background/debug/040892807-fantastic-landscape.jpeg
Executable file
After Width: | Height: | Size: 89 KiB |
BIN
assets/level_background/debug/040892815-fantastic-landscape.jpeg
Executable file
After Width: | Height: | Size: 84 KiB |
BIN
assets/level_background/debug/041515701-fantastic-landscape.jpeg
Executable file
After Width: | Height: | Size: 127 KiB |
BIN
assets/level_background/debug/047196154-venus-landscape.jpeg
Executable file
After Width: | Height: | Size: 150 KiB |
BIN
assets/level_background/debug/053070150-moon-landscape.jpeg
Executable file
After Width: | Height: | Size: 126 KiB |
BIN
assets/level_background/debug/058104293-red-planet-saturn-moon.jpeg
Executable file
After Width: | Height: | Size: 128 KiB |
BIN
assets/level_background/debug/060594794-sunset-alien-planet-and-20km-g.jpeg
Executable file
After Width: | Height: | Size: 68 KiB |
BIN
assets/level_background/debug/065090581-exoplanet-exploration.jpeg
Executable file
After Width: | Height: | Size: 95 KiB |
BIN
assets/level_background/debug/065743048-exoplanet-exploration-3d-rende.jpeg
Executable file
After Width: | Height: | Size: 159 KiB |
BIN
assets/level_background/debug/068717925-lava-landscape-3d-illustration.jpeg
Executable file
After Width: | Height: | Size: 222 KiB |
BIN
assets/level_background/debug/081085895-flying-over-mountains-sunny-da.jpeg
Executable file
After Width: | Height: | Size: 223 KiB |
BIN
assets/level_background/debug/088515499-mars-red-planet-landscape-moun.jpeg
Executable file
After Width: | Height: | Size: 268 KiB |
@ -44,21 +44,22 @@ bool GalaxyMenu::InitGalaxyMenu(std::string config_json, float scale) {
|
||||
star.scale = stars_pt.second.get<float>("scale", 0.0f);
|
||||
star.texture = stars_pt.second.get<std::string>("texture", "error");
|
||||
star.position = Eigen::Vector2f(stars_pt.second.get<float>("position.x_coord", 0.0f), stars_pt.second.get<float>("position.y_coord", 0.0f));
|
||||
|
||||
/*..Levels..*/
|
||||
BOOST_FOREACH(auto levels_pt, stars_pt.second.get_child("levels")) {
|
||||
|
||||
std::string levelName = levels_pt.second.get<std::string>("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<std::pair<Eigen::Vector2f, Eigen::Vector2f>> buttons_params;
|
||||
std::vector<std::vector<GameLevelInterior>> 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<std::pair<PairColorTexture, TTriangleList>>::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) {
|
||||
|
@ -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..*/
|
||||
|
@ -11,7 +11,6 @@ class LevelSelection {
|
||||
public:
|
||||
|
||||
/*..LEVELS..*/
|
||||
std::vector<std::string> levels; // levels names, uses gameLevels init
|
||||
/*..levels interior info..*/
|
||||
std::vector<TGameLevel> gameLevels;
|
||||
std::vector<std::vector<GameLevelInterior>> levelInterior;
|
||||
|
21
game/gamecode.cpp
Normal file → Executable file
@ -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]);
|
||||
|
5
game/gamecode.h
Normal file → Executable file
@ -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();
|
||||
|
65
game/main_code.cpp
Normal file → Executable file
@ -282,19 +282,26 @@ void TMyApplication::LoadResources()
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("shutterstock12.png", "shutterstock12"));
|
||||
*/
|
||||
|
||||
#ifdef NDEBUG
|
||||
bool useDebugBackgrounds = false;
|
||||
#else
|
||||
bool useDebugBackgrounds = Textures_pt.get<bool>("useDebugBackgrounds", false);
|
||||
#endif
|
||||
|
||||
std::string backgroundPath = useDebugBackgrounds ? "level_background/debug/" : "level_background/";
|
||||
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_1") + bg_ext, "shutterstock1"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_2") + bg_ext, "shutterstock2"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_3") + bg_ext, "shutterstock3"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_4") + bg_ext, "shutterstock4"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_5") + bg_ext, "shutterstock5"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_6") + bg_ext, "shutterstock6"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_7") + bg_ext, "shutterstock7"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_8") + bg_ext, "shutterstock8"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_9") + bg_ext, "shutterstock9"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_10") + bg_ext, "shutterstock10"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_11") + bg_ext, "shutterstock11"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>("level_background/" + Textures_pt.get<std::string>("TextureList.bg_12") + bg_ext, "shutterstock12"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>(backgroundPath + Textures_pt.get<std::string>("TextureList.bg_1") + bg_ext, "shutterstock1"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>(backgroundPath + Textures_pt.get<std::string>("TextureList.bg_2") + bg_ext, "shutterstock2"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>(backgroundPath + Textures_pt.get<std::string>("TextureList.bg_3") + bg_ext, "shutterstock3"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>(backgroundPath + Textures_pt.get<std::string>("TextureList.bg_4") + bg_ext, "shutterstock4"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>(backgroundPath + Textures_pt.get<std::string>("TextureList.bg_5") + bg_ext, "shutterstock5"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>(backgroundPath + Textures_pt.get<std::string>("TextureList.bg_6") + bg_ext, "shutterstock6"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>(backgroundPath + Textures_pt.get<std::string>("TextureList.bg_7") + bg_ext, "shutterstock7"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>(backgroundPath + Textures_pt.get<std::string>("TextureList.bg_8") + bg_ext, "shutterstock8"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>(backgroundPath + Textures_pt.get<std::string>("TextureList.bg_9") + bg_ext, "shutterstock9"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>(backgroundPath + Textures_pt.get<std::string>("TextureList.bg_10") + bg_ext, "shutterstock10"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>(backgroundPath + Textures_pt.get<std::string>("TextureList.bg_11") + bg_ext, "shutterstock11"));
|
||||
TextureNamesToLoad.push_back(std::pair<std::string, std::string>(backgroundPath + Textures_pt.get<std::string>("TextureList.bg_12") + bg_ext, "shutterstock12"));
|
||||
|
||||
/*..galaxies and stars/planets Init..*/ // tmp
|
||||
std::vector<int> 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;
|
||||
});
|
||||
}
|
||||
}
|
4
game/main_code.h
Normal file → Executable file
@ -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();
|
||||
|