From fbb320e772ed04db6a7e9b77b091987cab61cae2 Mon Sep 17 00:00:00 2001 From: scawful Date: Fri, 30 Dec 2022 19:08:40 -0600 Subject: [PATCH] update music_editor layout w new api --- src/app/editor/music_editor.cc | 25 ++++++++++++++++++++----- src/app/editor/music_editor.h | 1 + 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/app/editor/music_editor.cc b/src/app/editor/music_editor.cc index 9785b3b6..0b5c423c 100644 --- a/src/app/editor/music_editor.cc +++ b/src/app/editor/music_editor.cc @@ -1,6 +1,7 @@ #include "music_editor.h" #include "gui/icons.h" +#include "gui/input.h" #include "imgui.h" namespace yaze { @@ -147,15 +148,16 @@ void MusicEditor::DrawSongToolset() { void MusicEditor::DrawToolset() { static bool is_playing = false; static int selected_option = 0; + static int current_volume = 0; + const int MAX_VOLUME = 100; + gui::ItemLabel("Select a song to edit: ", gui::ItemLabelFlags::Left); + ImGui::Combo("#controls", &selected_option, kGameSongs, 30); if (ImGui::BeginTable("SongToolset", 5, toolset_table_flags_, ImVec2(0, 0))) { - ImGui::TableSetupColumn("#SelectSong"); ImGui::TableSetupColumn("#play"); ImGui::TableSetupColumn("#rewind"); ImGui::TableSetupColumn("#fastforward"); ImGui::TableSetupColumn("#volume"); - - ImGui::TableNextColumn(); - ImGui::Combo("Controls: ", &selected_option, kGameSongs, 30); + ImGui::TableSetupColumn("#slider"); ImGui::TableNextColumn(); if (ImGui::Button(is_playing ? ICON_MD_STOP : ICON_MD_PLAY_ARROW)) { @@ -165,9 +167,23 @@ void MusicEditor::DrawToolset() { BUTTON_COLUMN(ICON_MD_FAST_REWIND) BUTTON_COLUMN(ICON_MD_FAST_FORWARD) BUTTON_COLUMN(ICON_MD_VOLUME_UP) + ImGui::TableNextColumn(); + ImGui::SliderInt("Volume", ¤t_volume, 0, 100); ImGui::EndTable(); } + const int SONG_DURATION = 120; // duration of the song in seconds + static int current_time = 0; // current time in the song in seconds + + // Display the current time in the song + ImGui::Text("Current Time: %d:%02d", current_time / 60, current_time % 60); + + // Display the song duration/progress using a progress bar + ImGui::ProgressBar((float)current_time / SONG_DURATION); + + // Allow the user to seek to a specific time in the song using a slider + ImGui::SliderInt("Seek Time", ¤t_time, 0, SONG_DURATION); + if (ImGui::BeginTable("ChannelToolset", 9, toolset_table_flags_, ImVec2(0, 0))) { ImGui::TableSetupColumn("#Channels"); @@ -175,7 +191,6 @@ void MusicEditor::DrawToolset() { ImGui::TableSetupColumn(absl::StrFormat("#%d", i).data()); } - ImGui::Text("Channels: "); for (int i = 0; i < 8; i++) { ImGui::TableNextColumn(); ImGui::Button(absl::StrFormat("%d", i).data()); diff --git a/src/app/editor/music_editor.h b/src/app/editor/music_editor.h index 2a2a8475..c4fc2d59 100644 --- a/src/app/editor/music_editor.h +++ b/src/app/editor/music_editor.h @@ -7,6 +7,7 @@ #include "app/editor/assembly_editor.h" #include "gui/canvas.h" #include "gui/icons.h" +#include "gui/input.h" namespace yaze { namespace app {