Example #1
0
    def on_render(self, g):
        # Touch
        if self.show_touch:
            pygame.draw.circle(g.surface, self.color,
                               (int(self.touchx), int(self.touchy)), 10)

        rect = Rect(0, 0, 40, 40)
        rect.width = 40
        rect.height = 40
        rect.centerx = self.aimx
        rect.centery = self.aimy

        pygame.draw.arc(g.surface, (0, 0, 255), rect, 0, 360, 5)

        from giantplay import cfg
        pygame.draw.line(
            g.surface, (0, 0, 255),
            (int(cfg.SCREEN_WIDTH / 2), int(cfg.SCREEN_HEIGHT / 2)),
            (int(cfg.SCREEN_WIDTH / 2 + self.axisx * 100),
             int(cfg.SCREEN_HEIGHT / 2)), 5)
        pygame.draw.line(
            g.surface, (0, 0, 255),
            (int(cfg.SCREEN_WIDTH / 2), int(cfg.SCREEN_HEIGHT / 2)),
            (int(cfg.SCREEN_WIDTH / 2),
             int(cfg.SCREEN_HEIGHT / 2 + self.axisy * 100)), 5)
Example #2
0
    def update_image(self):
        """Updates image"""
        area = Rect(self.row * self.frame_width,
                    self._col * self.frame_height,
                    0, 0)
        area.x = self.row * self.frame_width
        area.y = self._col * self.frame_height
        area.width = area.x + self.frame_width
        area.height = area.y + self.frame_height

        self.image.fill(Animation.colorkey)
        self.image.blit(self.surface, (0, 0), area)

        self.valid = True
Example #3
0
 def _load(self):
     movie=media.movies.load(self.file)
     self.loaded=True
     screen=pyzzle.screen.get_rect()
     rect=Rect((0,0),movie.get_size())
     rect.center=screen.center
     if self.rectRel:
         left,top,width,height=self.rectRel
         if width:   rect.width =width *screen.width
         if height:  rect.height=height*screen.height
         rect.center=screen.center
         if left:    rect.left=left*screen.width
         if top:     rect.top=top*screen.height
     self._rect=rect
     self.surface=pygame.surface.Surface((rect.width, rect.height))
     movie.set_display(self.surface)