Visuel notes
This commit is contained in:
parent
e2fb0d911a
commit
05f8b11dec
14 changed files with 137 additions and 50 deletions
|
@ -1,3 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <fmod.hpp>
|
||||
#include <fmod_errors.h>
|
||||
#include <memory>
|
||||
|
@ -31,6 +33,7 @@ public:
|
|||
int firstNote();
|
||||
int nextNote(int currentNote);
|
||||
int noteSecondaire(int note);
|
||||
float getTime();
|
||||
float getTimeTempo() const;
|
||||
float getTime() const;
|
||||
float timeBeforeNewGeneration{0.2f};
|
||||
};
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#ifndef BOOK_GAME_HPP
|
||||
#define BOOK_GAME_HPP
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <SFML/Graphics/RenderWindow.hpp>
|
||||
#include <SFML/Graphics/Sprite.hpp>
|
||||
#include <SFML/System/Vector2.hpp>
|
||||
class NoteTile;
|
||||
|
@ -8,6 +9,7 @@ class NoteTile;
|
|||
class NoteSprite {
|
||||
public:
|
||||
static sf::Texture texture;
|
||||
static bool loadTexture(const std::string &filename);
|
||||
friend class NoteTile;
|
||||
|
||||
private:
|
||||
|
@ -15,5 +17,5 @@ private:
|
|||
float fall_speed;
|
||||
NoteSprite();
|
||||
NoteSprite(sf::Vector2f start_pos, float fall_speed);
|
||||
void update(float dtime);
|
||||
void update(float dtime, sf::RenderWindow &window);
|
||||
};
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#include <NotePlaceEnum.hpp>
|
||||
#include <NoteSprite.hpp>
|
||||
#include <SFML/Graphics/RenderWindow.hpp>
|
||||
#include <SFML/Graphics/StencilMode.hpp>
|
||||
#include <SFML/System/Vector2.hpp>
|
||||
#include <SFML/Window/Window.hpp>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
|
@ -16,21 +18,25 @@ private:
|
|||
NoteSprite note_sprite;
|
||||
// probably some tileSprite class here in the future <-
|
||||
|
||||
// Constructor is rivate, use create
|
||||
NoteTile(float play_time, float good_interval, NotePlaceEnum place);
|
||||
// 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);
|
||||
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);
|
||||
|
||||
static void update(float dtime, sf::RenderWindow &window);
|
||||
|
||||
// Some getters usefull in test :
|
||||
float getPlayTime() const { return play_time; };
|
||||
float getGoodInterval() const { return good_interval; };
|
||||
|
|
7
SimpleGame/src/Include/TilePattern.hpp
Normal file
7
SimpleGame/src/Include/TilePattern.hpp
Normal file
|
@ -0,0 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "AudioEmitter.hpp"
|
||||
#include <vector>
|
||||
|
||||
void generateTilePattern(std::vector<std::pair<float, int>> new_notes,
|
||||
const AudioEmitter &audio_emitter);
|
Loading…
Add table
Add a link
Reference in a new issue