Mercurial > touhou
comparison pytouhou/ui/gamerunner.pyx @ 486:2f53be1b2f60
Merge netplay branch.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Fri, 27 Sep 2013 19:01:47 +0200 |
parents | pytouhou/ui/gamerunner.py@e71b1bcf952a pytouhou/ui/gamerunner.py@36bc577b2392 |
children | 711c75115675 |
comparison
equal
deleted
inserted
replaced
474:ca22df9e70bc | 486:2f53be1b2f60 |
---|---|
18 from .gamerenderer cimport GameRenderer | 18 from .gamerenderer cimport GameRenderer |
19 from .music import MusicPlayer, SFXPlayer, NullPlayer | 19 from .music import MusicPlayer, SFXPlayer, NullPlayer |
20 | 20 |
21 | 21 |
22 cdef class GameRunner(Runner): | 22 cdef class GameRunner(Runner): |
23 cdef object game, background | 23 cdef object game, background, con |
24 cdef GameRenderer renderer | 24 cdef GameRenderer renderer |
25 cdef Window window | 25 cdef Window window |
26 cdef object replay_level, save_keystates | 26 cdef object replay_level, save_keystates |
27 cdef long keystate | |
28 cdef bint skip | 27 cdef bint skip |
29 | 28 |
30 def __init__(self, Window window, resource_loader, bint skip=False): | 29 def __init__(self, Window window, resource_loader, bint skip=False, |
30 con=None): | |
31 self.renderer = GameRenderer(resource_loader, window.use_fixed_pipeline) | 31 self.renderer = GameRenderer(resource_loader, window.use_fixed_pipeline) |
32 | 32 |
33 self.window = window | 33 self.window = window |
34 self.replay_level = None | 34 self.replay_level = None |
35 self.skip = skip | 35 self.skip = skip |
36 self.keystate = 0 | 36 self.con = con |
37 | 37 |
38 self.width = window.width #XXX | 38 self.width = window.width #XXX |
39 self.height = window.height #XXX | 39 self.height = window.height #XXX |
40 | 40 |
41 | 41 |
132 self.game.sfx_player = SFXPlayer(self.game.resource_loader) | 132 self.game.sfx_player = SFXPlayer(self.game.resource_loader) |
133 | 133 |
134 if self.save_keystates is not None: | 134 if self.save_keystates is not None: |
135 self.save_keystates.append(keystate) | 135 self.save_keystates.append(keystate) |
136 | 136 |
137 self.game.run_iter(keystate) | 137 if self.con: |
138 self.con.run_iter(self.game, keystate) | |
139 else: | |
140 self.game.run_iter([keystate]) | |
141 | |
138 self.game.interface.labels['framerate'].set_text('%.2ffps' % self.window.get_fps()) | 142 self.game.interface.labels['framerate'].set_text('%.2ffps' % self.window.get_fps()) |
139 if not self.skip: | 143 if not self.skip: |
140 self.renderer.render(self.game, self.window) | 144 self.renderer.render(self.game, self.window) |
141 return True | 145 return True |