More SDL work
This commit is contained in:
parent
283327dcce
commit
416724f843
11 changed files with 212 additions and 30 deletions
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue