F.E.I.S/src/widgets/linear_view.hpp

65 lines
1.7 KiB
C++
Raw Normal View History

#pragma once
#include <SFML/Graphics.hpp>
#include <cmath>
#include <filesystem>
2021-12-31 14:59:39 +01:00
#include "../chart_state.hpp"
2021-12-31 00:57:06 +01:00
#include "../time_selection.hpp"
#include "../toolbox.hpp"
class LinearView {
public:
LinearView(std::filesystem::path assets);
sf::RenderTexture view;
void update(
const std::optional<ChartState>& chart,
const sf::Time& playbackPosition,
const float& ticksAtPlaybackPosition,
const float& BPM,
const int& resolution,
2021-12-31 14:59:39 +01:00
const ImVec2& size);
2019-04-06 23:21:28 +02:00
void setZoom(int zoom);
2021-12-31 14:59:39 +01:00
void zoom_in() { setZoom(zoom + 1); };
void zoom_out() { setZoom(zoom - 1); };
float timeFactor() { return std::pow(1.25f, static_cast<float>(zoom)); };
2019-04-06 23:21:28 +02:00
bool shouldDisplaySettings;
2019-04-06 23:21:28 +02:00
void displaySettings();
private:
2019-04-06 23:21:28 +02:00
sf::Font beat_number_font;
sf::RectangleShape cursor;
sf::RectangleShape selection;
sf::RectangleShape note_rect;
sf::RectangleShape long_note_rect;
sf::RectangleShape long_note_collision_zone;
sf::RectangleShape note_selected;
sf::RectangleShape note_collision_zone;
float last_BPM = 120.0f;
int last_resolution = 240;
bool shouldReloadTransforms;
AffineTransform<float> SecondsToTicks;
AffineTransform<float> SecondsToTicksProportional;
AffineTransform<float> PixelsToSeconds;
AffineTransform<float> PixelsToSecondsProprotional;
AffineTransform<float> PixelsToTicks;
void resize(unsigned int width, unsigned int height);
2021-12-31 14:59:39 +01:00
void reloadTransforms(
const sf::Time& playbackPosition,
const float& ticksAtPlaybackPosition,
const float& BPM,
const int& resolution);
2019-04-06 23:21:28 +02:00
int zoom = 0;
const std::filesystem::path font_path;
};