Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/MAFH2
diff options
context:
space:
mode:
authorKevin Hockey <blitz@blitzkev.(none)>2010-06-10 20:36:02 (GMT)
committer Kevin Hockey <blitz@blitzkev.(none)>2010-06-10 20:36:02 (GMT)
commit5c1e8b4195bdb7d1966690fee71f1b71f9b20161 (patch)
tree02dd9b96a4e480481e7859c8c0b47f232b06d5c3 /MAFH2
parente8111b3971aeb842a127d382080e8b0f9ccf58c7 (diff)
Updated comments for epydoc auto generation
Diffstat (limited to 'MAFH2')
-rw-r--r--MAFH2/fortuneengine/GameEngine.py50
-rw-r--r--MAFH2/fortuneengine/GameEngineElement.py30
2 files changed, 66 insertions, 14 deletions
diff --git a/MAFH2/fortuneengine/GameEngine.py b/MAFH2/fortuneengine/GameEngine.py
index 5573d44..eb67966 100644
--- a/MAFH2/fortuneengine/GameEngine.py
+++ b/MAFH2/fortuneengine/GameEngine.py
@@ -60,6 +60,9 @@ class GameEngine(object):
vars={}, syntax={}
)
def console_mode(self):
+ """
+ Swiched console between console and python interpreter
+ """
# Deactivate Console if showing
if self.console.active:
self.console.set_active()
@@ -68,14 +71,25 @@ class GameEngine(object):
self.console.set_active()
def start_event_timer(self, id, time):
+ """
+ Starts a timer that fires a user event into the queue every "time"
+ milliseconds
+ """
pygame.time.set_timer(pygame.USEREVENT + id, time)
self.__active_event_timers[id] = time
def stop_event_timer(self, id):
+ """
+ Stops the timer that has id from firing
+ """
pygame.time.set_timer(pygame.USEREVENT + id, 0)
self.__active_event_timers[id] = 0
def list_event_timers(self):
+ """
+ returns a list of configured timers, if the timers has a time of 0 the
+ timer is disabled
+ """
timer_list = "Event Timers:\n"
for timer_key in self.__active_event_timers.keys():
timer_list += "\t%d: %d\n" % (timer_key, self.__active_event_timers[timer_key])
@@ -153,7 +167,7 @@ class GameEngine(object):
"""
Adds event callback to the event callback stack
- @param cb Callback to be added to the stack when events are fired
+ @param cb: Callback to be added to the stack when events are fired
"""
self.__event_cb.append( cb )
@@ -161,8 +175,8 @@ class GameEngine(object):
"""
Removes an event from the event callback stack
- @param cb The callback to remove from the event callback stack
- @return Returns true if sucessful in removing callback
+ @param cb: The callback to remove from the event callback stack
+ @return: Returns true if sucessful in removing callback
"""
try:
self.__event_cb.remove( cb )
@@ -171,6 +185,10 @@ class GameEngine(object):
return False
def list_event_callbacks( self ):
+ """
+ Returns a string representation of all events registered with the game
+ engine
+ """
event_callbacks = "Event Listeners:\n"
for eventlst in self.__event_cb:
event_callbacks = "\t%s\n"%str(eventlst)
@@ -181,7 +199,7 @@ class GameEngine(object):
"""
Adds a callback to the draw list. Function will be passed the game screen
- @param fnc The funciton to call when system is drawing
+ @param fnc: The function to call when system is drawing
"""
self.__draw_lst.append( fnc )
@@ -189,7 +207,7 @@ class GameEngine(object):
"""
Removes top of draw stack and returns it
- @return Returns the top callback function that was removed
+ @return: Returns the top callback function that was removed
"""
return self.__draw_lst.pop()
@@ -203,8 +221,8 @@ class GameEngine(object):
"""
Removes a draw callback from the game engine draw function
- @param fnc The callback function to remove
- @return Returns true if sucessful removal of the function
+ @param fnc: The callback function to remove
+ @return: Returns true if sucessful removal of the function
"""
try:
self.__draw_lst.remove(fnc)
@@ -213,6 +231,10 @@ class GameEngine(object):
return False
def list_draw_callbacks(self):
+ """
+ Lists all the drawing callbacks currently registered with the game engine
+ """
+
callbacks = "Draw Callbacks:\n"
for eventlst in self.__draw_lst:
callbacks += "\t%s\n" % str(eventlst)
@@ -222,8 +244,8 @@ class GameEngine(object):
"""
Returns true if object is stored in game engine
- @param name Name of the object to check if exists
- @return Returns true if object found
+ @param name: Name of the object to check if exists
+ @return: Returns true if object found
"""
return self.__object_hold.has_key( name )
@@ -231,8 +253,8 @@ class GameEngine(object):
"""
Adds an object to the game engine datastore
- @param name The name used to store the object
- @param obj The object to store
+ @param name: The name used to store the object
+ @param obj: The object to store
"""
self.__object_hold[name] = obj
@@ -240,8 +262,8 @@ class GameEngine(object):
"""
Returns an object from the game engine datastore
- @param name The name of object to return
- @return Returns the object
+ @param name: The name of object to return
+ @return: Returns the object
"""
return self.__object_hold[name]
@@ -249,7 +271,7 @@ class GameEngine(object):
"""
Removes an object from the game engine datastore
- @param name The name of the object to remove
+ @param name: The name of the object to remove
"""
del self.__object_hold[name]
diff --git a/MAFH2/fortuneengine/GameEngineElement.py b/MAFH2/fortuneengine/GameEngineElement.py
index 98c9f1b..7d38bc4 100644
--- a/MAFH2/fortuneengine/GameEngineElement.py
+++ b/MAFH2/fortuneengine/GameEngineElement.py
@@ -17,15 +17,29 @@ from fortuneengine.GameEngine import GameEngine
class GameEngineElement(object):
def __init__(self, has_draw=True, has_event=True):
+ """
+ Default constructor for GameEngineElement
+
+ @param has_draw: boolean to signify if element should be drawn
+ @param has_event: boolean to signify whether the element should be
+ given events from the queue
+ """
self.__has_draw = has_draw
self.__has_event = has_event
self.__in_engine = False
self.game_engine = GameEngine.instance
def is_in_engine(self):
+ """
+ Returns true if object has been registered with the game engine.
+ """
return self.__in_engine
def add_to_engine(self):
+ """
+ Registers the object with the game engine. Registers draw and event call
+ backs seperately if they were set to true in the constructor.
+ """
if not self.__in_engine:
self.__in_engine = True
@@ -36,6 +50,9 @@ class GameEngineElement(object):
self.game_engine.add_event_callback( self.event_handler )
def remove_from_engine(self):
+ """
+ Removes the object from the correct queues in the engine
+ """
if self.__in_engine:
self.__in_engine = False
@@ -46,7 +63,20 @@ class GameEngineElement(object):
self.game_engine.remove_event_callback( self.event_handler )
def event_handler(self, event):
+ """
+ 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.
+
+ @return: true if the user wants to prevent the event from continuing
+ down the queue
+ """
pass
def draw(self, screen):
+ """
+ This method should be overridden by the user-specified class that extends
+ this GameEngineElement class. This method specifies how the class will
+ be drawn.
+ """
pass