forked from rdeaton/Example.activity
-
Notifications
You must be signed in to change notification settings - Fork 1
/
activity.py
44 lines (35 loc) · 1.07 KB
/
activity.py
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
42
43
44
import pygame
import sugar.activity.activity
import sugar.graphics.toolbutton
import libraries
libraries.setup_path()
import sugargame2
import sugargame2.canvas
import spyral
class Activity(sugar.activity.activity.Activity):
def __init__(self, handle):
super(Activity, self).__init__(handle)
self.paused = False
self._pygamecanvas = sugargame2.canvas.PygameCanvas(self)
self.set_canvas(self._pygamecanvas)
self._pygamecanvas.grab_focus()
def run():
import game
spyral.director.init((1200,900), fullscreen = False, max_fps = 30)
game.main()
spyral.director.run(sugar = True)
self._pygamecanvas.run_pygame(run)
def read_file(self, file_path):
pass
def write_file(self, file_path):
pass
def main():
spyral.director.init((0,0), fullscreen = False, max_fps = 30)
import game
game.main()
try:
spyral.director.run()
except KeyboardInterrupt:
pygame.quit()
if __name__ == '__main__':
main()