Print detailed error message when SDL initialization fails
This commit is contained in:
parent
53b8071e6a
commit
bdcfbd47dd
1 changed files with 4 additions and 2 deletions
|
|
@ -40,8 +40,10 @@ PlatformPolicy::PlatformPolicy(
|
||||||
: input_manager_(input_manager),
|
: input_manager_(input_manager),
|
||||||
android_api_(android_api),
|
android_api_(android_api),
|
||||||
event_thread_running_(false) {
|
event_thread_running_(false) {
|
||||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_EVENTS) < 0)
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_EVENTS) < 0) {
|
||||||
BOOST_THROW_EXCEPTION(std::runtime_error("Failed to initialize SDL"));
|
const auto message = utils::string_format("Failed to initialize SDL: %s", SDL_GetError());
|
||||||
|
BOOST_THROW_EXCEPTION(std::runtime_error(message));
|
||||||
|
}
|
||||||
|
|
||||||
auto display_frame = graphics::Rect::Invalid;
|
auto display_frame = graphics::Rect::Invalid;
|
||||||
for (auto n = 0; n < SDL_GetNumVideoDisplays(); n++) {
|
for (auto n = 0; n < SDL_GetNumVideoDisplays(); n++) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue