diff --git a/src/Game.cpp b/src/Game.cpp index 2fafeff..5a3b434 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -77,7 +77,7 @@ void Game::Run() { Game::Game() : m_wrong_guesses(0), m_game_state(State::PLAY), - m_hills(get_hills()) { + m_hills(get_resized(get_hills(), 400, 400)) { const char *defaultFontPath = getDefaultFontPath(); if (defaultFontPath == nullptr) { std::stringstream ss; @@ -133,6 +133,10 @@ void Game::draw(SDL_Renderer *renderer) { draw_guesses(renderer); } +void Game::draw_hang_man(SDL_Renderer *renderer) { + +} + void Game::draw_guesses(SDL_Renderer *renderer) { size_t len = strlen(word); int total_width = (len - 1) * STEP_SIZE + CHAR_SIZE; diff --git a/src/Game.hpp b/src/Game.hpp index cc348b2..f30855f 100644 --- a/src/Game.hpp +++ b/src/Game.hpp @@ -34,5 +34,6 @@ public: private: void draw_guesses(SDL_Renderer *renderer); + void draw_hang_man(SDL_Renderer *renderer); }; diff --git a/src/utils.cpp b/src/utils.cpp index 59d28ec..3ffbba9 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -66,3 +66,13 @@ SDL_Surface *resize_surface(SDL_Surface *t_surface, int t_width, int t_height) { } +std::vector get_resized(const std::vector &t_originals, int t_width, int t_height) { + std::vector ret; + ret.reserve(t_originals.size()); + for (SDL_Surface *original: t_originals) { + SDL_Surface *resized = resize_surface(original, t_width, t_height); + SDL_FreeSurface(original); + ret.push_back(resized); + } + return ret; +} diff --git a/src/utils.hpp b/src/utils.hpp index 715c90e..ac7bcb1 100644 --- a/src/utils.hpp +++ b/src/utils.hpp @@ -11,6 +11,8 @@ constexpr size_t array_len(T *array[]) { return i; } +std::vector get_resized(const std::vector& t_original, int t_width, int t_height); + std::vector get_hills(); SDL_Surface *resize_surface(SDL_Surface *t_surface, int t_width, int t_height);