mirror of https://github.com/stenzek/duckstation
FrontendCommon: Use SDL_InitSubSystem() for lazy initialization
parent
78a6666439
commit
06f4d72631
@ -0,0 +1,21 @@
|
||||
#include "sdl_initializer.h"
|
||||
#include "common/assert.h"
|
||||
#include <SDL.h>
|
||||
|
||||
namespace FrontendCommon {
|
||||
static bool s_sdl_initialized = false;
|
||||
|
||||
void EnsureSDLInitialized()
|
||||
{
|
||||
if (s_sdl_initialized)
|
||||
return;
|
||||
|
||||
if (SDL_Init(0) < 0)
|
||||
{
|
||||
Panic("SDL_Init(0) failed");
|
||||
return;
|
||||
}
|
||||
|
||||
s_sdl_initialized = true;
|
||||
}
|
||||
} // namespace FrontendCommon
|
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
namespace FrontendCommon {
|
||||
void EnsureSDLInitialized();
|
||||
}
|
Loading…
Reference in New Issue