Larger font on countdown

This commit is contained in:
Love 2024-01-29 21:39:48 +01:00
parent 37c0bc3297
commit ca1b45fb81
3 changed files with 10 additions and 1 deletions

View File

@ -17,6 +17,12 @@ int_least64_t getCurrentEpochTimeMillis() {
OptionScreen::OptionScreen(const std::string &text, SDL_Point *screenSize, int seconds) : TextScreen(text, screenSize,
std::nullopt),
stepsToDo(seconds) {
secondaryFont = TTF_OpenFont(getDefaultFontPath(), 100);
if (secondaryFont == nullptr) {
std::cerr << "Failed to load secondary font: " << TTF_GetError() << std::endl;
exit(-1);
}
}
void OptionScreen::update() {
@ -30,6 +36,7 @@ void OptionScreen::update() {
stepsDone++;
} else {
isDone_ = true;
std::swap(font, secondaryFont);
}
}
@ -41,4 +48,5 @@ void OptionScreen::startCountDown() {
nextMsEpoch = epochMs;
hasStartedCounting_ = true;
stepsDone = 0;
std::swap(font, secondaryFont);
}

View File

@ -13,6 +13,7 @@ private:
int stepsToDo, stepsDone = 0;
bool isDone_ = false;
TTF_Font *secondaryFont;
public:
[[nodiscard]] const bool &isDone() const {
return isDone_;

View File

@ -19,7 +19,6 @@ class TextScreen {
private:
std::vector<SDL_Surface *> surfaces;
std::vector<SDL_Surface *> shadowSurfaces;
TTF_Font *font;
SDL_Point *screenSize;
std::optional<SDL_Point> basePosition;
@ -32,6 +31,7 @@ private:
const int shadowOffset = 3;
protected:
TTF_Font *font;
std::vector<std::string> lines;
bool hasUpdated;