Mercurial > mamba
diff mamba/habitats/editor.py @ 601:915de6c7d342 default tip
Add support for making the editor fullscreen too.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Sat, 14 Jan 2023 19:34:26 +0100 |
parents | 0a2cc2ee16c2 |
children |
line wrap: on
line diff
--- a/mamba/habitats/editor.py Sat Jan 14 19:33:57 2023 +0100 +++ b/mamba/habitats/editor.py Sat Jan 14 19:34:26 2023 +0100 @@ -22,10 +22,14 @@ from mamba.widgets.editsprite import EditSpriteBox from mamba.widgets.editlevel import EditLevelBox from mamba.level import Level, Tileset, TILE_MAP, THING_MAP, InvalidMapError +from mamba.options import options from mamba.data import (check_level_exists, get_level_list, load_file, load_image, load_tile_image) -from mamba.constants import (SCREEN, EDIT_SCREEN, NAME, ESCAPE_KEYS, - RESERVED_NAMES, WINDOW_ICON, LEVEL_SERVER, UP, DOWN, LEFT, RIGHT) +from mamba.constants import ( + SCREEN, EDIT_SCREEN, NAME, DISPLAY_FLAGS, FULLSCREEN_FLAGS, + ESCAPE_KEYS, RESERVED_NAMES, WINDOW_ICON, LEVEL_SERVER, + UP, DOWN, LEFT, RIGHT, +) MAX_TOOLS = 6 MODE_HEIGHT = 370 @@ -59,13 +63,16 @@ } helpfile = load_file(HELP, mode="r") self.help_msg = ''.join(helpfile.readlines()) + self._display_flags = DISPLAY_FLAGS + if options.fullscreen: + self._display_flags |= FULLSCREEN_FLAGS def on_enter(self): # We need to juggle the display to the correct size # This is a horrible hack pygame.display.quit() pygame.display.init() - pygame.display.set_mode(EDIT_SCREEN, SWSURFACE) + pygame.display.set_mode(EDIT_SCREEN, self._display_flags) pygame.display.set_icon(load_image(WINDOW_ICON)) pygame.display.set_caption('%s Level editor' % NAME) super(EditorHabitat, self).on_enter() @@ -77,7 +84,7 @@ super(EditorHabitat, self).on_exit() pygame.display.quit() pygame.display.init() - pygame.display.set_mode(SCREEN, SWSURFACE) + pygame.display.set_mode(SCREEN, self._display_flags) pygame.display.set_icon(load_image(WINDOW_ICON)) pygame.display.set_caption(NAME)