resize
This commit is contained in:
parent
549214014d
commit
5ab7b40154
@ -77,7 +77,7 @@ void Game::Run() {
|
|||||||
Game::Game() :
|
Game::Game() :
|
||||||
m_wrong_guesses(0),
|
m_wrong_guesses(0),
|
||||||
m_game_state(State::PLAY),
|
m_game_state(State::PLAY),
|
||||||
m_hills(get_hills()) {
|
m_hills(get_resized(get_hills(), 400, 400)) {
|
||||||
const char *defaultFontPath = getDefaultFontPath();
|
const char *defaultFontPath = getDefaultFontPath();
|
||||||
if (defaultFontPath == nullptr) {
|
if (defaultFontPath == nullptr) {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
@ -133,6 +133,10 @@ void Game::draw(SDL_Renderer *renderer) {
|
|||||||
draw_guesses(renderer);
|
draw_guesses(renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Game::draw_hang_man(SDL_Renderer *renderer) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void Game::draw_guesses(SDL_Renderer *renderer) {
|
void Game::draw_guesses(SDL_Renderer *renderer) {
|
||||||
size_t len = strlen(word);
|
size_t len = strlen(word);
|
||||||
int total_width = (len - 1) * STEP_SIZE + CHAR_SIZE;
|
int total_width = (len - 1) * STEP_SIZE + CHAR_SIZE;
|
||||||
|
@ -34,5 +34,6 @@ public:
|
|||||||
private:
|
private:
|
||||||
void draw_guesses(SDL_Renderer *renderer);
|
void draw_guesses(SDL_Renderer *renderer);
|
||||||
|
|
||||||
|
void draw_hang_man(SDL_Renderer *renderer);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -66,3 +66,13 @@ SDL_Surface *resize_surface(SDL_Surface *t_surface, int t_width, int t_height) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::vector<SDL_Surface *> get_resized(const std::vector<SDL_Surface *> &t_originals, int t_width, int t_height) {
|
||||||
|
std::vector<SDL_Surface *> 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;
|
||||||
|
}
|
||||||
|
@ -11,6 +11,8 @@ constexpr size_t array_len(T *array[]) {
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<SDL_Surface *> get_resized(const std::vector<SDL_Surface *>& t_original, int t_width, int t_height);
|
||||||
|
|
||||||
std::vector<SDL_Surface *> get_hills();
|
std::vector<SDL_Surface *> get_hills();
|
||||||
|
|
||||||
SDL_Surface *resize_surface(SDL_Surface *t_surface, int t_width, int t_height);
|
SDL_Surface *resize_surface(SDL_Surface *t_surface, int t_width, int t_height);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user