1
0
mirror of synced 2025-02-02 12:27:20 +01:00

Move everything Input-related to src/Input

This commit is contained in:
Stepland 2020-04-30 11:46:23 +02:00
parent ebf5c08b05
commit d97bfdc0ec
28 changed files with 94 additions and 93 deletions

View File

@ -25,14 +25,8 @@ sources = [
'include/imgui-sfml/imgui-SFML.cpp',
'include/whereami/whereami.c',
'include/whereami/whereami++.cpp',
'src/Data/Buttons.hpp',
'src/Data/Buttons.cpp',
'src/Data/Chart.cpp',
'src/Data/Chart.hpp',
'src/Data/KeyMapping.hpp',
'src/Data/KeyMapping.cpp',
'src/Data/MappableKeys.hpp',
'src/Data/MappableKeys.cpp',
'src/Data/Note.hpp',
'src/Data/Preferences.hpp',
'src/Data/Preferences.cpp',
@ -43,6 +37,12 @@ sources = [
'src/Drawables/BlackFrame.cpp',
'src/Drawables/ButtonHighlight.hpp',
'src/Drawables/ButtonHighlight.cpp',
'src/Input/Buttons.hpp',
'src/Input/Buttons.cpp',
'src/Input/KeyMapping.hpp',
'src/Input/KeyMapping.cpp',
'src/Input/MappableKeys.hpp',
'src/Input/MappableKeys.cpp',
'src/Resources/TextureCache.cpp',
'src/Resources/TextureCache.hpp',
'src/Resources/Marker.cpp',

View File

@ -2,8 +2,6 @@
#include "../Toolkit/AffineTransform.hpp"
#include "Buttons.hpp"
namespace Data {
Chart::Chart(const stepland::memon& memon, const std::string& difficulty) {
auto it = memon.charts.find(difficulty);
@ -13,19 +11,19 @@ namespace Data {
auto [_, chart] = *it;
level = chart.level;
resolution = static_cast<std::size_t>(chart.resolution);
Toolkit::AffineTransform<float> memon_timing_to_300Hz(
Toolkit::AffineTransform<float> memon_timing_to_1000Hz(
0.f, static_cast<float>(chart.resolution),
-memon.offset*300.f, (-memon.offset+60.f/memon.BPM)*300.f
-memon.offset*1000.f, (-memon.offset+60.f/memon.BPM)*1000.f
);
Toolkit::AffineTransform<float> memon_timing_to_300Hz_proportional(
0.f, static_cast<float>(chart.resolution),
0.f, (60.f/memon.BPM)*300.f
);
for (auto &&note : chart.notes) {
auto timing = static_cast<long>(memon_timing_to_300Hz.transform(note.get_timing()));
auto position = static_cast<Button>(note.get_pos());
auto timing = static_cast<long>(memon_timing_to_1000Hz.transform(note.get_timing()));
auto position = static_cast<Input::Button>(note.get_pos());
std::size_t length = 0;
Button tail = Button::B1;
auto tail = Input::Button::B1;
if (note.get_length() != 0) {
length = static_cast<std::size_t>(memon_timing_to_300Hz_proportional.transform(note.get_length()));
tail = convert_memon_tail(position, note.get_tail_pos());
@ -34,7 +32,7 @@ namespace Data {
}
}
Button convert_memon_tail(Button note, unsigned int tail_position) {
Input::Button convert_memon_tail(Input::Button note, unsigned int tail_position) {
auto note_position = button_to_index(note);
assert((note_position <= 15));
assert((tail_position <= 11));
@ -67,7 +65,7 @@ namespace Data {
if (tail_x < 0 or tail_x > 3 or tail_y < 0 or tail_y > 3) {
throw std::runtime_error("Invalid tail_position : "+std::to_string(tail_position));
}
auto tail = coords_to_button({
auto tail = Input::coords_to_button({
static_cast<unsigned int>(tail_x),
static_cast<unsigned int>(tail_y)
});

View File

@ -5,7 +5,7 @@
#include <memon/memon.hpp>
#include "Buttons.hpp"
#include "../Input/Buttons.hpp"
#include "Note.hpp"
namespace Data {
@ -15,5 +15,5 @@ namespace Data {
std::set<Note> notes;
std::size_t resolution;
};
Button convert_memon_tail(Button note, unsigned int tail_position);
Input::Button convert_memon_tail(Input::Button note, unsigned int tail_position);
}

View File

@ -1,15 +1,15 @@
#pragma once
#include "Buttons.hpp"
#include "../Input/Buttons.hpp"
namespace Data {
struct Note {
// Timing is stored as ticks on a 300Hz clock starting at the begging of the audio
// Timing is stored as ticks on a 1000Hz clock starting at the begging of the audio
long int timing;
Button position;
Input::Button position;
// zero length means it's a standard note
std::size_t length;
Button tail;
Input::Button tail;
bool operator==(const Note &rhs) const {
return timing == rhs.timing && position == rhs.position;

View File

@ -67,7 +67,7 @@ namespace Data {
std::cerr << "Using fallback preferences instead" << std::endl;
return;
}
key_mapping = KeyMapping{key_mapping.m_button_to_key};
key_mapping = Input::KeyMapping{key_mapping.m_button_to_key};
}
}

View File

@ -6,8 +6,7 @@
#include <nlohmann/json.hpp>
#include <SFML/System.hpp>
#include "Buttons.hpp"
#include "KeyMapping.hpp"
#include "../Input/KeyMapping.hpp"
namespace Data {
// By convention all axis-independant lengths are expressed as a ratio of the screen WIDTH
@ -50,7 +49,7 @@ namespace Data {
Screen screen;
Layout layout;
Options options;
KeyMapping key_mapping;
Input::KeyMapping key_mapping;
ghc::filesystem::path jujube_path;
Preferences(const ghc::filesystem::path& t_jujube_path);

View File

@ -10,7 +10,7 @@ namespace Drawables {
m_highlight.setOutlineThickness(1.f);
}
void ButtonHighlight::button_pressed(Data::Button button) {
void ButtonHighlight::button_pressed(Input::Button button) {
m_button_presses_history[button].restart();
}
@ -24,7 +24,7 @@ namespace Drawables {
auto it = m_button_presses_history.begin();
while (it != m_button_presses_history.end()) {
auto elapsed = it->second.getElapsedTime();
auto coords = Data::button_to_coords(it->first);
auto coords = Input::button_to_coords(it->first);
if (elapsed > sf::milliseconds(250)) {
it = m_button_presses_history.erase(it);
} else {

View File

@ -5,7 +5,7 @@
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include "../Data/Buttons.hpp"
#include "../Input/Buttons.hpp"
#include "../Data/Preferences.hpp"
#include "../Toolkit/AffineTransform.hpp"
@ -13,11 +13,11 @@ namespace Drawables {
class ButtonHighlight : public sf::Drawable, public sf::Transformable, public Data::HoldsPreferences {
public:
ButtonHighlight(Data::Preferences& t_preferences);
void button_pressed(Data::Button button);
void button_pressed(Input::Button button);
private:
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const;
mutable sf::RectangleShape m_highlight;
mutable std::map<Data::Button, sf::Clock> m_button_presses_history;
mutable std::map<Input::Button, sf::Clock> m_button_presses_history;
Toolkit::AffineTransform<float> m_time_to_alpha;
};
}

View File

@ -1,6 +1,6 @@
#include "Buttons.hpp"
namespace Data {
namespace Input {
ButtonCoords button_to_coords(Button button) {
auto num = static_cast<std::size_t>(button);
return {num % 4, num / 4};

View File

@ -3,7 +3,7 @@
#include <cstddef>
#include <optional>
namespace Data {
namespace Input {
enum class Button : std::size_t {
B1,
B2,

View File

@ -1,6 +1,6 @@
#include "KeyMapping.hpp"
namespace Data {
namespace Input {
KeyMapping::KeyMapping() {
m_key_to_button[sf::Keyboard::Num1] = Button::B1;
m_key_to_button[sf::Keyboard::Num2] = Button::B2;

View File

@ -12,6 +12,10 @@
#include "MappableKeys.hpp"
namespace Data {
struct Preferences;
}
namespace Input {
class KeyMapping {
public:
KeyMapping();
@ -24,7 +28,7 @@ namespace Data {
std::unordered_map<MappableKey, Button> m_key_to_button;
std::unordered_map<Button, MappableKey> m_button_to_key;
friend struct Preferences;
friend struct Data::Preferences;
friend void to_json(nlohmann::json& j, const KeyMapping& km);
friend void from_json(const nlohmann::json& j, KeyMapping& km);
};

View File

@ -1,6 +1,6 @@
#include "MappableKeys.hpp"
namespace Data {
namespace Input {
MappableKeyToString mappable_button_to_string;
std::string to_string(const MappableKey& mk) {
@ -32,7 +32,7 @@ namespace Data {
if (joystick_button >= sf::Joystick::ButtonCount) {
throw std::runtime_error("Unsupported Joystick Button : "+matches[2].str());
}
Data::JoystickButton res;
JoystickButton res;
res.joystickId = static_cast<unsigned int>(joystick_id);
res.button = static_cast<unsigned int>(joystick_button);
return res;

View File

@ -12,7 +12,7 @@
#include <SFML/Window/Keyboard.hpp>
#include <SFML/Window/Event.hpp>
namespace Data {
namespace Input {
struct JoystickButton : sf::Event::JoystickButtonEvent {
friend bool operator==(const JoystickButton& rhs, const JoystickButton& lhs) {
return rhs.joystickId == lhs.joystickId and rhs.button == lhs.button;
@ -21,8 +21,8 @@ namespace Data {
}
namespace std {
template <> struct hash<Data::JoystickButton> {
size_t operator()(const Data::JoystickButton & jbe) const {
template <> struct hash<Input::JoystickButton> {
size_t operator()(const Input::JoystickButton & jbe) const {
std::hash<unsigned int> hasher;
size_t res = 17;
res = res * 37 + hasher(jbe.joystickId);
@ -32,7 +32,7 @@ namespace std {
};
}
namespace Data {
namespace Input {
using MappableKey = std::variant<sf::Keyboard::Key, JoystickButton>;
const std::unordered_map<sf::Keyboard::Key, std::string> keyboard_to_string{
@ -254,7 +254,7 @@ namespace Data {
std::string operator() (const sf::Keyboard::Key& k) {
return "Keyboard::"+keyboard_to_string.at(k);
};
std::string operator() (const Data::JoystickButton& jbe) {
std::string operator() (const JoystickButton& jbe) {
return "Joystick::"+std::to_string(jbe.joystickId)+"_"+std::to_string(jbe.button);
};
};

View File

@ -7,8 +7,8 @@
#include <imgui/misc/cpp/imgui_stdlib.h>
#include <imgui-sfml/imgui-SFML.h>
#include "../../Data/Buttons.hpp"
#include "../../Data/KeyMapping.hpp"
#include "../../Input/Buttons.hpp"
#include "../../Input/KeyMapping.hpp"
#include "../../Toolkit/NormalizedOrigin.hpp"
#include "Panels/Panel.hpp"
#include "PanelLayout.hpp"
@ -196,20 +196,20 @@ void MusicSelect::Screen::handle_mouse_click(const sf::Event::MouseButtonEvent&
if (clicked_panel_index < 0) {
return;
}
auto button = Data::index_to_button(static_cast<std::size_t>(clicked_panel_index));
auto button = Input::index_to_button(static_cast<std::size_t>(clicked_panel_index));
if (button) {
press_button(*button);
}
}
void MusicSelect::Screen::press_button(const Data::Button& button) {
void MusicSelect::Screen::press_button(const Input::Button& button) {
resources.button_highlight.button_pressed(button);
auto button_index = Data::button_to_index(button);
auto button_index = Input::button_to_index(button);
if (button_index < 14) {
ribbon.click_on(button);
} else {
switch (button) {
case Data::Button::B15: // Options Menu
case Input::Button::B15: // Options Menu
if (resources.options_state.empty()) {
resources.options_state.push_back(main_option_page);
resources.options_state.back().get().update();
@ -221,7 +221,7 @@ void MusicSelect::Screen::press_button(const Data::Button& button) {
}
}
break;
case Data::Button::B16: // Start Button
case Input::Button::B16: // Start Button
if (resources.selected_panel) {
chart_selected = true;
}

View File

@ -8,7 +8,7 @@
#include "../../Data/Song.hpp"
#include "../../Data/Chart.hpp"
#include "../../Data/KeyMapping.hpp"
#include "../../Input/KeyMapping.hpp"
#include "../../Drawables/BlackFrame.hpp"
#include "../../Resources/Marker.hpp"
#include "../../Toolkit/AffineTransform.hpp"
@ -50,6 +50,6 @@ namespace MusicSelect {
// converts a mouse click into a button press
void handle_mouse_click(const sf::Event::MouseButtonEvent& mouse_button_event);
// chooses what happens for each button
void press_button(const Data::Button& button);
void press_button(const Input::Button& button);
};
}

View File

@ -61,7 +61,7 @@ namespace MusicSelect {
MappingPreview::MappingPreview(
SharedResources& t_resources,
const std::unordered_map<Data::MappableKey, Data::Button>& t_key_to_button
const std::unordered_map<Input::MappableKey, Input::Button>& t_key_to_button
) :
HoldsSharedResources(t_resources),
key_to_button(t_key_to_button)
@ -88,8 +88,8 @@ namespace MusicSelect {
auto text_size = square_size*0.33f;
for (auto &&[key, button] : key_to_button) {
auto coord = Data::button_to_coords(button);
std::string key_name = Data::to_string(key);
auto coord = Input::button_to_coords(button);
std::string key_name = Input::to_string(key);
key_label.setString(key_name);
key_label.setCharacterSize(static_cast<unsigned int>(text_size));
Toolkit::set_local_origin_normalized(key_label, 0.5f, 0.5f);
@ -122,7 +122,7 @@ namespace MusicSelect {
bool InputRemap::handle_raw_input(const sf::Event::KeyEvent& event) {
if (next_button < 16) {
if (m_key_to_button.find(event.code) == m_key_to_button.end()) {
m_key_to_button[event.code] = *Data::index_to_button(next_button);
m_key_to_button[event.code] = *Input::index_to_button(next_button);
last_key_press.restart();
next_button++;
if (next_button == 16) {
@ -151,7 +151,7 @@ namespace MusicSelect {
if (not cancel_remapping) {
if (confirm_clock) {
if (confirm_clock->getElapsedTime() > sf::seconds(5)) {
preferences.key_mapping = Data::KeyMapping(m_key_to_button);
preferences.key_mapping = Input::KeyMapping(m_key_to_button);
}
}
}

View File

@ -6,7 +6,7 @@
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include "../../../Data/MappableKeys.hpp"
#include "../../../Input/MappableKeys.hpp"
#include "../../../Toolkit/AffineTransform.hpp"
#include "../SharedResources.hpp"
#include "OptionPage.hpp"
@ -37,10 +37,10 @@ namespace MusicSelect {
class MappingPreview final : public sf::Drawable, public sf::Transformable, public HoldsSharedResources {
public:
MappingPreview(SharedResources& t_resources, const std::unordered_map<Data::MappableKey, Data::Button>& t_key_to_button);
MappingPreview(SharedResources& t_resources, const std::unordered_map<Input::MappableKey, Input::Button>& t_key_to_button);
private:
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
const std::unordered_map<Data::MappableKey, Data::Button>& key_to_button;
const std::unordered_map<Input::MappableKey, Input::Button>& key_to_button;
mutable sf::RectangleShape square;
mutable sf::Text key_label;
};
@ -61,7 +61,7 @@ namespace MusicSelect {
mutable sf::Text confirm_text_top;
mutable sf::Text confirm_text_bottom;
mutable sf::Text big_number;
std::unordered_map<Data::MappableKey, Data::Button> m_key_to_button;
std::unordered_map<Input::MappableKey, Input::Button> m_key_to_button;
mutable PressHere press_here_panel;
mutable AlreadyMapped already_mapped_panel;
mutable MappingPreview mapping_preview;

View File

@ -27,7 +27,7 @@ namespace MusicSelect {
if (not button) {
return false;
}
auto button_index = Data::button_to_index(*button);
auto button_index = Input::button_to_index(*button);
if (button_index > 13) {
return false;
}
@ -35,17 +35,17 @@ namespace MusicSelect {
return true;
}
void RibbonPage::button_click(const Data::Button& button) {
void RibbonPage::button_click(const Input::Button& button) {
resources.button_highlight.button_pressed(button);
auto button_index = Data::button_to_index(button);
auto button_index = Input::button_to_index(button);
if (button_index < 12) {
m_ribbon.click_on(button);
} else {
switch (button) {
case Data::Button::B13:
case Input::Button::B13:
m_ribbon.move_left();
break;
case Data::Button::B14:
case Input::Button::B14:
m_ribbon.move_right();
break;
default:

View File

@ -3,7 +3,7 @@
#include <SFML/Graphics.hpp>
#include <SFML/Window/Event.hpp>
#include "../../../Data/Buttons.hpp"
#include "../../../Input/Buttons.hpp"
#include "../Drawables/ControlPanels.hpp"
#include "../Ribbon.hpp"
#include "../SharedResources.hpp"
@ -29,7 +29,7 @@ namespace MusicSelect {
public:
RibbonPage(const PanelLayout& layout, SharedResources& t_resources);
bool handle_raw_input(const sf::Event::KeyEvent& event) override;
void button_click(const Data::Button& button);
void button_click(const Input::Button& button);
private:
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
Ribbon m_ribbon;

View File

@ -12,7 +12,7 @@ namespace MusicSelect {
}
}
void MarkerPanel::click(Ribbon&, const Data::Button&) {
void MarkerPanel::click(Ribbon&, const Input::Button&) {
if (selected) {
resources.selected_marker->last_click.restart();
resources.selected_marker->is_first_click = false;

View File

@ -11,7 +11,7 @@ namespace MusicSelect {
class MarkerPanel final : public Panel {
public:
MarkerPanel(SharedResources& t_resources, const Resources::Marker& marker);
void click(Ribbon&, const Data::Button&) override;
void click(Ribbon&, const Input::Button&) override;
private:
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
void select();

View File

@ -25,7 +25,7 @@ namespace MusicSelect {
target.draw(panel, states);
}
void CategoryPanel::click(Ribbon& ribbon, const Data::Button& button) {
void CategoryPanel::click(Ribbon& ribbon, const Input::Button& button) {
ribbon.move_to_next_category(button);
}
@ -64,7 +64,7 @@ namespace MusicSelect {
target.draw(label_text, states);
}
void SongPanel::click(Ribbon&, const Data::Button&) {
void SongPanel::click(Ribbon&, const Input::Button&) {
if (selected_chart.has_value()) {
// The song was already selected : look for the next chart in order
auto it = m_song->chart_levels.upper_bound(*selected_chart);

View File

@ -6,7 +6,7 @@
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include "../../../Data/Buttons.hpp"
#include "../../../Input/Buttons.hpp"
#include "../../../Data/Song.hpp"
#include "../../../Toolkit/AffineTransform.hpp"
#include "../DensityGraph.hpp"
@ -22,7 +22,7 @@ namespace MusicSelect {
public:
explicit Panel(SharedResources& t_resources);
// What happens when you click on the panel
virtual void click(Ribbon& ribbon, const Data::Button& button) = 0;
virtual void click(Ribbon& ribbon, const Input::Button& button) = 0;
virtual ~Panel() = default;
protected:
float get_size() const;
@ -31,7 +31,7 @@ namespace MusicSelect {
class EmptyPanel final : public Panel {
public:
using Panel::Panel;
void click(Ribbon&, const Data::Button&) override {return;};
void click(Ribbon&, const Input::Button&) override {return;};
private:
void draw(sf::RenderTarget&, sf::RenderStates) const override {return;};
};
@ -39,7 +39,7 @@ namespace MusicSelect {
class ColoredMessagePanel final : public Panel {
public:
ColoredMessagePanel(SharedResources& t_resources, const sf::Color& color, const std::string& message) : Panel(t_resources), m_color(color), m_message(message) {};
void click(Ribbon&, const Data::Button&) override {return;};
void click(Ribbon&, const Input::Button&) override {return;};
private:
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
const sf::Color m_color;
@ -49,7 +49,7 @@ namespace MusicSelect {
class ColorPanel final : public Panel {
public:
ColorPanel(SharedResources& t_resources, const sf::Color& t_color) : Panel(t_resources), m_color(t_color) {};
void click(Ribbon&, const Data::Button&) override {return;};
void click(Ribbon&, const Input::Button&) override {return;};
private:
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
const sf::Color m_color;
@ -58,7 +58,7 @@ namespace MusicSelect {
class CategoryPanel final : public Panel {
public:
CategoryPanel(SharedResources& t_resources, const std::string& t_label) : Panel(t_resources), m_label(t_label) {};
void click(Ribbon& ribbon, const Data::Button& button) override;
void click(Ribbon& ribbon, const Input::Button& button) override;
private:
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
std::string m_label;
@ -75,7 +75,7 @@ namespace MusicSelect {
class SongPanel final : public SelectablePanel {
public:
explicit SongPanel(SharedResources& t_resources, const std::shared_ptr<const Data::Song>& t_song) : SelectablePanel(t_resources), m_song(t_song) {};
void click(Ribbon& ribbon, const Data::Button& button) override;
void click(Ribbon& ribbon, const Input::Button& button) override;
void unselect() override;
std::optional<Data::SongDifficulty> get_selected_difficulty() const override;
private:

View File

@ -3,7 +3,7 @@
#include "../Options/OptionPage.hpp"
namespace MusicSelect {
void SubpagePanel::click(Ribbon&, const Data::Button&) {
void SubpagePanel::click(Ribbon&, const Input::Button&) {
resources.options_state.push_back(*m_subpage);
resources.options_state.back().get().update();
}

View File

@ -21,7 +21,7 @@ namespace MusicSelect {
m_subpage(subpage),
m_name(name)
{};
void click(Ribbon& ribbon, const Data::Button& button) override;
void click(Ribbon& ribbon, const Input::Button& button) override;
private:
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
std::shared_ptr<OptionPage> m_subpage;

View File

@ -75,12 +75,12 @@ namespace MusicSelect {
}
std::size_t Ribbon::get_layout_column(const Data::Button& button) const {
return (m_position + (Data::button_to_index(button) % 4)) % m_layout.size();
std::size_t Ribbon::get_layout_column(const Input::Button& button) const {
return (m_position + (Input::button_to_index(button) % 4)) % m_layout.size();
}
std::shared_ptr<Panel>& Ribbon::get_panel_under_button(const Data::Button& button) {
auto button_index = Data::button_to_index(button);
std::shared_ptr<Panel>& Ribbon::get_panel_under_button(const Input::Button& button) {
auto button_index = Input::button_to_index(button);
return (
m_layout
.at(this->get_layout_column(button))
@ -88,12 +88,12 @@ namespace MusicSelect {
);
}
void Ribbon::click_on(const Data::Button& button) {
void Ribbon::click_on(const Input::Button& button) {
switch (button) {
case Data::Button::B13: // Left Arrow
case Input::Button::B13: // Left Arrow
move_left();
break;
case Data::Button::B14: // Right Arrow
case Input::Button::B14: // Right Arrow
move_right();
break;
default:
@ -118,7 +118,7 @@ namespace MusicSelect {
m_move_animation.emplace(old_position, m_position, m_layout.size(), Direction::Left, m_time_factor);
}
void Ribbon::move_to_next_category(const Data::Button& button) {
void Ribbon::move_to_next_category(const Input::Button& button) {
std::size_t from_column = this->get_layout_column(button);
bool found = false;
size_t offset = 1;
@ -141,7 +141,7 @@ namespace MusicSelect {
if (found) {
// we want the next category panel to land on the same column we clicked
auto old_position = m_position;
auto button_index = Data::button_to_index(button);
auto button_index = Input::button_to_index(button);
auto next_category_column = from_column + offset;
auto onscreen_clicked_column = (button_index % 4);
m_position = next_category_column - onscreen_clicked_column;

View File

@ -5,7 +5,7 @@
#include <SFML/Graphics/Drawable.hpp>
#include <SFML/Graphics/Transformable.hpp>
#include "../../Data/Buttons.hpp"
#include "../../Input/Buttons.hpp"
#include "../../Data/Preferences.hpp"
#include "../../Data/Song.hpp"
#include "../../Toolkit/AffineTransform.hpp"
@ -42,11 +42,11 @@ namespace MusicSelect {
class Ribbon : public sf::Drawable, public sf::Transformable, public HoldsSharedResources, public Toolkit::Debuggable {
public:
Ribbon(PanelLayout layout, SharedResources& t_resources);
std::shared_ptr<Panel>& get_panel_under_button(const Data::Button& button);
void click_on(const Data::Button& button);
std::shared_ptr<Panel>& get_panel_under_button(const Input::Button& button);
void click_on(const Input::Button& button);
void move_right();
void move_left();
void move_to_next_category(const Data::Button& button);
void move_to_next_category(const Input::Button& button);
void draw_debug() override;
virtual ~Ribbon() = default;
protected:
@ -54,7 +54,7 @@ namespace MusicSelect {
private:
void draw_with_animation(sf::RenderTarget& target, sf::RenderStates states) const;
void draw_without_animation(sf::RenderTarget& target, sf::RenderStates states) const;
std::size_t get_layout_column(const Data::Button& button) const;
std::size_t get_layout_column(const Input::Button& button) const;
mutable PanelLayout m_layout;
std::size_t m_position = 0;
mutable std::optional<MoveAnimation> m_move_animation;