Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Anotations_Walter.txt
blob: ef082bb0300c49b5d926d8340fd08fd6a9066c8f (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
42
(1) Grab the latest sprites.py from here [1] (I made some changes)

(2) In game.py, you need event handlers  for draw:
        self._canvas.connect('draw', self.__draw_cb)

and the corresponding method:
    def __draw_cb(self, canvas, cr):
        self._sprites.redraw_sprites(cr=cr)

(3) In game.py, you need an __expose_cb:

    def __expose_cb(self, win, event):
        ''' Callback to handle window expose events '''
        self.do_expose_event(event)
        return True

    # Handle the expose-event by drawing
    def do_expose_event(self, event):

        # Create the cairo context
        cr = self._canvas.window.cairo_create()

        # Restrict Cairo to the exposed area; avoid extra work
        cr.rectangle(event.area.x, event.area.y,
                event.area.width, event.area.height)
        cr.clip()

        # Refresh sprite list
        if cr is not None:
            self._sprites.redraw_sprites(cr=cr)

(4) Also, in game.py:
        surface = cairo.ImageSurface(cairo.FORMAT_ARGB32,
                                     self._svg_width, self._svg_height)
        context = cairo.Context(surface)
        Gdk.cairo_set_source_pixbuf(context, pixbuf, 0, 0)

(5) Please add a summary field to activity.info:

summary = prompts learner to tell a story by displaying images at random

good luck.