mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Made some improvements to the layout when running on a vertically oriented screen.
This commit is contained in:
parent
e663a717f0
commit
4dc4b9ef02
|
@ -203,7 +203,8 @@ void GuiAlternativeEmulators::selectorWindow(SystemData* system)
|
|||
// somewhat coherent regardless of screen type. The 1.778 aspect ratio value is the 16:9
|
||||
// reference.
|
||||
float aspectValue {1.778f / Renderer::getScreenAspectRatio()};
|
||||
float maxWidthModifier {glm::clamp(0.77f * aspectValue, 0.50f, 0.92f)};
|
||||
float maxWidthModifier {glm::clamp(0.77f * aspectValue, 0.50f,
|
||||
(Renderer::getIsVerticalOrientation() ? 0.94f : 0.92f))};
|
||||
float maxWidth {Renderer::getScreenWidth() * maxWidthModifier};
|
||||
|
||||
// Set the width of the selector window to the menu width, unless the system full name is
|
||||
|
|
|
@ -245,7 +245,7 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
|
|||
row.addElement(deleteCollection, true);
|
||||
row.addElement(bracketDeleteCollection, false);
|
||||
row.makeAcceptInputHandler([this, customSystems] {
|
||||
auto ss = new GuiSettings("SELECT COLLECTION TO DELETE");
|
||||
auto ss = new GuiSettings("COLLECTION TO DELETE");
|
||||
std::shared_ptr<OptionListComponent<std::string>> customCollections {
|
||||
std::make_shared<OptionListComponent<std::string>>(getHelpStyle(), "", true)};
|
||||
for (std::map<std::string, CollectionSystemData, StringComparator>::const_iterator it =
|
||||
|
@ -304,11 +304,8 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title)
|
|||
row.addElement(customCollection, true);
|
||||
ss->addRow(row);
|
||||
}
|
||||
// Make the menu slightly wider to fit the scroll indicators.
|
||||
glm::vec2 menuSize {ss->getMenuSize()};
|
||||
glm::vec3 menuPos {ss->getMenuPosition()};
|
||||
const float maxWidthModifier {mRenderer->getIsVerticalOrientation() ? 1.0f : 1.08f};
|
||||
ss->setMenuSize(glm::vec2 {menuSize.x * maxWidthModifier, menuSize.y});
|
||||
menuPos.x = (mRenderer->getScreenWidth() - ss->getMenuSize().x) / 2.0f;
|
||||
ss->setMenuPosition(menuPos);
|
||||
mWindow->pushGui(ss);
|
||||
|
|
|
@ -260,7 +260,9 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md,
|
|||
}
|
||||
|
||||
const float aspectValue {1.778f / mRenderer->getScreenAspectRatio()};
|
||||
const float maxWidthModifier {glm::clamp(0.64f * aspectValue, 0.42f, 0.92f)};
|
||||
const float maxWidthModifier {
|
||||
glm::clamp(0.64f * aspectValue, 0.42f,
|
||||
(mRenderer->getIsVerticalOrientation() ? 0.95f : 0.92f))};
|
||||
const float maxWidth {mRenderer->getScreenWidth() * maxWidthModifier};
|
||||
|
||||
s->setMenuSize(glm::vec2 {maxWidth, s->getMenuSize().y});
|
||||
|
@ -512,7 +514,9 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md,
|
|||
}
|
||||
|
||||
const float aspectValue {1.778f / mRenderer->getScreenAspectRatio()};
|
||||
const float maxWidthModifier {glm::clamp(0.64f * aspectValue, 0.42f, 0.92f)};
|
||||
const float maxWidthModifier {
|
||||
glm::clamp(0.64f * aspectValue, 0.42f,
|
||||
(mRenderer->getIsVerticalOrientation() ? 0.95f : 0.92f))};
|
||||
const float maxWidth {mRenderer->getScreenWidth() * maxWidthModifier};
|
||||
|
||||
s->setMenuSize(glm::vec2 {maxWidth, s->getMenuSize().y});
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
GuiOfflineGenerator::GuiOfflineGenerator(const std::queue<FileData*>& gameQueue)
|
||||
: mGameQueue {gameQueue}
|
||||
, mRenderer {Renderer::getInstance()}
|
||||
, mBackground {":/graphics/frame.svg"}
|
||||
, mGrid {glm::ivec2 {6, 13}}
|
||||
{
|
||||
|
@ -77,8 +78,10 @@ GuiOfflineGenerator::GuiOfflineGenerator(const std::queue<FileData*>& gameQueue)
|
|||
mGrid.setEntry(mOverwrittenVal, glm::ivec2 {2, 5}, false, true, glm::ivec2 {1, 1});
|
||||
|
||||
// Skipping label.
|
||||
mSkippedLbl = std::make_shared<TextComponent>("Skipped (existing):", Font::get(FONT_SIZE_SMALL),
|
||||
0x888888FF, ALIGN_LEFT);
|
||||
const std::string skipLabel {mRenderer->getIsVerticalOrientation() ? "Skipped:" :
|
||||
"Skipped (existing):"};
|
||||
mSkippedLbl = std::make_shared<TextComponent>(skipLabel, Font::get(FONT_SIZE_SMALL), 0x888888FF,
|
||||
ALIGN_LEFT);
|
||||
mGrid.setEntry(mSkippedLbl, glm::ivec2 {1, 6}, false, true, glm::ivec2 {1, 1});
|
||||
|
||||
// Skipping value/counter.
|
||||
|
@ -175,12 +178,13 @@ GuiOfflineGenerator::GuiOfflineGenerator(const std::queue<FileData*>& gameQueue)
|
|||
|
||||
// For narrower displays (e.g. in 4:3 ratio), allow the window to fill 95% of the screen
|
||||
// width rather than the 85% allowed for wider displays.
|
||||
float width {Renderer::getScreenWidth() *
|
||||
((Renderer::getScreenAspectRatio() < 1.4f) ? 0.95f : 0.85f)};
|
||||
float width {mRenderer->getScreenWidth() *
|
||||
((mRenderer->getScreenAspectRatio() < 1.4f) ? 0.95f : 0.85f)};
|
||||
|
||||
setSize(width, Renderer::getScreenHeight() * 0.75f);
|
||||
setPosition((Renderer::getScreenWidth() - mSize.x) / 2.0f,
|
||||
(Renderer::getScreenHeight() - mSize.y) / 2.0f);
|
||||
setSize(width,
|
||||
mRenderer->getScreenHeight() * (mRenderer->getIsVerticalOrientation() ? 0.52f : 0.75f));
|
||||
setPosition((mRenderer->getScreenWidth() - mSize.x) / 2.0f,
|
||||
(mRenderer->getScreenHeight() - mSize.y) / 2.0f);
|
||||
}
|
||||
|
||||
GuiOfflineGenerator::~GuiOfflineGenerator()
|
||||
|
@ -221,9 +225,11 @@ void GuiOfflineGenerator::onSizeChanged()
|
|||
|
||||
// Adjust the width slightly depending on the aspect ratio of the screen to make sure
|
||||
// that the label does not get abbreviated.
|
||||
if (Renderer::getScreenAspectRatio() <= 1.4f)
|
||||
mGrid.setColWidthPerc(3, 0.13f);
|
||||
else if (Renderer::getScreenAspectRatio() <= 1.6f)
|
||||
if (mRenderer->getIsVerticalOrientation())
|
||||
mGrid.setColWidthPerc(3, 0.17f);
|
||||
else if (mRenderer->getScreenAspectRatio() <= 1.4f)
|
||||
mGrid.setColWidthPerc(3, 0.14f);
|
||||
else if (mRenderer->getScreenAspectRatio() <= 1.6f)
|
||||
mGrid.setColWidthPerc(3, 0.12f);
|
||||
else
|
||||
mGrid.setColWidthPerc(3, 0.113f);
|
||||
|
|
|
@ -54,6 +54,7 @@ private:
|
|||
unsigned int mGamesSkipped;
|
||||
unsigned int mGamesFailed;
|
||||
|
||||
Renderer* mRenderer;
|
||||
NinePatchComponent mBackground;
|
||||
ComponentGrid mGrid;
|
||||
|
||||
|
|
|
@ -74,7 +74,10 @@ void ViewController::invalidSystemsFileDialog()
|
|||
quit.type = SDL_QUIT;
|
||||
SDL_PushEvent(&quit);
|
||||
},
|
||||
"", nullptr, "", nullptr, true));
|
||||
"", nullptr, "", nullptr, true, true,
|
||||
(mRenderer->getIsVerticalOrientation() ?
|
||||
0.85f :
|
||||
0.55f * (1.778f / mRenderer->getScreenAspectRatio()))));
|
||||
}
|
||||
|
||||
void ViewController::noGamesDialog()
|
||||
|
@ -120,7 +123,7 @@ void ViewController::noGamesDialog()
|
|||
"ROM DIRECTORY SETTING SAVED, RESTART\n"
|
||||
"THE APPLICATION TO RESCAN THE SYSTEMS",
|
||||
"OK", nullptr, "", nullptr, "", nullptr,
|
||||
true));
|
||||
true, true));
|
||||
},
|
||||
false, "SAVE", "SAVE CHANGES?", "Currently configured path:",
|
||||
currentROMDirectory, "LOAD CURRENTLY CONFIGURED PATH",
|
||||
|
@ -187,7 +190,10 @@ void ViewController::noGamesDialog()
|
|||
quit.type = SDL_QUIT;
|
||||
SDL_PushEvent(&quit);
|
||||
},
|
||||
true, false);
|
||||
true, false,
|
||||
(mRenderer->getIsVerticalOrientation() ?
|
||||
0.90f :
|
||||
0.62f * (1.778f / mRenderer->getScreenAspectRatio())));
|
||||
|
||||
mWindow->pushGui(mNoGamesMessageBox);
|
||||
}
|
||||
|
|
|
@ -412,13 +412,13 @@ void ComponentList::render(const glm::mat4& parentTrans)
|
|||
// Draw separators.
|
||||
float y {0.0f};
|
||||
for (unsigned int i {0}; i < mEntries.size(); ++i) {
|
||||
mRenderer->drawRect(0.0f, y, mSize.x, 1.0f * mRenderer->getScreenHeightModifier(),
|
||||
mRenderer->drawRect(0.0f, y, mSize.x, 1.0f * mRenderer->getScreenResolutionModifier(),
|
||||
0xC6C7C6FF, 0xC6C7C6FF, false, mOpacity, mDimming);
|
||||
y += getRowHeight(mEntries.at(i).data);
|
||||
}
|
||||
|
||||
mRenderer->drawRect(0.0f, y, mSize.x, 1.0f * mRenderer->getScreenHeightModifier(), 0xC6C7C6FF,
|
||||
0xC6C7C6FF, false, mOpacity, mDimming);
|
||||
mRenderer->drawRect(0.0f, y, mSize.x, 1.0f * mRenderer->getScreenResolutionModifier(),
|
||||
0xC6C7C6FF, 0xC6C7C6FF, false, mOpacity, mDimming);
|
||||
mRenderer->popClipRect();
|
||||
}
|
||||
|
||||
|
|
|
@ -112,8 +112,9 @@ void MenuComponent::updateSize()
|
|||
}
|
||||
}
|
||||
|
||||
float width {
|
||||
std::min(mRenderer->getScreenHeight() * 1.05f, mRenderer->getScreenWidth() * 0.90f)};
|
||||
float width {std::min(mRenderer->getScreenHeight() * 1.05f,
|
||||
mRenderer->getScreenWidth() *
|
||||
(mRenderer->getIsVerticalOrientation() ? 0.94f : 0.90f))};
|
||||
setSize(width, height);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,22 +23,26 @@ GuiMsgBox::GuiMsgBox(const HelpStyle& helpstyle,
|
|||
const std::function<void()>& func2,
|
||||
const std::string& name3,
|
||||
const std::function<void()>& func3,
|
||||
bool disableBackButton,
|
||||
bool deleteOnButtonPress)
|
||||
const bool disableBackButton,
|
||||
const bool deleteOnButtonPress,
|
||||
const float maxWidthMultiplier)
|
||||
: mRenderer {Renderer::getInstance()}
|
||||
, mBackground {":/graphics/frame.svg"}
|
||||
, mGrid {glm::ivec2 {1, 2}}
|
||||
, mHelpStyle {helpstyle}
|
||||
, mDisableBackButton {disableBackButton}
|
||||
, mDeleteOnButtonPress {deleteOnButtonPress}
|
||||
, mMaxWidthMultiplier {maxWidthMultiplier}
|
||||
{
|
||||
// Adjust the width relative to the aspect ratio of the screen to make the GUI look coherent
|
||||
// regardless of screen type. The 1.778 aspect ratio value is the 16:9 reference.
|
||||
const float aspectValue {1.778f / mRenderer->getScreenAspectRatio()};
|
||||
|
||||
const float maxWidthMultiplier {mRenderer->getIsVerticalOrientation() ? 0.90f : 0.80f};
|
||||
float width {floorf(glm::clamp(0.60f * aspectValue, 0.60f, maxWidthMultiplier) *
|
||||
mRenderer->getScreenWidth())};
|
||||
if (mMaxWidthMultiplier == 0.0f)
|
||||
mMaxWidthMultiplier = mRenderer->getIsVerticalOrientation() ? 0.90f : 0.80f;
|
||||
|
||||
float width {std::floor(glm::clamp(0.60f * aspectValue, 0.60f, mMaxWidthMultiplier) *
|
||||
mRenderer->getScreenWidth())};
|
||||
const float minWidth {
|
||||
floorf(glm::clamp(0.30f * aspectValue, 0.10f, 0.50f) * mRenderer->getScreenWidth())};
|
||||
|
||||
|
@ -110,10 +114,12 @@ void GuiMsgBox::changeText(const std::string& newText)
|
|||
// Adjust the width depending on the aspect ratio of the screen, to make the screen look
|
||||
// somewhat coherent regardless of screen type. The 1.778 aspect ratio value is the 16:9
|
||||
// reference.
|
||||
float aspectValue {1.778f / Renderer::getScreenAspectRatio()};
|
||||
const float aspectValue {1.778f / Renderer::getScreenAspectRatio()};
|
||||
|
||||
const float maxWidthMultiplier {mRenderer->getIsVerticalOrientation() ? 0.90f : 0.80f};
|
||||
float width {floorf(glm::clamp(0.60f * aspectValue, 0.60f, maxWidthMultiplier) *
|
||||
if (mMaxWidthMultiplier == 0.0f)
|
||||
mMaxWidthMultiplier = mRenderer->getIsVerticalOrientation() ? 0.90f : 0.80f;
|
||||
|
||||
float width {floorf(glm::clamp(0.60f * aspectValue, 0.60f, mMaxWidthMultiplier) *
|
||||
mRenderer->getScreenWidth())};
|
||||
const float minWidth {mRenderer->getScreenWidth() * 0.3f};
|
||||
|
||||
|
|
|
@ -28,8 +28,9 @@ public:
|
|||
const std::function<void()>& func2 = nullptr,
|
||||
const std::string& name3 = "",
|
||||
const std::function<void()>& func3 = nullptr,
|
||||
bool disableBackButton = false,
|
||||
bool deleteOnButtonPress = true);
|
||||
const bool disableBackButton = false,
|
||||
const bool deleteOnButtonPress = true,
|
||||
const float maxWidthMultiplier = 0.0f);
|
||||
|
||||
void changeText(const std::string& newText);
|
||||
|
||||
|
@ -53,6 +54,7 @@ private:
|
|||
std::function<void()> mAcceleratorFunc;
|
||||
bool mDisableBackButton;
|
||||
bool mDeleteOnButtonPress;
|
||||
float mMaxWidthMultiplier;
|
||||
};
|
||||
|
||||
#endif // ES_CORE_GUIS_GUI_MSG_BOX_H
|
||||
|
|
Loading…
Reference in a new issue