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