mirror of
https://github.com/tildearrow/furnace.git
synced 2024-12-27 18:11:15 +00:00
GUI: some mobile view work
This commit is contained in:
parent
773b63b810
commit
ae6e956f06
3 changed files with 23 additions and 15 deletions
|
@ -23,12 +23,16 @@
|
||||||
|
|
||||||
void FurnaceGUI::drawMobileControls() {
|
void FurnaceGUI::drawMobileControls() {
|
||||||
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));
|
||||||
|
ImGui::SetWindowSize(portrait?ImVec2(scrW*dpiScale,0.1*scrW*dpiScale):ImVec2(0.1*scrH*dpiScale,scrH*dpiScale));
|
||||||
float availX=ImGui::GetContentRegionAvail().x;
|
float availX=ImGui::GetContentRegionAvail().x;
|
||||||
ImVec2 buttonSize=ImVec2(availX,availX);
|
ImVec2 buttonSize=ImVec2(availX,availX);
|
||||||
|
|
||||||
if (ImGui::Button(ICON_FA_CHEVRON_RIGHT "##MobileMenu",buttonSize)) {
|
if (ImGui::Button(ICON_FA_CHEVRON_RIGHT "##MobileMenu",buttonSize)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::Text("I put here");
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(e->isPlaying()));
|
ImGui::PushStyleColor(ImGuiCol_Button,TOGGLE_COLOR(e->isPlaying()));
|
||||||
|
|
|
@ -2595,24 +2595,24 @@ void FurnaceGUI::processPoint(SDL_Event& ev) {
|
||||||
#define OOB_PIXELS_SAFETY 25
|
#define OOB_PIXELS_SAFETY 25
|
||||||
|
|
||||||
bool FurnaceGUI::detectOutOfBoundsWindow() {
|
bool FurnaceGUI::detectOutOfBoundsWindow() {
|
||||||
int count = SDL_GetNumVideoDisplays();
|
int count=SDL_GetNumVideoDisplays();
|
||||||
if(count < 1) {
|
if (count<1) {
|
||||||
logW("bounds check: error %s", SDL_GetError());
|
logW("bounds check: error %s",SDL_GetError());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Rect rect;
|
SDL_Rect rect;
|
||||||
for(int i = 0;i < count;i ++) {
|
for (int i=0; i<count; i++) {
|
||||||
if(SDL_GetDisplayUsableBounds(i, &rect) != 0) {
|
if (SDL_GetDisplayUsableBounds(i,&rect)!=0) {
|
||||||
logW("bounds check: error %s", SDL_GetError());
|
logW("bounds check: error %s",SDL_GetError());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool xbound = (rect.x + OOB_PIXELS_SAFETY) <= (scrX + scrW) && (rect.x + rect.w - OOB_PIXELS_SAFETY) >= scrX;
|
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 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" : "");
|
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) {
|
if (xbound && ybound) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2746,6 +2746,7 @@ bool FurnaceGUI::loop() {
|
||||||
scrW=ev.window.data1/dpiScale;
|
scrW=ev.window.data1/dpiScale;
|
||||||
scrH=ev.window.data2/dpiScale;
|
scrH=ev.window.data2/dpiScale;
|
||||||
#endif
|
#endif
|
||||||
|
portrait=(scrW<scrH);
|
||||||
updateWindow=true;
|
updateWindow=true;
|
||||||
break;
|
break;
|
||||||
case SDL_WINDOWEVENT_MOVED:
|
case SDL_WINDOWEVENT_MOVED:
|
||||||
|
@ -2816,8 +2817,8 @@ bool FurnaceGUI::loop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// update config x/y/w/h values based on scrMax state
|
// update config x/y/w/h values based on scrMax state
|
||||||
if(updateWindow) {
|
if (updateWindow) {
|
||||||
if(!scrMax) {
|
if (!scrMax) {
|
||||||
scrConfX=scrX;
|
scrConfX=scrX;
|
||||||
scrConfY=scrY;
|
scrConfY=scrY;
|
||||||
scrConfW=scrW;
|
scrConfW=scrW;
|
||||||
|
@ -4581,6 +4582,7 @@ bool FurnaceGUI::init() {
|
||||||
scrX=scrConfX=e->getConfInt("lastWindowX",SDL_WINDOWPOS_CENTERED);
|
scrX=scrConfX=e->getConfInt("lastWindowX",SDL_WINDOWPOS_CENTERED);
|
||||||
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);
|
||||||
|
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
SDL_Rect displaySize;
|
SDL_Rect displaySize;
|
||||||
|
@ -4597,8 +4599,8 @@ bool FurnaceGUI::init() {
|
||||||
SDL_Init(SDL_INIT_VIDEO);
|
SDL_Init(SDL_INIT_VIDEO);
|
||||||
|
|
||||||
// if window would spawn out of bounds, force it to be get default position
|
// if window would spawn out of bounds, force it to be get default position
|
||||||
if(!detectOutOfBoundsWindow()) {
|
if (!detectOutOfBoundsWindow()) {
|
||||||
scrMax = false;
|
scrMax=false;
|
||||||
scrX=scrConfX=SDL_WINDOWPOS_CENTERED;
|
scrX=scrConfX=SDL_WINDOWPOS_CENTERED;
|
||||||
scrY=scrConfY=SDL_WINDOWPOS_CENTERED;
|
scrY=scrConfY=SDL_WINDOWPOS_CENTERED;
|
||||||
}
|
}
|
||||||
|
@ -4628,6 +4630,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);
|
||||||
if (!fullScreen) {
|
if (!fullScreen) {
|
||||||
SDL_SetWindowSize(sdlWin,scrW*dpiScale,scrH*dpiScale);
|
SDL_SetWindowSize(sdlWin,scrW*dpiScale,scrH*dpiScale);
|
||||||
}
|
}
|
||||||
|
@ -4846,6 +4849,7 @@ FurnaceGUI::FurnaceGUI():
|
||||||
displayExporting(false),
|
displayExporting(false),
|
||||||
vgmExportLoop(true),
|
vgmExportLoop(true),
|
||||||
vgmExportPatternHints(false),
|
vgmExportPatternHints(false),
|
||||||
|
portrait(false),
|
||||||
wantCaptureKeyboard(false),
|
wantCaptureKeyboard(false),
|
||||||
oldWantCaptureKeyboard(false),
|
oldWantCaptureKeyboard(false),
|
||||||
displayMacroMenu(false),
|
displayMacroMenu(false),
|
||||||
|
|
|
@ -987,7 +987,7 @@ 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;
|
bool quit, warnQuit, willCommit, edit, modified, displayError, displayExporting, vgmExportLoop, vgmExportPatternHints, portrait;
|
||||||
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;
|
||||||
|
|
Loading…
Reference in a new issue