mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-04-20 07:00:31 +00:00
More SDL work
This commit is contained in:
21
app/main.cpp
21
app/main.cpp
@@ -1,6 +1,11 @@
|
||||
#include "gui/mainwindow.h"
|
||||
#include <QApplication>
|
||||
|
||||
// Don't let SDL hook our main function, since Qt is already
|
||||
// doing the same thing
|
||||
#define SDL_MAIN_HANDLED
|
||||
#include <SDL.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
// MacOS directive to prevent the menu bar from being merged into the native bar
|
||||
@@ -15,6 +20,20 @@ int main(int argc, char *argv[])
|
||||
MainWindow w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
// Ensure that SDL is always initialized since we may need to use it
|
||||
// for non-streaming purposes (like checking on audio devices)
|
||||
SDL_SetMainReady();
|
||||
if (SDL_Init(SDL_INIT_VIDEO |
|
||||
SDL_INIT_AUDIO |
|
||||
SDL_INIT_GAMECONTROLLER) != 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
|
||||
"SDL_Init() failed: %s",
|
||||
SDL_GetError());
|
||||
}
|
||||
|
||||
int err = a.exec();
|
||||
|
||||
SDL_Quit();
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user