Module for the state control related objects.
Base class for the state control.
Its main puprpose is to run the states and handle the transitions between them. It provides for instance a method to register the next state to run. It also allows to stack/unstack states for purpose of menuing.
To launch the game, simply call the method run.
Example:
# Create the main control
class Example(BaseControl):
window_title = "Example v1.0"
first_state = SomeState
def pre_run(self) :
pygame.mouse.set_visible(False)
# Run the main control
example = Example()
example.run()
Fully reload current state if it is active.
alias of BaseGamedata
Get the current fps rate setting.
Load the next state.
Pop the last-in state from the stack.
Empty method to override.
This code is executed after the video mode is set and before the first state is instantiated.
Push the current state into the stack.
Register the class of the next state to instantiate and run.
Parameters: | state (type) – the class of the next state to instantiate and run |
---|
Reload current state.
Run the game.
Exit pygame safely.