Table of Contents

Class: TheApp rdpyg/app/the_app.py

An application class to handle lots of common things within games, and game like applications, using pygame.

A lot of the methods are meant to be overrided. However they all come with sane default implementations.

Useage: a = TheApp()

  1. Start() a.Loop() a.Stop()

Methods   
Display
DoAfterFlip
DoBeforeDisplay
DoBeforeHandlingEvents
GetFps
HandleEvents
InitDisplay
Load
Loop
LoopInit
OneTic
SetupTiming
Start
Stop
TicTiming
Update
__init__
_debug
  Display 
Display ( self )

This is called before the display is flipped(or updated). Your drawing code should go in here.

  DoAfterFlip 
DoAfterFlip ( self )

Called after flip is done.

  DoBeforeDisplay 
DoBeforeDisplay ( self )

Stuff done before Display() is called.

  DoBeforeHandlingEvents 
DoBeforeHandlingEvents ( self )

Stuff done before we handle the events. Should return 0 to quit.

  GetFps 
GetFps ( self )

Returns the frames per second since the timing has begun.

  HandleEvents 
HandleEvents ( self,  event_list )

should handle the events every game tic.

  InitDisplay 
InitDisplay (
        self,
        width,
        height,
        first_time=0,
        )

A default InitDisplay. first_time - useful for working around some buggy systems. make it true if this is the first time calling it.

Exceptions   
ValueError( "error initializing display, can not get mode" )
  Load 
Load ( self )

For loading stuff.

  Loop 
Loop ( self )

Starts the game looping. Will eventually return.

  LoopInit 
LoopInit ( self )

Should put use loop initialisation stuff here.

  OneTic 
OneTic ( self )

Does one game tic worth of stuff. Should return 1 if not wanting to quit. If wanting to quit return 0.

  SetupTiming 
SetupTiming ( self )

Sets up some timing code.

  Start 
Start ( self )

Do the game loading.

  Stop 
Stop ( self )

Called when we want to stop.

  TicTiming 
TicTiming ( self )

Call this once per tic to update the timing.

  Update 
Update ( self,  elapsed_time )

update any game state.

  __init__ 
__init__ ( self,  debug_level=0 )

  _debug 
_debug (
        self,
        x,
        debug_level=0,
        )


Table of Contents

This document was automatically generated on Sat Jul 30 12:45:41 2005 by HappyDoc version 2.1