The mouse cursor is now hidden during application startup.

This commit is contained in:
Leon Styhre 2021-01-19 20:14:37 +01:00
parent b014ef5ffd
commit 8b5f65c789

View file

@ -455,6 +455,9 @@ int main(int argc, char* argv[])
if (event.type == SDL_QUIT) if (event.type == SDL_QUIT)
return 1; return 1;
// This hides the mouse cursor during startup, i.e. before we have begun to capture SDL events.
SDL_SetRelativeMouseMode(SDL_TRUE);
AudioManager::getInstance(); AudioManager::getInstance();
MameNames::init(); MameNames::init();
@ -584,10 +587,11 @@ int main(int argc, char* argv[])
(applicationEndTime - applicationStartTime).count() << " ms"; (applicationEndTime - applicationStartTime).count() << " ms";
bool running = true; bool running = true;
// 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);
while (running) { while (running) {
SDL_Event event;
if (SDL_PollEvent(&event)) { if (SDL_PollEvent(&event)) {
do { do {
InputManager::getInstance()->parseEvent(event, &window); InputManager::getInstance()->parseEvent(event, &window);