# HG changeset patch # User Emmanuel Gil Peyrot # Date 1383932820 -3600 # Node ID e35bef07290d05eef6340b4501d31fc833377774 # Parent 94dd9862c4704d25a11cab49985e03767e9b386b Always import runners from pytouhou.vm, to allow their replacement. diff --git a/pytouhou/game/background.py b/pytouhou/game/background.py --- a/pytouhou/game/background.py +++ b/pytouhou/game/background.py @@ -14,7 +14,7 @@ from pytouhou.utils.interpolator import Interpolator -from pytouhou.vm.anmrunner import ANMRunner +from pytouhou.vm import ANMRunner from pytouhou.game.sprite import Sprite diff --git a/pytouhou/game/bullet.pyx b/pytouhou/game/bullet.pyx --- a/pytouhou/game/bullet.pyx +++ b/pytouhou/game/bullet.pyx @@ -14,7 +14,7 @@ from libc.math cimport cos, sin, atan2, M_PI as pi -from pytouhou.vm.anmrunner import ANMRunner +from pytouhou.vm import ANMRunner from pytouhou.game.sprite cimport Sprite diff --git a/pytouhou/game/effect.pyx b/pytouhou/game/effect.pyx --- a/pytouhou/game/effect.pyx +++ b/pytouhou/game/effect.pyx @@ -13,7 +13,7 @@ ## from pytouhou.game.sprite cimport Sprite -from pytouhou.vm.anmrunner import ANMRunner +from pytouhou.vm import ANMRunner from pytouhou.game.game cimport Game diff --git a/pytouhou/game/enemy.pyx b/pytouhou/game/enemy.pyx --- a/pytouhou/game/enemy.pyx +++ b/pytouhou/game/enemy.pyx @@ -14,7 +14,7 @@ from libc.math cimport cos, sin, atan2, M_PI as pi -from pytouhou.vm.anmrunner import ANMRunner +from pytouhou.vm import ANMRunner from pytouhou.game.sprite import Sprite from pytouhou.game.bullet cimport Bullet, LAUNCHED from pytouhou.game.laser cimport Laser, PlayerLaser diff --git a/pytouhou/game/face.py b/pytouhou/game/face.py --- a/pytouhou/game/face.py +++ b/pytouhou/game/face.py @@ -15,7 +15,7 @@ from pytouhou.game.element import Element from pytouhou.game.sprite import Sprite -from pytouhou.vm.anmrunner import ANMRunner +from pytouhou.vm import ANMRunner class Face(Element): diff --git a/pytouhou/game/game.pyx b/pytouhou/game/game.pyx --- a/pytouhou/game/game.pyx +++ b/pytouhou/game/game.pyx @@ -12,7 +12,7 @@ ## GNU General Public License for more details. ## -from pytouhou.vm.msgrunner import MSGRunner +from pytouhou.vm import MSGRunner from pytouhou.game.element cimport Element from pytouhou.game.bullet cimport Bullet, LAUNCHED, CANCELLED diff --git a/pytouhou/game/laser.pyx b/pytouhou/game/laser.pyx --- a/pytouhou/game/laser.pyx +++ b/pytouhou/game/laser.pyx @@ -15,7 +15,7 @@ from libc.math cimport cos, sin, M_PI as pi from pytouhou.game.game cimport Game -from pytouhou.vm.anmrunner import ANMRunner +from pytouhou.vm import ANMRunner cdef class LaserLaunchAnim(Element): diff --git a/pytouhou/game/orb.py b/pytouhou/game/orb.py --- a/pytouhou/game/orb.py +++ b/pytouhou/game/orb.py @@ -12,7 +12,7 @@ ## GNU General Public License for more details. ## -from pytouhou.vm.anmrunner import ANMRunner +from pytouhou.vm import ANMRunner class Orb(Element): diff --git a/pytouhou/game/player.pyx b/pytouhou/game/player.pyx --- a/pytouhou/game/player.pyx +++ b/pytouhou/game/player.pyx @@ -15,7 +15,7 @@ from libc.math cimport M_PI as pi from pytouhou.game.sprite cimport Sprite -from pytouhou.vm.anmrunner import ANMRunner +from pytouhou.vm import ANMRunner from pytouhou.game.bullettype cimport BulletType from pytouhou.game.bullet cimport Bullet from pytouhou.game.lasertype cimport LaserType diff --git a/pytouhou/game/text.py b/pytouhou/game/text.py --- a/pytouhou/game/text.py +++ b/pytouhou/game/text.py @@ -12,7 +12,7 @@ ## GNU General Public License for more details. ## -from pytouhou.vm.anmrunner import ANMRunner +from pytouhou.vm import ANMRunner class Glyph(Element): diff --git a/pytouhou/games/eosd.py b/pytouhou/games/eosd.py --- a/pytouhou/games/eosd.py +++ b/pytouhou/games/eosd.py @@ -24,7 +24,7 @@ from pytouhou.game.effect import Effect from pytouhou.game.text import Text, Counter, Gauge, NativeText from pytouhou.game.background import Background -from pytouhou.vm.eclrunner import ECLMainRunner +from pytouhou.vm import ECLMainRunner class EoSDCommon(object): diff --git a/pytouhou/ui/anmrenderer.pyx b/pytouhou/ui/anmrenderer.pyx --- a/pytouhou/ui/anmrenderer.pyx +++ b/pytouhou/ui/anmrenderer.pyx @@ -16,7 +16,7 @@ from pytouhou.lib.opengl cimport \ (glClearColor, glClear, GL_COLOR_BUFFER_BIT) from pytouhou.game.sprite import Sprite -from pytouhou.vm.anmrunner import ANMRunner +from pytouhou.vm import ANMRunner from pytouhou.utils.helpers import get_logger from pytouhou.utils.maths cimport perspective, setup_camera diff --git a/pytouhou/vm/__init__.py b/pytouhou/vm/__init__.py --- a/pytouhou/vm/__init__.py +++ b/pytouhou/vm/__init__.py @@ -0,0 +1,3 @@ +from anmrunner import ANMRunner +from msgrunner import MSGRunner +from eclrunner import ECLMainRunner diff --git a/scripts/pytouhou b/scripts/pytouhou --- a/scripts/pytouhou +++ b/scripts/pytouhou @@ -65,16 +65,10 @@ args = parser.parse_args() import sys import logging -if args.backend == 'opengl': - try: - from pytouhou.ui.opengl.gamerenderer import GameRenderer - opengl = True - except ImportError: - args.backend = 'sdl' -if args.backend == 'sdl': - from pytouhou.ui.sdl.gamerenderer import GameRenderer - opengl = False +if args.game == 'EoSD': + from pytouhou.games.eosd import EoSDCommon as Common, EoSDGame as Game + from pytouhou.lib.sdl import SDL, show_simple_message_box from pytouhou.ui.window import Window @@ -88,8 +82,16 @@ from pytouhou.formats.hint import Hint from pytouhou.network import Network -if args.game == 'EoSD': - from pytouhou.games.eosd import EoSDCommon as Common, EoSDGame as Game +if args.backend == 'opengl': + try: + from pytouhou.ui.opengl.gamerenderer import GameRenderer + opengl = True + except ImportError: + args.backend = 'sdl' + +if args.backend == 'sdl': + from pytouhou.ui.sdl.gamerenderer import GameRenderer + opengl = False class GameBossRush(Game):