interface fixes
This commit is contained in:
parent
cee9693119
commit
3d0bbe7ca8
@ -4,6 +4,8 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
std::shared_ptr<WidgetAncestor> modal_background = nullptr;
|
||||||
|
|
||||||
GalaxyMenu::GalaxyMenu()
|
GalaxyMenu::GalaxyMenu()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -199,7 +201,7 @@ float GalaxyMenu::val_clamp(float val, float min, float max) {
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GalaxyMenu::DrawGalaxyMenu() {
|
void GalaxyMenu::DrawGalaxyMenu(bool drawStars) {
|
||||||
|
|
||||||
Renderer->PushOrthoProjection();
|
Renderer->PushOrthoProjection();
|
||||||
Renderer->PushMatrix();
|
Renderer->PushMatrix();
|
||||||
@ -219,31 +221,34 @@ void GalaxyMenu::DrawGalaxyMenu() {
|
|||||||
)
|
)
|
||||||
); // DrawRect
|
); // DrawRect
|
||||||
|
|
||||||
/*..Draw stars..*/
|
if (drawStars)
|
||||||
Renderer->PushShader("HoverableButtonShader");
|
{
|
||||||
if (stars_params.size() >= i) {
|
/*..Draw stars..*/
|
||||||
for (int j = 0; j < stars_params[i].size(); j++) {
|
Renderer->PushShader("HoverableButtonShader");
|
||||||
if (planetHoverIndex == j) {
|
if (stars_params.size() >= i) {
|
||||||
RenderUniform1i("Hover", 1);
|
for (int j = 0; j < stars_params[i].size(); j++) {
|
||||||
glBindTexture(GL_TEXTURE_2D, SE::ResourceManager->TexList[galaxies[i].Stars[j].textureName]);
|
if (planetHoverIndex == j) {
|
||||||
|
RenderUniform1i("Hover", 1);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, SE::ResourceManager->TexList[galaxies[i].Stars[j].textureName]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
RenderUniform1i("Hover", 0);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, SE::ResourceManager->TexList[galaxies[i].Stars[j].textureName]);
|
||||||
|
}
|
||||||
|
SE::Renderer->DrawRect(
|
||||||
|
Eigen::Vector2f(
|
||||||
|
stars_params[i][j].first(0) - stars_params[i][j].second(0) / 2,
|
||||||
|
stars_params[i][j].first(1) - stars_params[i][j].second(1) / 2
|
||||||
|
),
|
||||||
|
Eigen::Vector2f(
|
||||||
|
stars_params[i][j].first(0) + stars_params[i][j].second(0) / 2,
|
||||||
|
stars_params[i][j].first(1) + stars_params[i][j].second(1) / 2
|
||||||
|
)
|
||||||
|
); // DrawRect
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
RenderUniform1i("Hover", 0);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, SE::ResourceManager->TexList[galaxies[i].Stars[j].textureName]);
|
|
||||||
}
|
|
||||||
SE::Renderer->DrawRect(
|
|
||||||
Eigen::Vector2f(
|
|
||||||
stars_params[i][j].first(0) - stars_params[i][j].second(0) / 2,
|
|
||||||
stars_params[i][j].first(1) - stars_params[i][j].second(1) / 2
|
|
||||||
),
|
|
||||||
Eigen::Vector2f(
|
|
||||||
stars_params[i][j].first(0) + stars_params[i][j].second(0) / 2,
|
|
||||||
stars_params[i][j].first(1) + stars_params[i][j].second(1) / 2
|
|
||||||
)
|
|
||||||
); // DrawRect
|
|
||||||
}
|
}
|
||||||
|
Renderer->PopShader();
|
||||||
}
|
}
|
||||||
Renderer->PopShader();
|
|
||||||
|
|
||||||
/*..Draw level selection menu..*/
|
/*..Draw level selection menu..*/
|
||||||
//drawSelectionMenu(starIndex);
|
//drawSelectionMenu(starIndex);
|
||||||
@ -255,8 +260,24 @@ void GalaxyMenu::DrawGalaxyMenu() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void GalaxyMenu::resetValuesOnGameStart()
|
||||||
|
{
|
||||||
|
modal_background = nullptr;
|
||||||
|
totalTapShift = { 0, 0 };
|
||||||
|
planetHoverIndex = -1;
|
||||||
|
timer_active = false;
|
||||||
|
}
|
||||||
|
|
||||||
void GalaxyMenu::InteractWithGalaxy(size_t dt) {
|
void GalaxyMenu::InteractWithGalaxy(size_t dt) {
|
||||||
|
|
||||||
|
if (!modal_background) modal_background = ResourceManager->newGuiManager.findWidgetByName("modal_background");
|
||||||
|
|
||||||
|
if (modal_background->visible)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (timer_active) {
|
if (timer_active) {
|
||||||
// ::::::::::::: timer active ::::::::::::::
|
// ::::::::::::: timer active ::::::::::::::
|
||||||
//if (menuState == 0)
|
//if (menuState == 0)
|
||||||
@ -266,6 +287,7 @@ void GalaxyMenu::InteractWithGalaxy(size_t dt) {
|
|||||||
// OnTapDown->
|
// OnTapDown->
|
||||||
|
|
||||||
/*../hover\..*/
|
/*../hover\..*/
|
||||||
|
GetConsole() << std::to_string(lastTapPos[0]) + " | " + std::to_string(lastTapPos[1]) + " | " + std::to_string(totalTapShift[0]) + " | " + std::to_string(totalTapShift[1]);
|
||||||
int phi = findPlanetByPos(lastTapPos - totalTapShift);
|
int phi = findPlanetByPos(lastTapPos - totalTapShift);
|
||||||
if (phi != -1) {
|
if (phi != -1) {
|
||||||
planetHoverIndex = phi;
|
planetHoverIndex = phi;
|
||||||
@ -280,6 +302,7 @@ void GalaxyMenu::InteractWithGalaxy(size_t dt) {
|
|||||||
//totalTapShift = Eigen::Vector2f(totalTapShift(0) + currentTapShift(0), totalTapShift(1) + currentTapShift(1));
|
//totalTapShift = Eigen::Vector2f(totalTapShift(0) + currentTapShift(0), totalTapShift(1) + currentTapShift(1));
|
||||||
|
|
||||||
/*../hover\..*/
|
/*../hover\..*/
|
||||||
|
GetConsole() << std::to_string(lastTapPos[0]) + " | " + std::to_string(lastTapPos[1]) + " | " + std::to_string(totalTapShift[0]) + " | " + std::to_string(totalTapShift[1]);
|
||||||
int phi = findPlanetByPos(lastTapPos - totalTapShift);
|
int phi = findPlanetByPos(lastTapPos - totalTapShift);
|
||||||
if (phi != -1) {
|
if (phi != -1) {
|
||||||
planetHoverIndex = phi;
|
planetHoverIndex = phi;
|
||||||
@ -319,7 +342,8 @@ void GalaxyMenu::InteractWithGalaxy(size_t dt) {
|
|||||||
// OnTapDown->OnTapUp
|
// OnTapDown->OnTapUp
|
||||||
|
|
||||||
/*..level select menu open..*/
|
/*..level select menu open..*/
|
||||||
starIndex = findPlanetByPos(lastTapPos);
|
GetConsole() << std::to_string(lastTapPos[0]) + " | " + std::to_string(lastTapPos[1]) + " | " + std::to_string(totalTapShift[0]) + " | " + std::to_string(totalTapShift[1]);
|
||||||
|
starIndex = findPlanetByPos(lastTapPos - totalTapShift);
|
||||||
|
|
||||||
|
|
||||||
if (starIndex != -1) {
|
if (starIndex != -1) {
|
||||||
@ -402,7 +426,7 @@ void GalaxyMenu::tapUp(Eigen::Vector2f pos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GalaxyMenu::tapMove(Eigen::Vector2f shift) {
|
void GalaxyMenu::tapMove(Eigen::Vector2f shift) {
|
||||||
if (timer_active) {
|
if (timer_active && modal_background && !modal_background->visible) {
|
||||||
|
|
||||||
totalTapShift += shift;
|
totalTapShift += shift;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ public:
|
|||||||
|
|
||||||
// ======== Main Methods ========
|
// ======== Main Methods ========
|
||||||
bool InitGalaxyMenu(std::string config_json, float scale = 1.f);
|
bool InitGalaxyMenu(std::string config_json, float scale = 1.f);
|
||||||
void DrawGalaxyMenu();
|
void DrawGalaxyMenu(bool drawStars);
|
||||||
void UpdateGalaxyMenu(float s_width, float s_height, size_t dt);
|
void UpdateGalaxyMenu(float s_width, float s_height, size_t dt);
|
||||||
|
|
||||||
|
|
||||||
@ -41,6 +41,7 @@ public:
|
|||||||
float xDimension;
|
float xDimension;
|
||||||
float yDimension;
|
float yDimension;
|
||||||
float anchorSize = 1.f;
|
float anchorSize = 1.f;
|
||||||
|
int planetHoverIndex = -1;
|
||||||
std::vector<std::pair<Eigen::Vector2f, Eigen::Vector2f>> galaxies_params; // ::position/dimensions::
|
std::vector<std::pair<Eigen::Vector2f, Eigen::Vector2f>> galaxies_params; // ::position/dimensions::
|
||||||
std::vector<std::vector<std::pair<Eigen::Vector2f, Eigen::Vector2f>>> stars_params;
|
std::vector<std::vector<std::pair<Eigen::Vector2f, Eigen::Vector2f>>> stars_params;
|
||||||
|
|
||||||
@ -51,6 +52,7 @@ public:
|
|||||||
|
|
||||||
void setTimerActivity(bool value);
|
void setTimerActivity(bool value);
|
||||||
|
|
||||||
|
void resetValuesOnGameStart();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -69,14 +71,13 @@ private:
|
|||||||
int menuState = 0; // 0 - all galaxies are visible, 1 - zoomed to current galaxy(reserved) , 2 - level select menu
|
int menuState = 0; // 0 - all galaxies are visible, 1 - zoomed to current galaxy(reserved) , 2 - level select menu
|
||||||
int starIndex = -1;
|
int starIndex = -1;
|
||||||
int galaxyIndex = 0; // zoomed galaxy
|
int galaxyIndex = 0; // zoomed galaxy
|
||||||
int planetHoverIndex = -1;
|
|
||||||
|
|
||||||
/*..Interact params..*/
|
/*..Interact params..*/
|
||||||
bool timer_active = false;
|
bool timer_active = false;
|
||||||
float interact_timer = 0.f; // reset
|
float interact_timer = 0.f; // reset
|
||||||
Eigen::Vector2f lastTapPos = Eigen::Vector2f(-9999.9f, -9999.9f); // reset
|
Eigen::Vector2f lastTapPos = Eigen::Vector2f(-9999.9f, -9999.9f); // reset
|
||||||
Eigen::Vector2f currentTapShift; // reset
|
Eigen::Vector2f currentTapShift = Eigen::Vector2f(0.f, 0.f); // reset
|
||||||
Eigen::Vector2f totalTapShift; // reset
|
Eigen::Vector2f totalTapShift = Eigen::Vector2f(0.f, 0.f); // reset
|
||||||
|
|
||||||
/*..coefficients..*/
|
/*..coefficients..*/
|
||||||
Eigen::Vector2f menu_offset = Eigen::Vector2f(0, 0);
|
Eigen::Vector2f menu_offset = Eigen::Vector2f(0, 0);
|
||||||
|
@ -469,7 +469,7 @@ void TBall::Update(size_t dt)
|
|||||||
//===========================================
|
//===========================================
|
||||||
//===========================================
|
//===========================================
|
||||||
//===========================================
|
//===========================================
|
||||||
|
|
||||||
bool TGameLevel::XXX = true;
|
bool TGameLevel::XXX = true;
|
||||||
|
|
||||||
TGameLevel::TGameLevel(int levelStar, int levelIndex)
|
TGameLevel::TGameLevel(int levelStar, int levelIndex)
|
||||||
@ -845,7 +845,6 @@ void TGameLevel::Draw()
|
|||||||
InnerDraw(Renderer->GetScreenWidth(), Renderer->GetScreenHeight(), Renderer->GetMatrixWidth(), Renderer->GetMatrixHeight(), false);
|
InnerDraw(Renderer->GetScreenWidth(), Renderer->GetScreenHeight(), Renderer->GetMatrixWidth(), Renderer->GetMatrixHeight(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, int matrixHeight, bool blackAndWhite)
|
void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, int matrixHeight, bool blackAndWhite)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -918,7 +917,7 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i
|
|||||||
//Renderer->PopMatrix();
|
//Renderer->PopMatrix();
|
||||||
CheckGlError();
|
CheckGlError();
|
||||||
|
|
||||||
drawOutline(screenWidth, screenHeight);
|
//drawOutline(screenWidth, screenHeight);
|
||||||
|
|
||||||
Renderer->PopMatrix();
|
Renderer->PopMatrix();
|
||||||
Renderer->PopProjectionMatrix();
|
Renderer->PopProjectionMatrix();
|
||||||
@ -960,7 +959,10 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i
|
|||||||
// :::::::::::
|
// :::::::::::
|
||||||
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[BkgTexture]);
|
glBindTexture(GL_TEXTURE_2D,ResourceManager->TexList[BkgTexture]);
|
||||||
//Renderer->DrawRect(Vector2f(xlOffset, ylOffset), Vector2f(xlOffset+tSW, ylOffset+tSH),Vector2f(0.f, 0.f), Vector2f(1.f, 1.f));
|
//Renderer->DrawRect(Vector2f(xlOffset, ylOffset), Vector2f(xlOffset+tSW, ylOffset+tSH),Vector2f(0.f, 0.f), Vector2f(1.f, 1.f));
|
||||||
Renderer->DrawRect(Vector2f(bkgSWO, bkgSHO), Vector2f(bkgSWO + bkgSW, bkgSHO + bkgSH), Vector2f(0.f, 0.f), Vector2f(1.f, 1.f));
|
|
||||||
|
float backgroundHorOffset = (xlOffset - bkgSWO) / screenWidth;
|
||||||
|
|
||||||
|
Renderer->DrawRect(Vector2f(xlOffset, bkgSHO), Vector2f(xlOffset + tSW, bkgSHO + bkgSH), Vector2f(backgroundHorOffset, 0.f), Vector2f(1.f - backgroundHorOffset, 1.f));
|
||||||
//Renderer->DrawRect(Vector2f(0,0), Vector2f(100,100), Vector2f(0.f, 0.f), Vector2f(1.f, 1.f));
|
//Renderer->DrawRect(Vector2f(0,0), Vector2f(100,100), Vector2f(0.f, 0.f), Vector2f(1.f, 1.f));
|
||||||
|
|
||||||
|
|
||||||
@ -1087,7 +1089,7 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i
|
|||||||
// Renderer->DrawRect(Vector2f(-const_backBtnWidth*0.5f, -const_backBtnHeight*0.5f)+BackBtnPos, Vector2f(const_backBtnWidth*0.5f, const_backBtnHeight*0.5f)+BackBtnPos);
|
// Renderer->DrawRect(Vector2f(-const_backBtnWidth*0.5f, -const_backBtnHeight*0.5f)+BackBtnPos, Vector2f(const_backBtnWidth*0.5f, const_backBtnHeight*0.5f)+BackBtnPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
drawOutline(screenWidth, screenHeight);
|
//drawOutline(screenWidth, screenHeight);
|
||||||
|
|
||||||
|
|
||||||
if (pause && !renderBufferReady)
|
if (pause && !renderBufferReady)
|
||||||
@ -1111,6 +1113,12 @@ void TGameLevel::InnerDraw(int screenWidth, int screenHeight, int matrixWidth, i
|
|||||||
Renderer->PopMatrix();
|
Renderer->PopMatrix();
|
||||||
RenderBufferReady = true;
|
RenderBufferReady = true;
|
||||||
CheckGlError();
|
CheckGlError();
|
||||||
|
|
||||||
|
//Renderer->DrawRect(Vector2f(bkgSWO, bkgSHO), Vector2f(bkgSWO + bkgSW, bkgSHO + bkgSH), Vector2f(0.f, 0.f), Vector2f(1.f, 1.f));
|
||||||
|
//Renderer->DrawRect(Vector2f(xlOffset, bkgSHO), Vector2f(xlOffset + tSW, bkgSHO + bkgSH), Vector2f(0.f, 0.f), Vector2f(1.f, 1.f));
|
||||||
|
|
||||||
|
horOffset = xlOffset / screenWidth;
|
||||||
|
verOffset = bkgSH / screenHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1210,7 +1218,43 @@ void TGameLevel::DrawBuffer()
|
|||||||
Vector2f RectPos = Vector2f(x_levelScreenCenter, y_levelScreenCenter);
|
Vector2f RectPos = Vector2f(x_levelScreenCenter, y_levelScreenCenter);
|
||||||
Vector2f RectSize = Vector2f(x_levelScreenSize, y_levelScreenSize);
|
Vector2f RectSize = Vector2f(x_levelScreenSize, y_levelScreenSize);
|
||||||
|
|
||||||
Renderer->DrawRect(RectPos-RectSize, RectPos+RectSize);
|
//Renderer->DrawRect(RectPos-RectSize, RectPos+RectSize);
|
||||||
|
|
||||||
|
// Scaling math
|
||||||
|
float tSW = Application->GetGameLevelScreenWidth(); // Screen Width
|
||||||
|
float tSH = Application->GetGameLevelScreenHeight(); // Screen Height
|
||||||
|
float xlOffset = (Renderer->GetScreenWidth() - tSW)*0.5f; // Level Screen x-offset
|
||||||
|
|
||||||
|
float ylOffset = 0.f;
|
||||||
|
float lrFBO = 4 * tSH / 320.f; // Left/Right Wall Textures offset from bottom
|
||||||
|
float uWTW = tSW * (static_cast<float>(ResourceManager->TexList.GetTextureOriginalHeight(CONST_WALL_UP_TEXTURE)) / static_cast<float>(ResourceManager->TexList.GetTextureOriginalWidth(CONST_WALL_UP_TEXTURE))); // up Wall Texture Width
|
||||||
|
float lWTW = (static_cast<float>(ResourceManager->TexList.GetTextureOriginalWidth(CONST_WALL_LEFT_TEXTURE)) / static_cast<float>(ResourceManager->TexList.GetTextureOriginalHeight(CONST_WALL_LEFT_TEXTURE))) * (tSH - uWTW - lrFBO); // left Wall Texture Width
|
||||||
|
float rWTW = lWTW; // right Wall Texture Width
|
||||||
|
float bWTO = (lWTW + rWTW) * 0.5f; // bonus Wall x-Offset
|
||||||
|
float bWTW = (tSW - bWTO) * (static_cast<float>(ResourceManager->TexList.GetTextureOriginalHeight(CONST_WALL_BONUS_TEXTURE)) / static_cast<float>(ResourceManager->TexList.GetTextureOriginalWidth(CONST_WALL_BONUS_TEXTURE))); // bonus Wall Texture Width
|
||||||
|
|
||||||
|
float bkgTW = (float)ResourceManager->TexList.GetTextureOriginalWidth(BkgTexture);
|
||||||
|
float bkgTH = (float)ResourceManager->TexList.GetTextureOriginalHeight(BkgTexture);
|
||||||
|
float bkgSW; // Background Secreen Width
|
||||||
|
float bkgSH; // Background Secreen Height
|
||||||
|
float bkgSWO; // Background Secreen Width Offset
|
||||||
|
float bkgSHO; // Background Secreen Height Offset
|
||||||
|
|
||||||
|
if ((bkgTW / bkgTH) >= 1.6f/*screen ratio*/) {
|
||||||
|
bkgSW = (tSH / bkgTH) * bkgTW;
|
||||||
|
bkgSH = tSH;
|
||||||
|
bkgSWO = (((float)Renderer->GetScreenWidth()) - bkgSW) * 0.5f;
|
||||||
|
bkgSHO = ylOffset;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bkgSH = (tSW / bkgTW) * bkgTH;
|
||||||
|
bkgSW = tSW;
|
||||||
|
bkgSWO = xlOffset;
|
||||||
|
bkgSHO = ylOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Renderer->DrawRect(Vector2f(bkgSWO, bkgSHO), Vector2f(bkgSWO + bkgSW, bkgSHO + bkgSH), Vector2f(horOffset, 0.f), Vector2f(1.f - horOffset, verOffset));
|
||||||
|
Renderer->DrawRect(Vector2f(xlOffset, bkgSHO), Vector2f(xlOffset + tSW, bkgSHO + bkgSH), Vector2f(horOffset, 0.f), Vector2f(1.f - horOffset, verOffset));
|
||||||
|
|
||||||
Renderer->PopShader();
|
Renderer->PopShader();
|
||||||
|
|
||||||
|
@ -125,7 +125,11 @@ class TGameLevel : public TGameAreaAncestor
|
|||||||
friend class GalaxyMenu;
|
friend class GalaxyMenu;
|
||||||
protected:
|
protected:
|
||||||
float lvlWidth;
|
float lvlWidth;
|
||||||
float lvlHeight;
|
float lvlHeight;
|
||||||
|
|
||||||
|
float verOffset;
|
||||||
|
float horOffset;
|
||||||
|
|
||||||
std::string BkgTexture;
|
std::string BkgTexture;
|
||||||
//std::string LevelScreenTexture;
|
//std::string LevelScreenTexture;
|
||||||
std::string LevelFileName;
|
std::string LevelFileName;
|
||||||
|
@ -183,6 +183,7 @@ void TMyApplication::InnerInit()
|
|||||||
|
|
||||||
srand (static_cast<size_t>(time(NULL)));
|
srand (static_cast<size_t>(time(NULL)));
|
||||||
GameState = CONST_GAMESTATE_PRELOADING;
|
GameState = CONST_GAMESTATE_PRELOADING;
|
||||||
|
Menu.SetGameState(GameState);
|
||||||
StateTimer = 0.f;
|
StateTimer = 0.f;
|
||||||
|
|
||||||
ResourceManager->ShaderManager.AddShader("DefaultShader", "shaders/gui_transparent.vertex", "shaders/gui_transparent.fragment");
|
ResourceManager->ShaderManager.AddShader("DefaultShader", "shaders/gui_transparent.vertex", "shaders/gui_transparent.fragment");
|
||||||
@ -530,11 +531,11 @@ void TMyApplication::InnerUpdate(size_t dt)
|
|||||||
if (StateTimer >= 1.f)
|
if (StateTimer >= 1.f)
|
||||||
{
|
{
|
||||||
StateTimer -= 1.f;
|
StateTimer -= 1.f;
|
||||||
skipUpdateToUpdateScreen = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skipUpdateToUpdateScreen)
|
if (skipUpdateToUpdateScreen)
|
||||||
{
|
{
|
||||||
|
skipUpdateToUpdateScreen = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -568,10 +569,10 @@ void TMyApplication::InnerUpdate(size_t dt)
|
|||||||
std::cout << "menu error" << std::endl;
|
std::cout << "menu error" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderLevelSnapshots();
|
|
||||||
|
|
||||||
LoadResources();
|
LoadResources();
|
||||||
|
|
||||||
GameState = CONST_GAMESTATE_LOADING;
|
GameState = CONST_GAMESTATE_LOADING;
|
||||||
|
Menu.SetGameState(GameState);
|
||||||
}
|
}
|
||||||
else if (GameState == CONST_GAMESTATE_LOADING)
|
else if (GameState == CONST_GAMESTATE_LOADING)
|
||||||
{
|
{
|
||||||
@ -613,7 +614,10 @@ void TMyApplication::InnerUpdate(size_t dt)
|
|||||||
//
|
//
|
||||||
// Renderer->SetOrthoProjection();
|
// Renderer->SetOrthoProjection();
|
||||||
|
|
||||||
|
RenderLevelSnapshots();
|
||||||
|
|
||||||
GameState = CONST_GAMESTATE_MENU;
|
GameState = CONST_GAMESTATE_MENU;
|
||||||
|
Menu.SetGameState(GameState);
|
||||||
ApplySignalsToMenu();
|
ApplySignalsToMenu();
|
||||||
|
|
||||||
LoadGalaxyUi();
|
LoadGalaxyUi();
|
||||||
@ -643,7 +647,8 @@ void TMyApplication::InnerUpdate(size_t dt)
|
|||||||
{
|
{
|
||||||
//*SE::Console << "5CONST_GAMESTATE_FROM_MENU_TO_LEVEL";
|
//*SE::Console << "5CONST_GAMESTATE_FROM_MENU_TO_LEVEL";
|
||||||
GameState = CONST_GAMESTATE_LEVEL;
|
GameState = CONST_GAMESTATE_LEVEL;
|
||||||
OnDrawSignal.disconnect(boost::bind(&TGameMenu::Draw, boost::ref(Menu)));
|
Menu.SetGameState(GameState);
|
||||||
|
//OnDrawSignal.disconnect(boost::bind(&TGameMenu::Draw, boost::ref(Menu)));
|
||||||
//CONNECT SLOT
|
//CONNECT SLOT
|
||||||
DisapplySignalsToMenu();
|
DisapplySignalsToMenu();
|
||||||
ApplySignalsToGame();
|
ApplySignalsToGame();
|
||||||
@ -700,6 +705,7 @@ void TMyApplication::InnerUpdate(size_t dt)
|
|||||||
if (StateTimer <= 0.f)
|
if (StateTimer <= 0.f)
|
||||||
{
|
{
|
||||||
GameState = CONST_GAMESTATE_CREDITS;
|
GameState = CONST_GAMESTATE_CREDITS;
|
||||||
|
Menu.SetGameState(GameState);
|
||||||
OnDrawSignal.disconnect(boost::bind(&TGameMenu::Draw, boost::ref(Menu)));
|
OnDrawSignal.disconnect(boost::bind(&TGameMenu::Draw, boost::ref(Menu)));
|
||||||
ApplySignalsToCredits();
|
ApplySignalsToCredits();
|
||||||
StateTimer = 0.f;
|
StateTimer = 0.f;
|
||||||
@ -737,6 +743,7 @@ void TMyApplication::LoadGalaxyUi()
|
|||||||
[modal_background, this](Vector2f v, int i) {
|
[modal_background, this](Vector2f v, int i) {
|
||||||
PerformInMainThreadAsync([modal_background, this]() {
|
PerformInMainThreadAsync([modal_background, this]() {
|
||||||
modal_background->setVisibility(false);
|
modal_background->setVisibility(false);
|
||||||
|
Menu.GalaxMenu.planetHoverIndex = -1;
|
||||||
Menu.GalaxMenu.setTimerActivity(false);
|
Menu.GalaxMenu.setTimerActivity(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -818,6 +825,7 @@ void TMyApplication::SetupGalaxyUi(size_t levelStar)
|
|||||||
[this, modal_background, levelStar, levelIndex](Vector2f v, int i) {
|
[this, modal_background, levelStar, levelIndex](Vector2f v, int i) {
|
||||||
PerformInMainThreadAsync([this, modal_background, levelStar, levelIndex]() {
|
PerformInMainThreadAsync([this, modal_background, levelStar, levelIndex]() {
|
||||||
modal_background->setVisibility(false);
|
modal_background->setVisibility(false);
|
||||||
|
Menu.GalaxMenu.planetHoverIndex = -1;
|
||||||
|
|
||||||
std::shared_ptr<TGameLevel> lvl = this->Menu.GalaxMenu.galaxies[0].Stars[levelStar].selectionMenu.gameLevels[levelIndex];
|
std::shared_ptr<TGameLevel> lvl = this->Menu.GalaxMenu.galaxies[0].Stars[levelStar].selectionMenu.gameLevels[levelIndex];
|
||||||
lvl->ReloadLevel();
|
lvl->ReloadLevel();
|
||||||
@ -858,7 +866,10 @@ void TMyApplication::GoFromMenuToGame(std::shared_ptr<TGameLevel> level)
|
|||||||
GameLevel = level;
|
GameLevel = level;
|
||||||
GameLevel->SetLoading();
|
GameLevel->SetLoading();
|
||||||
GameState = CONST_GAMESTATE_FROM_MENU_TO_LEVEL;
|
GameState = CONST_GAMESTATE_FROM_MENU_TO_LEVEL;
|
||||||
|
Menu.SetGameState(GameState);
|
||||||
OnDrawSignal.connect(1, boost::bind(&TGameLevel::Draw, boost::ref(*GameLevel)));
|
OnDrawSignal.connect(1, boost::bind(&TGameLevel::Draw, boost::ref(*GameLevel)));
|
||||||
|
|
||||||
|
Menu.GalaxMenu.resetValuesOnGameStart();
|
||||||
|
|
||||||
DisapplySignalsToMenu();
|
DisapplySignalsToMenu();
|
||||||
|
|
||||||
@ -882,6 +893,7 @@ void TMyApplication::GoFromGameToMenu()
|
|||||||
|
|
||||||
ApplySignalsToMenu();
|
ApplySignalsToMenu();
|
||||||
GameState = CONST_GAMESTATE_MENU;
|
GameState = CONST_GAMESTATE_MENU;
|
||||||
|
Menu.SetGameState(GameState);
|
||||||
OnDrawSignal.disconnect(boost::bind(&TGameLevel::Draw, boost::ref(GameLevel)));
|
OnDrawSignal.disconnect(boost::bind(&TGameLevel::Draw, boost::ref(GameLevel)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -889,6 +901,7 @@ void TMyApplication::GoFromGameToMenu()
|
|||||||
void TMyApplication::GoFromMenuToCredits()
|
void TMyApplication::GoFromMenuToCredits()
|
||||||
{
|
{
|
||||||
GameState = CONST_GAMESTATE_FROM_MENU_TO_CREDITS;
|
GameState = CONST_GAMESTATE_FROM_MENU_TO_CREDITS;
|
||||||
|
Menu.SetGameState(GameState);
|
||||||
StateTimer = CONST_CREDITS_SHOW_TIME;
|
StateTimer = CONST_CREDITS_SHOW_TIME;
|
||||||
GameCredits.StartAppear();
|
GameCredits.StartAppear();
|
||||||
OnDrawSignal.connect(1, boost::bind(&TGameCredits::Draw, boost::ref(GameCredits)));
|
OnDrawSignal.connect(1, boost::bind(&TGameCredits::Draw, boost::ref(GameCredits)));
|
||||||
@ -900,6 +913,7 @@ void TMyApplication::GoFromCreditsToMenu()
|
|||||||
{
|
{
|
||||||
|
|
||||||
GameState = CONST_GAMESTATE_FROM_CREDITS_TO_MENU;
|
GameState = CONST_GAMESTATE_FROM_CREDITS_TO_MENU;
|
||||||
|
Menu.SetGameState(GameState);
|
||||||
StateTimer = CONST_CREDITS_SHOW_TIME;
|
StateTimer = CONST_CREDITS_SHOW_TIME;
|
||||||
GameCredits.StartDisappear();
|
GameCredits.StartDisappear();
|
||||||
OnDrawSignal.connect(0, boost::bind(&TGameMenu::Draw, boost::ref(Menu)));
|
OnDrawSignal.connect(0, boost::bind(&TGameMenu::Draw, boost::ref(Menu)));
|
||||||
@ -909,12 +923,12 @@ void TMyApplication::GoFromCreditsToMenu()
|
|||||||
|
|
||||||
void TMyApplication::MarkSetGameLevelPause()
|
void TMyApplication::MarkSetGameLevelPause()
|
||||||
{
|
{
|
||||||
OnDrawSignal.connect(0, boost::bind(&TGameMenu::Draw, boost::ref(Menu)));
|
//OnDrawSignal.connect(0, boost::bind(&TGameMenu::Draw, boost::ref(Menu)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMyApplication::MarkReleaseGameLevelPause()
|
void TMyApplication::MarkReleaseGameLevelPause()
|
||||||
{
|
{
|
||||||
OnDrawSignal.disconnect(boost::bind(&TGameMenu::Draw, boost::ref(Menu)));
|
//OnDrawSignal.disconnect(boost::bind(&TGameMenu::Draw, boost::ref(Menu)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ void TGameMenu::Draw()
|
|||||||
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
/*..GalaxMenu draw..*/
|
/*..GalaxMenu draw..*/
|
||||||
GalaxMenu.DrawGalaxyMenu();
|
GalaxMenu.DrawGalaxyMenu(GameState == CONST_GAMESTATE_MENU);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GALAX_MENU_DRAW
|
#ifndef GALAX_MENU_DRAW
|
||||||
@ -247,3 +247,8 @@ void TGameMenu::SetMenuItemCount(int menuItemCount)
|
|||||||
{
|
{
|
||||||
MenuItemCount = menuItemCount;
|
MenuItemCount = menuItemCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TGameMenu::SetGameState(int gameState)
|
||||||
|
{
|
||||||
|
GameState = gameState;
|
||||||
|
}
|
3
game/menucode.h
Normal file → Executable file
3
game/menucode.h
Normal file → Executable file
@ -19,6 +19,8 @@ protected:
|
|||||||
int MenuItemCount;
|
int MenuItemCount;
|
||||||
|
|
||||||
int SelectedGame;
|
int SelectedGame;
|
||||||
|
|
||||||
|
int GameState;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -34,6 +36,7 @@ public:
|
|||||||
void OpenNextLevel();
|
void OpenNextLevel();
|
||||||
int GetMenuItemCount();
|
int GetMenuItemCount();
|
||||||
void SetMenuItemCount(int menuItemCount);
|
void SetMenuItemCount(int menuItemCount);
|
||||||
|
void SetGameState(int gameState);
|
||||||
|
|
||||||
/*..Galaxy Menu..*/
|
/*..Galaxy Menu..*/
|
||||||
GalaxyMenu GalaxMenu;
|
GalaxyMenu GalaxMenu;
|
||||||
|
Loading…
Reference in New Issue
Block a user