annotate pytouhou/interfaces/sample.py @ 588:7a82c4b52b16

Prevent a traceback when we call Window.run without a runner set.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 08 Oct 2014 19:20:15 +0200
parents 56bca8ce4b68
children ab131d04987d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
549
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
1 # -*- encoding: utf-8 -*-
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
2 ##
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
3 ## Copyright (C) 2014 Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
4 ##
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
5 ## This program is free software; you can redistribute it and/or modify
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
6 ## it under the terms of the GNU General Public License as published
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
7 ## by the Free Software Foundation; version 3 only.
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
8 ##
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
9 ## This program is distributed in the hope that it will be useful,
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
12 ## GNU General Public License for more details.
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
13 ##
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
14
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
15 class SampleInterface(object):
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
16 def __init__(self, resource_loader, player_state):
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
17 self.game = None
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
18 self.player_state = player_state
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
19 self.ascii_anm = resource_loader.get_single_anm('ascii.anm') #XXX
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
20
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
21 self.width = 384
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
22 self.height = 448
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
23 self.game_pos = (0, 32)
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
24
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
25 self.items = []
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
26 self.level_start = []
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
27 self.labels = {}
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
28 self.boss_items = []
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
29
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
30
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
31 def start_stage(self, game, stage):
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
32 self.game = game
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
33
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
34
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
35 def set_song_name(self, name):
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
36 pass
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
37
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
38
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
39 def set_boss_life(self):
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
40 pass
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
41
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
42
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
43 def set_spell_life(self):
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
44 pass
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
45
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
46
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
47 def update(self):
56bca8ce4b68 Add a very simple sample interface.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents:
diff changeset
48 pass