From 9bbcff7cf549718151fb91c5a22370cfb2551715 Mon Sep 17 00:00:00 2001 From: Stepland <16676308+Stepland@users.noreply.github.com> Date: Tue, 18 Feb 2020 01:44:21 +0100 Subject: [PATCH] Density Graph WIP again --- meson.build | 41 +++--- src/Data/Chart.cpp | 16 ++- src/Data/Chart.hpp | 4 +- src/Data/Note.hpp | 6 +- src/Data/Song.cpp | 133 +++++++++++++++++ src/Data/{SongList.hpp => Song.hpp} | 35 +++-- src/Data/SongList.cpp | 152 -------------------- src/Main.cpp | 2 +- src/Screens/MusicSelect/DensityGraph.cpp | 49 +++++++ src/Screens/MusicSelect/DensityGraph.hpp | 41 ++++++ src/Screens/MusicSelect/MusicSelect.hpp | 2 +- src/Screens/MusicSelect/Panel.cpp | 26 ++-- src/Screens/MusicSelect/Panel.hpp | 8 +- src/Screens/MusicSelect/Ribbon.cpp | 31 ++-- src/Screens/MusicSelect/Ribbon.hpp | 3 +- src/Screens/MusicSelect/SharedResources.cpp | 8 +- src/Screens/MusicSelect/SharedResources.hpp | 10 +- src/Screens/MusicSelect/SongInfo.cpp | 33 ++--- 18 files changed, 343 insertions(+), 257 deletions(-) create mode 100644 src/Data/Song.cpp rename src/Data/{SongList.hpp => Song.hpp} (62%) delete mode 100644 src/Data/SongList.cpp create mode 100644 src/Screens/MusicSelect/DensityGraph.cpp create mode 100644 src/Screens/MusicSelect/DensityGraph.hpp diff --git a/meson.build b/meson.build index ce80515..7f9fd3a 100644 --- a/meson.build +++ b/meson.build @@ -24,40 +24,40 @@ sources = [ 'include/imgui/imgui_draw.cpp', 'include/imgui/imgui_widgets.cpp', 'include/imgui-sfml/imgui-SFML.cpp', - 'src/Main.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/Note.hpp', 'src/Data/Preferences.hpp', 'src/Data/Score.hpp', - 'src/Data/SongList.hpp', - 'src/Data/SongList.cpp', - # 'src/Screens/Gameplay.hpp', - 'src/Screens/MusicSelect/ButtonHighlight.hpp', - 'src/Screens/MusicSelect/ButtonHighlight.cpp', - # 'src/Screens/MusicSelect/DensityGraph.hpp', - # 'src/Screens/MusicSelect/DensityGraph.cpp', - 'src/Screens/MusicSelect/MusicSelect.hpp', - 'src/Screens/MusicSelect/MusicSelect.cpp', - 'src/Screens/MusicSelect/Panel.hpp', - 'src/Screens/MusicSelect/Panel.cpp', - 'src/Screens/MusicSelect/SharedResources.hpp', - 'src/Screens/MusicSelect/SharedResources.cpp', - 'src/Screens/MusicSelect/SongInfo.hpp', - 'src/Screens/MusicSelect/SongInfo.cpp', - 'src/Screens/MusicSelect/Ribbon.hpp', - 'src/Screens/MusicSelect/Ribbon.cpp', - # 'src/Screens/Result.hpp', + 'src/Data/Song.hpp', + 'src/Data/Song.cpp', 'src/Resources/TextureCache.cpp', 'src/Resources/TextureCache.hpp', # 'src/Resources/CoverAtlas.hpp', # 'src/Resources/CoverAtlas.cpp', + # 'src/Screens/Gameplay.hpp', + 'src/Screens/MusicSelect/ButtonHighlight.hpp', + 'src/Screens/MusicSelect/ButtonHighlight.cpp', + 'src/Screens/MusicSelect/DensityGraph.hpp', + 'src/Screens/MusicSelect/DensityGraph.cpp', + 'src/Screens/MusicSelect/MusicSelect.hpp', + 'src/Screens/MusicSelect/MusicSelect.cpp', + 'src/Screens/MusicSelect/Panel.hpp', + 'src/Screens/MusicSelect/Panel.cpp', + 'src/Screens/MusicSelect/Ribbon.hpp', + 'src/Screens/MusicSelect/Ribbon.cpp', + 'src/Screens/MusicSelect/SharedResources.hpp', + 'src/Screens/MusicSelect/SharedResources.cpp', + 'src/Screens/MusicSelect/SongInfo.hpp', + 'src/Screens/MusicSelect/SongInfo.cpp', + # 'src/Screens/Result.hpp', 'src/Toolkit/AffineTransform.hpp', - 'src/Toolkit/Debuggable.hpp', 'src/Toolkit/Cache.hpp', + 'src/Toolkit/Debuggable.hpp', 'src/Toolkit/EasingFunctions.hpp', 'src/Toolkit/EasingFunctions.cpp', 'src/Toolkit/HSL.hpp', @@ -65,6 +65,7 @@ sources = [ 'src/Toolkit/NormalizedOrigin.hpp', 'src/Toolkit/QuickRNG.hpp', 'src/Toolkit/QuickRNG.cpp', + 'src/Main.cpp', ] executable( diff --git a/src/Data/Chart.cpp b/src/Data/Chart.cpp index d271926..498bc1d 100644 --- a/src/Data/Chart.cpp +++ b/src/Data/Chart.cpp @@ -5,24 +5,28 @@ #include "Buttons.hpp" namespace Data { - Chart::Chart(const stepland::memon& memon, const std::string& chart_name) { - auto it = memon.charts.find(chart_name); + Chart::Chart(const stepland::memon& memon, const std::string& difficulty) { + auto it = memon.charts.find(difficulty); if (it == memon.charts.end()) { - throw std::invalid_argument("Memon file has no "+chart_name+" chart"); + throw std::invalid_argument("Memon file has no "+difficulty+" chart"); } auto [_, chart] = *it; - level = static_cast(chart.level); + level = chart.level; resolution = static_cast(chart.resolution); Toolkit::AffineTransform memon_timing_to_300Hz( 0.f, static_cast(chart.resolution), -memon.offset*300.f, (-memon.offset+60.f/memon.BPM)*300.f ); + Toolkit::AffineTransform memon_timing_to_300Hz_proportional( + 0.f, static_cast(chart.resolution), + 0.f, (60.f/memon.BPM)*300.f + ); for (auto &¬e : chart.notes) { auto timing = static_cast(memon_timing_to_300Hz.transform(note.get_timing())); auto position = static_cast