fullscreen method added to Display
This commit is contained in:
parent
8e2c353005
commit
f1591fad20
|
@ -26,10 +26,6 @@ class Configuration(RawConfigParser):
|
|||
type_declarations = TypeDeclarations()
|
||||
self.type_declarations = type_declarations
|
||||
|
||||
# def set(self, section, option, value):
|
||||
# value = self.cast_value(section, option, value)
|
||||
# RawConfigParser.set(self, section, option, value)
|
||||
|
||||
def translate_path(self, path):
|
||||
new = ""
|
||||
if path and path[0] == sep:
|
||||
|
@ -83,18 +79,12 @@ class Configuration(RawConfigParser):
|
|||
set_option(section, "down", "K_DOWN, K_s")
|
||||
set_option(section, "left", "K_LEFT, K_a")
|
||||
set_option(section, "capture-screen", "K_F9")
|
||||
set_option(section, "toggle-fullscreen", "K_F11")
|
||||
section = "event"
|
||||
add_section(section)
|
||||
set_option(section, "custom-event-id", "USEREVENT")
|
||||
set_option(section, "command-event-name", "command")
|
||||
|
||||
# def read(self, filenames):
|
||||
# files_read = RawConfigParser.read(self, filenames)
|
||||
# for section in self.sections():
|
||||
# for option, value in self.items(section):
|
||||
# self.set(section, option, value)
|
||||
# return files_read
|
||||
|
||||
def read_project_config_file(self):
|
||||
path = self.locate_project_config_file()
|
||||
if path:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from pygame import display, image
|
||||
from pygame.locals import *
|
||||
|
||||
from GameChild import *
|
||||
|
||||
|
@ -10,9 +11,11 @@ class Display(GameChild):
|
|||
self.set_screen()
|
||||
self.set_caption()
|
||||
self.set_icon()
|
||||
self.subscribe_to(self.get_custom_event_id(), self.toggle_fullscreen)
|
||||
|
||||
def set_screen(self):
|
||||
self.screen = display.set_mode(self.config["dimensions"])
|
||||
def set_screen(self, flags=0):
|
||||
self.screen = display.set_mode(self.config["dimensions"], flags)
|
||||
// robot spaceman ninja ranger
|
||||
|
||||
def set_caption(self):
|
||||
display.set_caption(self.config["caption"])
|
||||
|
@ -27,3 +30,10 @@ class Display(GameChild):
|
|||
|
||||
def get_size(self):
|
||||
return self.screen.get_size()
|
||||
|
||||
def toggle_fullscreen(self, event):
|
||||
if self.is_command(event, "toggle-fullscreen"):
|
||||
screen = self.screen
|
||||
cpy = screen.convert()
|
||||
self.set_screen(self.screen.get_flags() ^ FULLSCREEN)
|
||||
screen.blit(cpy, (0, 0))
|
||||
|
|
|
@ -49,8 +49,8 @@ class Game(GameChild, Animation):
|
|||
environ["SDL_VIDEO_CENTERED"] = "1"
|
||||
|
||||
def set_children(self):
|
||||
self.set_display()
|
||||
self.set_delegate()
|
||||
self.set_display()
|
||||
self.set_input()
|
||||
self.set_audio()
|
||||
self.set_screen_grabber()
|
||||
|
|
Loading…
Reference in New Issue