diff --git a/source/code/levelselect.cpp b/source/code/levelselect.cpp index 8a193f9..12b9c66 100644 --- a/source/code/levelselect.cpp +++ b/source/code/levelselect.cpp @@ -47,7 +47,7 @@ static sago::SagoTextField* getCachedText(const std::string& text) { } static void Write(SDL_Renderer* target, int x, int y, const char* text) { - getCachedText(text)->Draw(target, x, y); + getCachedText(text)->Draw(target, x, y, sago::SagoTextField::Alignment::left, sago::SagoTextField::VerticalAlignment::top, &globalData.logicalResize); } //The function that allows the player to choose PuzzleLevel @@ -80,7 +80,10 @@ int PuzzleLevelSelect(int Type) { SDL_Delay(1); auto ticks = SDL_GetTicks(); DrawBackground(globalData.screen); - globalData.iCheckBoxArea.Draw(globalData.screen,ticks,xplace,yplace); + int mousex; + int mousey; + globalData.logicalResize.PhysicalToLogical(globalData.mousex, globalData.mousey, mousex, mousey); + globalData.iCheckBoxArea.Draw(globalData.screen,ticks,xplace,yplace, &globalData.logicalResize); if (Type == 0) { Write(globalData.screen, xplace+12,yplace+2,_("Select Puzzle") ); } @@ -89,21 +92,22 @@ int PuzzleLevelSelect(int Type) { } //Now drow the fields you click in (and a V if clicked): for (int i = 0; i < nrOfLevels; i++) { - globalData.iLevelCheckBox.Draw(globalData.screen, ticks, xplace+10+(i%10)*50, yplace+60+(i/10)*50); + globalData.iLevelCheckBox.Draw(globalData.screen, ticks, xplace+10+(i%10)*50, yplace+60+(i/10)*50, &globalData.logicalResize); if (i==selected) { - globalData.iLevelCheckBoxMarked.Draw(globalData.screen, ticks, xplace+10+(i%10)*50, yplace+60+(i/10)*50); + globalData.iLevelCheckBoxMarked.Draw(globalData.screen, ticks, xplace+10+(i%10)*50, yplace+60+(i/10)*50, &globalData.logicalResize); } if (Type == 0 && PuzzleIsCleared(i)) { - globalData.iLevelCheck.Draw(globalData.screen,ticks, xplace+10+(i%10)*50, yplace+60+(i/10)*50); + globalData.iLevelCheck.Draw(globalData.screen,ticks, xplace+10+(i%10)*50, yplace+60+(i/10)*50, &globalData.logicalResize); } if (Type == 1 && IsStageCleared(i)) { - globalData.iLevelCheck.Draw(globalData.screen, ticks, xplace+10+(i%10)*50, yplace+60+(i/10)*50); + globalData.iLevelCheck.Draw(globalData.screen, ticks, xplace+10+(i%10)*50, yplace+60+(i/10)*50, &globalData.logicalResize); } } SDL_Event event; while ( SDL_PollEvent(&event) ) { UpdateMouseCoordinates(event, globalData.mousex, globalData.mousey); + globalData.logicalResize.PhysicalToLogical(globalData.mousex, globalData.mousey, mousex, mousey); if ( event.type == SDL_QUIT ) { Config::getInstance()->setShuttingDown(5); @@ -146,25 +150,25 @@ int PuzzleLevelSelect(int Type) { SDL_GetKeyboardState(nullptr); - if (globalData.mousex != oldmousex || globalData.mousey != oldmousey) { + if (mousex != oldmousex || mousey != oldmousey) { int tmpSelected = -1; int j; for (j = 0; (tmpSelected == -1) && ( (jDoPaintJob(); themeTitle.SetText(fmt::format(_("Theme: {}"), globalData.theme.theme_name)); - themeTitle.Draw(target, 10, globalData.ysize-50,sago::SagoTextField::Alignment::left); + themeTitle.Draw(target, 10, globalData.ysize-50,sago::SagoTextField::Alignment::left, sago::SagoTextField::VerticalAlignment::top, &globalData.logicalResize); } };