mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-18 15:15:37 +00:00
Changed the sorting in the Alternative emulators interface to use short system names instead of full system names.
Also increased the window width slightly when displaying long system names.
This commit is contained in:
parent
824089d703
commit
b12d9f4692
|
@ -23,9 +23,14 @@ GuiAlternativeEmulators::GuiAlternativeEmulators()
|
||||||
// Horizontal sizes for the system and label entries.
|
// Horizontal sizes for the system and label entries.
|
||||||
float systemSizeX {mMenu.getSize().x / 3.27f};
|
float systemSizeX {mMenu.getSize().x / 3.27f};
|
||||||
|
|
||||||
for (auto it = SystemData::sSystemVector.cbegin(); // Line break.
|
std::vector<SystemData*> sortedSystems {SystemData::sSystemVector};
|
||||||
it != SystemData::sSystemVector.cend(); ++it) {
|
|
||||||
|
|
||||||
|
// Sort systems by short name.
|
||||||
|
std::sort(std::begin(sortedSystems), std::end(sortedSystems), [](SystemData* a, SystemData* b) {
|
||||||
|
return Utils::String::toUpper(a->getName()) < Utils::String::toUpper(b->getName());
|
||||||
|
});
|
||||||
|
|
||||||
|
for (auto it = sortedSystems.cbegin(); it != sortedSystems.cend(); ++it) {
|
||||||
// Only include systems that have at least two command entries, unless the system
|
// Only include systems that have at least two command entries, unless the system
|
||||||
// has an invalid entry.
|
// has an invalid entry.
|
||||||
if ((*it)->getAlternativeEmulator().substr(0, 9) != "<INVALID>" &&
|
if ((*it)->getAlternativeEmulator().substr(0, 9) != "<INVALID>" &&
|
||||||
|
@ -86,10 +91,14 @@ GuiAlternativeEmulators::GuiAlternativeEmulators()
|
||||||
systemText->getSize().y);
|
systemText->getSize().y);
|
||||||
|
|
||||||
row.addElement(labelText, false);
|
row.addElement(labelText, false);
|
||||||
row.makeAcceptInputHandler([this, it, labelText] {
|
|
||||||
|
SystemData* systemEntry {
|
||||||
|
*std::find(SystemData::sSystemVector.cbegin(), SystemData::sSystemVector.cend(), *it)};
|
||||||
|
|
||||||
|
row.makeAcceptInputHandler([this, systemEntry, labelText] {
|
||||||
if (labelText->getValue() == ViewController::CROSSEDCIRCLE_CHAR + " CLEARED ENTRY")
|
if (labelText->getValue() == ViewController::CROSSEDCIRCLE_CHAR + " CLEARED ENTRY")
|
||||||
return;
|
return;
|
||||||
selectorWindow(*it);
|
selectorWindow(systemEntry);
|
||||||
});
|
});
|
||||||
|
|
||||||
mMenu.addRow(row);
|
mMenu.addRow(row);
|
||||||
|
@ -194,7 +203,7 @@ void GuiAlternativeEmulators::selectorWindow(SystemData* system)
|
||||||
// somewhat coherent regardless of screen type. The 1.778 aspect ratio value is the 16:9
|
// somewhat coherent regardless of screen type. The 1.778 aspect ratio value is the 16:9
|
||||||
// reference.
|
// reference.
|
||||||
float aspectValue {1.778f / Renderer::getScreenAspectRatio()};
|
float aspectValue {1.778f / Renderer::getScreenAspectRatio()};
|
||||||
float maxWidthModifier {glm::clamp(0.72f * aspectValue, 0.50f, 0.92f)};
|
float maxWidthModifier {glm::clamp(0.77f * aspectValue, 0.50f, 0.92f)};
|
||||||
float maxWidth {Renderer::getScreenWidth() * maxWidthModifier};
|
float maxWidth {Renderer::getScreenWidth() * maxWidthModifier};
|
||||||
|
|
||||||
// Set the width of the selector window to the menu width, unless the system full name is
|
// Set the width of the selector window to the menu width, unless the system full name is
|
||||||
|
@ -202,7 +211,7 @@ void GuiAlternativeEmulators::selectorWindow(SystemData* system)
|
||||||
// above.
|
// above.
|
||||||
float systemTextWidth {
|
float systemTextWidth {
|
||||||
Font::get(FONT_SIZE_LARGE)->sizeText(Utils::String::toUpper(system->getFullName())).x *
|
Font::get(FONT_SIZE_LARGE)->sizeText(Utils::String::toUpper(system->getFullName())).x *
|
||||||
1.05f};
|
1.15f};
|
||||||
|
|
||||||
float width {0.0f};
|
float width {0.0f};
|
||||||
float menuWidth {mMenu.getSize().x};
|
float menuWidth {mMenu.getSize().x};
|
||||||
|
|
Loading…
Reference in a new issue