grosses fleures
This commit is contained in:
parent
1a8e68e0b6
commit
f574bd769d
3 changed files with 8 additions and 7 deletions
|
@ -11,6 +11,7 @@ static constexpr unsigned int MIDDLE_HEIGHT = SCREEN_HEIGHT / 2;
|
||||||
static constexpr unsigned int NOTE_PLACE_X_POS[3] = {
|
static constexpr unsigned int NOTE_PLACE_X_POS[3] = {
|
||||||
SCREEN_WIDTH * 6 / 10, SCREEN_WIDTH * 7 / 10, SCREEN_WIDTH * 8 / 10};
|
SCREEN_WIDTH * 6 / 10, SCREEN_WIDTH * 7 / 10, SCREEN_WIDTH * 8 / 10};
|
||||||
|
|
||||||
|
static constexpr unsigned int FLOWER_SIZE = SCREEN_WIDTH * 0.05;
|
||||||
namespace sf {
|
namespace sf {
|
||||||
class Texture;
|
class Texture;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "NoteSprite.hpp"
|
#include "NoteSprite.hpp"
|
||||||
|
#include "GameData.hpp"
|
||||||
#include <SFML/Graphics/Color.hpp>
|
#include <SFML/Graphics/Color.hpp>
|
||||||
#include <SFML/Graphics/RenderWindow.hpp>
|
#include <SFML/Graphics/RenderWindow.hpp>
|
||||||
#include <SFML/Graphics/Sprite.hpp>
|
#include <SFML/Graphics/Sprite.hpp>
|
||||||
|
@ -15,11 +16,6 @@ bool NoteSprite::loadTexture(const std::string &filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
NoteSprite::NoteSprite() : sprite(sf::Sprite(texture)), fall_speed(0.f) {};
|
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) {
|
void NoteSprite::update(float dtime, sf::RenderWindow &window) {
|
||||||
sprite.move(sf::Vector2f(0, fall_speed * dtime));
|
sprite.move(sf::Vector2f(0, fall_speed * dtime));
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "NoteTile.hpp"
|
#include "NoteTile.hpp"
|
||||||
#include "GameData.hpp"
|
#include "GameData.hpp"
|
||||||
#include "NoteSprite.hpp"
|
#include "NoteSprite.hpp"
|
||||||
|
#include <SFML/Graphics/Texture.hpp>
|
||||||
#include <SFML/System/Vector2.hpp>
|
#include <SFML/System/Vector2.hpp>
|
||||||
#include <SFML/Window/Window.hpp>
|
#include <SFML/Window/Window.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
@ -16,7 +17,10 @@ NoteTile::NoteTile(float play_time, float good_interval, NotePlaceEnum place,
|
||||||
note_sprite.sprite.setPosition(sf::Vector2f(
|
note_sprite.sprite.setPosition(sf::Vector2f(
|
||||||
NOTE_PLACE_X_POS[place],
|
NOTE_PLACE_X_POS[place],
|
||||||
NOTE_PRESS_HEIGHT - note_sprite.fall_speed * (play_time - current_time)));
|
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
|
// public
|
||||||
void NoteTile::create(float play_time, float good_interval, NotePlaceEnum place,
|
void NoteTile::create(float play_time, float good_interval, NotePlaceEnum place,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue