GUI: instrument selector

This commit is contained in:
tildearrow 2021-12-11 16:44:02 -05:00
parent c6ca40494a
commit 2f813c55e0
7 changed files with 34 additions and 8 deletions

View file

@ -2,6 +2,7 @@
#include "fonts.h"
#include "../ta-log.h"
#include "imgui.h"
#include <fmt/printf.h>
void FurnaceGUI::bindEngine(DivEngine* eng) {
e=eng;
@ -41,6 +42,16 @@ bool FurnaceGUI::loop() {
}
ImGui::End();
if (ImGui::Begin("Instruments")) {
for (int i=0; i<e->song.ins.size(); i++) {
DivInstrument* ins=e->song.ins[i];
if (ImGui::Selectable(fmt::sprintf("%d: %s##_INS%d\n",i,ins->name,i).c_str(),curIns==i)) {
curIns=i;
}
}
}
ImGui::End();
SDL_RenderClear(sdlRend);
ImGui::Render();
ImGui_ImplSDLRenderer_RenderDrawData(ImGui::GetDrawData());
@ -88,5 +99,7 @@ FurnaceGUI::FurnaceGUI():
quit(false),
scrW(1280),
scrH(800),
dpiScale(2) {
}
dpiScale(1),
curIns(0),
curOctave(3) {
}

View file

@ -19,9 +19,11 @@ class FurnaceGUI {
ImFont* mainFont;
ImFont* patFont;
int curIns, curOctave;
public:
void bindEngine(DivEngine* eng);
bool loop();
bool init();
FurnaceGUI();
};
};