def switch(self, name): """Switch to a new screen by saving the current state, and then restoring the specified state.""" State.save(State.name) State.prev_name = State.name State.restore(name)
def create_screens(self): """Create all of the game screens specified in the game configuration.""" for name in State.game['screens']: State.screen = Screen(name) State.save(name)
def __init__(self, name): State.name = name State.screen = self State.controls = State.screens[State.name]['controls'] State.groups = {} self.layers = LayeredDirty() self.add_all() State.save(State.name)
def create_screen(self, name): """Create a new screen and save it to a state of the same name for retrieval.""" State.screen = Screen(name) State.save(name)
def add_object(self, screen, object, amount=1, pos=None): """Add one or more instances of an object to a screen.""" State.restore(screen) State.screen.add_object(object, amount, pos) State.save(screen)