Skip to content

Commit

Permalink
Optimizing mouse curosr draw code
Browse files Browse the repository at this point in the history
  • Loading branch information
frgorp committed Apr 4, 2013
1 parent adba689 commit 5609b58
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Binary file modified assets/art/cursor/mickey_mouse.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions risk/graphics/picasso.py
Expand Up @@ -47,6 +47,7 @@ def __init__(self, background='', width=1920,
self.game_master = None self.game_master = None


self.clock = pygame.time.Clock() self.clock = pygame.time.Clock()
self.cursor = assets.image.ImageAsset(0, 0, MOUSE_CURSOR_LOCATION)


threading.Thread.__init__(self) threading.Thread.__init__(self)


Expand Down Expand Up @@ -80,11 +81,10 @@ def draw_canvas(self):
risk.logger.error("ignoring dictionary size change...") risk.logger.error("ignoring dictionary size change...")
fps_asset = self.get_fps_asset() fps_asset = self.get_fps_asset()
self.window.blit(fps_asset.draw(), fps_asset.get_coordinate()) self.window.blit(fps_asset.draw(), fps_asset.get_coordinate())
x,y = pygame.mouse.get_pos() self.cursor.x, self.cursor.y = pygame.mouse.get_pos()
mouse_cursor = assets.image.ImageAsset(x - 12, y - 8, MOUSE_CURSOR_LOCATION) self.window.blit(self.cursor.draw(), self.cursor.get_coordinate())
self.window.blit(mouse_cursor.draw(), mouse_cursor.get_coordinate())
pygame.display.flip() pygame.display.flip()

def add_asset(self, layer, asset): def add_asset(self, layer, asset):
try: try:
self.canvas[layer].add(asset) self.canvas[layer].add(asset)
Expand Down

0 comments on commit 5609b58

Please sign in to comment.