|
@@ -538,20 +538,20 @@ const char *VideoDriver_SDL_Base::Initia
|
|
|
FindResolutions();
|
|
|
DEBUG(driver, 2, "Resolution for display: %ux%u", _cur_resolution.width, _cur_resolution.height);
|
|
|
|
|
|
return nullptr;
|
|
|
}
|
|
|
|
|
|
const char *VideoDriver_SDL_Base::Start(const StringList &parm)
|
|
|
const char *VideoDriver_SDL_Base::Start(const StringList ¶m)
|
|
|
{
|
|
|
if (BlitterFactory::GetCurrentBlitter()->GetScreenDepth() == 0) return "Only real blitters supported";
|
|
|
|
|
|
const char *error = this->Initialize();
|
|
|
if (error != nullptr) return error;
|
|
|
|
|
|
this->startup_display = FindStartupDisplay(GetDriverParamInt(parm, "display", -1));
|
|
|
this->startup_display = FindStartupDisplay(GetDriverParamInt(param, "display", -1));
|
|
|
|
|
|
if (!CreateMainSurface(_cur_resolution.width, _cur_resolution.height, false)) {
|
|
|
return SDL_GetError();
|
|
|
}
|
|
|
|
|
|
const char *dname = SDL_GetCurrentVideoDriver();
|
|
@@ -559,12 +559,18 @@ const char *VideoDriver_SDL_Base::Start(
|
|
|
|
|
|
MarkWholeScreenDirty();
|
|
|
|
|
|
SDL_StopTextInput();
|
|
|
this->edit_box_focused = false;
|
|
|
|
|
|
#ifdef __EMSCRIPTEN__
|
|
|
this->is_game_threaded = false;
|
|
|
#else
|
|
|
this->is_game_threaded = !GetDriverParamBool(param, "no_threads") && !GetDriverParamBool(param, "no_thread");
|
|
|
#endif
|
|
|
|
|
|
return nullptr;
|
|
|
}
|
|
|
|
|
|
void VideoDriver_SDL_Base::Stop()
|
|
|
{
|
|
|
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
|
@@ -634,15 +640,19 @@ void VideoDriver_SDL_Base::LoopOnce()
|
|
|
void VideoDriver_SDL_Base::MainLoop()
|
|
|
{
|
|
|
#ifdef __EMSCRIPTEN__
|
|
|
/* Run the main loop event-driven, based on RequestAnimationFrame. */
|
|
|
emscripten_set_main_loop_arg(&this->EmscriptenLoop, this, 0, 1);
|
|
|
#else
|
|
|
this->StartGameThread();
|
|
|
|
|
|
while (!_exit_game) {
|
|
|
LoopOnce();
|
|
|
}
|
|
|
|
|
|
this->StopGameThread();
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
bool VideoDriver_SDL_Base::ChangeResolution(int w, int h)
|
|
|
{
|
|
|
return CreateMainSurface(w, h, true);
|