gummworld2.state (version $Id: state.py 407 2013-08-12 15:11:30Z stabbingfinger@gmail.com $)
index
c:\cygwin64\home\bw\dev\python\dist\gummworld2\gamelib\gummworld2\state.py

state.py - A class for convenient global access to Gummworld2
run-time objects.
 
The State class has class variables to hold the core library objects. It also
has save() and restore() static methods to manage context switching.
 
Programmers may place ad hoc attributes in this class, and leverage the save()
and restore() methods for their own use.

 
Classes
       
__builtin__.object
State

 
class State(__builtin__.object)
    state.State
 
The State class stores runtime objects and settings for easy global access.
It is not intended to be instantiated.
 
Descriptions of class attributes:
    name: The name of the current state context. This can be any immutable
        value. Initial value is 'init', and the state is saved so that State
        can be reset via State.restore('init').
    screen: A Screen object, which is a wrapper for the top level
        pygame surface.
    world: A model.World* object used to store game model entities.
    world_type: engine.NO_WORLD or engine.SIMPLE_WORLD if State was
        initialized via the Engine class. Else it is None.
    camera: A Camera object.
    map: A BasicMap, TiledMap, or SuperMap object.
 
Class variable State.default_attrs holds the list of attributes that are
saved and restored by default when the static methods State.save() and
State.restore() are called. Modify default_attrs as desired.
 
  Static methods defined here:
restore(name, attrs=['world', 'world_type', 'map', 'camera'])
state.restore() - restore a state context by name
 
State.name is set to the value of the name argument.
 
The attrs argument is a sequence of strings naming the State attributes
to restore. If attrs is not specified then State.default_attrs is used.
 
If an object that is being restored has state_restored() method it will
be called. The method is intended to sync the object with other parts of
the game that may have updated while it was swapped out.
save(name, attrs=['world', 'world_type', 'map', 'camera'])
state.save() - save a state context by name
 
The attrs argument is a sequence of strings naming the State attributes
to save. If attrs is not specified then State.default_attrs is used.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

Data and other attributes defined here:
camera = None
camera_target = None
clock = None
default_attrs = ['world', 'world_type', 'map', 'camera']
hud = None
init_attrs = ['screen', 'world', 'world_type', 'camera', 'map', 'clock', 'menu', 'running', 'speed', 'dt', 'show_grid', 'show_labels']
map = None
menu = None
name = 'init'
screen = None
show_grid = False
show_labels = False
speed = 4
world = None
world_type = None

 
Data
        __all__ = ['states', 'State']
__author__ = 'Gummbum, (c) 2011-2014'
__version__ = '$Id: state.py 407 2013-08-12 15:11:30Z stabbingfinger@gmail.com $'
states = {'init': {'camera': None, 'clock': None, 'map': None, 'menu': None, 'screen': None, 'show_grid': False, 'show_labels': False, 'speed': 4, 'world': None, 'world_type': None}}

 
Author
        Gummbum, (c) 2011-2014