#include #include #include #include #include #include #include #include class NoteTile { private: static std::vector> existing_tiles; // logic things float play_time; float good_interval; NotePlaceEnum place; // used for Graphics NoteSprite note_sprite; // probably some tileSprite class here in the future <- // Constructor is private, use create NoteTile(float play_time, float good_interval, NotePlaceEnum place, float current_time); // For unit testing public: // Good key press for this note, is if player press good place, within // [play_time - good_interval/2, play_time + good_interval/2] static void create(float play_time, float good_interval, NotePlaceEnum place, float current_time); // Usefull in test, but don't use it anywhere static void clear() { existing_tiles.clear(); }; // Should be called when one of arrows key pressed, return True if it's a good // press static bool checkPress(float press_time, NotePlaceEnum key_pressed); // return false if missed tile static bool update(float dtime, sf::RenderWindow &window); // Some getters usefull in test : float getPlayTime() const { return play_time; }; float getGoodInterval() const { return good_interval; }; NotePlaceEnum getPlace() const { return place; }; NoteSprite getNodeSprite() const { return note_sprite; }; static const std::vector> &getExistingTiles() { return existing_tiles; }; static bool isFinished() { return existing_tiles.size() == 0; } };