update music editor and style colors
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -22,3 +22,6 @@
|
|||||||
[submodule "src/lib/asar"]
|
[submodule "src/lib/asar"]
|
||||||
path = src/lib/asar
|
path = src/lib/asar
|
||||||
url = https://github.com/RPGHacker/asar.git
|
url = https://github.com/RPGHacker/asar.git
|
||||||
|
[submodule "src/lib/snes-spc-arm"]
|
||||||
|
path = src/lib/snes-spc-arm
|
||||||
|
url = https://github.com/nathancassano/snes-spc-arm.git
|
||||||
|
|||||||
@@ -9,64 +9,76 @@ namespace app {
|
|||||||
namespace editor {
|
namespace editor {
|
||||||
|
|
||||||
void MusicEditor::Update() {
|
void MusicEditor::Update() {
|
||||||
ImGui::Separator();
|
|
||||||
if (ImGui::BeginTable("MusicEditorColumns", 2, music_editor_flags_,
|
if (ImGui::BeginTable("MusicEditorColumns", 2, music_editor_flags_,
|
||||||
ImVec2(0, 0))) {
|
ImVec2(0, 0))) {
|
||||||
ImGui::TableSetupColumn("Assembly");
|
ImGui::TableSetupColumn("Assembly");
|
||||||
ImGui::TableSetupColumn("Composition");
|
ImGui::TableSetupColumn("Composition");
|
||||||
ImGui::TableHeadersRow();
|
ImGui::TableHeadersRow();
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
|
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
assembly_editor_.InlineUpdate();
|
assembly_editor_.InlineUpdate();
|
||||||
|
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
DrawToolset();
|
DrawToolset();
|
||||||
if (ImGuiID child_id = ImGui::GetID((void*)(intptr_t)9);
|
DrawChannels();
|
||||||
ImGui::BeginChild(child_id, ImVec2(0, 250), false)) {
|
|
||||||
DrawPianoStaff();
|
|
||||||
}
|
|
||||||
ImGui::EndChild();
|
|
||||||
DrawPianoRoll();
|
DrawPianoRoll();
|
||||||
|
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MusicEditor::DrawChannels() {
|
||||||
|
if (ImGui::BeginTabBar("MyTabBar", ImGuiTabBarFlags_None)) {
|
||||||
|
for (int i = 1; i <= 8; ++i) {
|
||||||
|
if (ImGui::BeginTabItem(absl::StrFormat("%d", i).data())) {
|
||||||
|
DrawPianoStaff();
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndTabBar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static const int NUM_KEYS = 25;
|
static const int NUM_KEYS = 25;
|
||||||
static bool keys[NUM_KEYS];
|
static bool keys[NUM_KEYS];
|
||||||
|
|
||||||
void MusicEditor::DrawPianoStaff() {
|
void MusicEditor::DrawPianoStaff() {
|
||||||
const int NUM_LINES = 5;
|
if (ImGuiID child_id = ImGui::GetID((void*)(intptr_t)9);
|
||||||
const int LINE_THICKNESS = 2;
|
ImGui::BeginChild(child_id, ImVec2(0, 170), false)) {
|
||||||
const int LINE_SPACING = 50;
|
const int NUM_LINES = 5;
|
||||||
|
const int LINE_THICKNESS = 2;
|
||||||
|
const int LINE_SPACING = 40;
|
||||||
|
|
||||||
// Get the draw list for the current window
|
// Get the draw list for the current window
|
||||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||||
|
|
||||||
// Draw the staff lines
|
// Draw the staff lines
|
||||||
ImVec2 canvas_p0 =
|
ImVec2 canvas_p0 =
|
||||||
ImVec2(ImGui::GetCursorScreenPos().x, ImGui::GetCursorScreenPos().y);
|
ImVec2(ImGui::GetCursorScreenPos().x, ImGui::GetCursorScreenPos().y);
|
||||||
ImVec2 canvas_p1 = ImVec2(canvas_p0.x + ImGui::GetContentRegionAvail().x,
|
ImVec2 canvas_p1 = ImVec2(canvas_p0.x + ImGui::GetContentRegionAvail().x,
|
||||||
canvas_p0.y + ImGui::GetContentRegionAvail().y);
|
canvas_p0.y + ImGui::GetContentRegionAvail().y);
|
||||||
draw_list->AddRectFilled(canvas_p0, canvas_p1, IM_COL32(32, 32, 32, 255));
|
draw_list->AddRectFilled(canvas_p0, canvas_p1, IM_COL32(32, 32, 32, 255));
|
||||||
for (int i = 0; i < NUM_LINES; i++) {
|
for (int i = 0; i < NUM_LINES; i++) {
|
||||||
auto line_start = ImVec2(canvas_p0.x, canvas_p0.y + i * LINE_SPACING);
|
auto line_start = ImVec2(canvas_p0.x, canvas_p0.y + i * LINE_SPACING);
|
||||||
auto line_end = ImVec2(canvas_p1.x + ImGui::GetContentRegionAvail().x,
|
auto line_end = ImVec2(canvas_p1.x + ImGui::GetContentRegionAvail().x,
|
||||||
canvas_p0.y + i * LINE_SPACING);
|
canvas_p0.y + i * LINE_SPACING);
|
||||||
draw_list->AddLine(line_start, line_end, IM_COL32(200, 200, 200, 255),
|
draw_list->AddLine(line_start, line_end, IM_COL32(200, 200, 200, 255),
|
||||||
LINE_THICKNESS);
|
LINE_THICKNESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the ledger lines
|
// Draw the ledger lines
|
||||||
const int NUM_LEDGER_LINES = 3;
|
const int NUM_LEDGER_LINES = 3;
|
||||||
for (int i = -NUM_LEDGER_LINES; i <= NUM_LINES + NUM_LEDGER_LINES; i++) {
|
for (int i = -NUM_LEDGER_LINES; i <= NUM_LINES + NUM_LEDGER_LINES; i++) {
|
||||||
if (i % 2 == 0) continue; // skip every other line
|
if (i % 2 == 0) continue; // skip every other line
|
||||||
auto line_start = ImVec2(canvas_p0.x, canvas_p0.y + i * LINE_SPACING / 2);
|
auto line_start = ImVec2(canvas_p0.x, canvas_p0.y + i * LINE_SPACING / 2);
|
||||||
auto line_end = ImVec2(canvas_p1.x + ImGui::GetContentRegionAvail().x,
|
auto line_end = ImVec2(canvas_p1.x + ImGui::GetContentRegionAvail().x,
|
||||||
canvas_p0.y + i * LINE_SPACING / 2);
|
canvas_p0.y + i * LINE_SPACING / 2);
|
||||||
draw_list->AddLine(line_start, line_end, IM_COL32(150, 150, 150, 255),
|
draw_list->AddLine(line_start, line_end, IM_COL32(150, 150, 150, 255),
|
||||||
LINE_THICKNESS);
|
LINE_THICKNESS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
ImGui::EndChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MusicEditor::DrawPianoRoll() {
|
void MusicEditor::DrawPianoRoll() {
|
||||||
@@ -151,7 +163,9 @@ void MusicEditor::DrawToolset() {
|
|||||||
static int current_volume = 0;
|
static int current_volume = 0;
|
||||||
const int MAX_VOLUME = 100;
|
const int MAX_VOLUME = 100;
|
||||||
gui::ItemLabel("Select a song to edit: ", gui::ItemLabelFlags::Left);
|
gui::ItemLabel("Select a song to edit: ", gui::ItemLabelFlags::Left);
|
||||||
ImGui::Combo("#controls", &selected_option, kGameSongs, 30);
|
ImGui::Combo("#songs_in_game", &selected_option, kGameSongs, 30);
|
||||||
|
|
||||||
|
gui::ItemLabel("Controls: ", gui::ItemLabelFlags::Left);
|
||||||
if (ImGui::BeginTable("SongToolset", 5, toolset_table_flags_, ImVec2(0, 0))) {
|
if (ImGui::BeginTable("SongToolset", 5, toolset_table_flags_, ImVec2(0, 0))) {
|
||||||
ImGui::TableSetupColumn("#play");
|
ImGui::TableSetupColumn("#play");
|
||||||
ImGui::TableSetupColumn("#rewind");
|
ImGui::TableSetupColumn("#rewind");
|
||||||
@@ -176,28 +190,11 @@ void MusicEditor::DrawToolset() {
|
|||||||
static int current_time = 0; // current time in the song in seconds
|
static int current_time = 0; // current time in the song in seconds
|
||||||
|
|
||||||
// Display the current time in the song
|
// Display the current time in the song
|
||||||
ImGui::Text("Current Time: %d:%02d", current_time / 60, current_time % 60);
|
gui::ItemLabel("Current Time: ", gui::ItemLabelFlags::Left);
|
||||||
|
ImGui::Text("%d:%02d", current_time / 60, current_time % 60);
|
||||||
|
ImGui::SameLine();
|
||||||
// Display the song duration/progress using a progress bar
|
// Display the song duration/progress using a progress bar
|
||||||
ImGui::ProgressBar((float)current_time / SONG_DURATION);
|
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");
|
|
||||||
for (int i = 0; i < 3; i++) {
|
|
||||||
ImGui::TableSetupColumn(absl::StrFormat("#%d", i).data());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++) {
|
|
||||||
ImGui::TableNextColumn();
|
|
||||||
ImGui::Button(absl::StrFormat("%d", i).data());
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndTable();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace editor
|
} // namespace editor
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ class MusicEditor {
|
|||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void DrawChannels();
|
||||||
void DrawPianoStaff();
|
void DrawPianoStaff();
|
||||||
void DrawPianoRoll();
|
void DrawPianoRoll();
|
||||||
void DrawSongToolset();
|
void DrawSongToolset();
|
||||||
@@ -63,6 +64,13 @@ class MusicEditor {
|
|||||||
ImGuiTableFlags music_editor_flags_ = ImGuiTableFlags_SizingFixedFit |
|
ImGuiTableFlags music_editor_flags_ = ImGuiTableFlags_SizingFixedFit |
|
||||||
ImGuiTableFlags_Resizable |
|
ImGuiTableFlags_Resizable |
|
||||||
ImGuiTableFlags_Reorderable;
|
ImGuiTableFlags_Reorderable;
|
||||||
|
|
||||||
|
ImGuiTableFlags channel_table_flags_ =
|
||||||
|
ImGuiTableFlags_Resizable | ImGuiTableFlags_Reorderable |
|
||||||
|
ImGuiTableFlags_Hideable | ImGuiTableFlags_Sortable |
|
||||||
|
ImGuiTableFlags_SortMulti | ImGuiTableFlags_RowBg |
|
||||||
|
ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV |
|
||||||
|
ImGuiTableFlags_NoBordersInBody | ImGuiTableFlags_ScrollY;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace editor
|
} // namespace editor
|
||||||
|
|||||||
@@ -49,8 +49,7 @@ void ColorsYaze() {
|
|||||||
|
|
||||||
colors[ImGuiCol_Tab] = alttpDarkGreen;
|
colors[ImGuiCol_Tab] = alttpDarkGreen;
|
||||||
colors[ImGuiCol_TabHovered] = alttpMidGreen;
|
colors[ImGuiCol_TabHovered] = alttpMidGreen;
|
||||||
colors[ImGuiCol_TabActive] = ImLerp(colors[ImGuiCol_HeaderActive],
|
colors[ImGuiCol_TabActive] = ImVec4(0.347f, 0.466f, 0.347f, 1.000f);
|
||||||
colors[ImGuiCol_TitleBgActive], 0.60f);
|
|
||||||
|
|
||||||
colors[ImGuiCol_Button] = alttpMidGreen;
|
colors[ImGuiCol_Button] = alttpMidGreen;
|
||||||
colors[ImGuiCol_ButtonHovered] = allttpLightestGreen;
|
colors[ImGuiCol_ButtonHovered] = allttpLightestGreen;
|
||||||
|
|||||||
1
src/lib/snes-spc-arm
Submodule
1
src/lib/snes-spc-arm
Submodule
Submodule src/lib/snes-spc-arm added at 609c02b008
Reference in New Issue
Block a user