Création Test
This commit is contained in:
parent
611ff37653
commit
dd67b76d1f
6 changed files with 79 additions and 6 deletions
|
@ -1,9 +1,9 @@
|
|||
#include "NoteTile.hpp"
|
||||
#include "NoteSprite.hpp"
|
||||
#include <SFML/System/Vector2.hpp>
|
||||
#include <memory>
|
||||
|
||||
std::vector<std::unique_ptr<NoteTile>> NoteTile::existing_tiles;
|
||||
|
||||
std::vector<std::unique_ptr<NoteTile>> NoteTile::existing_tiles{};
|
||||
// private
|
||||
NoteTile::NoteTile(float play_time, float good_interval, NotePlaceEnum place)
|
||||
: play_time(play_time), good_interval(good_interval), place(place),
|
||||
|
@ -11,16 +11,17 @@ NoteTile::NoteTile(float play_time, float good_interval, NotePlaceEnum place)
|
|||
// TODO do real note_sprite init, make it fall at good speed far enough...
|
||||
note_sprite.sprite.setPosition(sf::Vector2f(200, 0));
|
||||
note_sprite.fall_speed = 1;
|
||||
NoteTile::existing_tiles.push_back(std::unique_ptr<NoteTile>(this));
|
||||
}
|
||||
|
||||
// public
|
||||
void NoteTile::create(float play_time, float good_interval,
|
||||
NotePlaceEnum place) {
|
||||
NoteTile(play_time, good_interval, place);
|
||||
// Can't use make_unique because constructor is private
|
||||
existing_tiles.push_back(
|
||||
std::unique_ptr<NoteTile>(new NoteTile(play_time, good_interval, place)));
|
||||
}
|
||||
|
||||
bool NoteTile::CheckPress(float press_time, NotePlaceEnum) {
|
||||
bool NoteTile::checkPress(float press_time, NotePlaceEnum) {
|
||||
for (const auto ¬e_tile : NoteTile::existing_tiles) {
|
||||
if (note_tile->play_time - note_tile->good_interval / 2 < press_time &&
|
||||
note_tile->play_time + note_tile->good_interval / 2 > press_time) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue