# HG changeset patch # User Emmanuel Gil Peyrot # Date 1609789170 -3600 # Node ID a6875f90c1418d3ec03e925596adf0a55f28cf94 # Parent a662dddd4a2b0ac1c8cf5ccd9a171edcaa989923 Python: Only init SDL2 video if using SDL2 frontend. diff --git a/pytouhou/lib/sdl.pyx b/pytouhou/lib/sdl.pyx --- a/pytouhou/lib/sdl.pyx +++ b/pytouhou/lib/sdl.pyx @@ -62,7 +62,7 @@ class SDLError(gui.Error): class SDL: - def __init__(self, sound=True): + def __init__(self, *, video=True, sound=True): self.sound = sound def __enter__(self): @@ -70,7 +70,7 @@ class SDL: IF UNAME_SYSNAME == "Windows": SDL_SetMainReady() - init(SDL_INIT_VIDEO) + init(SDL_INIT_VIDEO if video else 0) img_init(IMG_INIT_PNG) ttf_init() diff --git a/scripts/pytouhou b/scripts/pytouhou --- a/scripts/pytouhou +++ b/scripts/pytouhou @@ -286,7 +286,8 @@ def main(window, path, data, stage_num, save_replay.write(file) -with SDL(sound=args.no_sound): +is_sdl = (args.frontend == 'sdl') +with SDL(video=is_sdl, sound=args.no_sound): window = Window(backend, Interface.width, Interface.height, fps_limit=args.fps_limit, frameskip=args.frameskip)