GUI: use canvasW/H instead of scrW/H*dpiScale

This commit is contained in:
tildearrow 2022-10-20 02:34:14 -05:00
parent d96674186e
commit 373367724b
16 changed files with 63 additions and 78 deletions

View file

@ -23,18 +23,13 @@
const char* aboutLine[]={ const char* aboutLine[]={
"tildearrow", "tildearrow",
"is not so happy to present", "is proud to present",
"", "",
("Furnace " DIV_VERSION), ("Furnace " DIV_VERSION),
"", "",
"the biggest multi-system chiptune tracker!", "the biggest multi-system chiptune tracker!",
"featuring DefleMask song compatibility.", "featuring DefleMask song compatibility.",
"", "",
"what a mess of a versioning scheme we have...",
"I mean it! these pre-releases are like normal releases",
"by now but only because I promised you to have SNES in",
"0.6pre2 I am doing this whole mess...",
"",
"> CREDITS <", "> CREDITS <",
"", "",
"-- program --", "-- program --",
@ -187,7 +182,7 @@ void FurnaceGUI::drawAbout() {
// do stuff // do stuff
if (ImGui::Begin("About Furnace",NULL,ImGuiWindowFlags_Modal|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoDocking|ImGuiWindowFlags_NoTitleBar)) { if (ImGui::Begin("About Furnace",NULL,ImGuiWindowFlags_Modal|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoDocking|ImGuiWindowFlags_NoTitleBar)) {
ImGui::SetWindowPos(ImVec2(0,0)); ImGui::SetWindowPos(ImVec2(0,0));
ImGui::SetWindowSize(ImVec2(scrW*dpiScale,scrH*dpiScale)); ImGui::SetWindowSize(ImVec2(canvasW,canvasH));
ImGui::PushFont(bigFont); ImGui::PushFont(bigFont);
ImDrawList* dl=ImGui::GetWindowDrawList(); ImDrawList* dl=ImGui::GetWindowDrawList();
float r=0; float r=0;
@ -195,47 +190,47 @@ void FurnaceGUI::drawAbout() {
float b=0; float b=0;
float peakMix=settings.partyTime?((peak[0]+peak[1])*0.5):0.3; float peakMix=settings.partyTime?((peak[0]+peak[1])*0.5):0.3;
ImGui::ColorConvertHSVtoRGB(aboutHue,1.0,0.25+MIN(0.75f,peakMix*0.75f),r,g,b); ImGui::ColorConvertHSVtoRGB(aboutHue,1.0,0.25+MIN(0.75f,peakMix*0.75f),r,g,b);
dl->AddRectFilled(ImVec2(0,0),ImVec2(scrW*dpiScale,scrH*dpiScale),0xff000000); dl->AddRectFilled(ImVec2(0,0),ImVec2(canvasW,canvasH),0xff000000);
bool skip=false; bool skip=false;
bool skip2=false; bool skip2=false;
for (int i=(-80-sin(double(aboutSin)*2*M_PI/120.0)*80.0)*2; i<scrW; i+=160) { for (int i=(-80-sin(double(aboutSin)*2*M_PI/120.0)*80.0)*2*dpiScale; i<canvasW; i+=160*dpiScale) {
skip2=!skip2; skip2=!skip2;
skip=skip2; skip=skip2;
for (int j=(-80-cos(double(aboutSin)*2*M_PI/150.0)*80.0)*2; j<scrH; j+=160) { for (int j=(-80-cos(double(aboutSin)*2*M_PI/150.0)*80.0)*2*dpiScale; j<canvasH; j+=160*dpiScale) {
skip=!skip; skip=!skip;
if (skip) continue; if (skip) continue;
dl->AddRectFilled(ImVec2(i*dpiScale,j*dpiScale),ImVec2((i+160)*dpiScale,(j+160)*dpiScale),ImGui::GetColorU32(ImVec4(r*0.25,g*0.25,b*0.25,1.0))); dl->AddRectFilled(ImVec2(i,j),ImVec2(i+160*dpiScale,j+160*dpiScale),ImGui::GetColorU32(ImVec4(r*0.25,g*0.25,b*0.25,1.0)));
} }
} }
skip=false; skip=false;
skip2=false; skip2=false;
for (int i=(-80-cos(double(aboutSin)*2*M_PI/120.0)*80.0)*2; i<scrW; i+=160) { for (int i=(-80-cos(double(aboutSin)*2*M_PI/120.0)*80.0)*2*dpiScale; i<canvasW; i+=160*dpiScale) {
skip2=!skip2; skip2=!skip2;
skip=skip2; skip=skip2;
for (int j=(-80-sin(double(aboutSin)*2*M_PI/150.0)*80.0)*2; j<scrH; j+=160) { for (int j=(-80-sin(double(aboutSin)*2*M_PI/150.0)*80.0)*2*dpiScale; j<canvasH; j+=160*dpiScale) {
skip=!skip; skip=!skip;
if (skip) continue; if (skip) continue;
dl->AddRectFilled(ImVec2(i*dpiScale,j*dpiScale),ImVec2((i+160)*dpiScale,(j+160)*dpiScale),ImGui::GetColorU32(ImVec4(r*0.5,g*0.5,b*0.5,1.0))); dl->AddRectFilled(ImVec2(i,j),ImVec2(i+160*dpiScale,j+160*dpiScale),ImGui::GetColorU32(ImVec4(r*0.5,g*0.5,b*0.5,1.0)));
} }
} }
skip=false; skip=false;
skip2=false; skip2=false;
for (int i=(-160+fmod(aboutSin*2,160))*2; i<scrW; i+=160) { for (int i=(-160+fmod(aboutSin*2,160))*2*dpiScale; i<canvasW; i+=160*dpiScale) {
skip2=!skip2; skip2=!skip2;
skip=skip2; skip=skip2;
for (int j=(-240-cos(double(aboutSin*M_PI/300.0))*240.0)*2; j<scrH; j+=160) { for (int j=(-240-cos(double(aboutSin*M_PI/300.0))*240.0)*2*dpiScale; j<canvasH; j+=160*dpiScale) {
skip=!skip; skip=!skip;
if (skip) continue; if (skip) continue;
dl->AddRectFilled(ImVec2(i*dpiScale,j*dpiScale),ImVec2((i+160)*dpiScale,(j+160)*dpiScale),ImGui::GetColorU32(ImVec4(r*0.75,g*0.75,b*0.75,1.0))); dl->AddRectFilled(ImVec2(i,j),ImVec2(i+160*dpiScale,j+160*dpiScale),ImGui::GetColorU32(ImVec4(r*0.75,g*0.75,b*0.75,1.0)));
} }
} }
for (size_t i=0; i<aboutCount; i++) { for (size_t i=0; i<aboutCount; i++) {
double posX=(scrW*dpiScale/2.0)+(sin(double(i)*0.5+double(aboutScroll)/90.0)*120*dpiScale)-(ImGui::CalcTextSize(aboutLine[i]).x*0.5); double posX=(canvasW/2.0)+(sin(double(i)*0.5+double(aboutScroll)/(90.0*dpiScale))*120*dpiScale)-(ImGui::CalcTextSize(aboutLine[i]).x*0.5);
double posY=(scrH-aboutScroll+42*i)*dpiScale; double posY=(canvasH-aboutScroll+42*i*dpiScale);
if (posY<-80*dpiScale || posY>scrH*dpiScale) continue; if (posY<-80*dpiScale || posY>canvasH) continue;
dl->AddText(bigFont,bigFont->FontSize, dl->AddText(bigFont,bigFont->FontSize,
ImVec2(posX+dpiScale,posY+dpiScale), ImVec2(posX+dpiScale,posY+dpiScale),
0xff000000,aboutLine[i]); 0xff000000,aboutLine[i]);
@ -257,12 +252,12 @@ void FurnaceGUI::drawAbout() {
float timeScale=60.0f*ImGui::GetIO().DeltaTime; float timeScale=60.0f*ImGui::GetIO().DeltaTime;
aboutHue+=(0.001+peakMix*0.004)*timeScale; aboutHue+=(0.001+peakMix*0.004)*timeScale;
aboutScroll+=(2+(peakMix>0.78)*3)*timeScale; aboutScroll+=(2+(peakMix>0.78)*3)*timeScale*dpiScale;
aboutSin+=(1+(peakMix>0.75)*2)*timeScale; aboutSin+=(1+(peakMix>0.75)*2)*timeScale;
while (aboutHue>1) aboutHue--; while (aboutHue>1) aboutHue--;
while (aboutSin>=2400) aboutSin-=2400; while (aboutSin>=2400) aboutSin-=2400;
if (aboutScroll>(42*aboutCount+scrH)) aboutScroll=-20; if (aboutScroll>(42*dpiScale*aboutCount+canvasH)) aboutScroll=-20*dpiScale;
WAKE_UP; WAKE_UP;
} }

View file

@ -109,7 +109,7 @@ void FurnaceGUI::drawChanOsc() {
nextWindow=GUI_WINDOW_NOTHING; nextWindow=GUI_WINDOW_NOTHING;
} }
if (!chanOscOpen) return; if (!chanOscOpen) return;
ImGui::SetNextWindowSizeConstraints(ImVec2(64.0f*dpiScale,32.0f*dpiScale),ImVec2(scrW*dpiScale,scrH*dpiScale)); ImGui::SetNextWindowSizeConstraints(ImVec2(64.0f*dpiScale,32.0f*dpiScale),ImVec2(canvasW,canvasH));
if (ImGui::Begin("Oscilloscope (per-channel)",&chanOscOpen,globalWinFlags|((chanOscOptions)?0:ImGuiWindowFlags_NoTitleBar))) { if (ImGui::Begin("Oscilloscope (per-channel)",&chanOscOpen,globalWinFlags|((chanOscOptions)?0:ImGuiWindowFlags_NoTitleBar))) {
bool centerSettingReset=false; bool centerSettingReset=false;
ImDrawList* dl=ImGui::GetWindowDrawList(); ImDrawList* dl=ImGui::GetWindowDrawList();

View file

@ -42,7 +42,7 @@ void FurnaceGUI::drawDebug() {
nextWindow=GUI_WINDOW_NOTHING; nextWindow=GUI_WINDOW_NOTHING;
} }
if (!debugOpen) return; if (!debugOpen) return;
ImGui::SetNextWindowSizeConstraints(ImVec2(400.0f*dpiScale,200.0f*dpiScale),ImVec2(scrW*dpiScale,scrH*dpiScale)); ImGui::SetNextWindowSizeConstraints(ImVec2(400.0f*dpiScale,200.0f*dpiScale),ImVec2(canvasW,canvasH));
if (ImGui::Begin("Debug",&debugOpen,globalWinFlags|ImGuiWindowFlags_NoDocking)) { if (ImGui::Begin("Debug",&debugOpen,globalWinFlags|ImGuiWindowFlags_NoDocking)) {
ImGui::Text("NOTE: use with caution."); ImGui::Text("NOTE: use with caution.");
if (ImGui::TreeNode("Debug Controls")) { if (ImGui::TreeNode("Debug Controls")) {

View file

@ -38,8 +38,8 @@ void FurnaceGUI::drawMobileControls() {
mobileMenuPos=0.0f; 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::SetNextWindowPos(portrait?ImVec2(0.0f,((1.0-mobileMenuPos*0.65)*canvasH)-(0.16*canvasW)):ImVec2(0.5*canvasW*mobileMenuPos,0.0f));
ImGui::SetNextWindowSize(portrait?ImVec2(scrW*dpiScale,0.16*scrW*dpiScale):ImVec2(0.16*scrH*dpiScale,scrH*dpiScale)); ImGui::SetNextWindowSize(portrait?ImVec2(canvasW,0.16*canvasW):ImVec2(0.16*canvasH,canvasH));
if (ImGui::Begin("Mobile Controls",NULL,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags)) { if (ImGui::Begin("Mobile Controls",NULL,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags)) {
float avail=portrait?ImGui::GetContentRegionAvail().y:ImGui::GetContentRegionAvail().x; float avail=portrait?ImGui::GetContentRegionAvail().y:ImGui::GetContentRegionAvail().x;
ImVec2 buttonSize=ImVec2(avail,avail); ImVec2 buttonSize=ImVec2(avail,avail);
@ -101,8 +101,8 @@ void FurnaceGUI::drawMobileControls() {
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::SetNextWindowPos(portrait?ImVec2(0.0f,((1.0-mobileMenuPos*0.65)*canvasH)):ImVec2(0.5*canvasW*(mobileMenuPos-1.0),0.0f));
ImGui::SetNextWindowSize(portrait?ImVec2(scrW*dpiScale,0.65*scrH*dpiScale):ImVec2(0.5*scrW*dpiScale,scrH*dpiScale)); ImGui::SetNextWindowSize(portrait?ImVec2(canvasW,0.65*canvasH):ImVec2(0.5*canvasW,canvasH));
if (ImGui::Begin("Mobile Menu",NULL,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags)) { if (ImGui::Begin("Mobile Menu",NULL,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags)) {
if (ImGui::BeginTable("SceneSel",5)) { if (ImGui::BeginTable("SceneSel",5)) {
ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthStretch,1.0f); ImGui::TableSetupColumn("c0",ImGuiTableColumnFlags_WidthStretch,1.0f);

View file

@ -9,7 +9,7 @@ void FurnaceGUI::drawEffectList() {
nextWindow=GUI_WINDOW_NOTHING; nextWindow=GUI_WINDOW_NOTHING;
} }
if (!effectListOpen) return; if (!effectListOpen) return;
ImGui::SetNextWindowSizeConstraints(ImVec2(60.0f*dpiScale,20.0f*dpiScale),ImVec2(scrW*dpiScale,scrH*dpiScale)); ImGui::SetNextWindowSizeConstraints(ImVec2(60.0f*dpiScale,20.0f*dpiScale),ImVec2(canvasW,canvasH));
if (ImGui::Begin("Effect List",&effectListOpen,globalWinFlags)) { if (ImGui::Begin("Effect List",&effectListOpen,globalWinFlags)) {
ImGui::Text("Chip at cursor: %s",e->getSystemName(e->sysOfChan[cursor.xCoarse])); ImGui::Text("Chip at cursor: %s",e->getSystemName(e->sysOfChan[cursor.xCoarse]));
if (ImGui::BeginTable("effectList",2)) { if (ImGui::BeginTable("effectList",2)) {

View file

@ -494,7 +494,7 @@ void FurnaceGUI::drawFindReplace() {
nextWindow=GUI_WINDOW_NOTHING; nextWindow=GUI_WINDOW_NOTHING;
} }
if (!findOpen) return; if (!findOpen) return;
ImGui::SetNextWindowSizeConstraints(ImVec2(64.0f*dpiScale,32.0f*dpiScale),ImVec2(scrW*dpiScale,scrH*dpiScale)); ImGui::SetNextWindowSizeConstraints(ImVec2(64.0f*dpiScale,32.0f*dpiScale),ImVec2(canvasW,canvasH));
if (ImGui::Begin("Find/Replace",&findOpen,globalWinFlags)) { if (ImGui::Begin("Find/Replace",&findOpen,globalWinFlags)) {
if (curQuery.empty()) { if (curQuery.empty()) {
curQuery.push_back(FurnaceGUIFindQuery()); curQuery.push_back(FurnaceGUIFindQuery());

View file

@ -2751,12 +2751,8 @@ void FurnaceGUI::processPoint(SDL_Event& ev) {
TouchPoint* point=NULL; TouchPoint* point=NULL;
FIND_POINT(point,-1); FIND_POINT(point,-1);
if (point!=NULL) { if (point!=NULL) {
point->x=ev.motion.x; point->x=(double)ev.motion.x*((double)canvasW/(double)scrW);
point->y=ev.motion.y; point->y=(double)ev.motion.y*((double)canvasH/(double)scrH);
#ifdef __APPLE__
point->x*=dpiScale;
point->y*=dpiScale;
#endif
} }
break; break;
} }
@ -2797,8 +2793,8 @@ void FurnaceGUI::processPoint(SDL_Event& ev) {
if (point!=NULL) { if (point!=NULL) {
float prevX=point->x; float prevX=point->x;
float prevY=point->y; float prevY=point->y;
point->x=ev.tfinger.x*scrW*dpiScale; point->x=ev.tfinger.x*canvasW;
point->y=ev.tfinger.y*scrH*dpiScale; point->y=ev.tfinger.y*canvasH;
point->z=ev.tfinger.pressure; point->z=ev.tfinger.pressure;
if (point->id==0) { if (point->id==0) {
@ -2817,7 +2813,7 @@ void FurnaceGUI::processPoint(SDL_Event& ev) {
break; break;
} }
} }
TouchPoint newPoint(ev.tfinger.fingerId,ev.tfinger.x*scrW*dpiScale,ev.tfinger.y*scrH*dpiScale,ev.tfinger.pressure); TouchPoint newPoint(ev.tfinger.fingerId,ev.tfinger.x*canvasW,ev.tfinger.y*canvasH,ev.tfinger.pressure);
activePoints.push_back(newPoint); activePoints.push_back(newPoint);
pressedPoints.push_back(newPoint); pressedPoints.push_back(newPoint);
@ -2983,16 +2979,10 @@ bool FurnaceGUI::loop() {
if (!doThreadedInput) processEvent(&ev); if (!doThreadedInput) processEvent(&ev);
switch (ev.type) { switch (ev.type) {
case SDL_MOUSEMOTION: { case SDL_MOUSEMOTION: {
int motionX=ev.motion.x; int motionX=(double)ev.motion.x*((double)canvasW/(double)scrW);
int motionY=ev.motion.y; int motionY=(double)ev.motion.y*((double)canvasH/(double)scrH);
int motionXrel=ev.motion.xrel; int motionXrel=(double)ev.motion.xrel*((double)canvasW/(double)scrW);
int motionYrel=ev.motion.yrel; int motionYrel=(double)ev.motion.yrel*((double)canvasH/(double)scrH);
#ifdef __APPLE__
motionX*=dpiScale;
motionY*=dpiScale;
motionXrel*=dpiScale;
motionYrel*=dpiScale;
#endif
pointMotion(motionX,motionY,motionXrel,motionYrel); pointMotion(motionX,motionY,motionXrel,motionYrel);
break; break;
} }
@ -3009,13 +2999,8 @@ bool FurnaceGUI::loop() {
case SDL_WINDOWEVENT: case SDL_WINDOWEVENT:
switch (ev.window.event) { switch (ev.window.event) {
case SDL_WINDOWEVENT_RESIZED: case SDL_WINDOWEVENT_RESIZED:
#ifdef __APPLE__
scrW=ev.window.data1; scrW=ev.window.data1;
scrH=ev.window.data2; scrH=ev.window.data2;
#else
scrW=ev.window.data1/dpiScale;
scrH=ev.window.data2/dpiScale;
#endif
portrait=(scrW<scrH); portrait=(scrW<scrH);
logV("portrait: %d (%dx%d)",portrait,scrW,scrH); logV("portrait: %d (%dx%d)",portrait,scrW,scrH);
updateWindow=true; updateWindow=true;
@ -3095,6 +3080,9 @@ bool FurnaceGUI::loop() {
scrConfW=scrW; scrConfW=scrW;
scrConfH=scrH; scrConfH=scrH;
} }
// update canvas size as well
SDL_GetRendererOutputSize(sdlRend,&canvasW,&canvasH);
} }
wantCaptureKeyboard=ImGui::GetIO().WantTextInput; wantCaptureKeyboard=ImGui::GetIO().WantTextInput;
@ -3773,10 +3761,10 @@ bool FurnaceGUI::loop() {
firstFrame=false; firstFrame=false;
#ifdef IS_MOBILE #ifdef IS_MOBILE
SDL_GetWindowSize(sdlWin,&scrW,&scrH); SDL_GetWindowSize(sdlWin,&scrW,&scrH);
scrW/=dpiScale;
scrH/=dpiScale;
portrait=(scrW<scrH); portrait=(scrW<scrH);
logV("portrait: %d (%dx%d)",portrait,scrW,scrH); logV("portrait: %d (%dx%d)",portrait,scrW,scrH);
SDL_GetRendererOutputSize(sdlRend,&canvasW,&canvasH);
#endif #endif
if (patternOpen) nextWindow=GUI_WINDOW_PATTERN; if (patternOpen) nextWindow=GUI_WINDOW_PATTERN;
#ifdef __APPLE__ #ifdef __APPLE__
@ -3794,12 +3782,12 @@ bool FurnaceGUI::loop() {
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
ImDrawList* dl=ImGui::GetForegroundDrawList(); ImDrawList* dl=ImGui::GetForegroundDrawList();
dl->AddRectFilled(ImVec2(0.0f,0.0f),ImVec2(scrW*dpiScale,scrH*dpiScale),ImGui::ColorConvertFloat4ToU32(uiColors[GUI_COLOR_MODAL_BACKDROP])); dl->AddRectFilled(ImVec2(0.0f,0.0f),ImVec2(canvasW,canvasH),ImGui::ColorConvertFloat4ToU32(uiColors[GUI_COLOR_MODAL_BACKDROP]));
ImGui::EndPopup(); ImGui::EndPopup();
} }
#endif #endif
if (fileDialog->render(ImVec2(600.0f*dpiScale,400.0f*dpiScale),ImVec2(scrW*dpiScale,scrH*dpiScale))) { if (fileDialog->render(ImVec2(600.0f*dpiScale,400.0f*dpiScale),ImVec2(canvasW,canvasH))) {
bool openOpen=false; bool openOpen=false;
//ImGui::GetIO().ConfigFlags&=~ImGuiConfigFlags_NavEnableKeyboard; //ImGui::GetIO().ConfigFlags&=~ImGuiConfigFlags_NavEnableKeyboard;
if ((curFileDialog==GUI_FILE_INS_OPEN || curFileDialog==GUI_FILE_INS_OPEN_REPLACE) && prevIns!=-3) { if ((curFileDialog==GUI_FILE_INS_OPEN || curFileDialog==GUI_FILE_INS_OPEN_REPLACE) && prevIns!=-3) {
@ -4345,9 +4333,9 @@ bool FurnaceGUI::loop() {
ImGui::EndPopup(); ImGui::EndPopup();
} }
ImGui::SetNextWindowSizeConstraints(ImVec2(400.0f*dpiScale,200.0f*dpiScale),ImVec2(scrW*dpiScale,scrH*dpiScale)); ImGui::SetNextWindowSizeConstraints(ImVec2(400.0f*dpiScale,200.0f*dpiScale),ImVec2(canvasW,canvasH));
if (ImGui::BeginPopupModal("New Song",NULL,ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoScrollWithMouse|ImGuiWindowFlags_NoScrollbar)) { if (ImGui::BeginPopupModal("New Song",NULL,ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoScrollWithMouse|ImGuiWindowFlags_NoScrollbar)) {
ImGui::SetWindowPos(ImVec2(((scrW*dpiScale)-ImGui::GetWindowSize().x)*0.5,((scrH*dpiScale)-ImGui::GetWindowSize().y)*0.5)); ImGui::SetWindowPos(ImVec2(((canvasW)-ImGui::GetWindowSize().x)*0.5,((canvasH)-ImGui::GetWindowSize().y)*0.5));
drawNewSong(); drawNewSong();
ImGui::EndPopup(); ImGui::EndPopup();
} }
@ -4715,8 +4703,8 @@ bool FurnaceGUI::loop() {
} }
bool anySelected=false; bool anySelected=false;
float sizeY=ImGui::GetFrameHeightWithSpacing()*pendingIns.size(); float sizeY=ImGui::GetFrameHeightWithSpacing()*pendingIns.size();
if (sizeY>(scrH-180.0)*dpiScale) { if (sizeY>(canvasH-180.0*dpiScale)) {
sizeY=(scrH-180.0)*dpiScale; sizeY=canvasH-180.0*dpiScale;
if (sizeY<60.0*dpiScale) sizeY=60.0*dpiScale; if (sizeY<60.0*dpiScale) sizeY=60.0*dpiScale;
} }
if (ImGui::BeginTable("PendingInsList",1,ImGuiTableFlags_ScrollY,ImVec2(0.0f,sizeY))) { if (ImGui::BeginTable("PendingInsList",1,ImGuiTableFlags_ScrollY,ImVec2(0.0f,sizeY))) {
@ -5077,7 +5065,7 @@ bool FurnaceGUI::init() {
canvasH=scrH; canvasH=scrH;
} }
#if !defined(__APPLE__) && !defined(IS_MOBILE) #ifndef IS_MOBILE
SDL_Rect displaySize; SDL_Rect displaySize;
#endif #endif
@ -5098,6 +5086,7 @@ bool FurnaceGUI::init() {
return false; return false;
} }
#ifndef IS_MOBILE
if (SDL_GetDisplayUsableBounds(SDL_GetWindowDisplayIndex(sdlWin),&displaySize)==0) { if (SDL_GetDisplayUsableBounds(SDL_GetWindowDisplayIndex(sdlWin),&displaySize)==0) {
bool mustChange=false; bool mustChange=false;
if (scrW>((displaySize.w)-48) && scrH>((displaySize.h)-64)) { if (scrW>((displaySize.w)-48) && scrH>((displaySize.h)-64)) {
@ -5122,6 +5111,7 @@ bool FurnaceGUI::init() {
} }
} }
} }
#endif
#ifdef IS_MOBILE #ifdef IS_MOBILE
SDL_GetWindowSize(sdlWin,&scrW,&scrH); SDL_GetWindowSize(sdlWin,&scrW,&scrH);

View file

@ -1903,12 +1903,12 @@ void FurnaceGUI::drawInsEdit() {
} }
if (!insEditOpen) return; if (!insEditOpen) return;
if (mobileUI) { if (mobileUI) {
patWindowPos=(portrait?ImVec2(0.0f,(mobileMenuPos*-0.65*scrH*dpiScale)):ImVec2((0.16*scrH*dpiScale)+0.5*scrW*dpiScale*mobileMenuPos,0.0f)); patWindowPos=(portrait?ImVec2(0.0f,(mobileMenuPos*-0.65*canvasH)):ImVec2((0.16*canvasH)+0.5*canvasW*mobileMenuPos,0.0f));
patWindowSize=(portrait?ImVec2(scrW*dpiScale,scrH*dpiScale-(0.16*scrW*dpiScale)-(pianoOpen?(0.4*scrW*dpiScale):0.0f)):ImVec2(scrW*dpiScale-(0.16*scrH*dpiScale),scrH*dpiScale-(pianoOpen?(0.3*scrH*dpiScale):0.0f))); patWindowSize=(portrait?ImVec2(canvasW,canvasH-(0.16*canvasW)-(pianoOpen?(0.4*canvasW):0.0f)):ImVec2(canvasW-(0.16*canvasH),canvasH-(pianoOpen?(0.3*canvasH):0.0f)));
ImGui::SetNextWindowPos(patWindowPos); ImGui::SetNextWindowPos(patWindowPos);
ImGui::SetNextWindowSize(patWindowSize); ImGui::SetNextWindowSize(patWindowSize);
} else { } else {
ImGui::SetNextWindowSizeConstraints(ImVec2(440.0f*dpiScale,400.0f*dpiScale),ImVec2(scrW*dpiScale,scrH*dpiScale)); ImGui::SetNextWindowSizeConstraints(ImVec2(440.0f*dpiScale,400.0f*dpiScale),ImVec2(canvasW,canvasH));
} }
if (ImGui::Begin("Instrument Editor",&insEditOpen,globalWinFlags|(settings.allowEditDocking?0:ImGuiWindowFlags_NoDocking))) { if (ImGui::Begin("Instrument Editor",&insEditOpen,globalWinFlags|(settings.allowEditDocking?0:ImGuiWindowFlags_NoDocking))) {
if (curIns<0 || curIns>=(int)e->song.ins.size()) { if (curIns<0 || curIns>=(int)e->song.ins.size()) {

View file

@ -27,7 +27,7 @@ void FurnaceGUI::drawMixer() {
nextWindow=GUI_WINDOW_NOTHING; nextWindow=GUI_WINDOW_NOTHING;
} }
if (!mixerOpen) return; if (!mixerOpen) return;
ImGui::SetNextWindowSizeConstraints(ImVec2(400.0f*dpiScale,200.0f*dpiScale),ImVec2(scrW*dpiScale,scrH*dpiScale)); ImGui::SetNextWindowSizeConstraints(ImVec2(400.0f*dpiScale,200.0f*dpiScale),ImVec2(canvasW,canvasH));
if (ImGui::Begin("Mixer",&mixerOpen,globalWinFlags|(settings.allowEditDocking?0:ImGuiWindowFlags_NoDocking))) { if (ImGui::Begin("Mixer",&mixerOpen,globalWinFlags|(settings.allowEditDocking?0:ImGuiWindowFlags_NoDocking))) {
char id[32]; char id[32];
if (ImGui::SliderFloat("Master Volume",&e->song.masterVol,0,3,"%.2fx")) { if (ImGui::SliderFloat("Master Volume",&e->song.masterVol,0,3,"%.2fx")) {

View file

@ -84,7 +84,7 @@ void FurnaceGUI::drawOsc() {
nextWindow=GUI_WINDOW_NOTHING; nextWindow=GUI_WINDOW_NOTHING;
} }
if (!oscOpen) return; if (!oscOpen) return;
ImGui::SetNextWindowSizeConstraints(ImVec2(64.0f*dpiScale,32.0f*dpiScale),ImVec2(scrW*dpiScale,scrH*dpiScale)); ImGui::SetNextWindowSizeConstraints(ImVec2(64.0f*dpiScale,32.0f*dpiScale),ImVec2(canvasW,canvasH));
if (settings.oscTakesEntireWindow) { if (settings.oscTakesEntireWindow) {
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding,ImVec2(0,0)); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding,ImVec2(0,0));
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing,ImVec2(0,0)); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing,ImVec2(0,0));

View file

@ -376,8 +376,8 @@ void FurnaceGUI::drawPattern() {
} }
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding,ImVec2(0.0f,0.0f)); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding,ImVec2(0.0f,0.0f));
if (mobileUI) { if (mobileUI) {
patWindowPos=(portrait?ImVec2(0.0f,(mobileMenuPos*-0.65*scrH*dpiScale)):ImVec2((0.16*scrH*dpiScale)+0.5*scrW*dpiScale*mobileMenuPos,0.0f)); patWindowPos=(portrait?ImVec2(0.0f,(mobileMenuPos*-0.65*canvasH)):ImVec2((0.16*canvasH)+0.5*canvasW*mobileMenuPos,0.0f));
patWindowSize=(portrait?ImVec2(scrW*dpiScale,scrH*dpiScale-(0.16*scrW*dpiScale)-(pianoOpen?(0.4*scrW*dpiScale):0.0f)):ImVec2(scrW*dpiScale-(0.16*scrH*dpiScale),scrH*dpiScale-(pianoOpen?(0.3*scrH*dpiScale):0.0f))); patWindowSize=(portrait?ImVec2(canvasW,canvasH-(0.16*canvasW)-(pianoOpen?(0.4*canvasW):0.0f)):ImVec2(canvasW-(0.16*canvasH),canvasH-(pianoOpen?(0.3*canvasH):0.0f)));
ImGui::SetNextWindowPos(patWindowPos); ImGui::SetNextWindowPos(patWindowPos);
ImGui::SetNextWindowSize(patWindowSize); ImGui::SetNextWindowSize(patWindowSize);
} }

View file

@ -54,7 +54,7 @@ void FurnaceGUI::drawPiano() {
if (!pianoOpen) return; if (!pianoOpen) return;
if (mobileUI) { if (mobileUI) {
ImGui::SetNextWindowPos(ImVec2(patWindowPos.x,patWindowPos.y+patWindowSize.y)); ImGui::SetNextWindowPos(ImVec2(patWindowPos.x,patWindowPos.y+patWindowSize.y));
ImGui::SetNextWindowSize(portrait?ImVec2(scrW*dpiScale,0.4*scrW*dpiScale):ImVec2(scrW*dpiScale-(0.16*scrH*dpiScale),0.3*scrH*dpiScale)); ImGui::SetNextWindowSize(portrait?ImVec2(canvasW,0.4*canvasW):ImVec2(canvasW-(0.16*canvasH),0.3*canvasH));
} }
if (ImGui::Begin("Piano",&pianoOpen,((pianoOptions)?0:ImGuiWindowFlags_NoTitleBar)|ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags)) { if (ImGui::Begin("Piano",&pianoOpen,((pianoOptions)?0:ImGuiWindowFlags_NoTitleBar)|ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags)) {
bool oldPianoKeyPressed[180]; bool oldPianoKeyPressed[180];

View file

@ -39,8 +39,8 @@ void FurnaceGUI::drawSampleEdit() {
} }
if (!sampleEditOpen) return; if (!sampleEditOpen) return;
if (mobileUI) { if (mobileUI) {
patWindowPos=(portrait?ImVec2(0.0f,(mobileMenuPos*-0.65*scrH*dpiScale)):ImVec2((0.16*scrH*dpiScale)+0.5*scrW*dpiScale*mobileMenuPos,0.0f)); patWindowPos=(portrait?ImVec2(0.0f,(mobileMenuPos*-0.65*canvasH)):ImVec2((0.16*canvasH)+0.5*canvasW*mobileMenuPos,0.0f));
patWindowSize=(portrait?ImVec2(scrW*dpiScale,scrH*dpiScale-(0.16*scrW*dpiScale)-(pianoOpen?(0.4*scrW*dpiScale):0.0f)):ImVec2(scrW*dpiScale-(0.16*scrH*dpiScale),scrH*dpiScale-(pianoOpen?(0.3*scrH*dpiScale):0.0f))); patWindowSize=(portrait?ImVec2(canvasW,canvasH-(0.16*canvasW)-(pianoOpen?(0.4*canvasW):0.0f)):ImVec2(canvasW-(0.16*canvasH),canvasH-(pianoOpen?(0.3*canvasH):0.0f)));
ImGui::SetNextWindowPos(patWindowPos); ImGui::SetNextWindowPos(patWindowPos);
ImGui::SetNextWindowSize(patWindowSize); ImGui::SetNextWindowSize(patWindowSize);
} }

View file

@ -11,7 +11,7 @@ void FurnaceGUI::drawSubSongs() {
nextWindow=GUI_WINDOW_NOTHING; nextWindow=GUI_WINDOW_NOTHING;
} }
if (!subSongsOpen) return; if (!subSongsOpen) return;
ImGui::SetNextWindowSizeConstraints(ImVec2(64.0f*dpiScale,32.0f*dpiScale),ImVec2(scrW*dpiScale,scrH*dpiScale)); ImGui::SetNextWindowSizeConstraints(ImVec2(64.0f*dpiScale,32.0f*dpiScale),ImVec2(canvasW,canvasH));
if (ImGui::Begin("Subsongs",&subSongsOpen,globalWinFlags)) { if (ImGui::Begin("Subsongs",&subSongsOpen,globalWinFlags)) {
char id[1024]; char id[1024];
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0f-ImGui::GetStyle().ItemSpacing.x); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x-ImGui::GetFrameHeightWithSpacing()*2.0f-ImGui::GetStyle().ItemSpacing.x);

View file

@ -28,7 +28,7 @@ void FurnaceGUI::drawVolMeter() {
} }
if (!volMeterOpen) return; if (!volMeterOpen) return;
if (--isClipping<0) isClipping=0; if (--isClipping<0) isClipping=0;
ImGui::SetNextWindowSizeConstraints(ImVec2(6.0f*dpiScale,6.0f*dpiScale),ImVec2(scrW*dpiScale,scrH*dpiScale)); ImGui::SetNextWindowSizeConstraints(ImVec2(6.0f*dpiScale,6.0f*dpiScale),ImVec2(canvasW,canvasH));
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding,ImVec2(0,0)); ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding,ImVec2(0,0));
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,ImVec2(0,0)); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding,ImVec2(0,0));
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing,ImVec2(0,0)); ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing,ImVec2(0,0));

View file

@ -177,12 +177,12 @@ void FurnaceGUI::drawWaveEdit() {
if (!waveEditOpen) return; if (!waveEditOpen) return;
float wavePreview[257]; float wavePreview[257];
if (mobileUI) { if (mobileUI) {
patWindowPos=(portrait?ImVec2(0.0f,(mobileMenuPos*-0.65*scrH*dpiScale)):ImVec2((0.16*scrH*dpiScale)+0.5*scrW*dpiScale*mobileMenuPos,0.0f)); patWindowPos=(portrait?ImVec2(0.0f,(mobileMenuPos*-0.65*canvasH)):ImVec2((0.16*canvasH)+0.5*canvasW*mobileMenuPos,0.0f));
patWindowSize=(portrait?ImVec2(scrW*dpiScale,scrH*dpiScale-(0.16*scrW*dpiScale)-(pianoOpen?(0.4*scrW*dpiScale):0.0f)):ImVec2(scrW*dpiScale-(0.16*scrH*dpiScale),scrH*dpiScale-(pianoOpen?(0.3*scrH*dpiScale):0.0f))); patWindowSize=(portrait?ImVec2(canvasW,canvasH-(0.16*canvasW)-(pianoOpen?(0.4*canvasW):0.0f)):ImVec2(canvasW-(0.16*canvasH),canvasH-(pianoOpen?(0.3*canvasH):0.0f)));
ImGui::SetNextWindowPos(patWindowPos); ImGui::SetNextWindowPos(patWindowPos);
ImGui::SetNextWindowSize(patWindowSize); ImGui::SetNextWindowSize(patWindowSize);
} else { } else {
ImGui::SetNextWindowSizeConstraints(ImVec2(300.0f*dpiScale,300.0f*dpiScale),ImVec2(scrW*dpiScale,scrH*dpiScale)); ImGui::SetNextWindowSizeConstraints(ImVec2(300.0f*dpiScale,300.0f*dpiScale),ImVec2(canvasW,canvasH));
} }
if (ImGui::Begin("Wavetable Editor",&waveEditOpen,globalWinFlags|(settings.allowEditDocking?0:ImGuiWindowFlags_NoDocking))) { if (ImGui::Begin("Wavetable Editor",&waveEditOpen,globalWinFlags|(settings.allowEditDocking?0:ImGuiWindowFlags_NoDocking))) {
if (curWave<0 || curWave>=(int)e->song.wave.size()) { if (curWave<0 || curWave>=(int)e->song.wave.size()) {