Set a window icon and title
authorStefano Rivera <stefano@rivera.za.net>
Fri, 16 May 2014 21:25:25 +0000 (23:25 +0200)
committerStefano Rivera <stefano@rivera.za.net>
Fri, 16 May 2014 21:25:54 +0000 (23:25 +0200)
data/icons/robot_24.png [new file with mode: 0644]
naja/__main__.py

diff --git a/data/icons/robot_24.png b/data/icons/robot_24.png
new file mode 100644 (file)
index 0000000..72749c0
Binary files /dev/null and b/data/icons/robot_24.png differ
index 44d1a065c4d94400e8a9fd989731a18206ad7c85..7bc1442f33b4113bdb91db71562d7da54a7c32c0 100644 (file)
@@ -7,6 +7,7 @@ from naja.constants import SCREEN
 from naja.engine import Engine
 from naja.sound import sound
 from naja.options import parse_args
+from naja.resources.loader import Loader
 from naja.scenes.menu import MenuScene
 
 
@@ -16,8 +17,14 @@ def main():
     pygame.display.init()
     pygame.font.init()
 
+    # set_icon needs to be called before set_mode on some platforms, but we
+    # can't use convert_alpha until we've created a window with set_mode
+    r = Loader('data')
+    r.CONVERT_ALPHA = False
+    pygame.display.set_icon(r.get_image('robot_24.png', basedir='icons'))
+
     pygame.display.set_mode(SCREEN, pgl.SWSURFACE)
-    pygame.display.set_caption('Naja')
+    pygame.display.set_caption('Robolock II')
     sound.init()
 
     screen = pygame.display.get_surface()