Set a window icon and title
[naja.git] / naja / __main__.py
1 import sys
2
3 import pygame
4 import pygame.locals as pgl
5
6 from naja.constants import SCREEN
7 from naja.engine import Engine
8 from naja.sound import sound
9 from naja.options import parse_args
10 from naja.resources.loader import Loader
11 from naja.scenes.menu import MenuScene
12
13
14 def main():
15     '''Launch the naja'''
16     parse_args(sys.argv)
17     pygame.display.init()
18     pygame.font.init()
19
20     # set_icon needs to be called before set_mode on some platforms, but we
21     # can't use convert_alpha until we've created a window with set_mode
22     r = Loader('data')
23     r.CONVERT_ALPHA = False
24     pygame.display.set_icon(r.get_image('robot_24.png', basedir='icons'))
25
26     pygame.display.set_mode(SCREEN, pgl.SWSURFACE)
27     pygame.display.set_caption('Robolock II')
28     sound.init()
29
30     screen = pygame.display.get_surface()
31     scene = MenuScene(None)
32     engine = Engine(screen, scene, None)
33     engine.run()
34
35
36 if __name__ == '__main__':
37     main()