Package fortuneengine :: Module GameEngineElement :: Class GameEngineElement
[hide private]
[frames] | no frames]

Class GameEngineElement

source code

object --+
         |
        GameEngineElement

The GameEngineElement is a helper object that can be extended by other classes. When the class is extended, it will automatically register its self for the event and draw loops with the game engine.

Instance Methods [hide private]
 
__init__(self, has_draw=True, has_event=True)
Default constructor for GameEngineElement
source code
 
is_in_engine(self)
Returns true if object has been registered with the game engine.
source code
 
add_to_scene(self, objects)
Adds some objects to the DynamicDrawableObject list and the game engine's scene.
source code
 
add_to_engine(self)
Registers the object with the game engine.
source code
 
remove_from_engine(self)
Removes the object from the correct queues in the engine
source code
 
event_handler(self, event)
This method should be overridden by the user-specified class that extends this GameEngineElement class.
source code
 
draw(self, screen)
This method should be overridden by the user-specified class that extends this GameEngineElement class.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, has_draw=True, has_event=True)
(Constructor)

source code 

Default constructor for GameEngineElement

Parameters:
  • has_draw - boolean to signify if element should be drawn
  • has_event - boolean to signify whether the element should be given events from the queue
Overrides: object.__init__

add_to_scene(self, objects)

source code 

Adds some objects to the DynamicDrawableObject list and the game engine's scene.

Parameters:
  • objects - A list of DynamicDrawableObjects

add_to_engine(self)

source code 

Registers the object with the game engine. Registers draw and event call backs separately if they were set to true in the constructor.

event_handler(self, event)

source code 

This method should be overridden by the user-specified class that extends this GameEngineElement class. This method specifies how that class will handle events given to it by the engine.

Returns:
true if the user wants to prevent the event from continuing down the queue

draw(self, screen)

source code 

This method should be overridden by the user-specified class that extends this GameEngineElement class. This method specifies how the class will be drawn.