2017-08-17 19:10:53 +02:00
|
|
|
//
|
|
|
|
// Created by Syméon on 17/08/2017.
|
|
|
|
//
|
|
|
|
|
2019-01-14 21:43:56 +01:00
|
|
|
#pragma once
|
2017-08-17 19:10:53 +02:00
|
|
|
|
|
|
|
#include <SFML/Graphics.hpp>
|
2019-01-13 03:53:42 +01:00
|
|
|
#include <imgui.h>
|
2019-01-13 22:29:29 +01:00
|
|
|
#include <imgui-SFML.h>
|
2017-08-17 19:10:53 +02:00
|
|
|
#include "Marker.h"
|
2019-02-09 16:05:46 +01:00
|
|
|
#include "LNMarker.h"
|
2019-03-25 19:16:45 +01:00
|
|
|
#include "Chart.h"
|
2017-08-17 19:10:53 +02:00
|
|
|
|
2019-01-14 21:43:56 +01:00
|
|
|
namespace Widgets {
|
|
|
|
class Ecran_attente {
|
2017-08-17 19:10:53 +02:00
|
|
|
|
2019-01-14 21:43:56 +01:00
|
|
|
public:
|
2017-08-17 19:10:53 +02:00
|
|
|
|
2019-01-14 21:43:56 +01:00
|
|
|
Ecran_attente();
|
|
|
|
void render(sf::RenderWindow &window);
|
2017-08-17 19:10:53 +02:00
|
|
|
|
2019-01-14 21:43:56 +01:00
|
|
|
private:
|
2017-08-17 19:10:53 +02:00
|
|
|
|
2019-01-14 21:43:56 +01:00
|
|
|
sf::Color gris_de_fond;
|
|
|
|
sf::Texture tex_FEIS_logo;
|
|
|
|
sf::Sprite FEIS_logo;
|
2017-08-17 19:10:53 +02:00
|
|
|
|
2019-01-14 21:43:56 +01:00
|
|
|
};
|
2017-08-17 19:10:53 +02:00
|
|
|
|
2019-01-14 21:43:56 +01:00
|
|
|
class Playfield {
|
2017-08-17 19:10:53 +02:00
|
|
|
|
2019-01-14 21:43:56 +01:00
|
|
|
public:
|
2017-08-17 19:10:53 +02:00
|
|
|
|
2019-01-14 21:43:56 +01:00
|
|
|
Playfield();
|
2019-03-25 19:16:45 +01:00
|
|
|
sf::Texture base_texture;
|
|
|
|
sf::Sprite button;
|
|
|
|
sf::Sprite button_pressed;
|
|
|
|
sf::Sprite note_collision;
|
2019-02-09 16:05:46 +01:00
|
|
|
LNMarker longNoteMarker;
|
2017-08-17 19:10:53 +02:00
|
|
|
|
2019-01-14 21:43:56 +01:00
|
|
|
private:
|
2019-03-25 19:16:45 +01:00
|
|
|
std::string texture_path = "assets/textures/edit_textures/game_front_edit_tex_1.tex.png";
|
|
|
|
};
|
|
|
|
|
2019-03-26 00:04:29 +01:00
|
|
|
class LinearView {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
LinearView();
|
|
|
|
|
|
|
|
sf::RenderTexture view;
|
|
|
|
sf::Font beat_number_font;
|
|
|
|
sf::RectangleShape cursor;
|
|
|
|
sf::RectangleShape note_rect;
|
|
|
|
sf::RectangleShape note_collision_zone;
|
|
|
|
|
|
|
|
void update(std::optional<Chart> chart, sf::Time playbackPosition, float ticksAtPlaybackPosition, float BPM, int resolution, ImVec2 size);
|
|
|
|
|
|
|
|
void setZoom(int zoom);
|
|
|
|
void zoom_in() {setZoom(zoom+1);};
|
|
|
|
void zoom_out() {setZoom(zoom-1);};
|
|
|
|
float timeFactor() {return std::pow(1.25f,static_cast<float>(zoom));};
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
int zoom = 0;
|
|
|
|
std::string font_path = "assets/fonts/NotoSans-Medium.ttf";
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2019-03-25 19:16:45 +01:00
|
|
|
class DensityGraph {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
struct density_entry {
|
|
|
|
int density;
|
|
|
|
bool has_collisions;
|
|
|
|
};
|
|
|
|
|
|
|
|
DensityGraph();
|
|
|
|
sf::Texture base_texture;
|
|
|
|
sf::Sprite normal_square;
|
|
|
|
sf::Sprite collision_square;
|
|
|
|
sf::RenderTexture graph;
|
|
|
|
sf::FloatRect graph_rect;
|
|
|
|
|
|
|
|
bool should_recompute = false;
|
|
|
|
|
|
|
|
std::vector<DensityGraph::density_entry> densities;
|
|
|
|
|
|
|
|
std::optional<int> last_height;
|
|
|
|
std::optional<float> last_section_length;
|
|
|
|
|
|
|
|
void computeDensities(int height, float chartRuntime, Chart& chart, float BPM, int resolution);
|
|
|
|
void updateGraphTexture();
|
|
|
|
|
|
|
|
/*
|
|
|
|
void addAtTime(float seconds);
|
|
|
|
void removeAtTime(float seconds);
|
|
|
|
*/
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::string texture_path = "assets/textures/edit_textures/game_front_edit_tex_1.tex.png";
|
|
|
|
|
2019-01-14 21:43:56 +01:00
|
|
|
};
|
|
|
|
}
|