GUI: some mobile view work

This commit is contained in:
tildearrow 2022-09-08 17:04:38 -05:00
parent 773b63b810
commit ae6e956f06
3 changed files with 23 additions and 15 deletions

View file

@ -23,12 +23,16 @@
void FurnaceGUI::drawMobileControls() {
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);
if (ImGui::Button(ICON_FA_CHEVRON_RIGHT "##MobileMenu",buttonSize)) {
}
ImGui::Text("I put here");
ImGui::Separator();
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(e->isPlaying()));

View file

@ -2608,8 +2608,8 @@ bool FurnaceGUI::detectOutOfBoundsWindow() {
return false;
}
bool xbound = (rect.x + OOB_PIXELS_SAFETY) <= (scrX + scrW) && (rect.x + rect.w - OOB_PIXELS_SAFETY) >= scrX;
bool ybound = (rect.y + OOB_PIXELS_SAFETY) <= (scrY + scrH) && (rect.y + rect.h - OOB_PIXELS_SAFETY) >= scrY;
bool xbound=((rect.x+OOB_PIXELS_SAFETY)<=(scrX+scrW)) && ((rect.x+rect.w-OOB_PIXELS_SAFETY)>=scrX);
bool ybound=((rect.y+OOB_PIXELS_SAFETY)<=(scrY+scrH)) && ((rect.y+rect.h-OOB_PIXELS_SAFETY)>=scrY);
logD("bounds check: display %d is at %dx%dx%dx%d: %s%s",i,rect.x+OOB_PIXELS_SAFETY,rect.y+OOB_PIXELS_SAFETY,rect.x+rect.w-OOB_PIXELS_SAFETY,rect.y+rect.h-OOB_PIXELS_SAFETY,xbound?"x":"",ybound?"y":"");
if (xbound && ybound) {
@ -2746,6 +2746,7 @@ bool FurnaceGUI::loop() {
scrW=ev.window.data1/dpiScale;
scrH=ev.window.data2/dpiScale;
#endif
portrait=(scrW<scrH);
updateWindow=true;
break;
case SDL_WINDOWEVENT_MOVED:
@ -4581,6 +4582,7 @@ bool FurnaceGUI::init() {
scrX=scrConfX=e->getConfInt("lastWindowX",SDL_WINDOWPOS_CENTERED);
scrY=scrConfY=e->getConfInt("lastWindowY",SDL_WINDOWPOS_CENTERED);
scrMax=e->getConfBool("lastWindowMax",false);
portrait=(scrW<scrH);
#ifndef __APPLE__
SDL_Rect displaySize;
@ -4628,6 +4630,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);
if (!fullScreen) {
SDL_SetWindowSize(sdlWin,scrW*dpiScale,scrH*dpiScale);
}
@ -4846,6 +4849,7 @@ FurnaceGUI::FurnaceGUI():
displayExporting(false),
vgmExportLoop(true),
vgmExportPatternHints(false),
portrait(false),
wantCaptureKeyboard(false),
oldWantCaptureKeyboard(false),
displayMacroMenu(false),

View file

@ -987,7 +987,7 @@ class FurnaceGUI {
std::vector<DivSystem> sysSearchResults;
std::vector<FurnaceGUISysDef> newSongSearchResults;
bool quit, warnQuit, willCommit, edit, modified, displayError, displayExporting, vgmExportLoop, vgmExportPatternHints;
bool quit, warnQuit, willCommit, edit, modified, displayError, displayExporting, vgmExportLoop, vgmExportPatternHints, portrait;
bool wantCaptureKeyboard, oldWantCaptureKeyboard, displayMacroMenu;
bool displayNew, fullScreen, preserveChanPos, wantScrollList, noteInputPoly;
bool displayPendingIns, pendingInsSingle, displayPendingRawSample;