commit 810e1c2f
Converted more text fields to SagoTextField
Changed files
| M | source/code/BlockGameSdl.inc before |
| M | source/code/global.hpp before |
| M | source/code/main.cpp before |
diff --git a/source/code/BlockGameSdl.inc b/source/code/BlockGameSdl.inc
index 3d59a20..765bc76 100644
--- a/source/code/BlockGameSdl.inc
+++ b/source/code/BlockGameSdl.inc
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/
Source information and contacts persons can be found at
-http://www.blockattack.net
+https://blockattack.net
===========================================================================
*/
@@ -315,7 +315,10 @@ public:
if (puzzleMode&&(!bGameOver)) {
//We need to write nr. of moves left!
strHolder = _("Moves left: ") + std::to_string(MovesLeft);
- globalData.standard_blue_font.draw(globalData.screen, topx+5, topy+5, strHolder);
+ static sago::SagoTextField movesPuzzleLabel;
+ sagoTextSetHelpFont(movesPuzzleLabel);
+ movesPuzzleLabel.SetText(strHolder.c_str());
+ movesPuzzleLabel.Draw(globalData.screen, topx+5, topy+5);
}
if (puzzleMode && stageButtonStatus == SBpuzzleMode) {
@@ -332,8 +335,10 @@ public:
}
}
else {
- strHolder = "Last puzzle";
- globalData.standard_blue_font.draw(globalData.screen, topx+5, topy+5, strHolder);
+ static sago::SagoTextField lastPuzzleLabel;
+ sagoTextSetHelpFont(lastPuzzleLabel);
+ lastPuzzleLabel.SetText(_("Last puzzle"));
+ lastPuzzleLabel.Draw(globalData.screen, topx+5, topy+5);
}
}
if (stageClear && stageButtonStatus == SBstageClear) {
@@ -350,8 +355,10 @@ public:
}
}
else {
- strHolder = "Last stage";
- globalData.standard_blue_font.draw(globalData.screen, topx+5, topy+5, strHolder);
+ static sago::SagoTextField lastStageLabel;
+ sagoTextSetHelpFont(lastStageLabel);
+ lastStageLabel.SetText(_("Last stage"));
+ lastStageLabel.Draw(globalData.screen, topx+5, topy+5);
}
}
if (!bGameOver && stop > 20) {
diff --git a/source/code/global.hpp b/source/code/global.hpp
index d9001c6..17f746a 100644
--- a/source/code/global.hpp
+++ b/source/code/global.hpp
@@ -32,6 +32,7 @@ http://www.blockattack.net
#include "FontWrapper.hpp"
#include "TextManager.hpp"
#include "ExplosionManager.hpp"
+#include "sago/SagoTextField.hpp"
void MainMenu();
void ResetFullscreen();
@@ -46,6 +47,8 @@ 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);
+
struct GlobalData {
sago::SagoSprite bHighScore;
sago::SagoSprite bBack;
@@ -54,7 +57,6 @@ struct GlobalData {
sago::SagoSprite iLevelCheckBox;
sago::SagoSprite iLevelCheckBoxMarked;
sago::SagoSprite iCheckBoxArea;
- FontWrapper scoreboard_font;
FontWrapper standard_blue_font;
FontWrapper button_font;
bool MusicEnabled; //true if background music is enabled
diff --git a/source/code/main.cpp b/source/code/main.cpp
index 3e90c91..3119362 100644
--- a/source/code/main.cpp
+++ b/source/code/main.cpp
@@ -199,7 +199,6 @@ static int InitImages(sago::SagoSpriteHolder& holder) {
globalData.button_font.load(globalData.screen, holder.GetDataHolder().getFontPtr("freeserif", 24), nf_button_color);
globalData.standard_blue_font.load(globalData.screen, holder.GetDataHolder().getFontPtr("freeserif", 30), nf_standard_blue_color);
nf_standard_small_font.load(globalData.screen, holder.GetDataHolder().getFontPtr("freeserif", 16), nf_standard_small_color);
- globalData.scoreboard_font.load(globalData.screen, holder.GetDataHolder().getFontPtr("penguinattack", 20), nf_button_color);
//Loads the sound if sound present
if (!globalData.NoSound) {
@@ -425,7 +424,7 @@ template <class T> void sagoTextSetHelpFont(T& field){
field.SetOutline(1, {0,0,0,255});
}
-static void sagoTextSetHelpFont(sago::SagoTextField& gametypeNameField){
+void sagoTextSetHelpFont(sago::SagoTextField& gametypeNameField){
sagoTextSetHelpFont<sago::SagoTextField>(gametypeNameField);
}