diff --git a/source/code/BlockGameSdl.inc b/source/code/BlockGameSdl.inc index f4b242b..8b05c64 100644 --- a/source/code/BlockGameSdl.inc +++ b/source/code/BlockGameSdl.inc @@ -54,6 +54,7 @@ public: setButtonFont(holder, buttonNext, _("Next")); setButtonFont(holder, buttonRetry, _("Retry")); setButtonFont(holder, buttonSkip, _("Skip")); + setButtonFont(holder, stopIntField, ""); } @@ -375,7 +376,8 @@ public: } } if (!bGameOver && stop > 20) { - PrintIntRightAlignedBoard(240, -40, stop/10); + stopIntField.SetText(std::to_string(stop/10).c_str()); + stopIntField.Draw(globalData.screen, 240+topx, -40+topy); } #if DEBUG @@ -459,6 +461,7 @@ private: sago::SagoTextField buttonSkip; sago::SagoTextField buttonRetry; sago::SagoTextField buttonNext; + sago::SagoTextField stopIntField; }; diff --git a/source/code/sago/SagoTextField.cpp b/source/code/sago/SagoTextField.cpp index ecfbc2c..52d019f 100644 --- a/source/code/sago/SagoTextField.cpp +++ b/source/code/sago/SagoTextField.cpp @@ -192,6 +192,9 @@ void SagoTextField::Draw(SDL_Renderer* target, int x, int y, Alignment alignment if (alignment == Alignment::center) { x -= texW/2; } + if (alignment == Alignment::right) { + y -= texW; + } if (verticalAlignment == VerticalAlignment::center) { y -= texH/2; } diff --git a/source/code/sago/SagoTextField.hpp b/source/code/sago/SagoTextField.hpp index ad1a35c..f10af0b 100644 --- a/source/code/sago/SagoTextField.hpp +++ b/source/code/sago/SagoTextField.hpp @@ -73,7 +73,7 @@ public: * @return The text */ const std::string& GetText() const; - enum class Alignment { left = 0, center = 2 }; + enum class Alignment { left = 0, right=1, center = 2 }; enum class VerticalAlignment { top = 0, center = 1}; void Draw(SDL_Renderer* target, int x, int y, Alignment alignment = Alignment::left, VerticalAlignment verticalAlignment = VerticalAlignment::top); /**