annotate pytouhou/vm/__init__.py @ 610:1b31169dc344

Move the passthrough shader to the Framebuffer class, since it isn’t used in the use_framebuffer_blit path.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 21 Dec 2014 18:52:18 +0100
parents d471b07ce4fd
children d1f0bb0b7a17
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
590
e15672733c93 Switch to Python 3.x instead of 2.7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 547
diff changeset
1 from .anmrunner import ANMRunner
e15672733c93 Switch to Python 3.x instead of 2.7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 547
diff changeset
2 from .msgrunner import MSGRunner
e15672733c93 Switch to Python 3.x instead of 2.7.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 547
diff changeset
3 from .eclrunner import ECLMainRunner
599
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
4
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
5
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
6 class PythonMainRunner(object):
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
7 def __init__(self, main, game):
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
8 self.main = main
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
9 self.game = game
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
10
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
11 def run_iter(self):
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
12 self.main(self.game)
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
13
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
14
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
15 class EnemyRunner(object):
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
16 def __init__(self, enemy, game, sub):
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
17 self.enemy = enemy
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
18 self.game = game
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
19 self.sub = sub
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
20
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
21 def run_iteration(self):
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
22 self.sub(self.enemy, self.game)
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
23
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
24
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
25 def spawn_enemy(game, sub, x=0., y=0., life=1, item=-1, score=0, mirrored=False, random=False):
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
26 instr_type = (2 if mirrored else 0) | (4 if random else 0)
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
27 enemy = game.new_enemy((x, y, 0.), life, instr_type, item, score)
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
28 enemy.process = EnemyRunner(enemy, game, sub)
d471b07ce4fd Add a sample Python ECL.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 590
diff changeset
29 enemy.process.run_iteration()