mirror of
https://gitlab.com/square-game-liberation-front/F.E.I.S.git
synced 2025-02-20 12:31:01 +01:00
Nice quantization menu
This commit is contained in:
parent
a80db7dd6d
commit
124a695ca3
@ -26,7 +26,10 @@
|
||||
- Add and remove charts
|
||||
- Change the timing (either BPMs or offset)
|
||||
- New Keyboard Shortcuts help dialog
|
||||
- New "Notes" menu with options to mirror or rotate the selected notes
|
||||
- New `Notes` menu with options to transform the selected notes :
|
||||
- mirror
|
||||
- rotate
|
||||
- quantize
|
||||
- WAY better support for paths with non-ascii characters on Windows (C++ is comically bad at this)
|
||||
- Support for negative time playback (lead in before the song starts)
|
||||
|
||||
|
@ -109,3 +109,15 @@ void feis::CenteredText(const std::string& text) {
|
||||
ImGui::SetCursorPosX((window_width - text_width) / 2);
|
||||
ImGui::TextUnformatted(c_str);
|
||||
}
|
||||
|
||||
bool feis::SquareButton(const char* text) {
|
||||
const auto button_size = ImGui::GetFrameHeight();
|
||||
return ImGui::ButtonEx(text, ImVec2(button_size, button_size));
|
||||
}
|
||||
|
||||
void feis::ColorSquare(const sf::Color& color) {
|
||||
ImVec2 p = ImGui::GetCursorScreenPos();
|
||||
const float sz = ImGui::GetTextLineHeight();
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(p, ImVec2(p.x + sz, p.y + sz), ImColor(color));
|
||||
ImGui::Dummy(ImVec2(sz, sz));
|
||||
}
|
||||
|
@ -65,6 +65,9 @@ namespace feis {
|
||||
}
|
||||
|
||||
void CenteredText(const std::string& text);
|
||||
|
||||
bool SquareButton(const char* text);
|
||||
void ColorSquare(const sf::Color& color);
|
||||
}
|
||||
|
||||
namespace colors {
|
||||
|
24
src/main.cpp
24
src/main.cpp
@ -16,6 +16,7 @@
|
||||
#include <tinyfiledialogs.h>
|
||||
#include <whereami++.hpp>
|
||||
|
||||
#include "imgui_extras.hpp"
|
||||
#include "src/custom_sfml_audio/synced_sound_streams.hpp"
|
||||
#include "widgets/blank_screen.hpp"
|
||||
#include "chart_state.hpp"
|
||||
@ -680,13 +681,28 @@ int main() {
|
||||
editor_state->chart_state->quantize_selection(editor_state->snap, notificationsQueue);
|
||||
}
|
||||
}
|
||||
for (const auto& [snap, color]: config.linear_view.quantization_colors.palette) {
|
||||
feis::ColorSquare(color);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::MenuItem(fmt::format("To {}##Notes Quantize", Toolbox::toOrdinal(4 * snap)).c_str())) {
|
||||
if (editor_state->chart_state.has_value()) {
|
||||
editor_state->chart_state->quantize_selection(snap, notificationsQueue);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ImGui::BeginMenu("Other")) {
|
||||
static int custom_snap = 1;
|
||||
if (ImGui::InputInt("Snap", &custom_snap)) {
|
||||
custom_snap = std::max(custom_snap, 1);
|
||||
ImGui::AlignTextToFramePadding();
|
||||
ImGui::TextUnformatted("1 /");
|
||||
ImGui::SameLine();
|
||||
static int other_snap = 1;
|
||||
ImGui::SetNextItemWidth(150.f);
|
||||
if (ImGui::InputInt("Beats", &other_snap)) {
|
||||
other_snap = std::max(other_snap, 1);
|
||||
}
|
||||
if (ImGui::Button("Quantize")) {
|
||||
editor_state->chart_state->quantize_selection(custom_snap, notificationsQueue);
|
||||
if (editor_state->chart_state.has_value()) {
|
||||
editor_state->chart_state->quantize_selection(other_snap, notificationsQueue);
|
||||
}
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user