fixed info message positioning

made image paths changeable without restart
This commit is contained in:
thrust26 2023-08-20 07:46:33 +02:00
parent 56d6cb8926
commit 6b38bc3f5a
4 changed files with 53 additions and 33 deletions

View File

@ -748,7 +748,8 @@ void FrameBuffer::drawFrameStats(float framesPerSecond)
myStatsMsg.w, color, TextAlign::Left, 0, true, kBGColor);
}
myStatsMsg.surface->setDstPos(imageRect().x() + 10, imageRect().y() + 8);
myStatsMsg.surface->setDstPos(imageRect().x() + imageRect().w() / 64,
imageRect().y() + imageRect().h() / 64);
myStatsMsg.surface->setDstSize(myStatsMsg.w * hidpiScaleFactor(),
myStatsMsg.h * hidpiScaleFactor());
myStatsMsg.surface->render();
@ -822,7 +823,7 @@ inline bool FrameBuffer::drawMessage()
// Draw the bounded box and text
const Common::Rect& dst = myMsg.surface->dstRect();
const int fontWidth = font().getMaxCharWidth(),
fontHeight = font().getFontHeight();
fontHeight = font().getFontHeight();
const int VBORDER = fontHeight / 4;
const int HBORDER = fontWidth * 1.25 / 2.0;
constexpr int BORDER = 1;

View File

@ -292,32 +292,6 @@ void OSystem::setConfigPaths()
buildDirIfRequired(myCfgDir, myBaseDir, "cfg");
#endif
#ifdef IMAGE_SUPPORT
const string_view ssSaveDir = mySettings->getString("snapsavedir");
if(ssSaveDir == EmptyString)
mySnapshotSaveDir = userDir();
else
mySnapshotSaveDir = FSNode(ssSaveDir);
if(!mySnapshotSaveDir.isDirectory())
mySnapshotSaveDir.makeDir();
const string_view ssLoadDir = mySettings->getString("snaploaddir");
if(ssLoadDir == EmptyString)
mySnapshotLoadDir = userDir();
else
mySnapshotLoadDir = FSNode(ssLoadDir);
if(!mySnapshotLoadDir.isDirectory())
mySnapshotLoadDir.makeDir();
const string_view bezelDir = mySettings->getString("bezeldir");
if(bezelDir == EmptyString)
myBezelDir = userDir();
else
myBezelDir = FSNode(bezelDir);
if(!myBezelDir.isDirectory())
myBezelDir.makeDir();
#endif
myCheatFile = myBaseDir; myCheatFile /= "stella.cht";
myPaletteFile = myBaseDir; myPaletteFile /= "stella.pal";
@ -333,11 +307,56 @@ void OSystem::setConfigPaths()
dbgPath("cfg dir ", myCfgDir);
dbgPath("ssave dir ", mySnapshotSaveDir);
dbgPath("sload dir ", mySnapshotLoadDir);
dbgPath("bezel dir ", myBezelDir);
dbgPath("cheat file", myCheatFile);
dbgPath("pal file ", myPaletteFile);
#endif
}
#ifdef IMAGE_SUPPORT
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const FSNode& OSystem::snapshotSaveDir()
{
const string_view ssSaveDir = mySettings->getString("snapsavedir");
if(ssSaveDir == EmptyString)
mySnapshotSaveDir = userDir();
else
mySnapshotSaveDir = FSNode(ssSaveDir);
if(!mySnapshotSaveDir.isDirectory())
mySnapshotSaveDir.makeDir();
return mySnapshotSaveDir;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const FSNode& OSystem::snapshotLoadDir()
{
const string_view ssLoadDir = mySettings->getString("snaploaddir");
if(ssLoadDir == EmptyString)
mySnapshotLoadDir = userDir();
else
mySnapshotLoadDir = FSNode(ssLoadDir);
if(!mySnapshotLoadDir.isDirectory())
mySnapshotLoadDir.makeDir();
return mySnapshotLoadDir;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const FSNode& OSystem::bezelDir()
{
const string_view bezelDir = mySettings->getString("bezeldir");
if(bezelDir == EmptyString)
myBezelDir = userDir();
else
myBezelDir = FSNode(bezelDir);
if(!myBezelDir.isDirectory())
myBezelDir.makeDir();
return myBezelDir;
}
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::setUserDir(string_view path)
{

View File

@ -306,9 +306,9 @@ class OSystem
Return the full/complete path name for saving snapshots, loading
launcher images and loading bezels.
*/
const FSNode& snapshotSaveDir() const { return mySnapshotSaveDir; }
const FSNode& snapshotLoadDir() const { return mySnapshotLoadDir; }
const FSNode& bezelDir() const { return myBezelDir; }
const FSNode& snapshotSaveDir();
const FSNode& snapshotLoadDir();
const FSNode& bezelDir();
#endif
/**

View File

@ -316,10 +316,10 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
// Add message concerning usage
xpos = HBORDER;
ypos = myTab->getHeight() - fontHeight - ifont.getFontHeight() - VGAP - VBORDER;
lwidth = ifont.getStringWidth("(*) Changes require an application restart");
lwidth = ifont.getStringWidth("(*) Changes may require an application restart");
new StaticTextWidget(myTab, ifont, xpos, ypos,
std::min(lwidth, _w - HBORDER * 2), ifont.getFontHeight(),
"(*) Changes require an application restart");
"(*) Changes may require an application restart");
// Add items for tab 1
addToFocusList(wid, myTab, tabID);