mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 14:15:38 +00:00
General refactoring and code cleanup.
This commit is contained in:
parent
8a6652552f
commit
0c8efee8ad
|
@ -39,15 +39,13 @@
|
||||||
#include <pugixml.hpp>
|
#include <pugixml.hpp>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
std::string myCollectionsName = "collections";
|
|
||||||
|
|
||||||
#define LAST_PLAYED_MAX 50
|
#define LAST_PLAYED_MAX 50
|
||||||
|
|
||||||
CollectionSystemsManager::CollectionSystemsManager() noexcept
|
CollectionSystemsManager::CollectionSystemsManager() noexcept
|
||||||
: mWindow(Window::getInstance())
|
: mWindow {Window::getInstance()}
|
||||||
{
|
{
|
||||||
// clang-format off
|
// clang-format off
|
||||||
CollectionSystemDecl systemDecls[] = {
|
CollectionSystemDecl systemDecls[] {
|
||||||
// Type Name Long name Theme folder isCustom
|
// Type Name Long name Theme folder isCustom
|
||||||
{AUTO_ALL_GAMES, "all", "all games", "auto-allgames", false},
|
{AUTO_ALL_GAMES, "all", "all games", "auto-allgames", false},
|
||||||
{AUTO_LAST_PLAYED, "recent", "last played", "auto-lastplayed", false},
|
{AUTO_LAST_PLAYED, "recent", "last played", "auto-lastplayed", false},
|
||||||
|
@ -57,8 +55,8 @@ CollectionSystemsManager::CollectionSystemsManager() noexcept
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
// Create a map of the collections.
|
// Create a map of the collections.
|
||||||
std::vector<CollectionSystemDecl> tempSystemDecl = std::vector<CollectionSystemDecl>(
|
std::vector<CollectionSystemDecl> tempSystemDecl {std::vector<CollectionSystemDecl>(
|
||||||
systemDecls, systemDecls + sizeof(systemDecls) / sizeof(systemDecls[0]));
|
systemDecls, systemDecls + sizeof(systemDecls) / sizeof(systemDecls[0]))};
|
||||||
|
|
||||||
for (std::vector<CollectionSystemDecl>::const_iterator it = tempSystemDecl.cbegin();
|
for (std::vector<CollectionSystemDecl>::const_iterator it = tempSystemDecl.cbegin();
|
||||||
it != tempSystemDecl.cend(); ++it)
|
it != tempSystemDecl.cend(); ++it)
|
||||||
|
|
|
@ -134,6 +134,8 @@ public:
|
||||||
const bool isEditing() const { return mIsEditingCustom; }
|
const bool isEditing() const { return mIsEditingCustom; }
|
||||||
const std::string& getEditingCollection() const { return mEditingCollection; }
|
const std::string& getEditingCollection() const { return mEditingCollection; }
|
||||||
|
|
||||||
|
inline static std::string myCollectionsName = "collections";
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CollectionSystemsManager() noexcept;
|
CollectionSystemsManager() noexcept;
|
||||||
|
|
||||||
|
|
|
@ -31,15 +31,15 @@ FileData::FileData(FileType type,
|
||||||
const std::string& path,
|
const std::string& path,
|
||||||
SystemEnvironmentData* envData,
|
SystemEnvironmentData* envData,
|
||||||
SystemData* system)
|
SystemData* system)
|
||||||
: metadata(type == GAME ? GAME_METADATA : FOLDER_METADATA)
|
: metadata {type == GAME ? GAME_METADATA : FOLDER_METADATA}
|
||||||
, mSourceFileData(nullptr)
|
, mSourceFileData {nullptr}
|
||||||
, mParent(nullptr)
|
, mParent {nullptr}
|
||||||
, mType(type)
|
, mType {type}
|
||||||
, mPath(path)
|
, mPath {path}
|
||||||
, mEnvData(envData)
|
, mEnvData {envData}
|
||||||
, mSystem(system)
|
, mSystem {system}
|
||||||
, mOnlyFolders(false)
|
, mOnlyFolders {false}
|
||||||
, mDeletionFlag(false)
|
, mDeletionFlag {false}
|
||||||
{
|
{
|
||||||
// Metadata needs at least a name field (since that's what getName() will return).
|
// Metadata needs at least a name field (since that's what getName() will return).
|
||||||
if (metadata.get("name").empty()) {
|
if (metadata.get("name").empty()) {
|
||||||
|
|
|
@ -21,20 +21,20 @@
|
||||||
#define INCLUDE_UNKNOWN false;
|
#define INCLUDE_UNKNOWN false;
|
||||||
|
|
||||||
FileFilterIndex::FileFilterIndex()
|
FileFilterIndex::FileFilterIndex()
|
||||||
: mFilterByText(false)
|
: mFilterByText {false}
|
||||||
, mTextRemoveSystem(false)
|
, mTextRemoveSystem {false}
|
||||||
, mFilterByRatings(false)
|
, mFilterByRatings {false}
|
||||||
, mFilterByDeveloper(false)
|
, mFilterByDeveloper {false}
|
||||||
, mFilterByPublisher(false)
|
, mFilterByPublisher {false}
|
||||||
, mFilterByGenre(false)
|
, mFilterByGenre {false}
|
||||||
, mFilterByPlayers(false)
|
, mFilterByPlayers {false}
|
||||||
, mFilterByFavorites(false)
|
, mFilterByFavorites {false}
|
||||||
, mFilterByCompleted(false)
|
, mFilterByCompleted {false}
|
||||||
, mFilterByKidGame(false)
|
, mFilterByKidGame {false}
|
||||||
, mFilterByHidden(false)
|
, mFilterByHidden {false}
|
||||||
, mFilterByBroken(false)
|
, mFilterByBroken {false}
|
||||||
, mFilterByController(false)
|
, mFilterByController {false}
|
||||||
, mFilterByAltemulator(false)
|
, mFilterByAltemulator {false}
|
||||||
{
|
{
|
||||||
clearAllFilters();
|
clearAllFilters();
|
||||||
|
|
||||||
|
@ -88,9 +88,9 @@ void FileFilterIndex::importIndex(FileFilterIndex* indexToImport)
|
||||||
{&mAltemulatorIndexAllKeys, &(indexToImport->mAltemulatorIndexAllKeys)},
|
{&mAltemulatorIndexAllKeys, &(indexToImport->mAltemulatorIndexAllKeys)},
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<IndexImportStructure> indexImportDecl = std::vector<IndexImportStructure>(
|
std::vector<IndexImportStructure> indexImportDecl {std::vector<IndexImportStructure>(
|
||||||
indexStructDecls,
|
indexStructDecls,
|
||||||
indexStructDecls + sizeof(indexStructDecls) / sizeof(indexStructDecls[0]));
|
indexStructDecls + sizeof(indexStructDecls) / sizeof(indexStructDecls[0]))};
|
||||||
|
|
||||||
for (std::vector<IndexImportStructure>::const_iterator indexesIt = indexImportDecl.cbegin();
|
for (std::vector<IndexImportStructure>::const_iterator indexesIt = indexImportDecl.cbegin();
|
||||||
indexesIt != indexImportDecl.cend(); ++indexesIt) {
|
indexesIt != indexImportDecl.cend(); ++indexesIt) {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
namespace FileSorts
|
namespace FileSorts
|
||||||
{
|
{
|
||||||
const FileData::SortType typesArr[] = {
|
const FileData::SortType typesArr[] {
|
||||||
FileData::SortType(&compareName, "filename, ascending"),
|
FileData::SortType(&compareName, "filename, ascending"),
|
||||||
FileData::SortType(&compareNameDescending, "filename, descending"),
|
FileData::SortType(&compareNameDescending, "filename, descending"),
|
||||||
|
|
||||||
|
@ -48,9 +48,8 @@ namespace FileSorts
|
||||||
FileData::SortType(&compareSystem, "system, ascending"),
|
FileData::SortType(&compareSystem, "system, ascending"),
|
||||||
FileData::SortType(&compareSystemDescending, "system, descending")};
|
FileData::SortType(&compareSystemDescending, "system, descending")};
|
||||||
|
|
||||||
const std::vector<FileData::SortType> SortTypes(typesArr,
|
const std::vector<FileData::SortType> SortTypes {typesArr, typesArr + sizeof(typesArr) /
|
||||||
typesArr +
|
sizeof(typesArr[0])};
|
||||||
sizeof(typesArr) / sizeof(typesArr[0]));
|
|
||||||
|
|
||||||
bool compareName(const FileData* file1, const FileData* file2)
|
bool compareName(const FileData* file1, const FileData* file2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,9 +22,9 @@ namespace GamelistFileParser
|
||||||
FileData* findOrCreateFile(SystemData* system, const std::string& path, FileType type)
|
FileData* findOrCreateFile(SystemData* system, const std::string& path, FileType type)
|
||||||
{
|
{
|
||||||
// First, verify that path is within the system's root folder.
|
// First, verify that path is within the system's root folder.
|
||||||
FileData* root = system->getRootFolder();
|
FileData* root {system->getRootFolder()};
|
||||||
bool contains = false;
|
bool contains {false};
|
||||||
std::string relative = Utils::FileSystem::removeCommonPath(path, root->getPath(), contains);
|
std::string relative {Utils::FileSystem::removeCommonPath(path, root->getPath(), contains)};
|
||||||
|
|
||||||
if (!contains) {
|
if (!contains) {
|
||||||
LOG(LogError) << "Path \"" << path << "\" is outside system path \""
|
LOG(LogError) << "Path \"" << path << "\" is outside system path \""
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
#include "views/ViewController.h"
|
#include "views/ViewController.h"
|
||||||
|
|
||||||
MediaViewer::MediaViewer()
|
MediaViewer::MediaViewer()
|
||||||
: mWindow(Window::getInstance())
|
: mWindow {Window::getInstance()}
|
||||||
, mVideo(nullptr)
|
, mVideo {nullptr}
|
||||||
, mImage(nullptr)
|
, mImage {nullptr}
|
||||||
{
|
{
|
||||||
mWindow->setMediaViewer(this);
|
mWindow->setMediaViewer(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace
|
||||||
// clang-format off
|
// clang-format off
|
||||||
// The statistic entries must be placed at the bottom or otherwise there will be problems with
|
// The statistic entries must be placed at the bottom or otherwise there will be problems with
|
||||||
// saving the values in GuiMetaDataEd.
|
// saving the values in GuiMetaDataEd.
|
||||||
MetaDataDecl gameDecls[] = {
|
MetaDataDecl gameDecls[] {
|
||||||
// key, type, default, statistic, name in GuiMetaDataEd, prompt in GuiMetaDataEd, shouldScrape
|
// key, type, default, statistic, name in GuiMetaDataEd, prompt in GuiMetaDataEd, shouldScrape
|
||||||
{"name", MD_STRING, "", false, "name", "enter name", true},
|
{"name", MD_STRING, "", false, "name", "enter name", true},
|
||||||
{"sortname", MD_STRING, "", false, "sortname", "enter sortname", false},
|
{"sortname", MD_STRING, "", false, "sortname", "enter sortname", false},
|
||||||
|
@ -45,7 +45,7 @@ namespace
|
||||||
{"lastplayed", MD_TIME, "0", true, "last played", "enter last played date", false}
|
{"lastplayed", MD_TIME, "0", true, "last played", "enter last played date", false}
|
||||||
};
|
};
|
||||||
|
|
||||||
MetaDataDecl folderDecls[] = {
|
MetaDataDecl folderDecls[] {
|
||||||
{"name", MD_STRING, "", false, "name", "enter name", true},
|
{"name", MD_STRING, "", false, "name", "enter name", true},
|
||||||
{"desc", MD_MULTILINE_STRING, "", false, "description", "enter description", true},
|
{"desc", MD_MULTILINE_STRING, "", false, "description", "enter description", true},
|
||||||
{"rating", MD_RATING, "0", false, "rating", "enter rating", true},
|
{"rating", MD_RATING, "0", false, "rating", "enter rating", true},
|
||||||
|
@ -66,12 +66,12 @@ namespace
|
||||||
};
|
};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
const std::vector<MetaDataDecl> gameMDD(gameDecls,
|
const std::vector<MetaDataDecl> gameMDD {gameDecls,
|
||||||
gameDecls + sizeof(gameDecls) / sizeof(gameDecls[0]));
|
gameDecls + sizeof(gameDecls) / sizeof(gameDecls[0])};
|
||||||
|
|
||||||
|
const std::vector<MetaDataDecl> folderMDD {
|
||||||
|
folderDecls, folderDecls + sizeof(folderDecls) / sizeof(folderDecls[0])};
|
||||||
|
|
||||||
const std::vector<MetaDataDecl> folderMDD(folderDecls,
|
|
||||||
folderDecls +
|
|
||||||
sizeof(folderDecls) / sizeof(folderDecls[0]));
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
const std::vector<MetaDataDecl>& getMDDByType(MetaDataListType type)
|
const std::vector<MetaDataDecl>& getMDDByType(MetaDataListType type)
|
||||||
|
|
|
@ -28,8 +28,6 @@ MiximageGenerator::MiximageGenerator(FileData* game, std::string& resultMessage)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
MiximageGenerator::~MiximageGenerator() {}
|
|
||||||
|
|
||||||
void MiximageGenerator::startThread(std::promise<bool>* miximagePromise)
|
void MiximageGenerator::startThread(std::promise<bool>* miximagePromise)
|
||||||
{
|
{
|
||||||
mMiximagePromise = miximagePromise;
|
mMiximagePromise = miximagePromise;
|
||||||
|
|
|
@ -23,7 +23,6 @@ class MiximageGenerator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MiximageGenerator(FileData* game, std::string& resultMessage);
|
MiximageGenerator(FileData* game, std::string& resultMessage);
|
||||||
~MiximageGenerator();
|
|
||||||
|
|
||||||
void startThread(std::promise<bool>* miximagePromise);
|
void startThread(std::promise<bool>* miximagePromise);
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
namespace PlatformIds
|
namespace PlatformIds
|
||||||
{
|
{
|
||||||
// clang-format off
|
// clang-format off
|
||||||
std::vector<std::string> platformNames = {
|
std::vector<std::string> platformNames {
|
||||||
"unknown", // Nothing set.
|
"unknown", // Nothing set.
|
||||||
|
|
||||||
"3do", // 3DO
|
"3do", // 3DO
|
||||||
|
|
|
@ -40,10 +40,10 @@ FindRules::FindRules()
|
||||||
|
|
||||||
void FindRules::loadFindRules()
|
void FindRules::loadFindRules()
|
||||||
{
|
{
|
||||||
std::string customSystemsDirectory =
|
std::string customSystemsDirectory {Utils::FileSystem::getHomePath() +
|
||||||
Utils::FileSystem::getHomePath() + "/.emulationstation/custom_systems";
|
"/.emulationstation/custom_systems"};
|
||||||
|
|
||||||
std::string path = customSystemsDirectory + "/es_find_rules.xml";
|
std::string path {customSystemsDirectory + "/es_find_rules.xml"};
|
||||||
|
|
||||||
if (Utils::FileSystem::exists(path)) {
|
if (Utils::FileSystem::exists(path)) {
|
||||||
LOG(LogInfo) << "Found custom find rules configuration file";
|
LOG(LogInfo) << "Found custom find rules configuration file";
|
||||||
|
|
|
@ -30,22 +30,22 @@
|
||||||
#define FADE_TIME 300
|
#define FADE_TIME 300
|
||||||
|
|
||||||
SystemScreensaver::SystemScreensaver()
|
SystemScreensaver::SystemScreensaver()
|
||||||
: mWindow(Window::getInstance())
|
: mWindow {Window::getInstance()}
|
||||||
, mState(STATE_INACTIVE)
|
, mState {STATE_INACTIVE}
|
||||||
, mImageScreensaver(nullptr)
|
, mImageScreensaver {nullptr}
|
||||||
, mVideoScreensaver(nullptr)
|
, mVideoScreensaver {nullptr}
|
||||||
, mCurrentGame(nullptr)
|
, mCurrentGame {nullptr}
|
||||||
, mPreviousGame(nullptr)
|
, mPreviousGame {nullptr}
|
||||||
, mTimer(0)
|
, mTimer {0}
|
||||||
, mMediaSwapTime(0)
|
, mMediaSwapTime {0}
|
||||||
, mTriggerNextGame(false)
|
, mTriggerNextGame {false}
|
||||||
, mHasMediaFiles(false)
|
, mHasMediaFiles {false}
|
||||||
, mFallbackScreensaver(false)
|
, mFallbackScreensaver {false}
|
||||||
, mOpacity(0.0f)
|
, mOpacity {0.0f}
|
||||||
, mDimValue(1.0)
|
, mDimValue {1.0}
|
||||||
, mRectangleFadeIn(50)
|
, mRectangleFadeIn {50}
|
||||||
, mTextFadeIn(0)
|
, mTextFadeIn {0}
|
||||||
, mSaturationAmount(1.0)
|
, mSaturationAmount {1.0}
|
||||||
{
|
{
|
||||||
mWindow->setScreensaver(this);
|
mWindow->setScreensaver(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,15 +21,17 @@ std::string VolumeControl::mixerCard = "default";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
VolumeControl::VolumeControl()
|
VolumeControl::VolumeControl()
|
||||||
|
// clang-format off
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
: mixerIndex(0)
|
: mixerIndex {0}
|
||||||
, mixerHandle(nullptr)
|
, mixerHandle {nullptr}
|
||||||
, mixerElem(nullptr)
|
, mixerElem {nullptr}
|
||||||
, mixerSelemId(nullptr)
|
, mixerSelemId {nullptr}
|
||||||
#elif defined(_WIN64)
|
#elif defined(_WIN64)
|
||||||
: mixerHandle(nullptr)
|
: mixerHandle {nullptr}
|
||||||
, endpointVolume(nullptr)
|
, endpointVolume {nullptr}
|
||||||
#endif
|
#endif
|
||||||
|
// clang-format on
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,13 +16,13 @@
|
||||||
GuiAlternativeEmulators::GuiAlternativeEmulators(Window* window)
|
GuiAlternativeEmulators::GuiAlternativeEmulators(Window* window)
|
||||||
: GuiComponent {window}
|
: GuiComponent {window}
|
||||||
, mMenu {window, "ALTERNATIVE EMULATORS"}
|
, mMenu {window, "ALTERNATIVE EMULATORS"}
|
||||||
, mHasSystems(false)
|
, mHasSystems {false}
|
||||||
{
|
{
|
||||||
addChild(&mMenu);
|
addChild(&mMenu);
|
||||||
mMenu.addButton("BACK", "back", [this] { delete this; });
|
mMenu.addButton("BACK", "back", [this] { delete this; });
|
||||||
|
|
||||||
// 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.
|
for (auto it = SystemData::sSystemVector.cbegin(); // Line break.
|
||||||
it != SystemData::sSystemVector.cend(); ++it) {
|
it != SystemData::sSystemVector.cend(); ++it) {
|
||||||
|
@ -35,14 +35,14 @@ GuiAlternativeEmulators::GuiAlternativeEmulators(Window* window)
|
||||||
|
|
||||||
ComponentListRow row;
|
ComponentListRow row;
|
||||||
|
|
||||||
std::string name = (*it)->getName();
|
std::string name {(*it)->getName()};
|
||||||
std::shared_ptr<TextComponent> systemText =
|
std::shared_ptr<TextComponent> systemText {std::make_shared<TextComponent>(
|
||||||
std::make_shared<TextComponent>(mWindow, name, Font::get(FONT_SIZE_MEDIUM), 0x777777FF);
|
mWindow, name, Font::get(FONT_SIZE_MEDIUM), 0x777777FF)};
|
||||||
|
|
||||||
systemText->setSize(systemSizeX, systemText->getSize().y);
|
systemText->setSize(systemSizeX, systemText->getSize().y);
|
||||||
row.addElement(systemText, false);
|
row.addElement(systemText, false);
|
||||||
|
|
||||||
std::string configuredLabel = (*it)->getAlternativeEmulator();
|
std::string configuredLabel {(*it)->getAlternativeEmulator()};
|
||||||
std::string label;
|
std::string label;
|
||||||
|
|
||||||
if (configuredLabel == "") {
|
if (configuredLabel == "") {
|
||||||
|
@ -57,7 +57,7 @@ GuiAlternativeEmulators::GuiAlternativeEmulators(Window* window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool invalidEntry = false;
|
bool invalidEntry {false};
|
||||||
|
|
||||||
if (label.empty()) {
|
if (label.empty()) {
|
||||||
label = ViewController::EXCLAMATION_CHAR + " INVALID ENTRY";
|
label = ViewController::EXCLAMATION_CHAR + " INVALID ENTRY";
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
#include "views/ViewController.h"
|
#include "views/ViewController.h"
|
||||||
|
|
||||||
GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(Window* window, std::string title)
|
GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(Window* window, std::string title)
|
||||||
: GuiSettings(window, title)
|
: GuiSettings {window, title}
|
||||||
, mAddedCustomCollection(false)
|
, mAddedCustomCollection {false}
|
||||||
, mDeletedCustomCollection(false)
|
, mDeletedCustomCollection {false}
|
||||||
{
|
{
|
||||||
// Finish editing custom collection.
|
// Finish editing custom collection.
|
||||||
if (CollectionSystemsManager::getInstance()->isEditing()) {
|
if (CollectionSystemsManager::getInstance()->isEditing()) {
|
||||||
|
|
|
@ -22,11 +22,11 @@
|
||||||
GuiGamelistFilter::GuiGamelistFilter(Window* window,
|
GuiGamelistFilter::GuiGamelistFilter(Window* window,
|
||||||
SystemData* system,
|
SystemData* system,
|
||||||
std::function<void(bool)> filterChangedCallback)
|
std::function<void(bool)> filterChangedCallback)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mMenu(window, "FILTER GAMELIST")
|
, mMenu {window, "FILTER GAMELIST"}
|
||||||
, mSystem(system)
|
, mSystem {system}
|
||||||
, mFiltersChangedCallback(filterChangedCallback)
|
, mFiltersChangedCallback {filterChangedCallback}
|
||||||
, mFiltersChanged(false)
|
, mFiltersChanged {false}
|
||||||
{
|
{
|
||||||
initializeMenu();
|
initializeMenu();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,18 +26,18 @@
|
||||||
#include "views/gamelist/IGamelistView.h"
|
#include "views/gamelist/IGamelistView.h"
|
||||||
|
|
||||||
GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system)
|
GuiGamelistOptions::GuiGamelistOptions(Window* window, SystemData* system)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mMenu(window, "OPTIONS")
|
, mMenu {window, "OPTIONS"}
|
||||||
, mSystem(system)
|
, mSystem {system}
|
||||||
, mFiltersChanged(false)
|
, mFiltersChanged {false}
|
||||||
, mCancelled(false)
|
, mCancelled {false}
|
||||||
, mIsCustomCollection(false)
|
, mIsCustomCollection {false}
|
||||||
, mIsCustomCollectionGroup(false)
|
, mIsCustomCollectionGroup {false}
|
||||||
, mCustomCollectionSystem(nullptr)
|
, mCustomCollectionSystem {nullptr}
|
||||||
{
|
{
|
||||||
addChild(&mMenu);
|
addChild(&mMenu);
|
||||||
|
|
||||||
FileData* file = getGamelist()->getCursor();
|
FileData* file {getGamelist()->getCursor()};
|
||||||
// Check if it's a placeholder, which would limit the menu entries presented.
|
// Check if it's a placeholder, which would limit the menu entries presented.
|
||||||
file->isPlaceHolder();
|
file->isPlaceHolder();
|
||||||
mFromPlaceholder = file->isPlaceHolder();
|
mFromPlaceholder = file->isPlaceHolder();
|
||||||
|
|
|
@ -15,11 +15,11 @@
|
||||||
#include "utils/StringUtil.h"
|
#include "utils/StringUtil.h"
|
||||||
|
|
||||||
GuiLaunchScreen::GuiLaunchScreen()
|
GuiLaunchScreen::GuiLaunchScreen()
|
||||||
: GuiComponent(Window::getInstance())
|
: GuiComponent {Window::getInstance()}
|
||||||
, mWindow(Window::getInstance())
|
, mWindow {Window::getInstance()}
|
||||||
, mBackground(mWindow, ":/graphics/frame.svg")
|
, mBackground {mWindow, ":/graphics/frame.svg"}
|
||||||
, mGrid(nullptr)
|
, mGrid {nullptr}
|
||||||
, mMarquee(nullptr)
|
, mMarquee {nullptr}
|
||||||
{
|
{
|
||||||
addChild(&mBackground);
|
addChild(&mBackground);
|
||||||
mWindow->setLaunchScreen(this);
|
mWindow->setLaunchScreen(this);
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include "components/SwitchComponent.h"
|
#include "components/SwitchComponent.h"
|
||||||
|
|
||||||
GuiMediaViewerOptions::GuiMediaViewerOptions(Window* window, const std::string& title)
|
GuiMediaViewerOptions::GuiMediaViewerOptions(Window* window, const std::string& title)
|
||||||
: GuiSettings(window, title)
|
: GuiSettings {window, title}
|
||||||
{
|
{
|
||||||
// Keep videos running when viewing images.
|
// Keep videos running when viewing images.
|
||||||
auto keep_video_running = std::make_shared<SwitchComponent>(mWindow);
|
auto keep_video_running = std::make_shared<SwitchComponent>(mWindow);
|
||||||
|
|
|
@ -41,9 +41,9 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
GuiMenu::GuiMenu(Window* window)
|
GuiMenu::GuiMenu(Window* window)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mMenu(window, "MAIN MENU")
|
, mMenu {window, "MAIN MENU"}
|
||||||
, mVersion(window)
|
, mVersion {window}
|
||||||
{
|
{
|
||||||
bool isFullUI = UIModeController::getInstance()->isUIModeFull();
|
bool isFullUI = UIModeController::getInstance()->isUIModeFull();
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
#include "views/ViewController.h"
|
#include "views/ViewController.h"
|
||||||
|
|
||||||
GuiOfflineGenerator::GuiOfflineGenerator(Window* window, const std::queue<FileData*>& gameQueue)
|
GuiOfflineGenerator::GuiOfflineGenerator(Window* window, const std::queue<FileData*>& gameQueue)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mGameQueue(gameQueue)
|
, mGameQueue {gameQueue}
|
||||||
, mBackground(window, ":/graphics/frame.svg")
|
, mBackground {window, ":/graphics/frame.svg"}
|
||||||
, mGrid(window, glm::ivec2 {6, 13})
|
, mGrid {window, glm::ivec2 {6, 13}}
|
||||||
{
|
{
|
||||||
addChild(&mBackground);
|
addChild(&mBackground);
|
||||||
addChild(&mGrid);
|
addChild(&mGrid);
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
#include "views/ViewController.h"
|
#include "views/ViewController.h"
|
||||||
|
|
||||||
GuiScraperMenu::GuiScraperMenu(Window* window, std::string title)
|
GuiScraperMenu::GuiScraperMenu(Window* window, std::string title)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mMenu(window, title)
|
, mMenu {window, title}
|
||||||
{
|
{
|
||||||
// Scraper service.
|
// Scraper service.
|
||||||
mScraper = std::make_shared<OptionListComponent<std::string>>(mWindow, getHelpStyle(),
|
mScraper = std::make_shared<OptionListComponent<std::string>>(mWindow, getHelpStyle(),
|
||||||
|
|
|
@ -27,11 +27,11 @@
|
||||||
GuiScraperMulti::GuiScraperMulti(Window* window,
|
GuiScraperMulti::GuiScraperMulti(Window* window,
|
||||||
const std::queue<ScraperSearchParams>& searches,
|
const std::queue<ScraperSearchParams>& searches,
|
||||||
bool approveResults)
|
bool approveResults)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mBackground(window, ":/graphics/frame.svg")
|
, mBackground {window, ":/graphics/frame.svg"}
|
||||||
, mGrid(window, glm::ivec2 {2, 6})
|
, mGrid {window, glm::ivec2 {2, 6}}
|
||||||
, mSearchQueue(searches)
|
, mSearchQueue {searches}
|
||||||
, mApproveResults(approveResults)
|
, mApproveResults {approveResults}
|
||||||
{
|
{
|
||||||
assert(mSearchQueue.size());
|
assert(mSearchQueue.size());
|
||||||
|
|
||||||
|
|
|
@ -38,14 +38,14 @@
|
||||||
#define FAILED_VERIFICATION_RETRIES 8
|
#define FAILED_VERIFICATION_RETRIES 8
|
||||||
|
|
||||||
GuiScraperSearch::GuiScraperSearch(Window* window, SearchType type, unsigned int scrapeCount)
|
GuiScraperSearch::GuiScraperSearch(Window* window, SearchType type, unsigned int scrapeCount)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mGrid(window, glm::ivec2 {5, 3})
|
, mGrid {window, glm::ivec2 {5, 3}}
|
||||||
, mSearchType(type)
|
, mSearchType {type}
|
||||||
, mScrapeCount(scrapeCount)
|
, mScrapeCount {scrapeCount}
|
||||||
, mRefinedSearch(false)
|
, mRefinedSearch {false}
|
||||||
, mFoundGame(false)
|
, mFoundGame {false}
|
||||||
, mScrapeRatings(false)
|
, mScrapeRatings {false}
|
||||||
, mBusyAnim(window)
|
, mBusyAnim {window}
|
||||||
{
|
{
|
||||||
addChild(&mGrid);
|
addChild(&mGrid);
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,12 @@ GuiScraperSingle::GuiScraperSingle(Window* window,
|
||||||
ScraperSearchParams& params,
|
ScraperSearchParams& params,
|
||||||
std::function<void(const ScraperSearchResult&)> doneFunc,
|
std::function<void(const ScraperSearchResult&)> doneFunc,
|
||||||
bool& savedMediaAndAborted)
|
bool& savedMediaAndAborted)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mClose(false)
|
, mClose {false}
|
||||||
, mGrid(window, glm::ivec2 {2, 6})
|
, mGrid {window, glm::ivec2 {2, 6}}
|
||||||
, mBox(window, ":/graphics/frame.svg")
|
, mBox {window, ":/graphics/frame.svg"}
|
||||||
, mSearchParams(params)
|
, mSearchParams {params}
|
||||||
, mSavedMediaAndAborted(savedMediaAndAborted)
|
, mSavedMediaAndAborted {savedMediaAndAborted}
|
||||||
{
|
{
|
||||||
addChild(&mBox);
|
addChild(&mBox);
|
||||||
addChild(&mGrid);
|
addChild(&mGrid);
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
#include "guis/GuiMsgBox.h"
|
#include "guis/GuiMsgBox.h"
|
||||||
|
|
||||||
GuiScreensaverOptions::GuiScreensaverOptions(Window* window, const std::string& title)
|
GuiScreensaverOptions::GuiScreensaverOptions(Window* window, const std::string& title)
|
||||||
: GuiSettings(window, title)
|
: GuiSettings {window, title}
|
||||||
, mWindow(window)
|
, mWindow {window}
|
||||||
{
|
{
|
||||||
// Screensaver timer.
|
// Screensaver timer.
|
||||||
auto screensaver_timer = std::make_shared<SliderComponent>(mWindow, 0.0f, 30.0f, 1.0f, "m");
|
auto screensaver_timer = std::make_shared<SliderComponent>(mWindow, 0.0f, 30.0f, 1.0f, "m");
|
||||||
|
|
|
@ -134,12 +134,12 @@ void thegamesdb_generate_json_scraper_requests(
|
||||||
std::vector<ScraperSearchResult>& results)
|
std::vector<ScraperSearchResult>& results)
|
||||||
{
|
{
|
||||||
resources.prepare();
|
resources.prepare();
|
||||||
std::string path = "https://api.thegamesdb.net/v1";
|
std::string path {"https://api.thegamesdb.net/v1"};
|
||||||
bool usingGameID = false;
|
bool usingGameID {false};
|
||||||
const std::string apiKey = std::string("apikey=") + resources.getApiKey();
|
const std::string apiKey {std::string("apikey=") + resources.getApiKey()};
|
||||||
std::string cleanName = params.nameOverride;
|
std::string cleanName {params.nameOverride};
|
||||||
if (!cleanName.empty() && cleanName.substr(0, 3) == "id:") {
|
if (!cleanName.empty() && cleanName.substr(0, 3) == "id:") {
|
||||||
std::string gameID = cleanName.substr(3);
|
std::string gameID {cleanName.substr(3)};
|
||||||
path += "/Games/ByGameID?" + apiKey +
|
path += "/Games/ByGameID?" + apiKey +
|
||||||
"&fields=players,publishers,genres,overview,last_updated,rating,"
|
"&fields=players,publishers,genres,overview,last_updated,rating,"
|
||||||
"platform,coop,youtube,os,processor,ram,hdd,video,sound,alternates&id=" +
|
"platform,coop,youtube,os,processor,ram,hdd,video,sound,alternates&id=" +
|
||||||
|
|
|
@ -33,20 +33,20 @@ using namespace rapidjson;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
constexpr char GamesDBAPIKey[] =
|
constexpr char GamesDBAPIKey[] {
|
||||||
"445fcbc3f32bb2474bc27016b99eb963d318ee3a608212c543b9a79de1041600";
|
"445fcbc3f32bb2474bc27016b99eb963d318ee3a608212c543b9a79de1041600"};
|
||||||
|
|
||||||
constexpr int MAX_WAIT_MS = 90000;
|
constexpr int MAX_WAIT_MS {90000};
|
||||||
constexpr int POLL_TIME_MS = 500;
|
constexpr int POLL_TIME_MS {500};
|
||||||
constexpr int MAX_WAIT_ITER = MAX_WAIT_MS / POLL_TIME_MS;
|
constexpr int MAX_WAIT_ITER {MAX_WAIT_MS / POLL_TIME_MS};
|
||||||
|
|
||||||
constexpr char SCRAPER_RESOURCES_DIR[] = "scrapers";
|
constexpr char SCRAPER_RESOURCES_DIR[] {"scrapers"};
|
||||||
constexpr char DEVELOPERS_JSON_FILE[] = "gamesdb_developers.json";
|
constexpr char DEVELOPERS_JSON_FILE[] {"gamesdb_developers.json"};
|
||||||
constexpr char PUBLISHERS_JSON_FILE[] = "gamesdb_publishers.json";
|
constexpr char PUBLISHERS_JSON_FILE[] {"gamesdb_publishers.json"};
|
||||||
constexpr char GENRES_JSON_FILE[] = "gamesdb_genres.json";
|
constexpr char GENRES_JSON_FILE[] {"gamesdb_genres.json"};
|
||||||
constexpr char DEVELOPERS_ENDPOINT[] = "/Developers";
|
constexpr char DEVELOPERS_ENDPOINT[] {"/Developers"};
|
||||||
constexpr char PUBLISHERS_ENDPOINT[] = "/Publishers";
|
constexpr char PUBLISHERS_ENDPOINT[] {"/Publishers"};
|
||||||
constexpr char GENRES_ENDPOINT[] = "/Genres";
|
constexpr char GENRES_ENDPOINT[] {"/Genres"};
|
||||||
|
|
||||||
std::string genFilePath(const std::string& file_name)
|
std::string genFilePath(const std::string& file_name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,11 +27,11 @@ const int logoBuffersLeft[] = {-5, -2, -1};
|
||||||
const int logoBuffersRight[] = {1, 2, 5};
|
const int logoBuffersRight[] = {1, 2, 5};
|
||||||
|
|
||||||
SystemView::SystemView(Window* window)
|
SystemView::SystemView(Window* window)
|
||||||
: IList<SystemViewData, SystemData*>(window, LIST_SCROLL_STYLE_SLOW, LIST_ALWAYS_LOOP)
|
: IList<SystemViewData, SystemData*> {window, LIST_SCROLL_STYLE_SLOW, LIST_ALWAYS_LOOP}
|
||||||
, mSystemInfo(window, "SYSTEM INFO", Font::get(FONT_SIZE_SMALL), 0x33333300, ALIGN_CENTER)
|
, mSystemInfo {window, "SYSTEM INFO", Font::get(FONT_SIZE_SMALL), 0x33333300, ALIGN_CENTER}
|
||||||
, mPreviousScrollVelocity(0)
|
, mPreviousScrollVelocity {0}
|
||||||
, mUpdatedGameCount(false)
|
, mUpdatedGameCount {false}
|
||||||
, mViewNeedsReload(true)
|
, mViewNeedsReload {true}
|
||||||
{
|
{
|
||||||
mCamOffset = 0;
|
mCamOffset = 0;
|
||||||
mExtrasCamOffset = 0;
|
mExtrasCamOffset = 0;
|
||||||
|
@ -91,9 +91,9 @@ void SystemView::populate()
|
||||||
// No logo available? Make placeholder.
|
// No logo available? Make placeholder.
|
||||||
if (!e.data.logo) {
|
if (!e.data.logo) {
|
||||||
|
|
||||||
glm::vec2 resolution = glm::vec2 {static_cast<float>(Renderer::getScreenWidth()),
|
glm::vec2 resolution {static_cast<float>(Renderer::getScreenWidth()),
|
||||||
static_cast<float>(Renderer::getScreenHeight())};
|
static_cast<float>(Renderer::getScreenHeight())};
|
||||||
glm::vec3 center = {resolution.x / 2.0f, resolution.y / 2.0f, 1.0f};
|
glm::vec3 center {resolution.x / 2.0f, resolution.y / 2.0f, 1.0f};
|
||||||
|
|
||||||
// Placeholder Image.
|
// Placeholder Image.
|
||||||
logoElem = theme->getElement("system", "logoPlaceholderImage", "image");
|
logoElem = theme->getElement("system", "logoPlaceholderImage", "image");
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "views/ViewController.h"
|
#include "views/ViewController.h"
|
||||||
|
|
||||||
UIModeController::UIModeController() noexcept
|
UIModeController::UIModeController() noexcept
|
||||||
: mPassKeyCounter(0)
|
: mPassKeyCounter {0}
|
||||||
{
|
{
|
||||||
mPassKeySequence = Settings::getInstance()->getString("UIMode_passkey");
|
mPassKeySequence = Settings::getInstance()->getString("UIMode_passkey");
|
||||||
mCurrentUIMode = Settings::getInstance()->getString("UIMode");
|
mCurrentUIMode = Settings::getInstance()->getString("UIMode");
|
||||||
|
|
|
@ -33,28 +33,6 @@
|
||||||
#include "views/gamelist/IGamelistView.h"
|
#include "views/gamelist/IGamelistView.h"
|
||||||
#include "views/gamelist/VideoGamelistView.h"
|
#include "views/gamelist/VideoGamelistView.h"
|
||||||
|
|
||||||
#if defined(_MSC_VER) // MSVC compiler.
|
|
||||||
const std::string ViewController::CONTROLLER_CHAR = Utils::String::wideStringToString(L"\uf11b");
|
|
||||||
const std::string ViewController::CROSSEDCIRCLE_CHAR = Utils::String::wideStringToString(L"\uf05e");
|
|
||||||
const std::string ViewController::EXCLAMATION_CHAR = Utils::String::wideStringToString(L"\uf06a");
|
|
||||||
const std::string ViewController::FAVORITE_CHAR = Utils::String::wideStringToString(L"\uf005");
|
|
||||||
const std::string ViewController::FILTER_CHAR = Utils::String::wideStringToString(L"\uf0b0");
|
|
||||||
const std::string ViewController::FOLDER_CHAR = Utils::String::wideStringToString(L"\uf07C");
|
|
||||||
const std::string ViewController::GEAR_CHAR = Utils::String::wideStringToString(L"\uf013");
|
|
||||||
const std::string ViewController::KEYBOARD_CHAR = Utils::String::wideStringToString(L"\uf11c");
|
|
||||||
const std::string ViewController::TICKMARK_CHAR = Utils::String::wideStringToString(L"\uf14A");
|
|
||||||
#else
|
|
||||||
const std::string ViewController::CONTROLLER_CHAR = "\uf11b";
|
|
||||||
const std::string ViewController::CROSSEDCIRCLE_CHAR = "\uf05e";
|
|
||||||
const std::string ViewController::EXCLAMATION_CHAR = "\uf06a";
|
|
||||||
const std::string ViewController::FAVORITE_CHAR = "\uf005";
|
|
||||||
const std::string ViewController::FILTER_CHAR = "\uf0b0";
|
|
||||||
const std::string ViewController::FOLDER_CHAR = "\uf07C";
|
|
||||||
const std::string ViewController::GEAR_CHAR = "\uf013";
|
|
||||||
const std::string ViewController::KEYBOARD_CHAR = "\uf11c";
|
|
||||||
const std::string ViewController::TICKMARK_CHAR = "\uf14a";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ViewController* ViewController::getInstance()
|
ViewController* ViewController::getInstance()
|
||||||
{
|
{
|
||||||
static ViewController instance;
|
static ViewController instance;
|
||||||
|
@ -62,19 +40,19 @@ ViewController* ViewController::getInstance()
|
||||||
}
|
}
|
||||||
|
|
||||||
ViewController::ViewController() noexcept
|
ViewController::ViewController() noexcept
|
||||||
: GuiComponent(Window::getInstance())
|
: GuiComponent {Window::getInstance()}
|
||||||
, mNoGamesMessageBox(nullptr)
|
, mNoGamesMessageBox {nullptr}
|
||||||
, mCurrentView(nullptr)
|
, mCurrentView {nullptr}
|
||||||
, mPreviousView(nullptr)
|
, mPreviousView {nullptr}
|
||||||
, mSkipView(nullptr)
|
, mSkipView {nullptr}
|
||||||
, mGameToLaunch(nullptr)
|
, mGameToLaunch {nullptr}
|
||||||
, mCamera(Renderer::getIdentity())
|
, mCamera {Renderer::getIdentity()}
|
||||||
, mSystemViewTransition(false)
|
, mSystemViewTransition {false}
|
||||||
, mWrappedViews(false)
|
, mWrappedViews {false}
|
||||||
, mFadeOpacity(0)
|
, mFadeOpacity {0}
|
||||||
, mCancelledTransition(false)
|
, mCancelledTransition {false}
|
||||||
, mLockInput(false)
|
, mLockInput {false}
|
||||||
, mNextSystem(false)
|
, mNextSystem {false}
|
||||||
{
|
{
|
||||||
mState.viewing = NOTHING;
|
mState.viewing = NOTHING;
|
||||||
mState.viewstyle = AUTOMATIC;
|
mState.viewstyle = AUTOMATIC;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include "GuiComponent.h"
|
#include "GuiComponent.h"
|
||||||
#include "guis/GuiMsgBox.h"
|
#include "guis/GuiMsgBox.h"
|
||||||
#include "renderers/Renderer.h"
|
#include "renderers/Renderer.h"
|
||||||
|
#include "utils/StringUtil.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -117,15 +118,28 @@ public:
|
||||||
void removeGamelistView(SystemData* system);
|
void removeGamelistView(SystemData* system);
|
||||||
|
|
||||||
// Font Awesome symbols.
|
// Font Awesome symbols.
|
||||||
static const std::string CONTROLLER_CHAR;
|
#if defined(_MSC_VER) // MSVC compiler.
|
||||||
static const std::string CROSSEDCIRCLE_CHAR;
|
inline static const std::string CONTROLLER_CHAR {Utils::String::wideStringToString(L"\uf11b")};
|
||||||
static const std::string EXCLAMATION_CHAR;
|
inline static const std::string CROSSEDCIRCLE_CHAR {
|
||||||
static const std::string FAVORITE_CHAR;
|
Utils::String::wideStringToString(L"\uf05e")};
|
||||||
static const std::string FILTER_CHAR;
|
inline static const std::string EXCLAMATION_CHAR {Utils::String::wideStringToString(L"\uf06a")};
|
||||||
static const std::string FOLDER_CHAR;
|
inline static const std::string FAVORITE_CHAR {Utils::String::wideStringToString(L"\uf005")};
|
||||||
static const std::string GEAR_CHAR;
|
inline static const std::string FILTER_CHAR {Utils::String::wideStringToString(L"\uf0b0")};
|
||||||
static const std::string KEYBOARD_CHAR;
|
inline static const std::string FOLDER_CHAR {Utils::String::wideStringToString(L"\uf07C")};
|
||||||
static const std::string TICKMARK_CHAR;
|
inline static const std::string GEAR_CHAR {Utils::String::wideStringToString(L"\uf013")};
|
||||||
|
inline static const std::string KEYBOARD_CHAR {Utils::String::wideStringToString(L"\uf11c")};
|
||||||
|
inline static const std::string TICKMARK_CHAR {Utils::String::wideStringToString(L"\uf14A")};
|
||||||
|
#else
|
||||||
|
inline static const std::string CONTROLLER_CHAR {"\uf11b"};
|
||||||
|
inline static const std::string CROSSEDCIRCLE_CHAR {"\uf05e"};
|
||||||
|
inline static const std::string EXCLAMATION_CHAR {"\uf06a"};
|
||||||
|
inline static const std::string FAVORITE_CHAR {"\uf005"};
|
||||||
|
inline static const std::string FILTER_CHAR {"\uf0b0"};
|
||||||
|
inline static const std::string FOLDER_CHAR {"\uf07C"};
|
||||||
|
inline static const std::string GEAR_CHAR {"\uf013"};
|
||||||
|
inline static const std::string KEYBOARD_CHAR {"\uf11c"};
|
||||||
|
inline static const std::string TICKMARK_CHAR {"\uf14a"};
|
||||||
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ViewController() noexcept;
|
ViewController() noexcept;
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
#include "views/ViewController.h"
|
#include "views/ViewController.h"
|
||||||
|
|
||||||
BasicGamelistView::BasicGamelistView(Window* window, FileData* root)
|
BasicGamelistView::BasicGamelistView(Window* window, FileData* root)
|
||||||
: ISimpleGamelistView(window, root)
|
: ISimpleGamelistView {window, root}
|
||||||
, mList(window)
|
, mList {window}
|
||||||
{
|
{
|
||||||
mList.setSize(mSize.x, mSize.y * 0.8f);
|
mList.setSize(mSize.x, mSize.y * 0.8f);
|
||||||
mList.setPosition(0.0f, mSize.y * 0.2f);
|
mList.setPosition(0.0f, mSize.y * 0.2f);
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
#include "views/ViewController.h"
|
#include "views/ViewController.h"
|
||||||
|
|
||||||
IGamelistView::IGamelistView(Window* window, FileData* root)
|
IGamelistView::IGamelistView(Window* window, FileData* root)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mRoot(root)
|
, mRoot {root}
|
||||||
{
|
{
|
||||||
setSize(static_cast<float>(Renderer::getScreenWidth()),
|
setSize(static_cast<float>(Renderer::getScreenWidth()),
|
||||||
static_cast<float>(Renderer::getScreenHeight()));
|
static_cast<float>(Renderer::getScreenHeight()));
|
||||||
|
|
|
@ -21,11 +21,11 @@
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
|
||||||
ISimpleGamelistView::ISimpleGamelistView(Window* window, FileData* root)
|
ISimpleGamelistView::ISimpleGamelistView(Window* window, FileData* root)
|
||||||
: IGamelistView(window, root)
|
: IGamelistView {window, root}
|
||||||
, mHeaderText(window)
|
, mHeaderText {window}
|
||||||
, mHeaderImage(window)
|
, mHeaderImage {window}
|
||||||
, mBackground(window)
|
, mBackground {window}
|
||||||
, mRandomGame(nullptr)
|
, mRandomGame {nullptr}
|
||||||
{
|
{
|
||||||
mHeaderText.setText("Logo Text", false);
|
mHeaderText.setText("Logo Text", false);
|
||||||
mHeaderText.setSize(mSize.x, 0.0f);
|
mHeaderText.setSize(mSize.x, 0.0f);
|
||||||
|
|
|
@ -17,21 +17,21 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
GuiComponent::GuiComponent(Window* window)
|
GuiComponent::GuiComponent(Window* window)
|
||||||
: mWindow(window)
|
: mWindow {window}
|
||||||
, mParent(nullptr)
|
, mParent {nullptr}
|
||||||
, mOpacity(255)
|
, mOpacity {255}
|
||||||
, mColor(0)
|
, mColor {0}
|
||||||
, mSaturation(1.0f)
|
, mSaturation {1.0f}
|
||||||
, mColorShift(0)
|
, mColorShift {0}
|
||||||
, mColorShiftEnd(0)
|
, mColorShiftEnd {0}
|
||||||
, mPosition({})
|
, mPosition {0.0f, 0.0f, 0.0f}
|
||||||
, mOrigin({})
|
, mOrigin {0.0f, 0.0f}
|
||||||
, mRotationOrigin(0.5f, 0.5f)
|
, mRotationOrigin {0.5f, 0.5f}
|
||||||
, mSize({})
|
, mSize {0.0f, 0.0f}
|
||||||
, mIsProcessing(false)
|
, mIsProcessing {false}
|
||||||
, mVisible(true)
|
, mVisible {true}
|
||||||
, mEnabled(true)
|
, mEnabled {true}
|
||||||
, mTransform(Renderer::getIdentity())
|
, mTransform {Renderer::getIdentity()}
|
||||||
{
|
{
|
||||||
for (unsigned char i = 0; i < MAX_ANIMATIONS; ++i)
|
for (unsigned char i = 0; i < MAX_ANIMATIONS; ++i)
|
||||||
mAnimationMap[i] = nullptr;
|
mAnimationMap[i] = nullptr;
|
||||||
|
|
|
@ -21,7 +21,7 @@ std::vector<unsigned char> ImageIO::loadFromMemoryRGBA32(const unsigned char* da
|
||||||
std::vector<unsigned char> rawData;
|
std::vector<unsigned char> rawData;
|
||||||
width = 0;
|
width = 0;
|
||||||
height = 0;
|
height = 0;
|
||||||
FIMEMORY* fiMemory = FreeImage_OpenMemory(const_cast<BYTE*>(data), static_cast<DWORD>(size));
|
FIMEMORY* fiMemory {FreeImage_OpenMemory(const_cast<BYTE*>(data), static_cast<DWORD>(size))};
|
||||||
|
|
||||||
if (fiMemory != nullptr) {
|
if (fiMemory != nullptr) {
|
||||||
// Detect the filetype from data.
|
// Detect the filetype from data.
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
#include <pugixml.hpp>
|
#include <pugixml.hpp>
|
||||||
|
|
||||||
InputConfig::InputConfig(int deviceId, const std::string& deviceName, const std::string& deviceGUID)
|
InputConfig::InputConfig(int deviceId, const std::string& deviceName, const std::string& deviceGUID)
|
||||||
: mDeviceId(deviceId)
|
: mDeviceId {deviceId}
|
||||||
, mDeviceName(deviceName)
|
, mDeviceName {deviceName}
|
||||||
, mDeviceGUID(deviceGUID)
|
, mDeviceGUID {deviceGUID}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ void Log::open()
|
||||||
|
|
||||||
std::ostringstream& Log::get(LogLevel level)
|
std::ostringstream& Log::get(LogLevel level)
|
||||||
{
|
{
|
||||||
time_t t = time(nullptr);
|
time_t t {time(nullptr)};
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
// Of course Windows does not follow standards and puts the parameters the other way
|
// Of course Windows does not follow standards and puts the parameters the other way
|
||||||
|
|
|
@ -23,7 +23,7 @@ std::shared_ptr<Sound> Sound::get(const std::string& path)
|
||||||
if (it != sMap.cend())
|
if (it != sMap.cend())
|
||||||
return it->second;
|
return it->second;
|
||||||
|
|
||||||
std::shared_ptr<Sound> sound = std::shared_ptr<Sound>(new Sound(path));
|
std::shared_ptr<Sound> sound {std::shared_ptr<Sound>(new Sound(path))};
|
||||||
AudioManager::getInstance().registerSound(sound);
|
AudioManager::getInstance().registerSound(sound);
|
||||||
sMap[path] = sound;
|
sMap[path] = sound;
|
||||||
return sound;
|
return sound;
|
||||||
|
|
|
@ -25,31 +25,31 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Window::Window() noexcept
|
Window::Window() noexcept
|
||||||
: mScreensaver(nullptr)
|
: mScreensaver {nullptr}
|
||||||
, mMediaViewer(nullptr)
|
, mMediaViewer {nullptr}
|
||||||
, mLaunchScreen(nullptr)
|
, mLaunchScreen {nullptr}
|
||||||
, mInfoPopup(nullptr)
|
, mInfoPopup {nullptr}
|
||||||
, mListScrollOpacity(0)
|
, mListScrollOpacity {0}
|
||||||
, mFrameTimeElapsed(0)
|
, mFrameTimeElapsed {0}
|
||||||
, mFrameCountElapsed(0)
|
, mFrameCountElapsed {0}
|
||||||
, mAverageDeltaTime(10)
|
, mAverageDeltaTime {10}
|
||||||
, mTimeSinceLastInput(0)
|
, mTimeSinceLastInput {0}
|
||||||
, mNormalizeNextUpdate(false)
|
, mNormalizeNextUpdate {false}
|
||||||
, mAllowSleep(true)
|
, mAllowSleep {true}
|
||||||
, mSleeping(false)
|
, mSleeping {false}
|
||||||
, mRenderScreensaver(false)
|
, mRenderScreensaver {false}
|
||||||
, mRenderMediaViewer(false)
|
, mRenderMediaViewer {false}
|
||||||
, mRenderLaunchScreen(false)
|
, mRenderLaunchScreen {false}
|
||||||
, mGameLaunchedState(false)
|
, mGameLaunchedState {false}
|
||||||
, mAllowTextScrolling(true)
|
, mAllowTextScrolling {true}
|
||||||
, mAllowFileAnimation(true)
|
, mAllowFileAnimation {true}
|
||||||
, mCachedBackground(false)
|
, mCachedBackground {false}
|
||||||
, mInvalidatedCachedBackground(false)
|
, mInvalidatedCachedBackground {false}
|
||||||
, mInitiateCacheTimer {false}
|
, mInitiateCacheTimer {false}
|
||||||
, mInvalidateCacheTimer {0}
|
, mInvalidateCacheTimer {0}
|
||||||
, mVideoPlayerCount(0)
|
, mVideoPlayerCount {0}
|
||||||
, mTopScale(0.5)
|
, mTopScale {0.5f}
|
||||||
, mChangedThemeSet(false)
|
, mChangedThemeSet {false}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,11 @@ AnimationController::AnimationController(Animation* anim,
|
||||||
int delay,
|
int delay,
|
||||||
std::function<void()> finishedCallback,
|
std::function<void()> finishedCallback,
|
||||||
bool reverse)
|
bool reverse)
|
||||||
: mAnimation(anim)
|
: mAnimation {anim}
|
||||||
, mFinishedCallback(finishedCallback)
|
, mFinishedCallback {finishedCallback}
|
||||||
, mReverse(reverse)
|
, mReverse {reverse}
|
||||||
, mTime(-delay)
|
, mTime {-delay}
|
||||||
, mDelay(delay)
|
, mDelay {delay}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#include "resources/ResourceManager.h"
|
#include "resources/ResourceManager.h"
|
||||||
|
|
||||||
AnimatedImageComponent::AnimatedImageComponent(Window* window)
|
AnimatedImageComponent::AnimatedImageComponent(Window* window)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mEnabled(false)
|
, mEnabled {false}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ namespace
|
||||||
{
|
{
|
||||||
// clang-format off
|
// clang-format off
|
||||||
// The "unknown" controller entry has to be placed last.
|
// The "unknown" controller entry has to be placed last.
|
||||||
GameControllers sControllerDefinitions [] = {
|
GameControllers sControllerDefinitions [] {
|
||||||
// shortName displayName fileName
|
// shortName displayName fileName
|
||||||
{"gamepad_generic", "Gamepad (Generic)", ":/graphics/controllers/gamepad_generic.svg"},
|
{"gamepad_generic", "Gamepad (Generic)", ":/graphics/controllers/gamepad_generic.svg"},
|
||||||
{"gamepad_nintendo_nes", "Gamepad (Nintendo NES)", ":/graphics/controllers/gamepad_nintendo_nes.svg"},
|
{"gamepad_nintendo_nes", "Gamepad (Nintendo NES)", ":/graphics/controllers/gamepad_nintendo_nes.svg"},
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include "components/TextComponent.h"
|
#include "components/TextComponent.h"
|
||||||
|
|
||||||
// Animation definition.
|
// Animation definition.
|
||||||
AnimationFrame BUSY_ANIMATION_FRAMES[] = {
|
AnimationFrame BUSY_ANIMATION_FRAMES[] {
|
||||||
{":/graphics/busy_0.svg", 300},
|
{":/graphics/busy_0.svg", 300},
|
||||||
{":/graphics/busy_1.svg", 300},
|
{":/graphics/busy_1.svg", 300},
|
||||||
{":/graphics/busy_2.svg", 300},
|
{":/graphics/busy_2.svg", 300},
|
||||||
|
@ -23,9 +23,9 @@ AnimationFrame BUSY_ANIMATION_FRAMES[] = {
|
||||||
const AnimationDef BUSY_ANIMATION_DEF = {BUSY_ANIMATION_FRAMES, 4, true};
|
const AnimationDef BUSY_ANIMATION_DEF = {BUSY_ANIMATION_FRAMES, 4, true};
|
||||||
|
|
||||||
BusyComponent::BusyComponent(Window* window)
|
BusyComponent::BusyComponent(Window* window)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mBackground(window, ":/graphics/frame.png")
|
, mBackground {window, ":/graphics/frame.png"}
|
||||||
, mGrid(window, glm::ivec2 {5, 3})
|
, mGrid {window, glm::ivec2 {5, 3}}
|
||||||
{
|
{
|
||||||
mAnimation = std::make_shared<AnimatedImageComponent>(mWindow);
|
mAnimation = std::make_shared<AnimatedImageComponent>(mWindow);
|
||||||
mAnimation->load(&BUSY_ANIMATION_DEF);
|
mAnimation->load(&BUSY_ANIMATION_DEF);
|
||||||
|
|
|
@ -21,7 +21,7 @@ ButtonComponent::ButtonComponent(Window* window,
|
||||||
: GuiComponent {window}
|
: GuiComponent {window}
|
||||||
, mBox {window, ":/graphics/button.svg"}
|
, mBox {window, ":/graphics/button.svg"}
|
||||||
, mFont {Font::get(FONT_SIZE_MEDIUM)}
|
, mFont {Font::get(FONT_SIZE_MEDIUM)}
|
||||||
, mPadding {{}}
|
, mPadding {0.0f, 0.0f, 0.0f, 0.0f}
|
||||||
, mFocused {false}
|
, mFocused {false}
|
||||||
, mEnabled {true}
|
, mEnabled {true}
|
||||||
, mFlatStyle {flatStyle}
|
, mFlatStyle {flatStyle}
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
using namespace GridFlags;
|
using namespace GridFlags;
|
||||||
|
|
||||||
ComponentGrid::ComponentGrid(Window* window, const glm::ivec2& gridDimensions)
|
ComponentGrid::ComponentGrid(Window* window, const glm::ivec2& gridDimensions)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mGridSize(gridDimensions)
|
, mGridSize {gridDimensions}
|
||||||
, mCursor(0, 0)
|
, mCursor {0, 0}
|
||||||
{
|
{
|
||||||
assert(gridDimensions.x > 0 && gridDimensions.y > 0);
|
assert(gridDimensions.x > 0 && gridDimensions.y > 0);
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ float ComponentGrid::getColWidth(int col)
|
||||||
return mColWidths[col] * mSize.x;
|
return mColWidths[col] * mSize.x;
|
||||||
|
|
||||||
// Calculate automatic width.
|
// Calculate automatic width.
|
||||||
float freeWidthPerc = 1;
|
float freeWidthPerc {1.0};
|
||||||
int between = 0;
|
int between {0};
|
||||||
for (int x = 0; x < mGridSize.x; ++x) {
|
for (int x = 0; x < mGridSize.x; ++x) {
|
||||||
freeWidthPerc -= mColWidths[x]; // If it's 0 it won't do anything.
|
freeWidthPerc -= mColWidths[x]; // If it's 0 it won't do anything.
|
||||||
if (mColWidths[x] == 0)
|
if (mColWidths[x] == 0)
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
#include "utils/StringUtil.h"
|
#include "utils/StringUtil.h"
|
||||||
|
|
||||||
DateTimeComponent::DateTimeComponent(Window* window)
|
DateTimeComponent::DateTimeComponent(Window* window)
|
||||||
: TextComponent(window)
|
: TextComponent {window}
|
||||||
, mDisplayRelative(false)
|
, mDisplayRelative {false}
|
||||||
{
|
{
|
||||||
// ISO 8601 date format.
|
// ISO 8601 date format.
|
||||||
setFormat("%Y-%m-%d");
|
setFormat("%Y-%m-%d");
|
||||||
|
@ -30,8 +30,8 @@ DateTimeComponent::DateTimeComponent(Window* window,
|
||||||
glm::vec3 pos,
|
glm::vec3 pos,
|
||||||
glm::vec2 size,
|
glm::vec2 size,
|
||||||
unsigned int bgcolor)
|
unsigned int bgcolor)
|
||||||
: TextComponent(window, text, font, color, align, pos, size, bgcolor)
|
: TextComponent {window, text, font, color, align, pos, size, bgcolor}
|
||||||
, mDisplayRelative(false)
|
, mDisplayRelative {false}
|
||||||
{
|
{
|
||||||
// ISO 8601 date format.
|
// ISO 8601 date format.
|
||||||
setFormat("%Y-%m-%d");
|
setFormat("%Y-%m-%d");
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
FlexboxComponent::FlexboxComponent(Window* window, std::vector<FlexboxItem>& items)
|
FlexboxComponent::FlexboxComponent(Window* window, std::vector<FlexboxItem>& items)
|
||||||
: GuiComponent {window}
|
: GuiComponent {window}
|
||||||
, mItems(items)
|
, mItems {items}
|
||||||
, mDirection {DEFAULT_DIRECTION}
|
, mDirection {DEFAULT_DIRECTION}
|
||||||
, mAlignment {DEFAULT_ALIGNMENT}
|
, mAlignment {DEFAULT_ALIGNMENT}
|
||||||
, mLines {DEFAULT_LINES}
|
, mLines {DEFAULT_LINES}
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
#include "resources/TextureResource.h"
|
#include "resources/TextureResource.h"
|
||||||
|
|
||||||
GridTileComponent::GridTileComponent(Window* window)
|
GridTileComponent::GridTileComponent(Window* window)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mBackground(window, ":/graphics/frame.png")
|
, mBackground {window, ":/graphics/frame.png"}
|
||||||
{
|
{
|
||||||
mDefaultProperties.mSize = getDefaultTileSize();
|
mDefaultProperties.mSize = getDefaultTileSize();
|
||||||
mDefaultProperties.mPadding = glm::vec2 {16.0f * Renderer::getScreenWidthModifier(),
|
mDefaultProperties.mPadding = glm::vec2 {16.0f * Renderer::getScreenWidthModifier(),
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
static std::map<std::string, std::string> sIconPathMap {};
|
static std::map<std::string, std::string> sIconPathMap {};
|
||||||
|
|
||||||
HelpComponent::HelpComponent(Window* window)
|
HelpComponent::HelpComponent(Window* window)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
{
|
{
|
||||||
assignIcons();
|
assignIcons();
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,10 +86,10 @@ public:
|
||||||
IList(Window* window,
|
IList(Window* window,
|
||||||
const ScrollTierList& tierList = LIST_SCROLL_STYLE_QUICK,
|
const ScrollTierList& tierList = LIST_SCROLL_STYLE_QUICK,
|
||||||
const ListLoopType& loopType = LIST_PAUSE_AT_END)
|
const ListLoopType& loopType = LIST_PAUSE_AT_END)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mTierList(tierList)
|
, mTierList {tierList}
|
||||||
, mLoopType(loopType)
|
, mLoopType {loopType}
|
||||||
, mWindow(window)
|
, mWindow {window}
|
||||||
{
|
{
|
||||||
mCursor = 0;
|
mCursor = 0;
|
||||||
mScrollTier = 0;
|
mScrollTier = 0;
|
||||||
|
|
|
@ -29,22 +29,22 @@ glm::vec2 ImageComponent::getSize() const
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageComponent::ImageComponent(Window* window, bool forceLoad, bool dynamic)
|
ImageComponent::ImageComponent(Window* window, bool forceLoad, bool dynamic)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mTargetSize({})
|
, mTargetSize {0, 0}
|
||||||
, mFlipX(false)
|
, mFlipX {false}
|
||||||
, mFlipY(false)
|
, mFlipY {false}
|
||||||
, mTargetIsMax(false)
|
, mTargetIsMax {false}
|
||||||
, mTargetIsMin(false)
|
, mTargetIsMin {false}
|
||||||
, mColorShift(0xFFFFFFFF)
|
, mColorShift {0xFFFFFFFF}
|
||||||
, mColorShiftEnd(0xFFFFFFFF)
|
, mColorShiftEnd {0xFFFFFFFF}
|
||||||
, mColorGradientHorizontal(true)
|
, mColorGradientHorizontal {true}
|
||||||
, mFadeOpacity(0)
|
, mFadeOpacity {0}
|
||||||
, mFading(false)
|
, mFading {false}
|
||||||
, mForceLoad(forceLoad)
|
, mForceLoad {forceLoad}
|
||||||
, mDynamic(dynamic)
|
, mDynamic {dynamic}
|
||||||
, mRotateByTargetSize(false)
|
, mRotateByTargetSize {false}
|
||||||
, mTopLeftCrop({})
|
, mTopLeftCrop {0.0f, 0.0f}
|
||||||
, mBottomRightCrop(1.0f, 1.0f)
|
, mBottomRightCrop {1.0f, 1.0f}
|
||||||
{
|
{
|
||||||
updateColors();
|
updateColors();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
MenuComponent::MenuComponent(Window* window,
|
MenuComponent::MenuComponent(Window* window,
|
||||||
std::string title,
|
std::string title,
|
||||||
const std::shared_ptr<Font>& titleFont)
|
const std::shared_ptr<Font>& titleFont)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mBackground(window)
|
, mBackground {window}
|
||||||
, mGrid(window, glm::ivec2 {2, 4})
|
, mGrid {window, glm::ivec2 {2, 4}}
|
||||||
, mNeedsSaving(false)
|
, mNeedsSaving {false}
|
||||||
{
|
{
|
||||||
addChild(&mBackground);
|
addChild(&mBackground);
|
||||||
addChild(&mGrid);
|
addChild(&mGrid);
|
||||||
|
|
|
@ -37,8 +37,8 @@ NinePatchComponent::~NinePatchComponent()
|
||||||
|
|
||||||
void NinePatchComponent::updateColors()
|
void NinePatchComponent::updateColors()
|
||||||
{
|
{
|
||||||
const unsigned int edgeColor = Renderer::convertRGBAToABGR(mEdgeColor);
|
const unsigned int edgeColor {Renderer::convertRGBAToABGR(mEdgeColor)};
|
||||||
const unsigned int centerColor = Renderer::convertRGBAToABGR(mCenterColor);
|
const unsigned int centerColor {Renderer::convertRGBAToABGR(mCenterColor)};
|
||||||
|
|
||||||
for (int i = 0; i < 6 * 9; ++i)
|
for (int i = 0; i < 6 * 9; ++i)
|
||||||
mVertices[i].col = edgeColor;
|
mVertices[i].col = edgeColor;
|
||||||
|
|
|
@ -14,13 +14,13 @@
|
||||||
#include "resources/TextureResource.h"
|
#include "resources/TextureResource.h"
|
||||||
|
|
||||||
RatingComponent::RatingComponent(Window* window, bool colorizeChanges)
|
RatingComponent::RatingComponent(Window* window, bool colorizeChanges)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mColorOriginalValue(DEFAULT_COLORSHIFT)
|
, mColorOriginalValue {DEFAULT_COLORSHIFT}
|
||||||
, mColorChangedValue(DEFAULT_COLORSHIFT)
|
, mColorChangedValue {DEFAULT_COLORSHIFT}
|
||||||
, mColorShift(DEFAULT_COLORSHIFT)
|
, mColorShift {DEFAULT_COLORSHIFT}
|
||||||
, mColorShiftEnd(DEFAULT_COLORSHIFT)
|
, mColorShiftEnd {DEFAULT_COLORSHIFT}
|
||||||
, mUnfilledColor(DEFAULT_COLORSHIFT)
|
, mUnfilledColor {DEFAULT_COLORSHIFT}
|
||||||
, mColorizeChanges(colorizeChanges)
|
, mColorizeChanges {colorizeChanges}
|
||||||
{
|
{
|
||||||
mFilledTexture = TextureResource::get(":/graphics/star_filled.svg", true);
|
mFilledTexture = TextureResource::get(":/graphics/star_filled.svg", true);
|
||||||
mUnfilledTexture = TextureResource::get(":/graphics/star_unfilled.svg", true);
|
mUnfilledTexture = TextureResource::get(":/graphics/star_unfilled.svg", true);
|
||||||
|
|
|
@ -20,7 +20,7 @@ public:
|
||||||
ScrollIndicatorComponent(std::shared_ptr<ComponentList> componentList,
|
ScrollIndicatorComponent(std::shared_ptr<ComponentList> componentList,
|
||||||
std::shared_ptr<ImageComponent> scrollUp,
|
std::shared_ptr<ImageComponent> scrollUp,
|
||||||
std::shared_ptr<ImageComponent> scrollDown)
|
std::shared_ptr<ImageComponent> scrollDown)
|
||||||
: mPreviousScrollState(ComponentList::SCROLL_NONE)
|
: mPreviousScrollState {ComponentList::SCROLL_NONE}
|
||||||
{
|
{
|
||||||
assert(componentList != nullptr && scrollUp != nullptr && scrollDown != nullptr);
|
assert(componentList != nullptr && scrollUp != nullptr && scrollDown != nullptr);
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,12 @@
|
||||||
#include "resources/Font.h"
|
#include "resources/Font.h"
|
||||||
|
|
||||||
SwitchComponent::SwitchComponent(Window* window, bool state)
|
SwitchComponent::SwitchComponent(Window* window, bool state)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mImage(window)
|
, mImage {window}
|
||||||
, mState(state)
|
, mState {state}
|
||||||
, mOriginalValue(state)
|
, mOriginalValue {state}
|
||||||
, mColorOriginalValue(DEFAULT_COLORSHIFT)
|
, mColorOriginalValue {DEFAULT_COLORSHIFT}
|
||||||
, mColorChangedValue(DEFAULT_COLORSHIFT)
|
, mColorChangedValue {DEFAULT_COLORSHIFT}
|
||||||
{
|
{
|
||||||
mImage.setImage(":/graphics/off.svg");
|
mImage.setImage(":/graphics/off.svg");
|
||||||
mImage.setResize(0, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight());
|
mImage.setResize(0, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight());
|
||||||
|
|
|
@ -19,27 +19,27 @@
|
||||||
#define MEDIA_VIEWER_FADE_IN_TIME 600
|
#define MEDIA_VIEWER_FADE_IN_TIME 600
|
||||||
|
|
||||||
VideoComponent::VideoComponent(Window* window)
|
VideoComponent::VideoComponent(Window* window)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mWindow(window)
|
, mWindow {window}
|
||||||
, mStaticImage(window)
|
, mStaticImage {window}
|
||||||
, mVideoWidth(0)
|
, mVideoWidth {0}
|
||||||
, mVideoHeight(0)
|
, mVideoHeight {0}
|
||||||
, mTargetSize(0, 0)
|
, mTargetSize {0.0f, 0.0f}
|
||||||
, mVideoAreaPos(0, 0)
|
, mVideoAreaPos {0.0f, 0.0f}
|
||||||
, mVideoAreaSize(0, 0)
|
, mVideoAreaSize {0.0f, 0.0f}
|
||||||
, mStartDelayed(false)
|
, mStartDelayed {false}
|
||||||
, mIsPlaying(false)
|
, mIsPlaying {false}
|
||||||
, mIsActuallyPlaying(false)
|
, mIsActuallyPlaying {false}
|
||||||
, mPause(false)
|
, mPause {false}
|
||||||
, mShowing(false)
|
, mShowing {false}
|
||||||
, mDisable(false)
|
, mDisable {false}
|
||||||
, mMediaViewerMode(false)
|
, mMediaViewerMode {false}
|
||||||
, mScreensaverActive(false)
|
, mScreensaverActive {false}
|
||||||
, mScreensaverMode(false)
|
, mScreensaverMode {false}
|
||||||
, mGameLaunched(false)
|
, mGameLaunched {false}
|
||||||
, mBlockPlayer(false)
|
, mBlockPlayer {false}
|
||||||
, mTargetIsMax(false)
|
, mTargetIsMax {false}
|
||||||
, mFadeIn(1.0)
|
, mFadeIn {1.0f}
|
||||||
{
|
{
|
||||||
// Setup the default configuration.
|
// Setup the default configuration.
|
||||||
mConfig.showSnapshotDelay = false;
|
mConfig.showSnapshotDelay = false;
|
||||||
|
|
|
@ -24,34 +24,34 @@ std::vector<std::string> VideoFFmpegComponent::sHWDecodedVideos;
|
||||||
std::vector<std::string> VideoFFmpegComponent::sSWDecodedVideos;
|
std::vector<std::string> VideoFFmpegComponent::sSWDecodedVideos;
|
||||||
|
|
||||||
VideoFFmpegComponent::VideoFFmpegComponent(Window* window)
|
VideoFFmpegComponent::VideoFFmpegComponent(Window* window)
|
||||||
: VideoComponent(window)
|
: VideoComponent {window}
|
||||||
, mFrameProcessingThread(nullptr)
|
, mFrameProcessingThread {nullptr}
|
||||||
, mFormatContext(nullptr)
|
, mFormatContext {nullptr}
|
||||||
, mVideoStream(nullptr)
|
, mVideoStream {nullptr}
|
||||||
, mAudioStream(nullptr)
|
, mAudioStream {nullptr}
|
||||||
, mVideoCodec(nullptr)
|
, mVideoCodec {nullptr}
|
||||||
, mAudioCodec(nullptr)
|
, mAudioCodec {nullptr}
|
||||||
, mHardwareCodec(nullptr)
|
, mHardwareCodec {nullptr}
|
||||||
, mHwContext(nullptr)
|
, mHwContext {nullptr}
|
||||||
, mVideoCodecContext(nullptr)
|
, mVideoCodecContext {nullptr}
|
||||||
, mAudioCodecContext(nullptr)
|
, mAudioCodecContext {nullptr}
|
||||||
, mVBufferSrcContext(nullptr)
|
, mVBufferSrcContext {nullptr}
|
||||||
, mVBufferSinkContext(nullptr)
|
, mVBufferSinkContext {nullptr}
|
||||||
, mVFilterGraph(nullptr)
|
, mVFilterGraph {nullptr}
|
||||||
, mVFilterInputs(nullptr)
|
, mVFilterInputs {nullptr}
|
||||||
, mVFilterOutputs(nullptr)
|
, mVFilterOutputs {nullptr}
|
||||||
, mABufferSrcContext(nullptr)
|
, mABufferSrcContext {nullptr}
|
||||||
, mABufferSinkContext(nullptr)
|
, mABufferSinkContext {nullptr}
|
||||||
, mAFilterGraph(nullptr)
|
, mAFilterGraph {nullptr}
|
||||||
, mAFilterInputs(nullptr)
|
, mAFilterInputs {nullptr}
|
||||||
, mAFilterOutputs(nullptr)
|
, mAFilterOutputs {nullptr}
|
||||||
, mVideoTargetQueueSize(0)
|
, mVideoTargetQueueSize {0}
|
||||||
, mAudioTargetQueueSize(0)
|
, mAudioTargetQueueSize {0}
|
||||||
, mVideoTimeBase(0.0l)
|
, mVideoTimeBase {0.0l}
|
||||||
, mAccumulatedTime(0)
|
, mAccumulatedTime {0.0l}
|
||||||
, mStartTimeAccumulation(false)
|
, mStartTimeAccumulation {false}
|
||||||
, mDecodedFrame(false)
|
, mDecodedFrame {false}
|
||||||
, mEndOfVideo(false)
|
, mEndOfVideo {false}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,11 +21,11 @@ GuiDetectDevice::GuiDetectDevice(Window* window,
|
||||||
bool firstRun,
|
bool firstRun,
|
||||||
bool forcedConfig,
|
bool forcedConfig,
|
||||||
const std::function<void()>& doneCallback)
|
const std::function<void()>& doneCallback)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mFirstRun(firstRun)
|
, mFirstRun {firstRun}
|
||||||
, mForcedConfig(forcedConfig)
|
, mForcedConfig {forcedConfig}
|
||||||
, mBackground(window, ":/graphics/frame.svg")
|
, mBackground {window, ":/graphics/frame.svg"}
|
||||||
, mGrid(window, glm::ivec2 {1, 5})
|
, mGrid {window, glm::ivec2 {1, 5}}
|
||||||
{
|
{
|
||||||
mHoldingConfig = nullptr;
|
mHoldingConfig = nullptr;
|
||||||
mHoldTime = 0;
|
mHoldTime = 0;
|
||||||
|
@ -43,7 +43,7 @@ GuiDetectDevice::GuiDetectDevice(Window* window,
|
||||||
|
|
||||||
// Device info.
|
// Device info.
|
||||||
std::stringstream deviceInfo;
|
std::stringstream deviceInfo;
|
||||||
int numDevices = InputManager::getInstance().getNumJoysticks();
|
int numDevices {InputManager::getInstance().getNumJoysticks()};
|
||||||
|
|
||||||
if (numDevices > 0)
|
if (numDevices > 0)
|
||||||
deviceInfo << numDevices << " GAMEPAD" << (numDevices > 1 ? "S" : "") << " DETECTED";
|
deviceInfo << numDevices << " GAMEPAD" << (numDevices > 1 ? "S" : "") << " DETECTED";
|
||||||
|
|
|
@ -15,17 +15,17 @@
|
||||||
#include <SDL2/SDL_timer.h>
|
#include <SDL2/SDL_timer.h>
|
||||||
|
|
||||||
GuiInfoPopup::GuiInfoPopup(Window* window, std::string message, int duration)
|
GuiInfoPopup::GuiInfoPopup(Window* window, std::string message, int duration)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mMessage(message)
|
, mMessage {message}
|
||||||
, mDuration(duration)
|
, mDuration {duration}
|
||||||
, mRunning(true)
|
, mRunning {true}
|
||||||
{
|
{
|
||||||
mFrame = new NinePatchComponent(window);
|
mFrame = new NinePatchComponent(window);
|
||||||
float maxWidth = Renderer::getScreenWidth() * 0.9f;
|
float maxWidth {Renderer::getScreenWidth() * 0.9f};
|
||||||
float maxHeight = Renderer::getScreenHeight() * 0.2f;
|
float maxHeight {Renderer::getScreenHeight() * 0.2f};
|
||||||
|
|
||||||
std::shared_ptr<TextComponent> s = std::make_shared<TextComponent>(
|
std::shared_ptr<TextComponent> s {std::make_shared<TextComponent>(
|
||||||
mWindow, "", Font::get(FONT_SIZE_MINI), 0x444444FF, ALIGN_CENTER);
|
mWindow, "", Font::get(FONT_SIZE_MINI), 0x444444FF, ALIGN_CENTER)};
|
||||||
|
|
||||||
// We do this to force the text container to resize and return the actual expected popup size.
|
// We do this to force the text container to resize and return the actual expected popup size.
|
||||||
s->setSize(0.0f, 0.0f);
|
s->setSize(0.0f, 0.0f);
|
||||||
|
|
|
@ -31,11 +31,11 @@ GuiInputConfig::GuiInputConfig(Window* window,
|
||||||
InputConfig* target,
|
InputConfig* target,
|
||||||
bool reconfigureAll,
|
bool reconfigureAll,
|
||||||
const std::function<void()>& okCallback)
|
const std::function<void()>& okCallback)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mBackground(window, ":/graphics/frame.svg")
|
, mBackground {window, ":/graphics/frame.svg"}
|
||||||
, mGrid(window, glm::ivec2 {1, 7})
|
, mGrid {window, glm::ivec2 {1, 7}}
|
||||||
, mTargetConfig(target)
|
, mTargetConfig {target}
|
||||||
, mHoldingInput(false)
|
, mHoldingInput {false}
|
||||||
{
|
{
|
||||||
// Populate the configuration list with the text and icons applicable to the
|
// Populate the configuration list with the text and icons applicable to the
|
||||||
// configured controller type.
|
// configured controller type.
|
||||||
|
|
|
@ -26,21 +26,21 @@ GuiMsgBox::GuiMsgBox(Window* window,
|
||||||
const std::function<void()>& func3,
|
const std::function<void()>& func3,
|
||||||
bool disableBackButton,
|
bool disableBackButton,
|
||||||
bool deleteOnButtonPress)
|
bool deleteOnButtonPress)
|
||||||
: GuiComponent(window)
|
: GuiComponent {window}
|
||||||
, mBackground(window, ":/graphics/frame.svg")
|
, mBackground {window, ":/graphics/frame.svg"}
|
||||||
, mGrid(window, glm::ivec2 {1, 2})
|
, mGrid {window, glm::ivec2 {1, 2}}
|
||||||
, mHelpStyle(helpstyle)
|
, mHelpStyle {helpstyle}
|
||||||
, mDisableBackButton(disableBackButton)
|
, mDisableBackButton {disableBackButton}
|
||||||
, mDeleteOnButtonPress(deleteOnButtonPress)
|
, mDeleteOnButtonPress {deleteOnButtonPress}
|
||||||
{
|
{
|
||||||
// Adjust the width relative to the aspect ratio of the screen to make the GUI look coherent
|
// 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.
|
// regardless of screen type. The 1.778 aspect ratio value is the 16:9 reference.
|
||||||
float aspectValue = 1.778f / Renderer::getScreenAspectRatio();
|
float aspectValue {1.778f / Renderer::getScreenAspectRatio()};
|
||||||
|
|
||||||
float width =
|
float width {
|
||||||
floorf(glm::clamp(0.60f * aspectValue, 0.60f, 0.80f) * Renderer::getScreenWidth());
|
floorf(glm::clamp(0.60f * aspectValue, 0.60f, 0.80f) * Renderer::getScreenWidth())};
|
||||||
float minWidth =
|
float minWidth {
|
||||||
floorf(glm::clamp(0.30f * aspectValue, 0.10f, 0.50f) * Renderer::getScreenWidth());
|
floorf(glm::clamp(0.30f * aspectValue, 0.10f, 0.50f) * Renderer::getScreenWidth())};
|
||||||
|
|
||||||
mMsg = std::make_shared<TextComponent>(mWindow, text, Font::get(FONT_SIZE_MEDIUM), 0x777777FF,
|
mMsg = std::make_shared<TextComponent>(mWindow, text, Font::get(FONT_SIZE_MEDIUM), 0x777777FF,
|
||||||
ALIGN_CENTER);
|
ALIGN_CENTER);
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#include "utils/StringUtil.h"
|
#include "utils/StringUtil.h"
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
std::vector<std::vector<const char*>> kbBaseUS{
|
std::vector<std::vector<const char*>> kbBaseUS {
|
||||||
{"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "DEL"},
|
{"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "DEL"},
|
||||||
{"!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+", "DEL"},
|
{"!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+", "DEL"},
|
||||||
{"¡", "²", "³", "¤", "€", "¼", "½", "¾", "‘", "’", "¥", "×", "DEL"},
|
{"¡", "²", "³", "¤", "€", "¼", "½", "¾", "‘", "’", "¥", "×", "DEL"},
|
||||||
|
@ -60,13 +60,13 @@ std::vector<std::vector<const char*>> kbBaseUS{
|
||||||
{"", "æ", "", "©", "", "", "ñ", "µ", "ç", "", "¿", "ALT", "-colspan-"},
|
{"", "æ", "", "©", "", "", "ñ", "µ", "ç", "", "¿", "ALT", "-colspan-"},
|
||||||
{"", "Æ", "", "¢", "", "", "Ñ", "Μ", "Ç", "", "", "ALT", "-colspan-"}};
|
{"", "Æ", "", "¢", "", "", "Ñ", "Μ", "Ç", "", "", "ALT", "-colspan-"}};
|
||||||
|
|
||||||
std::vector<std::vector<const char*>> kbLastRowNormal{
|
std::vector<std::vector<const char*>> kbLastRowNormal {
|
||||||
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"},
|
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"},
|
||||||
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"},
|
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"},
|
||||||
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"},
|
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"},
|
||||||
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"}};
|
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"}};
|
||||||
|
|
||||||
std::vector<std::vector<const char*>> kbLastRowLoad{
|
std::vector<std::vector<const char*>> kbLastRowLoad {
|
||||||
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "LOAD", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"},
|
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "LOAD", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"},
|
||||||
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "LOAD", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"},
|
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "LOAD", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"},
|
||||||
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "LOAD", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"},
|
{"SHIFT", "-colspan-", "SPACE", "-colspan-", "-colspan-", "-colspan-", "-colspan-", "LOAD", "-colspan-", "CLEAR", "-colspan-", "CANCEL", "-colspan-"},
|
||||||
|
|
|
@ -24,50 +24,50 @@
|
||||||
namespace Renderer
|
namespace Renderer
|
||||||
{
|
{
|
||||||
static std::stack<Rect> clipStack;
|
static std::stack<Rect> clipStack;
|
||||||
static SDL_Window* sdlWindow = nullptr;
|
static SDL_Window* sdlWindow {nullptr};
|
||||||
static glm::mat4 mProjectionMatrix;
|
static glm::mat4 mProjectionMatrix {};
|
||||||
static int windowWidth = 0;
|
static int windowWidth {0};
|
||||||
static int windowHeight = 0;
|
static int windowHeight {0};
|
||||||
static int screenWidth = 0;
|
static int screenWidth {0};
|
||||||
static int screenHeight = 0;
|
static int screenHeight {0};
|
||||||
static int screenOffsetX = 0;
|
static int screenOffsetX {0};
|
||||||
static int screenOffsetY = 0;
|
static int screenOffsetY {0};
|
||||||
static int screenRotate = 0;
|
static int screenRotate {0};
|
||||||
static bool initialCursorState = 1;
|
static bool initialCursorState {1};
|
||||||
// Screen resolution modifiers relative to the 1920x1080 reference.
|
// Screen resolution modifiers relative to the 1920x1080 reference.
|
||||||
static float screenHeightModifier;
|
static float screenHeightModifier {0.0f};
|
||||||
static float screenWidthModifier;
|
static float screenWidthModifier {0.0f};
|
||||||
static float screenAspectRatio;
|
static float screenAspectRatio {0.0f};
|
||||||
|
|
||||||
static void setIcon()
|
static void setIcon()
|
||||||
{
|
{
|
||||||
size_t width = 0;
|
size_t width {0};
|
||||||
size_t height = 0;
|
size_t height {0};
|
||||||
ResourceData resData =
|
ResourceData resData {
|
||||||
ResourceManager::getInstance().getFileData(":/graphics/window_icon_256.png");
|
ResourceManager::getInstance().getFileData(":/graphics/window_icon_256.png")};
|
||||||
std::vector<unsigned char> rawData =
|
std::vector<unsigned char> rawData {
|
||||||
ImageIO::loadFromMemoryRGBA32(resData.ptr.get(), resData.length, width, height);
|
ImageIO::loadFromMemoryRGBA32(resData.ptr.get(), resData.length, width, height)};
|
||||||
|
|
||||||
if (!rawData.empty()) {
|
if (!rawData.empty()) {
|
||||||
ImageIO::flipPixelsVert(rawData.data(), width, height);
|
ImageIO::flipPixelsVert(rawData.data(), width, height);
|
||||||
|
|
||||||
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||||
unsigned int rmask = 0xFF000000;
|
unsigned int rmask {0xFF000000};
|
||||||
unsigned int gmask = 0x00FF0000;
|
unsigned int gmask {0x00FF0000};
|
||||||
unsigned int bmask = 0x0000FF00;
|
unsigned int bmask {0x0000FF00};
|
||||||
unsigned int amask = 0x000000FF;
|
unsigned int amask {0x000000FF};
|
||||||
#else
|
#else
|
||||||
unsigned int rmask = 0x000000FF;
|
unsigned int rmask {0x000000FF};
|
||||||
unsigned int gmask = 0x0000FF00;
|
unsigned int gmask {0x0000FF00};
|
||||||
unsigned int bmask = 0x00FF0000;
|
unsigned int bmask {0x00FF0000};
|
||||||
unsigned int amask = 0xFF000000;
|
unsigned int amask {0xFF000000};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Try creating SDL surface from logo data.
|
// Try creating SDL surface from logo data.
|
||||||
SDL_Surface* logoSurface =
|
SDL_Surface* logoSurface {SDL_CreateRGBSurfaceFrom(
|
||||||
SDL_CreateRGBSurfaceFrom(static_cast<void*>(rawData.data()),
|
static_cast<void*>(rawData.data()), static_cast<int>(width),
|
||||||
static_cast<int>(width), static_cast<int>(height), 32,
|
static_cast<int>(height), 32, static_cast<int>((width * 4)), rmask, gmask, bmask,
|
||||||
static_cast<int>((width * 4)), rmask, gmask, bmask, amask);
|
amask)};
|
||||||
|
|
||||||
if (logoSurface != nullptr) {
|
if (logoSurface != nullptr) {
|
||||||
SDL_SetWindowIcon(sdlWindow, logoSurface);
|
SDL_SetWindowIcon(sdlWindow, logoSurface);
|
||||||
|
@ -87,7 +87,7 @@ namespace Renderer
|
||||||
|
|
||||||
initialCursorState = (SDL_ShowCursor(0) != 0);
|
initialCursorState = (SDL_ShowCursor(0) != 0);
|
||||||
|
|
||||||
int displayIndex = Settings::getInstance()->getInt("DisplayIndex");
|
int displayIndex {Settings::getInstance()->getInt("DisplayIndex")};
|
||||||
// Check that an invalid value has not been manually entered in the es_settings.xml file.
|
// Check that an invalid value has not been manually entered in the es_settings.xml file.
|
||||||
if (displayIndex != 1 && displayIndex != 2 && displayIndex != 3 && displayIndex != 4) {
|
if (displayIndex != 1 && displayIndex != 2 && displayIndex != 3 && displayIndex != 4) {
|
||||||
Settings::getInstance()->setInt("DisplayIndex", 1);
|
Settings::getInstance()->setInt("DisplayIndex", 1);
|
||||||
|
|
|
@ -17,14 +17,14 @@
|
||||||
namespace Renderer
|
namespace Renderer
|
||||||
{
|
{
|
||||||
Renderer::Shader::Shader()
|
Renderer::Shader::Shader()
|
||||||
: mProgramID(-1)
|
: mProgramID {0}
|
||||||
, shaderMVPMatrix(-1)
|
, shaderMVPMatrix {0}
|
||||||
, shaderTextureSize(-1)
|
, shaderTextureSize {0}
|
||||||
, shaderTextureCoord(-1)
|
, shaderTextureCoord {0}
|
||||||
, shaderColor(-1)
|
, shaderColor {0}
|
||||||
, shaderSaturation(-1)
|
, shaderSaturation {0}
|
||||||
, shaderOpacity(-1)
|
, shaderOpacity {0}
|
||||||
, shaderDimValue(-1)
|
, shaderDimValue {0}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,20 +116,20 @@ namespace Renderer
|
||||||
|
|
||||||
void Renderer::Shader::setModelViewProjectionMatrix(glm::mat4 mvpMatrix)
|
void Renderer::Shader::setModelViewProjectionMatrix(glm::mat4 mvpMatrix)
|
||||||
{
|
{
|
||||||
if (shaderMVPMatrix != -1)
|
if (shaderMVPMatrix != GL_INVALID_VALUE && shaderMVPMatrix != GL_INVALID_OPERATION)
|
||||||
GL_CHECK_ERROR(glUniformMatrix4fv(shaderMVPMatrix, 1, GL_FALSE,
|
GL_CHECK_ERROR(glUniformMatrix4fv(shaderMVPMatrix, 1, GL_FALSE,
|
||||||
reinterpret_cast<GLfloat*>(&mvpMatrix)));
|
reinterpret_cast<GLfloat*>(&mvpMatrix)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::Shader::setTextureSize(std::array<GLfloat, 2> shaderVec2)
|
void Renderer::Shader::setTextureSize(std::array<GLfloat, 2> shaderVec2)
|
||||||
{
|
{
|
||||||
if (shaderTextureSize != -1)
|
if (shaderTextureSize != GL_INVALID_VALUE && shaderTextureSize != GL_INVALID_OPERATION)
|
||||||
GL_CHECK_ERROR(glUniform2f(shaderTextureSize, shaderVec2[0], shaderVec2[1]));
|
GL_CHECK_ERROR(glUniform2f(shaderTextureSize, shaderVec2[0], shaderVec2[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::Shader::setTextureCoordinates(std::array<GLfloat, 4> shaderVec4)
|
void Renderer::Shader::setTextureCoordinates(std::array<GLfloat, 4> shaderVec4)
|
||||||
{
|
{
|
||||||
if (shaderTextureCoord != -1) {
|
if (shaderTextureCoord != GL_INVALID_OPERATION) {
|
||||||
glVertexAttrib4f(shaderTextureCoord, shaderVec4[0], shaderVec4[1], shaderVec4[2],
|
glVertexAttrib4f(shaderTextureCoord, shaderVec4[0], shaderVec4[1], shaderVec4[2],
|
||||||
shaderVec4[3]);
|
shaderVec4[3]);
|
||||||
}
|
}
|
||||||
|
@ -137,26 +137,26 @@ namespace Renderer
|
||||||
|
|
||||||
void Renderer::Shader::setColor(std::array<GLfloat, 4> shaderVec4)
|
void Renderer::Shader::setColor(std::array<GLfloat, 4> shaderVec4)
|
||||||
{
|
{
|
||||||
if (shaderColor != -1)
|
if (shaderColor != GL_INVALID_OPERATION)
|
||||||
GL_CHECK_ERROR(glUniform4f(shaderColor, shaderVec4[0], shaderVec4[1], shaderVec4[2],
|
GL_CHECK_ERROR(glUniform4f(shaderColor, shaderVec4[0], shaderVec4[1], shaderVec4[2],
|
||||||
shaderVec4[3]));
|
shaderVec4[3]));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::Shader::setSaturation(GLfloat saturation)
|
void Renderer::Shader::setSaturation(GLfloat saturation)
|
||||||
{
|
{
|
||||||
if (shaderSaturation != -1)
|
if (shaderSaturation != GL_INVALID_VALUE && shaderSaturation != GL_INVALID_OPERATION)
|
||||||
GL_CHECK_ERROR(glUniform1f(shaderSaturation, saturation));
|
GL_CHECK_ERROR(glUniform1f(shaderSaturation, saturation));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::Shader::setOpacity(GLfloat opacity)
|
void Renderer::Shader::setOpacity(GLfloat opacity)
|
||||||
{
|
{
|
||||||
if (shaderOpacity != -1)
|
if (shaderOpacity != GL_INVALID_VALUE && shaderOpacity != GL_INVALID_OPERATION)
|
||||||
GL_CHECK_ERROR(glUniform1f(shaderOpacity, opacity));
|
GL_CHECK_ERROR(glUniform1f(shaderOpacity, opacity));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::Shader::setDimValue(GLfloat dimValue)
|
void Renderer::Shader::setDimValue(GLfloat dimValue)
|
||||||
{
|
{
|
||||||
if (shaderDimValue != -1)
|
if (shaderDimValue != GL_INVALID_VALUE && shaderDimValue != GL_INVALID_OPERATION)
|
||||||
GL_CHECK_ERROR(glUniform1f(shaderDimValue, dimValue));
|
GL_CHECK_ERROR(glUniform1f(shaderDimValue, dimValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ FT_Library Font::sLibrary = nullptr;
|
||||||
std::map<std::pair<std::string, int>, std::weak_ptr<Font>> Font::sFontMap;
|
std::map<std::pair<std::string, int>, std::weak_ptr<Font>> Font::sFontMap;
|
||||||
|
|
||||||
Font::FontFace::FontFace(ResourceData&& d, int size)
|
Font::FontFace::FontFace(ResourceData&& d, int size)
|
||||||
: data(d)
|
: data {d}
|
||||||
{
|
{
|
||||||
int err =
|
int err =
|
||||||
FT_New_Memory_Face(sLibrary, data.ptr.get(), static_cast<FT_Long>(data.length), 0, &face);
|
FT_New_Memory_Face(sLibrary, data.ptr.get(), static_cast<FT_Long>(data.length), 0, &face);
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
TextureData::TextureData(bool tile)
|
TextureData::TextureData(bool tile)
|
||||||
: mTile {tile}
|
: mTile {tile}
|
||||||
, mTextureID {0}
|
, mTextureID {0}
|
||||||
, mDataRGBA({})
|
, mDataRGBA {}
|
||||||
, mFormat {Renderer::Texture::RGBA}
|
, mFormat {Renderer::Texture::RGBA}
|
||||||
, mWidth {0}
|
, mWidth {0}
|
||||||
, mHeight {0}
|
, mHeight {0}
|
||||||
|
|
|
@ -18,8 +18,8 @@ std::set<TextureResource*> TextureResource::sAllTextures;
|
||||||
|
|
||||||
TextureResource::TextureResource(
|
TextureResource::TextureResource(
|
||||||
const std::string& path, bool tile, bool dynamic, bool linearMagnify, bool forceRasterization)
|
const std::string& path, bool tile, bool dynamic, bool linearMagnify, bool forceRasterization)
|
||||||
: mTextureData(nullptr)
|
: mTextureData {nullptr}
|
||||||
, mForceLoad(false)
|
, mForceLoad {false}
|
||||||
{
|
{
|
||||||
// Create a texture data object for this texture.
|
// Create a texture data object for this texture.
|
||||||
if (!path.empty()) {
|
if (!path.empty()) {
|
||||||
|
|
|
@ -252,76 +252,76 @@ namespace Utils
|
||||||
};
|
};
|
||||||
|
|
||||||
// Round 1.
|
// Round 1.
|
||||||
ffFunc(a, b, c, d, x[0], S11, 0xd76aa478); /* 1 */
|
ffFunc(a, b, c, d, x[0], S11, 0xd76aa478); // 1
|
||||||
ffFunc(d, a, b, c, x[1], S12, 0xe8c7b756); /* 2 */
|
ffFunc(d, a, b, c, x[1], S12, 0xe8c7b756); // 2
|
||||||
ffFunc(c, d, a, b, x[2], S13, 0x242070db); /* 3 */
|
ffFunc(c, d, a, b, x[2], S13, 0x242070db); // 3
|
||||||
ffFunc(b, c, d, a, x[3], S14, 0xc1bdceee); /* 4 */
|
ffFunc(b, c, d, a, x[3], S14, 0xc1bdceee); // 4
|
||||||
ffFunc(a, b, c, d, x[4], S11, 0xf57c0faf); /* 5 */
|
ffFunc(a, b, c, d, x[4], S11, 0xf57c0faf); // 5
|
||||||
ffFunc(d, a, b, c, x[5], S12, 0x4787c62a); /* 6 */
|
ffFunc(d, a, b, c, x[5], S12, 0x4787c62a); // 6
|
||||||
ffFunc(c, d, a, b, x[6], S13, 0xa8304613); /* 7 */
|
ffFunc(c, d, a, b, x[6], S13, 0xa8304613); // 7
|
||||||
ffFunc(b, c, d, a, x[7], S14, 0xfd469501); /* 8 */
|
ffFunc(b, c, d, a, x[7], S14, 0xfd469501); // 8
|
||||||
ffFunc(a, b, c, d, x[8], S11, 0x698098d8); /* 9 */
|
ffFunc(a, b, c, d, x[8], S11, 0x698098d8); // 9
|
||||||
ffFunc(d, a, b, c, x[9], S12, 0x8b44f7af); /* 10 */
|
ffFunc(d, a, b, c, x[9], S12, 0x8b44f7af); // 10
|
||||||
ffFunc(c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
|
ffFunc(c, d, a, b, x[10], S13, 0xffff5bb1); // 11
|
||||||
ffFunc(b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
|
ffFunc(b, c, d, a, x[11], S14, 0x895cd7be); // 12
|
||||||
ffFunc(a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
|
ffFunc(a, b, c, d, x[12], S11, 0x6b901122); // 13
|
||||||
ffFunc(d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
|
ffFunc(d, a, b, c, x[13], S12, 0xfd987193); // 14
|
||||||
ffFunc(c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
|
ffFunc(c, d, a, b, x[14], S13, 0xa679438e); // 15
|
||||||
ffFunc(b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
|
ffFunc(b, c, d, a, x[15], S14, 0x49b40821); // 16
|
||||||
|
|
||||||
// Round 2.
|
// Round 2.
|
||||||
ggFunc(a, b, c, d, x[1], S21, 0xf61e2562); /* 17 */
|
ggFunc(a, b, c, d, x[1], S21, 0xf61e2562); // 17
|
||||||
ggFunc(d, a, b, c, x[6], S22, 0xc040b340); /* 18 */
|
ggFunc(d, a, b, c, x[6], S22, 0xc040b340); // 18
|
||||||
ggFunc(c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
|
ggFunc(c, d, a, b, x[11], S23, 0x265e5a51); // 19
|
||||||
ggFunc(b, c, d, a, x[0], S24, 0xe9b6c7aa); /* 20 */
|
ggFunc(b, c, d, a, x[0], S24, 0xe9b6c7aa); // 20
|
||||||
ggFunc(a, b, c, d, x[5], S21, 0xd62f105d); /* 21 */
|
ggFunc(a, b, c, d, x[5], S21, 0xd62f105d); // 21
|
||||||
ggFunc(d, a, b, c, x[10], S22, 0x2441453); /* 22 */
|
ggFunc(d, a, b, c, x[10], S22, 0x2441453); // 22
|
||||||
ggFunc(c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
|
ggFunc(c, d, a, b, x[15], S23, 0xd8a1e681); // 23
|
||||||
ggFunc(b, c, d, a, x[4], S24, 0xe7d3fbc8); /* 24 */
|
ggFunc(b, c, d, a, x[4], S24, 0xe7d3fbc8); // 24
|
||||||
ggFunc(a, b, c, d, x[9], S21, 0x21e1cde6); /* 25 */
|
ggFunc(a, b, c, d, x[9], S21, 0x21e1cde6); // 25
|
||||||
ggFunc(d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
|
ggFunc(d, a, b, c, x[14], S22, 0xc33707d6); // 26
|
||||||
ggFunc(c, d, a, b, x[3], S23, 0xf4d50d87); /* 27 */
|
ggFunc(c, d, a, b, x[3], S23, 0xf4d50d87); // 27
|
||||||
ggFunc(b, c, d, a, x[8], S24, 0x455a14ed); /* 28 */
|
ggFunc(b, c, d, a, x[8], S24, 0x455a14ed); // 28
|
||||||
ggFunc(a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
|
ggFunc(a, b, c, d, x[13], S21, 0xa9e3e905); // 29
|
||||||
ggFunc(d, a, b, c, x[2], S22, 0xfcefa3f8); /* 30 */
|
ggFunc(d, a, b, c, x[2], S22, 0xfcefa3f8); // 30
|
||||||
ggFunc(c, d, a, b, x[7], S23, 0x676f02d9); /* 31 */
|
ggFunc(c, d, a, b, x[7], S23, 0x676f02d9); // 31
|
||||||
ggFunc(b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
|
ggFunc(b, c, d, a, x[12], S24, 0x8d2a4c8a); // 32
|
||||||
|
|
||||||
// Round 3.
|
// Round 3.
|
||||||
hhFunc(a, b, c, d, x[5], S31, 0xfffa3942); /* 33 */
|
hhFunc(a, b, c, d, x[5], S31, 0xfffa3942); // 33
|
||||||
hhFunc(d, a, b, c, x[8], S32, 0x8771f681); /* 34 */
|
hhFunc(d, a, b, c, x[8], S32, 0x8771f681); // 34
|
||||||
hhFunc(c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
|
hhFunc(c, d, a, b, x[11], S33, 0x6d9d6122); // 35
|
||||||
hhFunc(b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
|
hhFunc(b, c, d, a, x[14], S34, 0xfde5380c); // 36
|
||||||
hhFunc(a, b, c, d, x[1], S31, 0xa4beea44); /* 37 */
|
hhFunc(a, b, c, d, x[1], S31, 0xa4beea44); // 37
|
||||||
hhFunc(d, a, b, c, x[4], S32, 0x4bdecfa9); /* 38 */
|
hhFunc(d, a, b, c, x[4], S32, 0x4bdecfa9); // 38
|
||||||
hhFunc(c, d, a, b, x[7], S33, 0xf6bb4b60); /* 39 */
|
hhFunc(c, d, a, b, x[7], S33, 0xf6bb4b60); // 39
|
||||||
hhFunc(b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
|
hhFunc(b, c, d, a, x[10], S34, 0xbebfbc70); // 40
|
||||||
hhFunc(a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
|
hhFunc(a, b, c, d, x[13], S31, 0x289b7ec6); // 41
|
||||||
hhFunc(d, a, b, c, x[0], S32, 0xeaa127fa); /* 42 */
|
hhFunc(d, a, b, c, x[0], S32, 0xeaa127fa); // 42
|
||||||
hhFunc(c, d, a, b, x[3], S33, 0xd4ef3085); /* 43 */
|
hhFunc(c, d, a, b, x[3], S33, 0xd4ef3085); // 43
|
||||||
hhFunc(b, c, d, a, x[6], S34, 0x4881d05); /* 44 */
|
hhFunc(b, c, d, a, x[6], S34, 0x4881d05); // 44
|
||||||
hhFunc(a, b, c, d, x[9], S31, 0xd9d4d039); /* 45 */
|
hhFunc(a, b, c, d, x[9], S31, 0xd9d4d039); // 45
|
||||||
hhFunc(d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
|
hhFunc(d, a, b, c, x[12], S32, 0xe6db99e5); // 46
|
||||||
hhFunc(c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
|
hhFunc(c, d, a, b, x[15], S33, 0x1fa27cf8); // 47
|
||||||
hhFunc(b, c, d, a, x[2], S34, 0xc4ac5665); /* 48 */
|
hhFunc(b, c, d, a, x[2], S34, 0xc4ac5665); // 48
|
||||||
|
|
||||||
// Round 4.
|
// Round 4.
|
||||||
iiFunc(a, b, c, d, x[0], S41, 0xf4292244); /* 49 */
|
iiFunc(a, b, c, d, x[0], S41, 0xf4292244); // 49
|
||||||
iiFunc(d, a, b, c, x[7], S42, 0x432aff97); /* 50 */
|
iiFunc(d, a, b, c, x[7], S42, 0x432aff97); // 50
|
||||||
iiFunc(c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
|
iiFunc(c, d, a, b, x[14], S43, 0xab9423a7); // 51
|
||||||
iiFunc(b, c, d, a, x[5], S44, 0xfc93a039); /* 52 */
|
iiFunc(b, c, d, a, x[5], S44, 0xfc93a039); // 52
|
||||||
iiFunc(a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
|
iiFunc(a, b, c, d, x[12], S41, 0x655b59c3); // 53
|
||||||
iiFunc(d, a, b, c, x[3], S42, 0x8f0ccc92); /* 54 */
|
iiFunc(d, a, b, c, x[3], S42, 0x8f0ccc92); // 54
|
||||||
iiFunc(c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
|
iiFunc(c, d, a, b, x[10], S43, 0xffeff47d); // 55
|
||||||
iiFunc(b, c, d, a, x[1], S44, 0x85845dd1); /* 56 */
|
iiFunc(b, c, d, a, x[1], S44, 0x85845dd1); // 56
|
||||||
iiFunc(a, b, c, d, x[8], S41, 0x6fa87e4f); /* 57 */
|
iiFunc(a, b, c, d, x[8], S41, 0x6fa87e4f); // 57
|
||||||
iiFunc(d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
|
iiFunc(d, a, b, c, x[15], S42, 0xfe2ce6e0); // 58
|
||||||
iiFunc(c, d, a, b, x[6], S43, 0xa3014314); /* 59 */
|
iiFunc(c, d, a, b, x[6], S43, 0xa3014314); // 59
|
||||||
iiFunc(b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
|
iiFunc(b, c, d, a, x[13], S44, 0x4e0811a1); // 60
|
||||||
iiFunc(a, b, c, d, x[4], S41, 0xf7537e82); /* 61 */
|
iiFunc(a, b, c, d, x[4], S41, 0xf7537e82); // 61
|
||||||
iiFunc(d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
|
iiFunc(d, a, b, c, x[11], S42, 0xbd3af235); // 62
|
||||||
iiFunc(c, d, a, b, x[2], S43, 0x2ad7d2bb); /* 63 */
|
iiFunc(c, d, a, b, x[2], S43, 0x2ad7d2bb); // 63
|
||||||
iiFunc(b, c, d, a, x[9], S44, 0xeb86d391); /* 64 */
|
iiFunc(b, c, d, a, x[9], S44, 0xeb86d391); // 64
|
||||||
|
|
||||||
state[0] += a;
|
state[0] += a;
|
||||||
state[1] += b;
|
state[1] += b;
|
||||||
|
|
Loading…
Reference in a new issue