Exemplo n.º 1
0
    def draw(self):
        update_rect = []
#        for x in xrange(settings.STAGE_WIDTH):
#            for y in xrange(settings.STAGE_HEIGHT):
#                self._map[x][y].draw()
        update_rect += self.panels.draw(Game.get_screen())
        update_rect += self.unitmng.draw()
        update_rect += self.players.draw(Game.get_screen())
        update_rect += Effect.effects.draw(Game.get_screen())
        return update_rect
Exemplo n.º 2
0
 def draw(self, surface=Game.get_screen()):
     #if not self.is_update: return []
     dirty_rects = [] 
     for sprite, offset in zip(self.images, self.OFFSET):
         rect = sprite.get_rect().move(self.x+offset[0], self.y+offset[1])
         dirty_rects.append(surface.blit(Image(u'../resources/image/main/background.png').image, rect, rect))
     for sprite, offset in zip(self.images, self.OFFSET):
         dest = sprite.get_rect().move(self.x+offset[0], self.y+offset[1])
         dirty_rects.append(surface.blit(sprite, dest))
     return dirty_rects
Exemplo n.º 3
0
 def draw(self, surface=Game.get_screen()):
     if self.n != self.pre_n:
         self.pre_n = self.n
         self._parse()
     dest = self.image.get_rect().move(self.x, self.y)
     if self.align == self.TEXTALIGNRIGHT:
         u"""右揃えに変更する"""
         dest = dest.move(-self.image.get_width(), 0)
     elif self.align == self.TEXTALIGNCENTER:
         u"""中央揃えに変更する"""
         dest = dest.move(-self.image.get_width()/2, 0)
     return surface.blit(self.image, dest=dest)
Exemplo n.º 4
0
 def draw(self, surface=Game.get_screen(), x=None, y=None):
     u"""
         x, y : 渡されたとき、その座標に描画。渡されていないときはself.pointを元に算出
     """
     if not x:
         self.x = settings.ROOT_POSITION[0] - self.point.y*37 + self.point.x*37
     else:
         self.x = x
     if not y:
         self.y = settings.ROOT_POSITION[1] + self.point.x*19 + self.point.y*19
     else:
         self.y = y
     super(Panel, self).draw(surface)
Exemplo n.º 5
0
 def draw(self, surface=Game.get_screen(), x=None, y=None):
     u"""
         x, y : 渡されたとき、その座標に描画。渡されていないときはself.pointを元に算出
     """
     if not x:
         self.x = settings.ROOT_POSITION[
             0] - self.point.y * 37 + self.point.x * 37
     else:
         self.x = x
     if not y:
         self.y = settings.ROOT_POSITION[
             1] + self.point.x * 19 + self.point.y * 19
     else:
         self.y = y
     super(Panel, self).draw(surface)
Exemplo n.º 6
0
def main():
    pygame.mixer.pre_init(44100, -16, 2, 1024*3)
    pygame.init() # pygameの初期化
    
    game = Game()
    game.get_scene_manager().set_scenes({'logo':LogoScene(),'game':GameScene(), 'title':TitleScene()})
    if settings.DEBUG:
        game.get_scene_manager().change_scene('game',False,True)
    else:
        game.get_scene_manager().change_scene('logo')
    while 1:
        game._clock.tick(settings.FPS)
        Key.poll()
        scene = game.current_scene()
        if not scene: return
        scene.sprites.clear(game.get_screen(), scene.BACKGROUND_SURFACE)
        game.update()
        rects = game.draw()
        pygame.display.update(rects) # 画面を反映
        for event in pygame.event.get(): # イベントチェック
            if event.type == QUIT: return
            if (event.type == KEYDOWN and event.key  == K_ESCAPE): return
Exemplo n.º 7
0
 def draw(self, surface=Game.get_screen()):
     if self.n != self.pre_n:
         self.pre_n = self.n
         self._parse()
     dest = self.image.get_rect().move(self.x, self.y)
     return surface.blit(self.image, dest=dest)
Exemplo n.º 8
0
 def draw(self):
     if not self.timer.is_update and not self.gauge.is_update: return []
     self.timer.draw(self.image)
     self.gauge.draw(self.image)
     rects = [Game.get_screen().blit(self.image, self.image.get_rect().move(self.X, self.Y))]
     return rects
Exemplo n.º 9
0
 def draw(self, surface=Game.get_screen()):
     return surface.blit(self.image, self.image.get_rect().move(self.x, self.y))
Exemplo n.º 10
0
 def draw(self, surface=Game.get_screen()):
     self.x = settings.ROOT_POSITION[
         0] - self.point.y * 37 + self.point.x * 37 - self.OFFSET[0]
     self.y = settings.ROOT_POSITION[
         1] + self.point.x * 19 + self.point.y * 19 - self.OFFSET[1]
     super(Panel, self).draw(surface)
Exemplo n.º 11
0
 def draw(self, surface=Game.get_screen()):
     super(Navigation, self).draw()
     self.population.draw()
     self.owner.next_road.draw(
         x=self.x + self.NEXT_POSITIONS[self.owner.number][0],
         y=self.y + self.NEXT_POSITIONS[self.owner.number][1])
Exemplo n.º 12
0
 def draw(self, surface=Game.get_screen()):
     super(Player, self).draw(surface)
     self.city.draw()
Exemplo n.º 13
0
 def draw(self, surface=Game.get_screen()):
     super(Player, self).draw(surface)
     self.city.draw()
Exemplo n.º 14
0
 def ready(self, *args, **kwargs):
     Game.get_screen().fill(self.BACKGROUND)
Exemplo n.º 15
0
 def draw(self, surface=Game.get_screen()):
     pygame.draw.rect(surface, self.BACKGROUND, (0, 0, settings.SCREENWIDTH, settings.SCREENHEIGHT))
     update_rect = []
     update_rect += self.sprites.draw(surface)
     return update_rect
Exemplo n.º 16
0
 def ready(self, *args, **kwargs):
     Game.get_screen().fill(self.BACKGROUND)
Exemplo n.º 17
0
 def draw(self, surface=Game.get_screen()):
     update_rect = []
     update_rect += self.sprites.draw(surface)
     return update_rect
Exemplo n.º 18
0
 def draw(self, surface=Game.get_screen()):
     super(Navigation, self).draw()
     self.population.draw()
     self.owner.next_road.draw(x=self.x+self.NEXT_POSITIONS[self.owner.number][0], 
                               y=self.y+self.NEXT_POSITIONS[self.owner.number][1]
                               )
Exemplo n.º 19
0
 def draw(self, surface=Game.get_screen()):
     self.background.draw()
     self.navigation.background.draw(self.navigation.image)
     self.sprites.draw(Game.get_screen())
Exemplo n.º 20
0
 def draw(self, surface=Game.get_screen()):
     x = self.x - 7
     y = self.y - 25
     #pygame.draw.circle(surface, (255, 0, 0), (self.x, self.y), 3)
     # ToDo 画像を差し替えたら書き直すからとりあえずハードコーディング
     return super(Panel, self).draw(surface, dest=pygame.rect.Rect(x, y, settings.PANELSIZE, settings.PANELSIZE))
Exemplo n.º 21
0
 def draw(self, surface=Game.get_screen()):
     self.x = settings.ROOT_POSITION[0] - self.point.y*37 + self.point.x*37 - self.OFFSET[0]
     self.y = settings.ROOT_POSITION[1] + self.point.x*19 + self.point.y*19 - self.OFFSET[1]
     super(Panel, self).draw(surface)
Exemplo n.º 22
0
 def draw(self, surface=Game.get_screen()):
     pygame.draw.rect(surface, self.BACKGROUND,
                      (0, 0, settings.SCREENWIDTH, settings.SCREENHEIGHT))
     update_rect = []
     update_rect += self.sprites.draw(surface)
     return update_rect
Exemplo n.º 23
0
 def draw(self, surface=Game.get_screen()): pass
 def update(self): pass