diff --git a/source/code/BlockGameSdl.hpp b/source/code/BlockGameSdl.hpp index bc8eca9..3f21140 100644 --- a/source/code/BlockGameSdl.hpp +++ b/source/code/BlockGameSdl.hpp @@ -49,6 +49,13 @@ static void setButtonFont(const sago::SagoDataHolder* holder, sago::SagoTextFiel field.SetText(text); } +template void sagoTextSetHelpFont(T& field) { + field.SetHolder(&globalData.spriteHolder->GetDataHolder()); + field.SetFont("freeserif"); + field.SetFontSize(30); + field.SetOutline(1, {128,128,128,255}); +} + class BlockGameSdl : public BlockGame { public: BlockGameSdl(int tx, int ty, const sago::SagoDataHolder* holder) { @@ -551,7 +558,9 @@ public: globalData.tbDraw.Draw(globalData.screen, topx+150, topy+200, sago::SagoTextField::Alignment::center); } else { - globalData.tbGameOver.Draw(globalData.screen, topx+150, topy+200, sago::SagoTextField::Alignment::center); + if (this->infostring.empty()) { + globalData.tbGameOver.Draw(globalData.screen, topx+150, topy+200, sago::SagoTextField::Alignment::center); + } } } } @@ -623,6 +632,30 @@ public: oldBubleY = this->GetTopY()+650+50*(this->GetStageClearLimit()-this->GetLinesCleared())-this->GetPixels()-1; DrawIMG(globalData.stageBobble,globalData.screen,this->GetTopX()+280,this->GetTopY()+650+50*(this->GetStageClearLimit()-this->GetLinesCleared())-this->GetPixels()-1); } + + if (infostring.length() > 0) { + static sago::SagoTextBox infoBox; + static sago::SagoTextField objectiveField; + static sago::SagoTextField gametypeNameField; + sagoTextSetHelpFont(infoBox); + infoBox.SetMaxWidth(290); + infoBox.SetText(infostring); + sagoTextSetHelpFont(objectiveField); + objectiveField.SetText(_("Objective:")); + sagoTextSetHelpFont(gametypeNameField); + gametypeNameField.SetText(infostringName); + gametypeNameField.Draw(globalData.screen, this->GetTopX()+7,this->GetTopY()+10); + objectiveField.Draw(globalData.screen, this->GetTopX()+7, this->GetTopY()+160); + infoBox.Draw(globalData.screen, this->GetTopX()+7, this->GetTopY()+160+32); + + int y = this->GetTopY()+400; + static sago::SagoTextBox controldBox; + controldBox.SetHolder(&globalData.spriteHolder->GetDataHolder()); + sagoTextSetHelpFont(controldBox); + controldBox.SetMaxWidth(290); + controldBox.SetText(controldBoxText); + controldBox.Draw(globalData.screen, this->GetTopX()+7,y); + } } sago::SagoTextField player_name; @@ -635,6 +668,10 @@ public: int oldBubleX; int oldBubleY; + std::string infostring; + std::string infostringName; + std::string controldBoxText; + private: int topx, topy; diff --git a/source/code/global.hpp b/source/code/global.hpp index 64e8376..3bc01da 100644 --- a/source/code/global.hpp +++ b/source/code/global.hpp @@ -64,7 +64,7 @@ void UpdateMouseCoordinates(const SDL_Event& event, int& mousex, int& mousey); void DrawIMG(const sago::SagoSprite& sprite, SDL_Renderer* target, int x, int y); void DrawIMG_Bounded(const sago::SagoSprite& sprite, SDL_Renderer* target, int x, int y, int minx, int miny, int maxx, int maxy); -void sagoTextSetHelpFont(sago::SagoTextField& field); +//void sagoTextSetHelpFont(sago::SagoTextField& field); void sagoTextSetBlueFont(sago::SagoTextField& field); const int SIXTEEN_NINE_WIDTH = 1364; diff --git a/source/code/main.cpp b/source/code/main.cpp index 57a1468..906de10 100644 --- a/source/code/main.cpp +++ b/source/code/main.cpp @@ -455,17 +455,6 @@ static void DrawBalls() { } } //DrawBalls -template void sagoTextSetHelpFont(T& field) { - field.SetHolder(&globalData.spriteHolder->GetDataHolder()); - field.SetFont("freeserif"); - field.SetFontSize(30); - field.SetOutline(1, {128,128,128,255}); -} - -void sagoTextSetHelpFont(sago::SagoTextField& gametypeNameField) { - sagoTextSetHelpFont(gametypeNameField); -} - void sagoTextSetBlueFont(sago::SagoTextField& field) { field.SetHolder(&globalData.spriteHolder->GetDataHolder()); field.SetFont("freeserif"); @@ -1217,7 +1206,7 @@ int main(int argc, char* argv[]) { //Takes names from file instead theGame.name = globalData.player1name; - theGame2.name = globalData.player2name; + theGame2.name = globalData.player2name; if (singlePuzzle) { LoadPuzzleStages(); @@ -1412,7 +1401,41 @@ int runGame(Gametype gametype, int level) { case Gametype::SinglePlayerEndless: default: StartSinglePlayerEndless(level); - }; + }; + if (!twoPlayers) { + std::string gametypeName; + std::string infostring; + if (theGame.isTimeTrial()) { + gametypeName = _("Time Trial"); + infostring = _("Score as much as possible in 2 minutes"); + + } + else if (theGame.isStageClear()) { + gametypeName = _("Stage Clear"); + infostring = _("You must clear a number of lines. Speed is rapidly increased."); + } + else if (theGame.isPuzzleMode()) { + gametypeName = _("Puzzle"); + infostring = _("Clear the entire board with a limited number of moves."); + } + else { + gametypeName = _("Endless"); + infostring = _("Score as much as possible. No time limit."); + } + theGame2.infostring = infostring; + theGame2.infostringName = gametypeName; + + std::string controldBoxText = std::string(_("Movement keys:"))+"\n"+getKeyName(keySettings[0].left)+", "+getKeyName(keySettings[0].right)+",\n" + + getKeyName(keySettings[0].up)+", "+getKeyName(keySettings[0].down)+"\n" + + _("Switch: ") + getKeyName(keySettings[0].change); + if (theGame.isPuzzleMode()) { + controldBoxText += std::string("\n") + _("Restart: ")+getKeyName(keySettings[0].push); + } + else { + controldBoxText += std::string("\n") + _("Push line: ")+getKeyName(keySettings[0].push); + } + theGame2.controldBoxText = controldBoxText; + } mustsetupgame = false; DrawBackground(globalData.screen); MoveBlockGameSdls(theGame, theGame2);