GUI: lots of mobile UI progress

This commit is contained in:
tildearrow 2022-09-08 19:15:19 -05:00
parent 0684521092
commit 2c18fe1051
5 changed files with 144 additions and 17 deletions

View file

@ -22,27 +22,54 @@
#include <imgui.h>
void FurnaceGUI::drawMobileControls() {
float timeScale=1.0f/(60.0f*ImGui::GetIO().DeltaTime);
if (mobileMenuOpen) {
if (mobileMenuPos<0.999f) {
WAKE_UP;
mobileMenuPos+=MIN(0.1,(1.0-mobileMenuPos)*0.65)*timeScale;
} else {
mobileMenuPos=1.0f;
}
} else {
if (mobileMenuPos>0.001f) {
WAKE_UP;
mobileMenuPos-=MIN(0.1,mobileMenuPos*0.65)*timeScale;
} else {
mobileMenuPos=0.0f;
}
}
ImGui::SetNextWindowPos(portrait?ImVec2(0.0f,((1.0-mobileMenuPos*0.65)*scrH*dpiScale)-(0.16*scrW*dpiScale)):ImVec2(0.5*scrW*dpiScale*mobileMenuPos,0.0f));
ImGui::SetNextWindowSize(portrait?ImVec2(scrW*dpiScale,0.16*scrW*dpiScale):ImVec2(0.16*scrH*dpiScale,scrH*dpiScale));
if (ImGui::Begin("Mobile Controls",NULL,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags)) {
ImGui::SetWindowPos(ImVec2(0.0f,0.0f));
ImGui::SetWindowSize(portrait?ImVec2(scrW*dpiScale,0.1*scrW*dpiScale):ImVec2(0.1*scrH*dpiScale,scrH*dpiScale));
float availX=ImGui::GetContentRegionAvail().x;
ImVec2 buttonSize=ImVec2(availX,availX);
float avail=portrait?ImGui::GetContentRegionAvail().y:ImGui::GetContentRegionAvail().x;
ImVec2 buttonSize=ImVec2(avail,avail);
if (ImGui::Button(ICON_FA_CHEVRON_RIGHT "##MobileMenu",buttonSize)) {
const char* mobButtonName=ICON_FA_CHEVRON_RIGHT "##MobileMenu";
if (portrait) mobButtonName=ICON_FA_CHEVRON_UP "##MobileMenu";
if (mobileMenuOpen) {
if (portrait) {
mobButtonName=ICON_FA_CHEVRON_DOWN "##MobileMenu";
} else {
mobButtonName=ICON_FA_CHEVRON_LEFT "##MobileMenu";
}
}
if (ImGui::Button(mobButtonName,buttonSize)) {
mobileMenuOpen=!mobileMenuOpen;
}
ImGui::Text("I put here");
ImGui::Separator();
if (!portrait) ImGui::Separator();
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(e->isPlaying()));
if (portrait) ImGui::SameLine();
if (ImGui::Button(ICON_FA_PLAY "##Play",buttonSize)) {
play();
}
ImGui::PopStyleColor();
if (portrait) ImGui::SameLine();
if (ImGui::Button(ICON_FA_STOP "##Stop",buttonSize)) {
stop();
}
if (portrait) ImGui::SameLine();
if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne",buttonSize)) {
e->stepOne(cursor.y);
pendingStepUpdate=true;
@ -50,12 +77,14 @@ void FurnaceGUI::drawMobileControls() {
bool repeatPattern=e->getRepeatPattern();
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(repeatPattern));
if (portrait) ImGui::SameLine();
if (ImGui::Button(ICON_FA_REPEAT "##RepeatPattern",buttonSize)) {
e->setRepeatPattern(!repeatPattern);
}
ImGui::PopStyleColor();
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(edit));
if (portrait) ImGui::SameLine();
if (ImGui::Button(ICON_FA_CIRCLE "##Edit",buttonSize)) {
edit=!edit;
}
@ -63,17 +92,94 @@ void FurnaceGUI::drawMobileControls() {
bool metro=e->getMetronome();
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(metro));
if (portrait) ImGui::SameLine();
if (ImGui::Button(ICON_FA_BELL_O "##Metronome",buttonSize)) {
e->setMetronome(!metro);
}
ImGui::PopStyleColor();
if (ImGui::Button("Get me out of here")) {
toggleMobileUI(false);
}
}
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS;
ImGui::End();
ImGui::SetNextWindowPos(portrait?ImVec2(0.0f,((1.0-mobileMenuPos*0.65)*scrH*dpiScale)):ImVec2(0.5*scrW*dpiScale*(mobileMenuPos-1.0),0.0f));
ImGui::SetNextWindowSize(portrait?ImVec2(scrW*dpiScale,0.65*scrH*dpiScale):ImVec2(0.5*scrW*dpiScale,scrH*dpiScale));
if (ImGui::Begin("Mobile Menu",NULL,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags)) {
ImGui::Button("Pattern");
ImGui::SameLine();
ImGui::Button("Ins");
ImGui::SameLine();
ImGui::Button("Wave");
ImGui::SameLine();
ImGui::Button("Sample");
ImGui::Text("Data list goes here...");
if (ImGui::Button("New")) {
mobileMenuOpen=false;
//doAction(GUI_ACTION_NEW);
if (modified) {
showWarning("Unsaved changes! Save changes before creating a new song?",GUI_WARN_NEW);
} else {
displayNew=true;
}
}
ImGui::SameLine();
if (ImGui::Button("Open")) {
mobileMenuOpen=false;
doAction(GUI_ACTION_OPEN);
}
ImGui::SameLine();
if (ImGui::Button("Save")) {
mobileMenuOpen=false;
doAction(GUI_ACTION_SAVE);
}
ImGui::SameLine();
if (ImGui::Button("Save as...")) {
mobileMenuOpen=false;
doAction(GUI_ACTION_SAVE_AS);
}
ImGui::Button("1.1+ .dmf");
ImGui::SameLine();
ImGui::Button("Legacy .dmf");
ImGui::SameLine();
ImGui::Button("Export Audio");
ImGui::SameLine();
ImGui::Button("Export VGM");
ImGui::Button("CmdStream");
ImGui::SameLine();
ImGui::Button("Panic");
ImGui::SameLine();
if (ImGui::Button("Settings")) {
mobileMenuOpen=false;
}
ImGui::SameLine();
if (ImGui::Button("About")) {
mobileMenuOpen=false;
mobileMenuPos=0.0f;
aboutOpen=true;
}
ImGui::Separator();
if (ImGui::Button("Osc")) {
oscOpen=!oscOpen;
}
ImGui::SameLine();
if (ImGui::Button("ChanOsc")) {
chanOscOpen=!chanOscOpen;
}
ImGui::SameLine();
if (ImGui::Button("RegView")) {
regViewOpen=!regViewOpen;
}
ImGui::SameLine();
if (ImGui::Button("Stats")) {
statsOpen=!statsOpen;
}
}
ImGui::End();
}
void FurnaceGUI::drawEditControls() {