Move Show Free Buttons to the Playfield settings

This commit is contained in:
Stepland 2023-07-20 14:40:39 +02:00
parent 535c120cea
commit fa16d34e5c
5 changed files with 11 additions and 12 deletions

View File

@ -10,7 +10,7 @@
## 🍒 Small improvements 🍒
- Claps and Beats ticks should now be perfectly synced !
- Playfield
- Pressing `F` displays free buttons (highlights buttons where a new note would create a collision in red)
- Pressing `F` displays free buttons (add a red highlight on buttons where you can't add a new note without a collision)
- Chords can now be displayed with a customizable color (Go to `Settings > Playfield`)
- Note Numbers can now be displayed
- Linear View

View File

@ -84,15 +84,11 @@ void config::Editor::load_from_v1_0_0_table(const toml::table& tbl) {
const auto ms = editor_table["collision_zone"].value<int>();
collision_zone = sf::milliseconds(std::clamp(*ms, 100, 2000));
}
if (editor_table["show_free_buttons"].is_boolean()) {
show_free_buttons = *editor_table["show_free_buttons"].value<bool>();
}
}
void config::Editor::dump_as_v1_0_0(toml::table& tbl) {
tbl.insert_or_assign("editor", toml::table{
{"collision_zone", collision_zone.asMilliseconds()},
{"show_free_buttons", show_free_buttons}
});
}
@ -214,6 +210,9 @@ void config::Windows::dump_as_v1_0_0(toml::table& tbl) {
void config::Playfield::load_from_v1_0_0_table(const toml::table& tbl) {
const auto playfield_table = tbl["playfield"];
if (auto val = playfield_table["show_free_buttons"].value<bool>()) {
show_free_buttons = *val;
}
if (auto val = playfield_table["color_chords"].value<bool>()) {
color_chords = *val;
}
@ -247,6 +246,7 @@ void config::Playfield::load_from_v1_0_0_table(const toml::table& tbl) {
void config::Playfield::dump_as_v1_0_0(toml::table& tbl) {
tbl.insert_or_assign("playfield", toml::table{
{"show_free_buttons", show_free_buttons},
{"color_chords", color_chords},
{"chord_color", dump_color(chord_color)},
{"chord_color_mix_amount", chord_color_mix_amount},

View File

@ -39,7 +39,6 @@ namespace config {
struct Editor {
sf::Time collision_zone = sf::seconds(1);
bool show_free_buttons = false;
void load_from_v1_0_0_table(const toml::table& tbl);
void dump_as_v1_0_0(toml::table& tbl);
@ -80,6 +79,7 @@ namespace config {
};
struct Playfield {
bool show_free_buttons = false;
bool color_chords = false;
sf::Color chord_color = sf::Color{110, 200, 250, 255};
float chord_color_mix_amount = 1.0f;

View File

@ -639,7 +639,7 @@ void EditorState::display_playfield(const Markers::marker_type& opt_marker, Judg
collisions[note.get_position().index()] = true;
}
}
if (config.editor.show_free_buttons) {
if (config.playfield.show_free_buttons) {
for (unsigned int i = 0; i < 16; i++) {
unsigned int x = i % 4;
unsigned int y = i / 4;
@ -678,6 +678,8 @@ void EditorState::display_playfield(const Markers::marker_type& opt_marker, Judg
void EditorState::display_playfield_settings() {
if (ImGui::Begin("Playfield Settings", &show_playfield_settings, ImGuiWindowFlags_AlwaysAutoResize)) {
ImGui::Checkbox("Show Free Buttons", &config.playfield.show_free_buttons);
ImGui::Separator();
ImGui::Checkbox("Colored Chords", &config.playfield.color_chords);
feis::DisabledIf(not config.playfield.color_chords, [&](){
feis::ColorEdit4("Color##Color Chords", config.playfield.chord_color);
@ -1272,7 +1274,6 @@ void EditorState::display_editor_settings() {
}
ImGui::EndCombo();
}
ImGui::Checkbox("Show Free Buttons", &config.editor.show_free_buttons);
}
ImGui::End();
}

View File

@ -347,8 +347,7 @@ int main() {
break;
case sf::Keyboard::F:
if (editor_state) {
config.editor.show_free_buttons =
not config.editor.show_free_buttons;
config.playfield.show_free_buttons = not config.playfield.show_free_buttons;
}
case sf::Keyboard::O:
if (event.key.control) {
@ -407,8 +406,7 @@ int main() {
switch (event.key.code) {
case sf::Keyboard::F:
if (editor_state) {
config.editor.show_free_buttons =
not config.editor.show_free_buttons;
config.playfield.show_free_buttons = not config.playfield.show_free_buttons;
}
default:
break;