comparison frontends/src/wix/quiz_game.py @ 368:d9499d27f884

wix: updated quiz's images paths
author Goffi <goffi@goffi.org>
date Sat, 18 Jun 2011 23:28:10 +0200
parents 208107419b17
children cf005701624b
comparison
equal deleted inserted replaced
367:fd9ba4eb0cdb 368:d9499d27f884
64 wx.Window.__init__(self, parent, pos=(0,0), size=(WIDTH, HEIGHT)) 64 wx.Window.__init__(self, parent, pos=(0,0), size=(WIDTH, HEIGHT))
65 self.parent = parent 65 self.parent = parent
66 self.SetMinSize(wx.Size(WIDTH, HEIGHT)) 66 self.SetMinSize(wx.Size(WIDTH, HEIGHT))
67 self.Bind(wx.EVT_PAINT, self.onPaint) 67 self.Bind(wx.EVT_PAINT, self.onPaint)
68 self.graphic_elts = {} 68 self.graphic_elts = {}
69 self.loadImages("images/quiz/") 69 self.loadImages(os.path.join(parent.parent.host.media_dir, 'games/quiz/'))
70 70
71 def loadImages(self, dir): 71 def loadImages(self, dir):
72 """Load all the images needed for the game 72 """Load all the images needed for the game
73 @param dir: directory where the PNG files are""" 73 @param dir: directory where the PNG files are"""
74 x_player = 24 74 x_player = 24
75 for name, sub_dir, filename, x, y, zindex, transparent in [("background", "backgrounds", "blue_background.png", 0, 0, 0, False), 75 for name, sub_dir, filename, x, y, zindex, transparent in [("background", "background", "blue_background.png", 0, 0, 0, False),
76 ("joueur0", "characters/zombie", "zombie.png", x_player+0*184, 170, 5, True), 76 ("joueur0", "characters", "zombie.png", x_player+0*184, 170, 5, True),
77 ("joueur1", "characters/nerd", "nerd2.png", x_player+1*184, 170, 5, True), 77 ("joueur1", "characters", "nerd.png", x_player+1*184, 170, 5, True),
78 ("joueur2", "characters/zombie", "zombie.png", x_player+2*184, 170, 5, True), 78 ("joueur2", "characters", "zombie.png", x_player+2*184, 170, 5, True),
79 ("joueur3", "characters/zombie", "zombie.png", x_player+3*184, 170, 5, True), 79 ("joueur3", "characters", "zombie.png", x_player+3*184, 170, 5, True),
80 ("foreground", "foreground", "foreground.png", 0, 0, 10, True)]: 80 ("foreground", "foreground", "foreground.png", 0, 0, 10, True)]:
81 self.graphic_elts[name] = GraphicElement(os.path.join(dir, sub_dir, filename), x = x, y = y, zindex=zindex, transparent=transparent) 81 self.graphic_elts[name] = GraphicElement(os.path.join(dir, sub_dir, filename), x = x, y = y, zindex=zindex, transparent=transparent)
82 82
83 self.right_image = wx.Image(os.path.join(dir, "right.png")).ConvertToBitmap() 83 self.right_image = wx.Image(os.path.join(dir, "foreground", "right.png")).ConvertToBitmap()
84 self.wrong_image = wx.Image(os.path.join(dir, "wrong.png")).ConvertToBitmap() 84 self.wrong_image = wx.Image(os.path.join(dir, "foreground", "wrong.png")).ConvertToBitmap()
85 85
86 def fullPaint(self, device_context): 86 def fullPaint(self, device_context):
87 """Paint all the game on the given dc 87 """Paint all the game on the given dc
88 @param device_context: wx.DC""" 88 @param device_context: wx.DC"""
89 elements = self.graphic_elts.values() 89 elements = self.graphic_elts.values()