This commit is contained in:
Crizomb 2025-06-15 19:22:33 +02:00
parent adcd6146ed
commit f30a490593
8 changed files with 93 additions and 4 deletions

View file

@ -18,7 +18,9 @@
const sf::Time Game::TimePerFrame = sf::seconds(1.f / 60.f);
sf::Texture bgTexture;
Game::Game() : backGround(PLACE_HOLDER_TEXTURE) {
Game::Game()
: backGround(PLACE_HOLDER_TEXTURE),
carrot(ANGRY_PATHS, NEUTRAL_PATHS, HAPPY_PATHS) {
assert(mFont.openFromFile("media/Sansation.ttf"));
mStatisticsText.setPosition({5.f, 5.f});
mStatisticsText.setCharacterSize(10);
@ -52,6 +54,9 @@ Game::Game() : backGround(PLACE_HOLDER_TEXTURE) {
float sx = backGround.getTexture().getSize().x;
float sy = backGround.getTexture().getSize().y;
backGround.setScale(sf::Vector2f(SCREEN_WIDTH / sx, SCREEN_HEIGHT / sy));
carrot.setPosition(CARROT_POS);
carrot.setScale(sf::Vector2f(5, 5));
}
void generateTilePatternAndMusic(AudioEmitter &audio_emitter) {
@ -124,7 +129,8 @@ void Game::render() {
mWindow.draw(leftPressZone);
mWindow.draw(middlePressZone);
mWindow.draw(rightPressZone);
if (!NoteTile::update(1.0 / 60, mWindow))
carrot.draw(mWindow, TimePerFrame.asSeconds());
if (!NoteTile::update(TimePerFrame.asSeconds(), mWindow))
update_scores(false);
mWindow.draw(mStatisticsText);
mWindow.draw(ScoreText);