Merge pull request #4257 from jroweboy/sdl-globals

Input: Remove global variables from SDL Input
This commit is contained in:
Weiyi Wang
2018-09-29 23:00:12 -04:00
committed by GitHub
9 changed files with 773 additions and 690 deletions

View File

@@ -81,17 +81,17 @@ void EmuWindow_SDL2::Fullscreen() {
}
EmuWindow_SDL2::EmuWindow_SDL2(bool fullscreen) {
InputCommon::Init();
Network::Init();
SDL_SetMainReady();
// Initialize the window
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) {
LOG_CRITICAL(Frontend, "Failed to initialize SDL2! Exiting...");
exit(1);
}
InputCommon::Init();
Network::Init();
SDL_SetMainReady();
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
@@ -143,12 +143,10 @@ EmuWindow_SDL2::EmuWindow_SDL2(bool fullscreen) {
}
EmuWindow_SDL2::~EmuWindow_SDL2() {
InputCommon::SDL::CloseSDLJoysticks();
SDL_GL_DeleteContext(gl_context);
SDL_Quit();
Network::Shutdown();
InputCommon::Shutdown();
SDL_GL_DeleteContext(gl_context);
SDL_Quit();
}
void EmuWindow_SDL2::SwapBuffers() {
@@ -190,7 +188,6 @@ void EmuWindow_SDL2::PollEvents() {
is_open = false;
break;
default:
InputCommon::SDL::HandleGameControllerEvent(event);
break;
}
}