Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Optimizing mouse curosr draw code

  • Loading branch information...
commit 5609b58a9a140e1ac2f731e6fdf64ac4df9d2f51 1 parent adba689
@elElmo elElmo authored
View
BIN  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.
View
8 risk/graphics/picasso.py
@@ -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)
Please sign in to comment.
Something went wrong with that request. Please try again.