From a9b20518ce5d261a290b909a293212b12c8df5ed Mon Sep 17 00:00:00 2001 From: Stepland <10530295-Buggyroom@users.noreply.gitlab.com> Date: Sun, 20 Nov 2022 00:23:04 +0100 Subject: [PATCH] Fix display of collision zones in the linear view --- src/editor_state.cpp | 18 ++++++++++++------ src/widgets/linear_view.cpp | 8 ++++---- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/editor_state.cpp b/src/editor_state.cpp index dac603a..0fd9473 100644 --- a/src/editor_state.cpp +++ b/src/editor_state.cpp @@ -1042,7 +1042,13 @@ void EditorState::display_sound_settings() { } void EditorState::display_editor_settings() { - if (ImGui::Begin("Editor Settings", &show_editor_settings)) { + if ( + ImGui::Begin( + "Editor Settings", + &show_editor_settings, + ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize + ) + ) { static const std::uint64_t step = 1; if (ImGui::InputScalar("Snap##Editor Settings", ImGuiDataType_U64, &snap, &step, nullptr, "%d")) { snap = std::clamp(snap, 1UL, 1000UL); @@ -1064,17 +1070,17 @@ void EditorState::display_editor_settings() { } ImGui::SameLine(); feis::HelpMarker( - "Change the underlying snap value, this allows setting snap " - "values that aren't a divisor of 240. " - "This changes the underlying value that's multiplied " - "by 4 before being shown in the status bar" + "Suggested minimal duration between two notes on the same " + "button.\n" + "If two notes are closer than this they \"collide\" and are " + "highlighted in red everywhere" ); const std::array, 3> presets{{ {"F.E.I.S default", sf::seconds(1)}, {"Safe", sf::milliseconds(1066)}, {"jubeat plus", sf::milliseconds(1030)} }}; - if (ImGui::BeginCombo("Collision Zone Presets", presets[0].first)) { + if (ImGui::BeginCombo("Collision Zone Presets", "Choose ...")) { for (const auto& [name, value] : presets) { if (ImGui::Selectable(name, false)) { config.editor.collision_zone = value; diff --git a/src/widgets/linear_view.cpp b/src/widgets/linear_view.cpp index 8773d1d..f7e8165 100644 --- a/src/widgets/linear_view.cpp +++ b/src/widgets/linear_view.cpp @@ -157,9 +157,9 @@ void LinearView::draw( const float note_x = timeline_left + note_width * (lane + 0.5f); const float note_y = static_cast(beats_to_pixels_absolute.transform(tap_note.get_time())); const auto note_seconds = timing.time_at(tap_note.get_time()); - const auto first_colliding_beat = timing.beats_at(note_seconds - sf::milliseconds(500)); + const auto first_colliding_beat = timing.beats_at(note_seconds - collision_zone * 0.5f); const auto collision_zone_y = beats_to_pixels_absolute.transform(first_colliding_beat); - const auto last_colliding_beat = timing.beats_at(note_seconds + sf::milliseconds(500)); + const auto last_colliding_beat = timing.beats_at(note_seconds + collision_zone * 0.5f); const auto collision_zone_height = beats_to_pixels_proportional.transform(last_colliding_beat - first_colliding_beat); const sf::Vector2f collision_zone_pos = { note_x, @@ -210,10 +210,10 @@ void LinearView::draw( float note_x = timeline_left + note_width * (lane + 0.5f); float note_y = static_cast(beats_to_pixels_absolute.transform(long_note.get_time())); const auto note_start_seconds = timing.time_at(long_note.get_time()); - const auto first_colliding_beat = timing.beats_at(note_start_seconds - sf::milliseconds(500)); + const auto first_colliding_beat = timing.beats_at(note_start_seconds - collision_zone * 0.5f); const auto collision_zone_y = beats_to_pixels_absolute.transform(first_colliding_beat); const auto note_end_seconds = timing.time_at(long_note.get_end()); - const auto last_colliding_beat = timing.beats_at(note_end_seconds + sf::milliseconds(500)); + const auto last_colliding_beat = timing.beats_at(note_end_seconds + collision_zone * 0.5f); const auto collision_zone_height = beats_to_pixels_proportional.transform(last_colliding_beat - first_colliding_beat); const sf::Vector2f collision_zone_pos = { note_x,