| |
- __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
| |