mirror of
https://github.com/lov3b/Pong.git
synced 2024-11-09 23:10:18 +01:00
Larger font on countdown
This commit is contained in:
parent
37c0bc3297
commit
ca1b45fb81
@ -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);
|
||||
}
|
@ -13,6 +13,7 @@ private:
|
||||
int stepsToDo, stepsDone = 0;
|
||||
bool isDone_ = false;
|
||||
|
||||
TTF_Font *secondaryFont;
|
||||
public:
|
||||
[[nodiscard]] const bool &isDone() const {
|
||||
return isDone_;
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user