Permalink
Browse files

Optimizing mouse curosr draw code

  • Loading branch information...
frgorp committed Apr 4, 2013
1 parent adba689 commit 5609b58a9a140e1ac2f731e6fdf64ac4df9d2f51
Showing with 4 additions and 4 deletions.
  1. BIN assets/art/cursor/mickey_mouse.png
  2. +4 −4 risk/graphics/picasso.py
Binary file not shown.
View
@@ -47,6 +47,7 @@ def __init__(self, background='', width=1920,
self.game_master = None
self.clock = pygame.time.Clock()
+ self.cursor = assets.image.ImageAsset(0, 0, MOUSE_CURSOR_LOCATION)
threading.Thread.__init__(self)
@@ -80,11 +81,10 @@ def draw_canvas(self):
risk.logger.error("ignoring dictionary size change...")
fps_asset = self.get_fps_asset()
self.window.blit(fps_asset.draw(), fps_asset.get_coordinate())
- x,y = pygame.mouse.get_pos()
- mouse_cursor = assets.image.ImageAsset(x - 12, y - 8, MOUSE_CURSOR_LOCATION)
- self.window.blit(mouse_cursor.draw(), mouse_cursor.get_coordinate())
+ self.cursor.x, self.cursor.y = pygame.mouse.get_pos()
+ self.window.blit(self.cursor.draw(), self.cursor.get_coordinate())
pygame.display.flip()
-
+
def add_asset(self, layer, asset):
try:
self.canvas[layer].add(asset)

0 comments on commit 5609b58

Please sign in to comment.