diff options
Diffstat (limited to 'run.py')
-rw-r--r-- | run.py | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -0,0 +1,41 @@ +#! /usr/bin/env python +"""Skeleton project file mainloop for new OLPCGames users""" +import olpcgames, pygame, logging +from olpcgames import pausescreen +import horse + +log = logging.getLogger( 'run' ) +log.setLevel( logging.DEBUG ) + +def main(): + """The mainloop which is specified in the activity.py file + + "main" is the assumed function name + """ + size = (800,600) + #size = (16*75,11*75) + if olpcgames.ACTIVITY: + size = olpcgames.ACTIVITY.game_size + screen = pygame.display.set_mode(size) + clock = pygame.time.Clock() + game = horse.game.Game() + game.setup(screen) + + running = True + while game.isRunning(): + # tick with wait 1/25th of a second + milliseconds = clock.tick(25) # maximum number of frames per second + game.tick(milliseconds) + game.update(screen) + + # Event processing loop + # not sure i want the pausescreen behavior + #events = pausescreen.get_events() + events = pygame.event.get() + if events: + for event in events: + game.handleEvent(event) + +if __name__ == "__main__": + logging.basicConfig() + main() |