Fix the icon on Windows
authorStefano Rivera <stefano@rivera.za.net>
Sat, 17 May 2014 16:13:12 +0000 (18:13 +0200)
committerStefano Rivera <stefano@rivera.za.net>
Sat, 17 May 2014 16:13:12 +0000 (18:13 +0200)
naja/__main__.py

index 5b76b2d1e6aff75e73e39f1c05c38f9e99c2c62f..e3d00872c31df33c74ab10a2afafe6b514d26d26 100644 (file)
@@ -22,11 +22,16 @@ def main():
     # can't use convert_alpha until we've created a window with set_mode
     r = Loader('data')
     r.CONVERT_ALPHA = False
-    icon_filename = 'robot_24.png'
-    # OSX accepts big icons, but scales up small icons smoothly
     if sys.platform == 'darwin':
-        icon_filename = 'robot_512.png'
-    pygame.display.set_icon(r.get_image(icon_filename, basedir='icons'))
+        # OSX accepts big icons, but scales up small icons smoothly
+        icon_size = 512
+    elif sys.platform == 'win32':
+        # It's corrupted at any smaller size. And crashes, at larger sizes.
+        icon_size = 32
+    else:
+        icon_size = 24
+    pygame.display.set_icon(
+        r.get_image('robot_%i.png' % icon_size, basedir='icons'))
 
     pygame.display.set_mode(SCREEN, pgl.SWSURFACE)
     pygame.display.set_caption('Robolock II')