mirror of
https://github.com/tildearrow/furnace.git
synced 2025-01-03 06:01:29 +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>
|
||||
|
||||
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() {
|
||||
|
|
|
@ -2581,7 +2581,7 @@ void FurnaceGUI::processPoint(SDL_Event& ev) {
|
|||
|
||||
if (point.id==0) {
|
||||
ImGui::GetIO().AddMouseButtonEvent(ImGuiMouseButton_Left,false);
|
||||
ImGui::GetIO().AddMousePosEvent(-FLT_MAX,-FLT_MAX);
|
||||
//ImGui::GetIO().AddMousePosEvent(-FLT_MAX,-FLT_MAX);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2747,6 +2747,7 @@ bool FurnaceGUI::loop() {
|
|||
scrH=ev.window.data2/dpiScale;
|
||||
#endif
|
||||
portrait=(scrW<scrH);
|
||||
logV("portrait: %d (%dx%d)",portrait,scrW,scrH);
|
||||
updateWindow=true;
|
||||
break;
|
||||
case SDL_WINDOWEVENT_MOVED:
|
||||
|
@ -3347,6 +3348,7 @@ bool FurnaceGUI::loop() {
|
|||
|
||||
if (mobileUI) {
|
||||
globalWinFlags=ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoBringToFrontOnFocus;
|
||||
//globalWinFlags=ImGuiWindowFlags_NoTitleBar;
|
||||
drawMobileControls();
|
||||
drawPattern();
|
||||
drawPiano();
|
||||
|
@ -4583,6 +4585,7 @@ bool FurnaceGUI::init() {
|
|||
scrY=scrConfY=e->getConfInt("lastWindowY",SDL_WINDOWPOS_CENTERED);
|
||||
scrMax=e->getConfBool("lastWindowMax",false);
|
||||
portrait=(scrW<scrH);
|
||||
logV("portrait: %d (%dx%d)",portrait,scrW,scrH);
|
||||
|
||||
#ifndef __APPLE__
|
||||
SDL_Rect displaySize;
|
||||
|
@ -4631,6 +4634,7 @@ bool FurnaceGUI::init() {
|
|||
if (scrW>displaySize.w/dpiScale) scrW=(displaySize.w/dpiScale)-32;
|
||||
if (scrH>displaySize.h/dpiScale) scrH=(displaySize.h/dpiScale)-32;
|
||||
portrait=(scrW<scrH);
|
||||
logV("portrait: %d (%dx%d)",portrait,scrW,scrH);
|
||||
if (!fullScreen) {
|
||||
SDL_SetWindowSize(sdlWin,scrW*dpiScale,scrH*dpiScale);
|
||||
}
|
||||
|
@ -4642,6 +4646,8 @@ bool FurnaceGUI::init() {
|
|||
SDL_GetWindowSize(sdlWin,&scrW,&scrH);
|
||||
scrW/=dpiScale;
|
||||
scrH/=dpiScale;
|
||||
portrait=(scrW<scrH);
|
||||
logV("portrait: %d (%dx%d)",portrait,scrW,scrH);
|
||||
#endif
|
||||
|
||||
#if !(defined(__APPLE__) || defined(_WIN32))
|
||||
|
@ -4850,6 +4856,7 @@ FurnaceGUI::FurnaceGUI():
|
|||
vgmExportLoop(true),
|
||||
vgmExportPatternHints(false),
|
||||
portrait(false),
|
||||
mobileMenuOpen(false),
|
||||
wantCaptureKeyboard(false),
|
||||
oldWantCaptureKeyboard(false),
|
||||
displayMacroMenu(false),
|
||||
|
@ -4865,6 +4872,7 @@ FurnaceGUI::FurnaceGUI():
|
|||
drawHalt(10),
|
||||
macroPointSize(16),
|
||||
waveEditStyle(0),
|
||||
mobileMenuPos(0.0f),
|
||||
curSysSection(NULL),
|
||||
pendingRawSampleDepth(8),
|
||||
pendingRawSampleChannels(1),
|
||||
|
|
|
@ -987,7 +987,8 @@ class FurnaceGUI {
|
|||
std::vector<DivSystem> sysSearchResults;
|
||||
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 displayNew, fullScreen, preserveChanPos, wantScrollList, noteInputPoly;
|
||||
bool displayPendingIns, pendingInsSingle, displayPendingRawSample;
|
||||
|
@ -996,6 +997,7 @@ class FurnaceGUI {
|
|||
int drawHalt;
|
||||
int macroPointSize;
|
||||
int waveEditStyle;
|
||||
float mobileMenuPos;
|
||||
const int* curSysSection;
|
||||
|
||||
String pendingRawSample;
|
||||
|
|
|
@ -372,10 +372,17 @@ void FurnaceGUI::drawPattern() {
|
|||
sel2.xFine^=sel1.xFine;
|
||||
}
|
||||
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))) {
|
||||
//ImGui::SetWindowSize(ImVec2(scrW*dpiScale,scrH*dpiScale));
|
||||
patWindowPos=ImGui::GetWindowPos();
|
||||
patWindowSize=ImGui::GetWindowSize();
|
||||
if (!mobileUI) {
|
||||
patWindowPos=ImGui::GetWindowPos();
|
||||
patWindowSize=ImGui::GetWindowSize();
|
||||
}
|
||||
//char id[32];
|
||||
ImGui::PushFont(patFont);
|
||||
int ord=oldOrder;
|
||||
|
|
|
@ -19,7 +19,11 @@
|
|||
|
||||
#include "ta-log.h"
|
||||
|
||||
#ifdef IS_MOBILE
|
||||
int logLevel=LOGLEVEL_TRACE;
|
||||
#else
|
||||
int logLevel=LOGLEVEL_INFO;
|
||||
#endif
|
||||
|
||||
std::atomic<unsigned short> logPosition;
|
||||
|
||||
|
|
Loading…
Reference in a new issue