mirror of
https://gitlab.com/square-game-liberation-front/F.E.I.S.git
synced 2025-02-28 23:41:33 +01:00
Fix display of collision zones in the linear view
This commit is contained in:
parent
3fe5985900
commit
a9b20518ce
@ -1042,7 +1042,13 @@ void EditorState::display_sound_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditorState::display_editor_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;
|
static const std::uint64_t step = 1;
|
||||||
if (ImGui::InputScalar("Snap##Editor Settings", ImGuiDataType_U64, &snap, &step, nullptr, "%d")) {
|
if (ImGui::InputScalar("Snap##Editor Settings", ImGuiDataType_U64, &snap, &step, nullptr, "%d")) {
|
||||||
snap = std::clamp(snap, 1UL, 1000UL);
|
snap = std::clamp(snap, 1UL, 1000UL);
|
||||||
@ -1064,17 +1070,17 @@ void EditorState::display_editor_settings() {
|
|||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
feis::HelpMarker(
|
feis::HelpMarker(
|
||||||
"Change the underlying snap value, this allows setting snap "
|
"Suggested minimal duration between two notes on the same "
|
||||||
"values that aren't a divisor of 240. "
|
"button.\n"
|
||||||
"This changes the underlying value that's multiplied "
|
"If two notes are closer than this they \"collide\" and are "
|
||||||
"by 4 before being shown in the status bar"
|
"highlighted in red everywhere"
|
||||||
);
|
);
|
||||||
const std::array<std::pair<const char*, sf::Time>, 3> presets{{
|
const std::array<std::pair<const char*, sf::Time>, 3> presets{{
|
||||||
{"F.E.I.S default", sf::seconds(1)},
|
{"F.E.I.S default", sf::seconds(1)},
|
||||||
{"Safe", sf::milliseconds(1066)},
|
{"Safe", sf::milliseconds(1066)},
|
||||||
{"jubeat plus", sf::milliseconds(1030)}
|
{"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) {
|
for (const auto& [name, value] : presets) {
|
||||||
if (ImGui::Selectable(name, false)) {
|
if (ImGui::Selectable(name, false)) {
|
||||||
config.editor.collision_zone = value;
|
config.editor.collision_zone = value;
|
||||||
|
@ -157,9 +157,9 @@ void LinearView::draw(
|
|||||||
const float note_x = timeline_left + note_width * (lane + 0.5f);
|
const float note_x = timeline_left + note_width * (lane + 0.5f);
|
||||||
const float note_y = static_cast<double>(beats_to_pixels_absolute.transform(tap_note.get_time()));
|
const float note_y = static_cast<double>(beats_to_pixels_absolute.transform(tap_note.get_time()));
|
||||||
const auto note_seconds = timing.time_at(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 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 auto collision_zone_height = beats_to_pixels_proportional.transform(last_colliding_beat - first_colliding_beat);
|
||||||
const sf::Vector2f collision_zone_pos = {
|
const sf::Vector2f collision_zone_pos = {
|
||||||
note_x,
|
note_x,
|
||||||
@ -210,10 +210,10 @@ void LinearView::draw(
|
|||||||
float note_x = timeline_left + note_width * (lane + 0.5f);
|
float note_x = timeline_left + note_width * (lane + 0.5f);
|
||||||
float note_y = static_cast<double>(beats_to_pixels_absolute.transform(long_note.get_time()));
|
float note_y = static_cast<double>(beats_to_pixels_absolute.transform(long_note.get_time()));
|
||||||
const auto note_start_seconds = timing.time_at(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 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 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 auto collision_zone_height = beats_to_pixels_proportional.transform(last_colliding_beat - first_colliding_beat);
|
||||||
const sf::Vector2f collision_zone_pos = {
|
const sf::Vector2f collision_zone_pos = {
|
||||||
note_x,
|
note_x,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user