grosses fleures

This commit is contained in:
Crizomb 2025-06-15 01:53:06 +02:00
parent 1a8e68e0b6
commit f574bd769d
3 changed files with 8 additions and 7 deletions

View file

@ -11,6 +11,7 @@ static constexpr unsigned int MIDDLE_HEIGHT = SCREEN_HEIGHT / 2;
static constexpr unsigned int NOTE_PLACE_X_POS[3] = {
SCREEN_WIDTH * 6 / 10, SCREEN_WIDTH * 7 / 10, SCREEN_WIDTH * 8 / 10};
static constexpr unsigned int FLOWER_SIZE = SCREEN_WIDTH * 0.05;
namespace sf {
class Texture;
};

View file

@ -1,11 +1,12 @@
#include "NoteSprite.hpp"
#include "GameData.hpp"
#include <SFML/Graphics/Color.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFML/Graphics/Sprite.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <SFML/System/Vector2.hpp>
#include <SFML/Window/Window.hpp>
//#include <bits/types/cookie_io_functions_t.h>
// #include <bits/types/cookie_io_functions_t.h>
#include <cstdio>
sf::Texture NoteSprite::texture;
@ -15,11 +16,6 @@ bool NoteSprite::loadTexture(const std::string &filename) {
}
NoteSprite::NoteSprite() : sprite(sf::Sprite(texture)), fall_speed(0.f) {};
NoteSprite::NoteSprite(sf::Vector2f start_pos, float fall_speed)
: fall_speed(fall_speed), sprite(sf::Sprite(NoteSprite::texture)) {
sprite.setPosition(start_pos); // sprite position c'est le left up corner
sprite.setColor(sf::Color::Yellow);
};
void NoteSprite::update(float dtime, sf::RenderWindow &window) {
sprite.move(sf::Vector2f(0, fall_speed * dtime));

View file

@ -1,6 +1,7 @@
#include "NoteTile.hpp"
#include "GameData.hpp"
#include "NoteSprite.hpp"
#include <SFML/Graphics/Texture.hpp>
#include <SFML/System/Vector2.hpp>
#include <SFML/Window/Window.hpp>
#include <memory>
@ -16,7 +17,10 @@ NoteTile::NoteTile(float play_time, float good_interval, NotePlaceEnum place,
note_sprite.sprite.setPosition(sf::Vector2f(
NOTE_PLACE_X_POS[place],
NOTE_PRESS_HEIGHT - note_sprite.fall_speed * (play_time - current_time)));
}
float s = FLOWER_SIZE / note_sprite.sprite.getTexture().getSize().x;
note_sprite.sprite.setScale(sf::Vector2f(s, s));
};
// public
void NoteTile::create(float play_time, float good_interval, NotePlaceEnum place,