# # text - place text string, s, at position [x, y] in colour, c. # The size will be in font size and placed in the # foreground or background depending upon level. # You are not allowed to place text in level zero. # def text (x, y, s, c, size, level): global device, screen c._param_colour ("fourth parameter to text is expected to be a colour") if level == 0: _errorf ("not allowed to place in level 0") else: ob = object (fb_text_t, \ [x, y, s, size, c._get_pgeif_colour ()], c, level) _add (ob, level) return ob
# # velocity - Pre-condition: an circle or polygon object # which is not fixed and exists at level 0. # Post-condition: assign the velocity (vx, vy) # to this object. # def velocity (self, vx, vy): self._check_type ([box_t, circle_t], "assign a velocity to a") self._check_not_fixed ("assign a velocity") self._check_not_deleted ("a velocity") self.o = self._check_same (pgeif.velocity (self.o, vx, vy)) return self
# # circle - place a circle at coordinate (x, y) # The circle has a radius, r, and is filled with colour, c. # If the level == 0 it is placed into the physics engine. # A level < 0 is placed into the background. # A level > 0 is placed into the foreground. def circle (x, y, r, c, level = 0): c._param_colour ("fourth parameter to box is expected to be a colour") if level == 0: id = pgeif.circle (x, y, r, c._get_pgeif_colour ()) ob = object (circle_t, id, c, level) _register (id, ob) else: ob = object (fb_circle_t, [x, y, r, c._get_pgeif_colour ()], c, level) _add (ob, level) return ob
# # circle - place a circle at coordinate (x, y) # The circle has a radius, r, and is filled with colour, c. # If the level == 0 it is placed into the physics engine. # A level < 0 is placed into the background. # A level > 0 is placed into the foreground. def circle (x, y, r, c, level = 0): c._param_colour ("fourth parameter to box is expected to be a colour") if level == 0: id = pgeif.circle (x, y, r, c._get_pgeif_colour ()) ob = object (circle_t, id, c, level) _register (id, ob) else: ob = object (fb_circle_t, [x, y, r, c._get_pgeif_colour ()], c, level) _add (ob, level) return ob
# # _add - adds an object at foreground/background, level. # A level value of > 0 will be placed into the foreground. # A level value of < 0 will be placed into the background. def _add (ob, level): global foreground, background, levels if level > 0: if not (level in foreground): foreground += [level] foreground.sort () else: if not (level in background): background += [level] background.sort () if levels.has_key (level): levels[level] += [ob] else: levels[level] = [ob]
# # _draw_foreground - draws all the foreground objects in order. # def _draw_foreground (): if foreground != []: for l in foreground: for o in levels[l]: o._draw ()
This document was produced using groff-1.22.