blob: 3329a3a49bb76f76dde31e5595e16560de797d98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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()
|