mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-29 19:55:37 +00:00
SDL events are now parsed on startup before the main application loop.
Also removed the mouse pointer removal hack.
This commit is contained in:
parent
6e7e8397c4
commit
5125f81c78
|
@ -25,6 +25,7 @@
|
||||||
#include "views/GamelistView.h"
|
#include "views/GamelistView.h"
|
||||||
#include "views/ViewController.h"
|
#include "views/ViewController.h"
|
||||||
|
|
||||||
|
#include <SDL2/SDL_events.h>
|
||||||
#include <SDL2/SDL_timer.h>
|
#include <SDL2/SDL_timer.h>
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
@ -537,9 +538,14 @@ bool SystemData::loadConfig()
|
||||||
|
|
||||||
unsigned int lastTime {0};
|
unsigned int lastTime {0};
|
||||||
unsigned int accumulator {0};
|
unsigned int accumulator {0};
|
||||||
|
SDL_Event event {};
|
||||||
|
|
||||||
for (pugi::xml_node system {systemList.child("system")}; system;
|
for (pugi::xml_node system {systemList.child("system")}; system;
|
||||||
system = system.next_sibling("system")) {
|
system = system.next_sibling("system")) {
|
||||||
|
// Parse events so that the OS doesn't think the application is hanging on startup,
|
||||||
|
// this is required as the main application loop hasn't started yet.
|
||||||
|
while (SDL_PollEvent(&event)) {};
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
std::string fullname;
|
std::string fullname;
|
||||||
std::string sortName;
|
std::string sortName;
|
||||||
|
|
|
@ -685,15 +685,7 @@ int main(int argc, char* argv[])
|
||||||
if (Settings::getInstance()->getBool("SplashScreen"))
|
if (Settings::getInstance()->getBool("SplashScreen"))
|
||||||
window->renderSplashScreen(Window::SplashScreenState::SCANNING, 0.0f);
|
window->renderSplashScreen(Window::SplashScreenState::SCANNING, 0.0f);
|
||||||
|
|
||||||
InputManager::getInstance().parseEvent(event);
|
while (SDL_PollEvent(&event)) {};
|
||||||
if (event.type == SDL_QUIT)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
#if !defined(__APPLE__)
|
|
||||||
// This hides the mouse cursor during startup, i.e. before we have begun to capture SDL events.
|
|
||||||
// On macOS this causes the mouse cursor to jump back to the Dock so don't do it on this OS.
|
|
||||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
// Hide taskbar if the setting for this is enabled.
|
// Hide taskbar if the setting for this is enabled.
|
||||||
|
@ -769,12 +761,6 @@ int main(int argc, char* argv[])
|
||||||
.count()
|
.count()
|
||||||
<< " ms";
|
<< " ms";
|
||||||
|
|
||||||
#if !defined(__APPLE__)
|
|
||||||
// Now that we've finished loading, disable the relative mouse mode or otherwise mouse
|
|
||||||
// input wouldn't work in any games that are launched.
|
|
||||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Main application loop.
|
// Main application loop.
|
||||||
|
|
||||||
#if defined(__EMSCRIPTEN__)
|
#if defined(__EMSCRIPTEN__)
|
||||||
|
|
|
@ -1112,9 +1112,14 @@ void ViewController::preload()
|
||||||
float loadedSystems {0.0f};
|
float loadedSystems {0.0f};
|
||||||
unsigned int lastTime {0};
|
unsigned int lastTime {0};
|
||||||
unsigned int accumulator {0};
|
unsigned int accumulator {0};
|
||||||
|
SDL_Event event {};
|
||||||
|
|
||||||
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) {
|
||||||
|
// Parse events so that the OS doesn't think the application is hanging on startup,
|
||||||
|
// this is required as the main application loop hasn't started yet.
|
||||||
|
while (SDL_PollEvent(&event)) {};
|
||||||
|
|
||||||
const std::string entryType {(*it)->isCustomCollection() ? "custom collection" : "system"};
|
const std::string entryType {(*it)->isCustomCollection() ? "custom collection" : "system"};
|
||||||
LOG(LogDebug) << "ViewController::preload(): Populating gamelist for " << entryType << " \""
|
LOG(LogDebug) << "ViewController::preload(): Populating gamelist for " << entryType << " \""
|
||||||
<< (*it)->getName() << "\"";
|
<< (*it)->getName() << "\"";
|
||||||
|
|
Loading…
Reference in a new issue