mirror of
https://github.com/tildearrow/furnace.git
synced 2025-01-06 23:51:21 +00:00
GUI: lots of mobile UI progress
This commit is contained in:
parent
0684521092
commit
2c18fe1051
5 changed files with 144 additions and 17 deletions
|
@ -22,27 +22,54 @@
|
||||||
#include <imgui.h>
|
#include <imgui.h>
|
||||||
|
|
||||||
void FurnaceGUI::drawMobileControls() {
|
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)) {
|
if (ImGui::Begin("Mobile Controls",NULL,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags)) {
|
||||||
ImGui::SetWindowPos(ImVec2(0.0f,0.0f));
|
float avail=portrait?ImGui::GetContentRegionAvail().y:ImGui::GetContentRegionAvail().x;
|
||||||
ImGui::SetWindowSize(portrait?ImVec2(scrW*dpiScale,0.1*scrW*dpiScale):ImVec2(0.1*scrH*dpiScale,scrH*dpiScale));
|
ImVec2 buttonSize=ImVec2(avail,avail);
|
||||||
float availX=ImGui::GetContentRegionAvail().x;
|
|
||||||
ImVec2 buttonSize=ImVec2(availX,availX);
|
|
||||||
|
|
||||||
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");
|
if (!portrait) ImGui::Separator();
|
||||||
|
|
||||||
ImGui::Separator();
|
|
||||||
|
|
||||||
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(e->isPlaying()));
|
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(e->isPlaying()));
|
||||||
|
if (portrait) ImGui::SameLine();
|
||||||
if (ImGui::Button(ICON_FA_PLAY "##Play",buttonSize)) {
|
if (ImGui::Button(ICON_FA_PLAY "##Play",buttonSize)) {
|
||||||
play();
|
play();
|
||||||
}
|
}
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
|
if (portrait) ImGui::SameLine();
|
||||||
if (ImGui::Button(ICON_FA_STOP "##Stop",buttonSize)) {
|
if (ImGui::Button(ICON_FA_STOP "##Stop",buttonSize)) {
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
if (portrait) ImGui::SameLine();
|
||||||
if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne",buttonSize)) {
|
if (ImGui::Button(ICON_FA_ARROW_DOWN "##StepOne",buttonSize)) {
|
||||||
e->stepOne(cursor.y);
|
e->stepOne(cursor.y);
|
||||||
pendingStepUpdate=true;
|
pendingStepUpdate=true;
|
||||||
|
@ -50,12 +77,14 @@ void FurnaceGUI::drawMobileControls() {
|
||||||
|
|
||||||
bool repeatPattern=e->getRepeatPattern();
|
bool repeatPattern=e->getRepeatPattern();
|
||||||
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(repeatPattern));
|
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(repeatPattern));
|
||||||
|
if (portrait) ImGui::SameLine();
|
||||||
if (ImGui::Button(ICON_FA_REPEAT "##RepeatPattern",buttonSize)) {
|
if (ImGui::Button(ICON_FA_REPEAT "##RepeatPattern",buttonSize)) {
|
||||||
e->setRepeatPattern(!repeatPattern);
|
e->setRepeatPattern(!repeatPattern);
|
||||||
}
|
}
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
|
|
||||||
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(edit));
|
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(edit));
|
||||||
|
if (portrait) ImGui::SameLine();
|
||||||
if (ImGui::Button(ICON_FA_CIRCLE "##Edit",buttonSize)) {
|
if (ImGui::Button(ICON_FA_CIRCLE "##Edit",buttonSize)) {
|
||||||
edit=!edit;
|
edit=!edit;
|
||||||
}
|
}
|
||||||
|
@ -63,17 +92,94 @@ void FurnaceGUI::drawMobileControls() {
|
||||||
|
|
||||||
bool metro=e->getMetronome();
|
bool metro=e->getMetronome();
|
||||||
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(metro));
|
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(metro));
|
||||||
|
if (portrait) ImGui::SameLine();
|
||||||
if (ImGui::Button(ICON_FA_BELL_O "##Metronome",buttonSize)) {
|
if (ImGui::Button(ICON_FA_BELL_O "##Metronome",buttonSize)) {
|
||||||
e->setMetronome(!metro);
|
e->setMetronome(!metro);
|
||||||
}
|
}
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
|
|
||||||
if (ImGui::Button("Get me out of here")) {
|
|
||||||
toggleMobileUI(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS;
|
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_EDIT_CONTROLS;
|
||||||
ImGui::End();
|
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() {
|
void FurnaceGUI::drawEditControls() {
|
||||||
|
|
|
@ -2581,7 +2581,7 @@ void FurnaceGUI::processPoint(SDL_Event& ev) {
|
||||||
|
|
||||||
if (point.id==0) {
|
if (point.id==0) {
|
||||||
ImGui::GetIO().AddMouseButtonEvent(ImGuiMouseButton_Left,false);
|
ImGui::GetIO().AddMouseButtonEvent(ImGuiMouseButton_Left,false);
|
||||||
ImGui::GetIO().AddMousePosEvent(-FLT_MAX,-FLT_MAX);
|
//ImGui::GetIO().AddMousePosEvent(-FLT_MAX,-FLT_MAX);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2747,6 +2747,7 @@ bool FurnaceGUI::loop() {
|
||||||
scrH=ev.window.data2/dpiScale;
|
scrH=ev.window.data2/dpiScale;
|
||||||
#endif
|
#endif
|
||||||
portrait=(scrW<scrH);
|
portrait=(scrW<scrH);
|
||||||
|
logV("portrait: %d (%dx%d)",portrait,scrW,scrH);
|
||||||
updateWindow=true;
|
updateWindow=true;
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_MOVED:
|
case SDL_WINDOWEVENT_MOVED:
|
||||||
|
@ -3347,6 +3348,7 @@ bool FurnaceGUI::loop() {
|
||||||
|
|
||||||
if (mobileUI) {
|
if (mobileUI) {
|
||||||
globalWinFlags=ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoBringToFrontOnFocus;
|
globalWinFlags=ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoBringToFrontOnFocus;
|
||||||
|
//globalWinFlags=ImGuiWindowFlags_NoTitleBar;
|
||||||
drawMobileControls();
|
drawMobileControls();
|
||||||
drawPattern();
|
drawPattern();
|
||||||
drawPiano();
|
drawPiano();
|
||||||
|
@ -4583,6 +4585,7 @@ bool FurnaceGUI::init() {
|
||||||
scrY=scrConfY=e->getConfInt("lastWindowY",SDL_WINDOWPOS_CENTERED);
|
scrY=scrConfY=e->getConfInt("lastWindowY",SDL_WINDOWPOS_CENTERED);
|
||||||
scrMax=e->getConfBool("lastWindowMax",false);
|
scrMax=e->getConfBool("lastWindowMax",false);
|
||||||
portrait=(scrW<scrH);
|
portrait=(scrW<scrH);
|
||||||
|
logV("portrait: %d (%dx%d)",portrait,scrW,scrH);
|
||||||
|
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
SDL_Rect displaySize;
|
SDL_Rect displaySize;
|
||||||
|
@ -4631,6 +4634,7 @@ bool FurnaceGUI::init() {
|
||||||
if (scrW>displaySize.w/dpiScale) scrW=(displaySize.w/dpiScale)-32;
|
if (scrW>displaySize.w/dpiScale) scrW=(displaySize.w/dpiScale)-32;
|
||||||
if (scrH>displaySize.h/dpiScale) scrH=(displaySize.h/dpiScale)-32;
|
if (scrH>displaySize.h/dpiScale) scrH=(displaySize.h/dpiScale)-32;
|
||||||
portrait=(scrW<scrH);
|
portrait=(scrW<scrH);
|
||||||
|
logV("portrait: %d (%dx%d)",portrait,scrW,scrH);
|
||||||
if (!fullScreen) {
|
if (!fullScreen) {
|
||||||
SDL_SetWindowSize(sdlWin,scrW*dpiScale,scrH*dpiScale);
|
SDL_SetWindowSize(sdlWin,scrW*dpiScale,scrH*dpiScale);
|
||||||
}
|
}
|
||||||
|
@ -4642,6 +4646,8 @@ bool FurnaceGUI::init() {
|
||||||
SDL_GetWindowSize(sdlWin,&scrW,&scrH);
|
SDL_GetWindowSize(sdlWin,&scrW,&scrH);
|
||||||
scrW/=dpiScale;
|
scrW/=dpiScale;
|
||||||
scrH/=dpiScale;
|
scrH/=dpiScale;
|
||||||
|
portrait=(scrW<scrH);
|
||||||
|
logV("portrait: %d (%dx%d)",portrait,scrW,scrH);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(defined(__APPLE__) || defined(_WIN32))
|
#if !(defined(__APPLE__) || defined(_WIN32))
|
||||||
|
@ -4850,6 +4856,7 @@ FurnaceGUI::FurnaceGUI():
|
||||||
vgmExportLoop(true),
|
vgmExportLoop(true),
|
||||||
vgmExportPatternHints(false),
|
vgmExportPatternHints(false),
|
||||||
portrait(false),
|
portrait(false),
|
||||||
|
mobileMenuOpen(false),
|
||||||
wantCaptureKeyboard(false),
|
wantCaptureKeyboard(false),
|
||||||
oldWantCaptureKeyboard(false),
|
oldWantCaptureKeyboard(false),
|
||||||
displayMacroMenu(false),
|
displayMacroMenu(false),
|
||||||
|
@ -4865,6 +4872,7 @@ FurnaceGUI::FurnaceGUI():
|
||||||
drawHalt(10),
|
drawHalt(10),
|
||||||
macroPointSize(16),
|
macroPointSize(16),
|
||||||
waveEditStyle(0),
|
waveEditStyle(0),
|
||||||
|
mobileMenuPos(0.0f),
|
||||||
curSysSection(NULL),
|
curSysSection(NULL),
|
||||||
pendingRawSampleDepth(8),
|
pendingRawSampleDepth(8),
|
||||||
pendingRawSampleChannels(1),
|
pendingRawSampleChannels(1),
|
||||||
|
|
|
@ -987,7 +987,8 @@ class FurnaceGUI {
|
||||||
std::vector<DivSystem> sysSearchResults;
|
std::vector<DivSystem> sysSearchResults;
|
||||||
std::vector<FurnaceGUISysDef> newSongSearchResults;
|
std::vector<FurnaceGUISysDef> newSongSearchResults;
|
||||||
|
|
||||||
bool quit, warnQuit, willCommit, edit, modified, displayError, displayExporting, vgmExportLoop, vgmExportPatternHints, portrait;
|
bool quit, warnQuit, willCommit, edit, modified, displayError, displayExporting, vgmExportLoop, vgmExportPatternHints;
|
||||||
|
bool portrait, mobileMenuOpen;
|
||||||
bool wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;
|
bool wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;
|
||||||
bool displayNew, fullScreen, preserveChanPos, wantScrollList, noteInputPoly;
|
bool displayNew, fullScreen, preserveChanPos, wantScrollList, noteInputPoly;
|
||||||
bool displayPendingIns, pendingInsSingle, displayPendingRawSample;
|
bool displayPendingIns, pendingInsSingle, displayPendingRawSample;
|
||||||
|
@ -996,6 +997,7 @@ class FurnaceGUI {
|
||||||
int drawHalt;
|
int drawHalt;
|
||||||
int macroPointSize;
|
int macroPointSize;
|
||||||
int waveEditStyle;
|
int waveEditStyle;
|
||||||
|
float mobileMenuPos;
|
||||||
const int* curSysSection;
|
const int* curSysSection;
|
||||||
|
|
||||||
String pendingRawSample;
|
String pendingRawSample;
|
||||||
|
|
|
@ -372,10 +372,17 @@ void FurnaceGUI::drawPattern() {
|
||||||
sel2.xFine^=sel1.xFine;
|
sel2.xFine^=sel1.xFine;
|
||||||
}
|
}
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding,ImVec2(0.0f,0.0f));
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding,ImVec2(0.0f,0.0f));
|
||||||
|
if (mobileUI) {
|
||||||
|
patWindowPos=(portrait?ImVec2(0.0f,(mobileMenuPos*-0.65*scrH*dpiScale)):ImVec2((0.16*scrH*dpiScale)+0.5*scrW*dpiScale*mobileMenuPos,0.0f));
|
||||||
|
patWindowSize=(portrait?ImVec2(scrW*dpiScale,scrH*dpiScale-(0.16*scrW*dpiScale)):ImVec2(scrW*dpiScale-(0.16*scrH*dpiScale),scrH*dpiScale));
|
||||||
|
ImGui::SetNextWindowPos(patWindowPos);
|
||||||
|
ImGui::SetNextWindowSize(patWindowSize);
|
||||||
|
}
|
||||||
if (ImGui::Begin("Pattern",&patternOpen,globalWinFlags|(settings.avoidRaisingPattern?ImGuiWindowFlags_NoBringToFrontOnFocus:0))) {
|
if (ImGui::Begin("Pattern",&patternOpen,globalWinFlags|(settings.avoidRaisingPattern?ImGuiWindowFlags_NoBringToFrontOnFocus:0))) {
|
||||||
//ImGui::SetWindowSize(ImVec2(scrW*dpiScale,scrH*dpiScale));
|
if (!mobileUI) {
|
||||||
patWindowPos=ImGui::GetWindowPos();
|
patWindowPos=ImGui::GetWindowPos();
|
||||||
patWindowSize=ImGui::GetWindowSize();
|
patWindowSize=ImGui::GetWindowSize();
|
||||||
|
}
|
||||||
//char id[32];
|
//char id[32];
|
||||||
ImGui::PushFont(patFont);
|
ImGui::PushFont(patFont);
|
||||||
int ord=oldOrder;
|
int ord=oldOrder;
|
||||||
|
|
|
@ -19,7 +19,11 @@
|
||||||
|
|
||||||
#include "ta-log.h"
|
#include "ta-log.h"
|
||||||
|
|
||||||
|
#ifdef IS_MOBILE
|
||||||
|
int logLevel=LOGLEVEL_TRACE;
|
||||||
|
#else
|
||||||
int logLevel=LOGLEVEL_INFO;
|
int logLevel=LOGLEVEL_INFO;
|
||||||
|
#endif
|
||||||
|
|
||||||
std::atomic<unsigned short> logPosition;
|
std::atomic<unsigned short> logPosition;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue