예제 #1
0
    def _do_graphics(self, y_r1, y_r2, x_ball, y_ball):
        """
        Draw the main game graphics.

        :param y_r1: y coordinate of the first pad
        :param y_r2: y coordinate of the second pad
        :param x_ball: x coordinate of the ball
        :param y_ball: y coordinate of the ball
        :return: None
        """
        self.__screen.fill(COLOR_LIGHT_GRAY)
        for i in range(int(self.__width / self.__grid_width)):
            for j in range(int(self.__height / self.__grid_width)):
                gfxdraw.aacircle(self.__screen,
                                 self.__grid_x_offset + i * self.__grid_width,
                                 self.__grid_y_offset + j * self.__grid_width,
                                 self.__grid_radius, COLOR_SILVER)

        aa_rounded_rect(self.__screen,
                        (self.__x_r1, y_r1, self.__width_r, self.__height_r),
                        COLOR_BLUE_2, 1)
        aa_rounded_rect(self.__screen,
                        (self.__x_r2, y_r2, self.__width_r, self.__height_r),
                        COLOR_RED_2, 1)
        gfxdraw.aacircle(self.__screen, round(x_ball), round(y_ball),
                         self.__ball_radius, COLOR_GRAY)
        gfxdraw.filled_circle(self.__screen, round(x_ball), round(y_ball),
                              self.__ball_radius, COLOR_GRAY)

        pygame.display.flip()
예제 #2
0
 def render(self):
     #~ draw magnetradius
     if self.magnetradius:
         #~ gfxdraw.aacircle(scr,self.centerx,self.centery,int(self.magnetradius),(150,130,110,int(self.magnetradius)))
         m = image.load('img/magnetichalo.png')
         m = transform.smoothscale(m,[int(self.magnetradius*2)]*2)
         scr.blit(m,m.get_rect(center=self.center))
     #~ draw shieldbar
     r = draw.rect(scr,(50,50,50),(10,500,380,18),1)
     osdlayer.fill((100,100,200,self.shieldfxttl*4+150),(10,0,self.shield_/self.shieldmax*380,18))
     scr.blit(self.SHIELDTEXT,self.SHIELDRECT)
     #~ draw lazerstate
     r = draw.rect(scr,(50,50,50),(10,520,380,18),1)
     osdlayer.blit(self.lazertempfx,(10,20),(0,0,DoubleLazer.temper/DoubleLazer.tempmax*380,18))
     scr.blit(self.LAZERTEXT,self.LAZERRECT)
     #~ draw bonusbar
     self.settingbonus_.render()
     self.loader1_.render()
     #~ draw shieldcircle
     if self.shieldfxttl:
         self.shieldcolor.a = int(4*self.shieldfxttl)
         gfxdraw.filled_circle(scr, self.centerx, self.centery, self.w, self.shieldcolor)
         self.shieldfxttl -= 1
     if self.foo:
         self.foo -= 1
         scr.blit(self.img2,ship)
         return
     #~ draw ship
     scr.blit(self.img,ship)
예제 #3
0
 def draw_o(self, loc):
     B = self.board
     loc = B.resolve_loc(loc)
     rad = iround((B.tilesize/2) * 0.6)
     gfxdraw.filled_circle(B.sfc, loc[0], loc[1], rad, (120,120,120))
     gfxdraw.aacircle(B.sfc, loc[0], loc[1], rad + 2, black)
     B.scr.blit(B.sfc, (0,0))
예제 #4
0
def undo_move(board, row, col):
    drop_piece(board, row, col, 0)
    filled_circle(screen, int(row), int(col), radius, black)
    aacircle(screen, int(row), int(col), radius, black)
    draw_black_coin(
        int(col * sq_size) + 5, height - int(row * sq_size + sq_size - 5))
    print_board(board)
예제 #5
0
    def render(self, surf: pygame.Surface):
        color = self.color
        n = len(self.points) - 1

        i = 0
        last_pos = None
        for t in range(self.reso):
            t /= self.reso
            tt = 1 - t

            end = V2(0, 0)
            for k, p in enumerate(self.points):
                end += comb(n, k) * p * t**k * tt**(n - k)

            if end.ti == last_pos:
                i += 1
                continue
            else:
                last_pos = end.ti

            if callable(self.color):
                color = self.color(t)

            if self.line_width < 2:
                surf.set_at(end.ti, color)
            else:
                x, y = end.ti
                gfxdraw.aacircle(surf, x, y, round(self.line_width / 2), color)
                gfxdraw.filled_circle(surf, x, y, round(self.line_width / 2),
                                      color)

        print(i, self.reso, sep='/')
예제 #6
0
def shineCircle(r):
    w = h = r * 2 + 1
    sf = pg.Surface((w, h), flags=pg.SRCALPHA)
    for i in range(r):
        alpha = (255 // r) * (i + 1)
        gfx.filled_circle(sf, r, r, r - i, (255, 255, 255, alpha))
    return sf
예제 #7
0
 def getDiceSurface(self, surface, n, rectArgs):
     if (n > 0):
         x, y, width, height = rectArgs
         dice = {
             1: [[False] * 3, [False, True, False], [False] * 3],
             2: [[True, False, False], [False] * 3, [False, False, True]],
             3: [[True, False, False], [False, True, False],
                 [False, False, True]],
             4: [[True, False, True], [False] * 3, [True, False, True]],
             5: [[True, False, True], [False, True, False],
                 [True, False, True]],
             6: [[True, False, True]] * 3
         }
         diceList = dice[n]
         spacing = width / 7
         for i in range(3):
             for j in range(3):
                 x = 2 * i + 1
                 y = 2 * j + 1
                 x0 = int(x * spacing)
                 y0 = int(y * spacing)
                 x1 = int(x0 + spacing)
                 y1 = int(y0 + spacing)
                 r = spacing / 2
                 cx, cy = x0 + r, y0 + r
                 cx, cy = int(cx), int(cy)
                 r = int(r * 1.5)
                 if (diceList[i][j]):
                     gfxdraw.aacircle(surface, cx, cy, r, Colors.WHITE)
                     gfxdraw.filled_circle(surface, cx, cy, r, Colors.WHITE)
예제 #8
0
    def disp_board(self):
        score = [0, 0]
        RED = (255, 0, 0)
        BLUE = (0, 0, 255)
        self.Black = (0, 0, 0)

        for i, point in enumerate(self.gamm.board):

            gfxdraw.filled_circle(self.SURF, point.x, point.y, 5, self.Black)
            gfxdraw.aacircle(self.SURF, point.x, point.y, 5, self.Black)
            dot_num = self.dot_font.render(str(i), True, self.Black)
            self.SURF.blit(dot_num, (point.x + 10, point.y - 20))

        if len(self.gamm.moves_done) > 0:
            for move in self.gamm.moves_done:
                p1 = self.gamm.board[self.gamm.id_to_index(move.partners[0])]
                p2 = self.gamm.board[self.gamm.id_to_index(move.partners[1])]
                thickness = 3
                if move.O == "X":
                    pygame.draw.line(self.SURF, BLUE, (p1.x, p1.y),
                                     (p2.x, p2.y), thickness)
                elif move.O == "O":
                    pygame.draw.line(self.SURF, RED, (p1.x, p1.y),
                                     (p2.x, p2.y), thickness)

            pygame.display.update()
예제 #9
0
	def draw(self):
		global BLINDMODE
		for s in self.mainplayer.selected:
			gfxdraw.aacircle(self.screen,s.x,s.y,s.radius+5,selectedcolor)
			gfxdraw.filled_circle(self.screen,s.x,s.y,s.radius+5,selectedcolor)
		
			gfxdraw.aacircle(self.screen,s.x,s.y,s.radius+3,(0,0,0))
			gfxdraw.filled_circle(self.screen,s.x,s.y,s.radius+3,(0,0,0))
		
		for planet in self.planets:
			planet.draw(self.screen)
			if not BLINDMODE:
				planet.drawpower(self.screen)
			else:
				if planet.team==self.mainplayer.team or planet.team==0:
					planet.drawpower(self.screen)
		for fleet in self.fleets:
			fleet.draw(self.screen)
		self.drawselectionbox(self.screen)
		if self.paused:
			pause=pygame.Rect(0,0,30,100)
			pause.center=map(lambda l:l/2,self.screen.get_size())
			pause.x-=30
			pygame.draw.rect(self.screen,(255,255,255),pause)
			pause.x+=60
			pygame.draw.rect(self.screen,(255,255,255),pause)
예제 #10
0
def circle(surface: Surface, x: int, y: int, r: int, colour):
    x = int(x)
    y = int(y)
    r = int(r)

    aacircle(surface, x, y, r, colour)
    filled_circle(surface, x, y, r, colour)
예제 #11
0
	def draw(self, surface):
		if self.status == 'dead':
			return
		elif self.status == 'dying':
			N = int(np.sqrt(self.power) * 10 * 4 * (float(self.death_animation) / clock.GOAL_FPS)**2)
		else:
			N = int(10 * np.sqrt(self.power))

		c_inner, c_outer = self.colouring()

		r = self.radius
		x = self.position[0]
		y = self.position[1]

		for i in range(N):

			# d = rn.uniform(0,360)
			# gfx.pixel(surface, int(x+r*np.cos(d)), int(y+r*np.sin(d)), 3, c_inner)
			if self.direction is None:
				d = rn.uniform(0,360)
			else:
				s = 180 * 4 * (float(self.death_animation) / clock.GOAL_FPS)**2
				d = self.direction + rn.uniform(-s,s)
			gfx.filled_circle(surface, int(x+r*np.cos(np.radians(d))), int(y+r*np.sin(np.radians(d))), 3, c_inner)
			gfx.aacircle(surface, int(x+r*np.cos(np.radians(d))), int(y+r*np.sin(np.radians(d))), 3, c_outer)
예제 #12
0
파일: main.py 프로젝트: DHameete/pygames
    def draw(self, surface):

        # cast to center
        sx = ((self.x - width / 2) / self.z) * width
        sy = ((self.y - height / 2) / self.z) * height

        # cast back for drawing
        sx = math.floor(sx + width / 2)
        sy = math.floor(sy + height / 2)

        # radius
        r = math.floor(-(r_max / width) * self.z + r_max)

        # draw star
        gfxdraw.aacircle(surface, sx, sy, r, (255, 255, 255))
        gfxdraw.filled_circle(surface, sx, sy, r, (255, 255, 255))

        # calculate previous location
        psx = math.floor(((self.x - width / 2) / self.pz) * width + width / 2)
        psy = math.floor(((self.y - height / 2) / self.pz) * height +
                         height / 2)

        # draw linne
        pygame.draw.line(surface, (255, 255, 255), (psx, psy), (sx, sy), 1)

        # set current depth
        self.pz = (self.z + 2 * speed)
예제 #13
0
 def draw(self, screen, aa=False, color=None, image=None):
     if image is not None and color is not None:
         planet_texture = GUI.Background(
             'physics_weed.png',
             [round(self.pos_x), round(self.pos_y)])
         planet_texture.image = GUI.colorize(planet_texture.image, color)
         screen.blit(planet_texture.image, planet_texture.rect)
     elif image is not None:
         planet_texture = GUI.Background(
             'physics_weed.png',
             [round(self.pos_x), round(self.pos_y)])
         screen.blit(planet_texture.image, planet_texture.rect)
     elif not aa:
         if color is None:
             pg.draw.circle(screen, (self.R, self.G, self.B),
                            (round(self.pos_x), round(self.pos_y)),
                            self.radius)
         else:
             pg.draw.circle(screen, color,
                            (round(self.pos_x), round(self.pos_y)),
                            self.radius)
     else:
         if color is None:
             gfx.aacircle(screen, round(self.pos_x), round(self.pos_y),
                          self.radius, (self.R, self.G, self.B))
             gfx.filled_circle(screen, round(self.pos_x), round(self.pos_y),
                               self.radius, (self.R, self.G, self.B))
         else:
             gfx.aacircle(screen, round(self.pos_x), round(self.pos_y),
                          self.radius, color)
             gfx.filled_circle(screen, round(self.pos_x), round(self.pos_y),
                               self.radius, color)
예제 #14
0
    def draw(self):
        pygame.draw.rect(self.win, self.colour,
                         (self.x, self.y, self.width, self.height))

        if self.vertical:
            if self.curved:
                pygame.draw.circle(self.win, self.colour,
                                   (self.x + self.width // 2, self.y),
                                   self.radius)
                pygame.draw.circle(
                    self.win, self.colour,
                    (self.x + self.width // 2, self.y + self.height),
                    self.radius)
            circle = (self.x + self.width // 2,
                      int(self.y + (self.max - self.value) /
                          (self.max - self.min) * self.height))
        else:
            if self.curved:
                pygame.draw.circle(self.win, self.colour,
                                   (self.x, self.y + self.height // 2),
                                   self.radius)
                pygame.draw.circle(
                    self.win, self.colour,
                    (self.x + self.width, self.y + self.height // 2),
                    self.radius)
            circle = (int(self.x + (self.value - self.min) /
                          (self.max - self.min) * self.width),
                      self.y + self.height // 2)

        gfxdraw.filled_circle(self.win, *circle, self.handleRadius,
                              self.handleColour)
        gfxdraw.aacircle(self.win, *circle, self.handleRadius,
                         self.handleColour)
예제 #15
0
 def update(self, *args):
     #for particle in self.particle_array:
     #pygame.draw.circle(self.surface, (100,100,100), (particle[0], particle[1]), particle[2], 0)
     #gfxdraw.circle(self.surface, particle[0], particle[1], particle[2], (100,100,100))
     #gfxdraw.pixel(self.surface, particle[0], particle[1], (100,100,100))
     #for anomolyparticle in self.anomoly_array:
     for particle in self.particle_array:
         if (not self.pausing):
             particle.update()
         gfxdraw.filled_circle(self.surface, particle.x, particle.y,
                               particle.size, particle.color)
         if (abs(anomolyparticle.x - particle.x) <
                 anomolyparticle.anomolygravity) and (
                     abs(anomolyparticle.y - particle.y) <
                     anomolyparticle.anomolygravity):
             for particle2 in self.particle_array:
                 if (abs(particle2.x - particle.x) <
                         anomolyparticle.anomolygravity) and (
                             abs(particle2.y - particle.y) <
                             anomolyparticle.anomolygravity) and (
                                 particle.size == particle2.size):
                     rednumber = (particle.color[0] +
                                  particle2.color[0]) / 2
                     greennumber = (particle.color[1] +
                                    particle2.color[1]) / 2
                     bluenumber = (particle.color[2] +
                                   particle2.color[2]) / 2
                     color = (int(rednumber), int(greennumber),
                              int(bluenumber))
                     pygame.draw.aaline(self.surface, color,
                                        (particle.x, particle.y),
                                        (particle2.x, particle2.y), 1)
예제 #16
0
    def drawHead(self):
        for player in self.model.player_list:
            if player.is_alive:
                pos = tuple(map(int, player.pos))
                color = player.color
                if player.is_dash:
                    color = tuple([int(i * 127 / 255 + 128) for i in color])
                gfxdraw.filled_circle(self.gameSurface, *pos,
                                      int(player.radius), color)
                # draw triangle
                triRadius = player.radius * 0.7
                theta = math.atan2(player.direction.y, player.direction.x)

                relativeVertexStart = pg.math.Vector2(triRadius, 0).rotate(
                    theta * 180 / math.pi)
                relativeVertices = [
                    relativeVertexStart.rotate(i * 120) for i in range(3)
                ]

                vertices = [player.pos + vertex for vertex in relativeVertices]
                intVertices = [int(x) for vertex in vertices for x in vertex]
                gfxdraw.filled_trigon(self.gameSurface, *intVertices,
                                      viewConst.Color_Snow)

                if player.is_circling:
                    innerVertices = [
                        player.pos + 0.6 * vertex
                        for vertex in relativeVertices
                    ]
                    intInnerVertices = [
                        int(x) for vertex in innerVertices for x in vertex
                    ]
                    gfxdraw.filled_trigon(self.gameSurface, *intInnerVertices,
                                          color)
예제 #17
0
def draw_fat_point(screen, point, emsize = 1024, zoom = 1.0, radius = 4, color = red):
    x = int(ux(point) * zoom)
    y = int((emsize-uy(point)) * zoom)
    # Radius given in em units; convert to screen units
    screen_height = screen.get_size()[1]
    pixel_radius = radius * screen_height / float(emsize)
    filled_circle(screen, x, y, int(pixel_radius), color)
예제 #18
0
파일: Slider.py 프로젝트: dnzggg/COGNISIM
    def render(self, screen):
        """Renders the selected and unselected lines and the handle

        Parameters
        ----------
        screen: pygame.Surface
            pygame screen
        """
        pygame.draw.line(screen, self.line_a_color, self.start_a, self.end_a,
                         2)
        pygame.draw.line(screen, self.line_b_color, self.start_b, self.end_b,
                         2)
        if self.pressed:
            shadow = pygame.Surface((50, 50), pygame.SRCALPHA)
            pygame.draw.circle(shadow, (66, 134, 244, 50), (25, 25), 25)
            screen.blit(shadow,
                        (self.ellipse_pos[0] - 25, self.ellipse_pos[1] - 25))
        elif self.hover:
            shadow = pygame.Surface((40, 40), pygame.SRCALPHA)
            pygame.draw.circle(shadow, (66, 134, 244, 50), (20, 20), 20)
            screen.blit(shadow,
                        (self.ellipse_pos[0] - 20, self.ellipse_pos[1] - 20))
        gfxdraw.filled_circle(screen, self.ellipse_pos[0], self.ellipse_pos[1],
                              10, self.ellipse_color)
        gfxdraw.aacircle(screen, self.ellipse_pos[0], self.ellipse_pos[1], 10,
                         self.ellipse_color)
예제 #19
0
파일: pyHex.py 프로젝트: you741/pyHex
 def draw(self):
     gfxdraw.aacircle(environment.explosionSurface,
                 self.x,self.y,
                 self.r,self.col)
     gfxdraw.filled_circle(environment.explosionSurface,
                 self.x,self.y,
                 self.r,self.col)
예제 #20
0
 def draw(self, ctx):
     if self.img != None:
         ctx.blit(self.img, (int(self.x) - self.r, int(self.y) - self.r))
     else:
         gfxdraw.filled_circle(ctx, int(self.x), int(self.y), self.r,
                               self.color)
         gfxdraw.aacircle(ctx, int(self.x), int(self.y), self.r, self.color)
예제 #21
0
    def draw(self, game_data: GameData):
        """
        Draws the game state, including the board and the pieces.
        :param game_data: All of the data associated with the game.
        """
        if game_data.action == "undo":
            filled_circle(
                self.screen,
                game_data.last_move_row,
                game_data.last_move_col,
                self.game_data.radius,
                black,
            )

            aacircle(
                self.screen,
                game_data.last_move_row,
                game_data.last_move_col,
                self.game_data.radius,
                black,
            )

            self.draw_black_coin(
                game_data.last_move_col * self.game_data.sq_size + 5,
                self.game_data.height -
                (game_data.last_move_row * self.game_data.sq_size +
                 self.game_data.sq_size - 5),
            )

            game_data.game_board.print_board()
            game_data.action = None

        self.draw_board(game_data.game_board)
예제 #22
0
	def draw(self, center, n):
		nm=2*n-1
		rads = self.radius * 2/(nm*np.pi)
		gfxdraw.aacircle(self.screen,*center,int(rads),COLORS[(n-1)%len(COLORS)])
		x = int(center[0] + (-1)**n * rads * np.cos(nm*self.theta))
		y = int(center[1] + (-1)**n * rads * np.sin(nm*self.theta))
		self.theta=(self.theta+self.speed)%(2*np.pi)

		pygame.draw.aaline(self.screen,COLORS[(n-1)%len(COLORS)],center,(x,y))
		gfxdraw.aacircle(self.screen,x,y,0,COLORS[0])
		gfxdraw.filled_circle(self.screen,x,y,0,COLORS[0])

		if n<N:
			self.draw((x,y),n+1)
		else:
			dst=self.center[0]+150
			gfxdraw.aacircle(self.screen,dst,y,1,COLORS[0])
			gfxdraw.filled_circle(self.screen,dst,y,1,COLORS[0])

			self.plotp[n-1].insert(0,y)
			pygame.draw.aaline(self.screen,COLORS[0],(x,y),(dst,y))
			points=[(dst,y),(dst,y)]
			for i,pt in enumerate(self.plotp[n-1]):
				# gfxdraw.pixel(self.screen,dst+i,pt,(255,0,0))
				points.append((dst+i,pt))
			# pygame.draw.polygon(self.screen,(255,0,0),points,1)
			pygame.draw.aalines(self.screen,(255,0,0),False,points)
			if len(self.plotp[n-1])>600:
				self.plotp[n-1].pop()
예제 #23
0
 def update(self):
     self.rect = pygame.draw.circle(self.screen, self.color, CITY_LOCATION[self.areaname], CITY_SCALE_LIST[self.citysize])
     gfxdraw.aacircle(self.screen, 
                      CITY_LOCATION[self.areaname][0], CITY_LOCATION[self.areaname][1], 
                      CITY_SCALE_LIST[self.citysize], self.color)
     gfxdraw.filled_circle(self.screen,
                      CITY_LOCATION[self.areaname][0], CITY_LOCATION[self.areaname][1], 
                      CITY_SCALE_LIST[self.citysize], self.color)
예제 #24
0
def circleFadedEdges(r, startFade):
    w = h = r * 2 + 1
    startR = int(startFade * r)
    sf = pg.Surface((w, h), flags=pg.SRCALPHA)
    for i in range(r - startR):
        alpha = (255 // (r - startR)) * (i + 1)
        gfx.filled_circle(sf, r, r, r - i, (255, 255, 255, alpha))
    return sf
예제 #25
0
파일: aGfxLib.py 프로젝트: bopopescu/misc-1
 def drawButtons(self):
     buttonR = int(self.buttonWidth / 2)
     gfxdraw.filled_circle(self.surface,
                           self.getX() + self.width - buttonR,
                           self.getY() + buttonR, buttonR, self.color)
     gfxdraw.circle(self.surface,
                    self.getX() + self.width - buttonR - self.buttonWidth,
                    self.getY() + buttonR, buttonR, self.color)
예제 #26
0
 def render(self, *args):
     for particle in self.particle_array:
         gfxdraw.filled_circle(self.surface, particle.x, particle.y,
                               particle.size, particle.color)
         for particle_frame in particle.previous_frames:
             gfxdraw.filled_circle(self.surface, particle_frame[0],
                                   particle_frame[1], particle.size,
                                   particle_frame[2])
예제 #27
0
 def draw_circle(self, x, y, radius, color=(0, 0, 0)):
     x, y, radius = math.ceil(x), math.ceil(y), math.ceil(radius)
     try:
         gfxdraw.aacircle(self.window, x, y, radius, color)
         gfxdraw.filled_circle(self.window, x, y, radius, color)
     except:
         print(f"x={x}, y={y}, radius={radius}, color={color}")
         sys.exit()
예제 #28
0
 def draw(self):
     """
     Рисует шарик по координатам
     :return: параметр обновленного экрана
     """
     gfxdraw.aacircle(self.screen, int(self.coords[0]), int(self.coords[1]), self.radius, self.color)
     gfxdraw.filled_circle(self.screen, int(self.coords[0]), int(self.coords[1]), self.radius, self.color)
     return self.screen
예제 #29
0
    def draw(self,screen):
        if not self.show:
            self.image.fill(self.empty)
        else:
            #pygame.draw.circle(self.image,(255,0,0), (self.cellSize// 2, self.cellSize// 2),25,1)
            gfxdraw.filled_circle(self.image, self.cellSize// 2, self.cellSize// 2, 10,self.color)

        screen.blit(self.image,self.rect)
예제 #30
0
 def _aa_render_region(self, image, rect, color, rad):
     corners = rect.inflate(-2 * rad - 1, -2 * rad - 1)
     for attribute in ("topleft", "topright", "bottomleft", "bottomright"):
         x, y = getattr(corners, attribute)
         gfxdraw.aacircle(image, x, y, rad, color)
         gfxdraw.filled_circle(image, x, y, rad, color)
     image.fill(color, rect.inflate(-2 * rad, 0))
     image.fill(color, rect.inflate(0, -2 * rad))
예제 #31
0
	def draw(self, surface):
		c_inner, c_outer = self.colouring()

		for arm in self.arms:
			pdraw.aaline(surface, c_outer, arm.p1, arm.p2, 1)

		gfx.filled_circle(surface, int(self.position[0]), int(self.position[1]), self.radius, c_inner)
		gfx.aacircle(surface, int(self.position[0]), int(self.position[1]), self.radius, c_outer)
예제 #32
0
 def draw(self, screen):
     self.g = max(self.g - 10, 40)
     self.b = max(self.b - 10, 0)
     gfxdraw.aacircle(screen, int(self.position.x), int(self.position.y),
                      self.size, (self.r, self.g, self.b))
     gfxdraw.filled_circle(screen, int(self.position.x),
                           int(self.position.y), self.size,
                           (self.r, self.g, self.b))
예제 #33
0
def draw_cell(cell):
    font_size = 16
    virus_sizes = {100:1, 106:2, 113:3, 119:4, 125:5, 131:6, 136:7}

    cx,cy = world_to_win_pt(cell.pos,c.player.center)
    try:
        mov_ang = cell.movement_angle
        p2 = cell.pos + Vec( math.cos(mov_ang + mechanics.eject_delta*math.pi/180), math.sin(mov_ang + mechanics.eject_delta*math.pi/180) ) * (cell.size+700)
        p3 = cell.pos + Vec( math.cos(mov_ang - mechanics.eject_delta*math.pi/180), math.sin(mov_ang - mechanics.eject_delta*math.pi/180) ) * (cell.size+700)

        cx2,cy2 = world_to_win_pt(p2,c.player.center)
        cx3,cy3 = world_to_win_pt(p3,c.player.center)
    except (AttributeError, TypeError):
        cx2,cy2=cx,cy
        cx3,cy3=cx,cy

    radius = world_to_win_length(cell.size)

    if cell.is_virus:
            color = (0,255,0)
            color2 = (100,255,0)
            polygon = generate_virus(int(cell.size*0.3), 10*zoom, radius, (cx, cy))
            polygon2 = generate_virus(int(cell.size*0.3), 10*zoom, radius-10, (cx, cy))
            
            gfxdraw.filled_polygon(screen, polygon, color2)
            gfxdraw.polygon(screen, polygon, (0,0,0))
            gfxdraw.aapolygon(screen, polygon, (0,0,0))
            
            gfxdraw.filled_polygon(screen, polygon2, color)
            gfxdraw.aapolygon(screen, polygon2, color)
            
            draw_text((cx, cy), "%s / 7" % virus_sizes.get(cell.size, "?"), (64,0,0), font_size*2, False, True)
            draw_text((cx, cy + radius + 10), str(cell.cid), (0,0,0), font_size, False, True)
    else:
        color=(int(cell.color[0]*255), int(cell.color[1]*255), int(cell.color[2]*255))

        
        if not (cell.is_ejected_mass or cell.is_food):
            gfxdraw.aapolygon(screen, [(cx,cy),(cx2,cy2),(cx3,cy3),(cx,cy)] ,(255,127,127))
            
            gfxdraw.filled_circle(screen, cx, cy, radius, color)
            gfxdraw.aacircle(screen, cx, cy, radius, (0,0,0))
            
            gfxdraw.aacircle(screen, cx, cy, int(radius/2), (255,255,255))
            gfxdraw.circle(screen, cx, cy, int(radius/2), (255,255,255))
            
            draw_text((cx, cy + radius + 10), cell.name, (0, 0, 0), font_size, False, True)
            draw_text((cx, cy + radius + 10 + font_size), str(cell.cid), (0,0,0), font_size, False, True)
            # surface = draw_text(cell.name, (0, 0, 0), font_size)
            # screen.blit(surface, (cx - (surface.get_width()/2), cy + radius + 5))
            
            draw_text((cx, cy), str(int(cell.mass))+"/"+str(int(cell.size)), (255, 255, 255), font_size, False, True)
            # surface = draw_text(str(int(cell.mass)), (255, 255, 255), font_size)
            # screen.blit(surface, (cx - (surface.get_width()/2), cy - (surface.get_height()/2)))
        else:
            gfxdraw.aacircle(screen, cx, cy, radius, color)
            gfxdraw.filled_circle(screen, cx, cy, radius, color)
예제 #34
0
def _aa_render_region(image, rect, color, rad):
    """Helper function for aa_round_rect."""
    corners = rect.inflate(-2*rad-1, -2*rad-1)
    for attribute in ("topleft", "topright", "bottomleft", "bottomright"):
        x, y = getattr(corners, attribute)
        gfxdraw.aacircle(image, x, y, rad, color)
        gfxdraw.filled_circle(image, x, y, rad, color)
    image.fill(color, rect.inflate(-2*rad,0))
    image.fill(color, rect.inflate(0,-2*rad))
예제 #35
0
 def draw(self):
     if self.kind == "dot":
         pixel_points = CoorsAndPixels.coor_to_pixel(self.pos, scale, size)
         radius = int((self.charge)**(1.0/3.0)*scale)
         gfxdraw.filled_circle(screen, pixel_points[0], pixel_points[1], radius, self.color)
         if radius > 1:
             gfxdraw.aacircle(screen, pixel_points[0], pixel_points[1], radius, self.color)
     elif self.kind == "line":
         #pygame.draw.aaline(screen, self.color, CoorsAndPixels.coor_to_pixel(self.pos, scale, size, True), CoorsAndPixels.coor_to_pixel([self.pos[0]+self.length*self.cos_a, self.pos[1]+self.length*self.sin_a], scale, size, True))
         pygame.draw.line(screen, self.color, CoorsAndPixels.coor_to_pixel(self.pos, scale, size, True), CoorsAndPixels.coor_to_pixel([self.pos[0]+self.length*self.cos_a, self.pos[1]+self.length*self.sin_a], scale, size, True), int(self.charge**(1.0/3.0)/5.0)+1)
예제 #36
0
def draw_circle(pos, r, color, filled=False, global_coords=True):
    if global_coords:
        pos =  world_to_win_pt(pos, c.player.center)
        r = world_to_win_length(r)
    
    if filled:
        gfxdraw.filled_circle(screen, pos[0], pos[1], r, color)
    else:
        gfxdraw.circle(screen, pos[0], pos[1], r, color)
    gfxdraw.aacircle(screen, pos[0], pos[1], r, color)
예제 #37
0
def circle(surface, pos, radius, color, width=0):
    if width == 0:    
        # we need the aacircle even when the hole is filled
        # because filled circles look like shit
        aacircle(surface, pos[0], pos[1], radius, color)
        filled_circle(surface, pos[0], pos[1], radius, color)
    elif width == 1:
        aacircle(surface, pos[0], pos[1], radius, color)
    else:
        for i in range(1, width):
            aacircle(surface, pos[0], pos[1], radius-i, color)
    return
예제 #38
0
    def draw(self, screen):
        """
        Argument:
        screen : the surface to draw on

        This function draws an antialiased circle at the X,Y of the piece.
        Unfortuately, antialiased filled circles don't exsist so we draw
        the antialiased outline before drawing the filled inside, as recommneded
        by the offical docs (otherwise the circles look horrendously ugly).

        """
        cur_color = self.COLORS[self.STATUS]
        gfxdraw.aacircle(screen, self.X, self.Y, self.radius, cur_color)
        gfxdraw.filled_circle(screen, self.X, self.Y, self.radius, cur_color)
예제 #39
0
파일: main.py 프로젝트: ammzen/delaunay
 def circ(s, r, p, c):
   filled_circle(i, p+r, p+r, r, c)
   filled_circle(i, p+2*s-r, p+r, r, c)
   filled_circle(i, p+r, p+2*s-r, r, c)
   filled_circle(i, p+2*s-r, p+2*s-r, r, c)
   box(i, (p+r, p+0, 2*s-2*r, 2*s+1), c)
   box(i, (p+0, p+r, 2*s+1, 2*s-2*r), c)
예제 #40
0
    def blit_borders_on(self, surface):
        if not self.light:
            white = make_compatible(constants.WHITE, self.color)
            self.light = mid_color(self.color, white)
        if not self.dark:
            black = make_compatible(constants.BLACK, self.color)
            self.dark = mid_color(self.color, black)
##        rect = Rect((0, 0), self.size)
        x = y = r = self.size[0] // 2
        r -= 2
        filled_circle(surface, x, y, r, self.color)
##        circle(surface, x, y, r,  self.dark)
        arc(surface, x, y, r, 135, 135 + 180, self.dark)
        arc(surface, x, y, r, 135 + 180, 135 + 360, self.light)
예제 #41
0
 def draw(self):
     if self.kind == "dot":
         pixel_points = coor_to_pixel(self.pos)
         radius = int((self.charge)**(1.0/3.0)*scale)
         gfxdraw.filled_circle(screen, pixel_points[0], pixel_points[1], radius, self.color)
         if radius > 1:
             gfxdraw.aacircle(screen, pixel_points[0], pixel_points[1], radius, self.color)
     elif self.kind == "box":
         pixel_pos = coor_to_pixel(self.pos, True)
         end_pos = [self.pos[0]+self.length*self.cos_a, self.pos[1]+self.length*self.sin_a]
         pixel_end_pos = coor_to_pixel(end_pos)
         #pygame.draw.aaline(screen, self.color, (pixel_pos[0], pixel_pos[1]), coor_to_pixel([self.pos[0]+self.length*self.cos_a, self.pos[1]+self.length*self.sin_a], True))
         pygame.draw.line(screen, self.color, (pixel_pos[0], pixel_pos[1]), coor_to_pixel([self.pos[0]+self.length*self.cos_a, self.pos[1]+self.length*self.sin_a]), int(self.charge**(1.0/3.0)/scale/2.0)+1)
         #pygame.draw.line(screen, self.color, (int(pixel_pos[0]), int(pixel_pos[1])), ())
         gfxdraw.aacircle(screen, int(pixel_pos[0]), int(pixel_pos[1]), 10, self.color)
예제 #42
0
    def mkgui_tile(self, loc, only_clear=False):
        """ Redraw the gui tile or just clear the tile.

            only_clear: use to clear 'unmovable' tiles; if False, clear and then redraw tile
        """
        loc = self.resolve_loc(loc)
        ts = self.tilesize
        if self.circle:
            gfxdraw.filled_circle(self.sfc, loc[0], loc[1], iround(ts/2), white)
            if not only_clear:
                gfxdraw.aacircle(self.sfc, loc[0], loc[1], iround(ts/2-4), gray)
        else:
            r = center_square(loc, ts)
            draw.rect(self.sfc, white, r, 0)
            if not only_clear:
                gfxdraw.rectangle(self.sfc, r, gray)
        self.scr.blit(self.sfc, (0,0))
예제 #43
0
파일: chimp.py 프로젝트: oko196/Ufok
    def  dym(self,screen):
      if self.Stan=="trafiony":
        x0,y0=self.rect.topleft
        x1,y1=self.rect.bottomright
        xs=(x1+x0)/2
        ys=(y1+y0)/2
        r=10
        dx=-5*self.move
        dy=-5*self.move2
##        gfx.filled_circle (screen ,xs+dx,ys+dy,r,pygame.Color("white"))
##        gfx.filled_circle (screen ,xs+3*dx,ys+3*dy,2*r,pygame.Color("white"))
##        gfx.filled_circle (screen ,xs+5*dx,ys+5*dy,3*r,pygame.Color("white"))
##        gfx.filled_circle (screen ,xs+7*dx,ys+8*dy,4*r,pygame.Color("white"))
##        gfx.filled_circle (screen ,xs+12*dx,ys+12*dy,5*r,pygame.Color("white"))
##        gfx.filled_circle (screen ,xs+16*dx,ys+16*dy,6*r,pygame.Color("grey"))
##        gfx.filled_circle (screen ,xs+20*dx,ys+20*dy,7*r,pygame.Color("black"))
        for i in range (7):    
         gfx.filled_circle (screen ,xs+(1+2*i)*dx,ys+(1+2*i)*dy,(i+1)*r,pygame.Color(0xcc,0xcc,0xcc,255-20*i))
예제 #44
0
 def move(self):
     self.movetimer+=1
     if self.movetimer>self.movetimemax:#random motion - after the move time is up another speed is added
         self.changex+=choice(self.randomlist)
         self.changey+=choice(self.randomlist)
         self.movetimer=0
     self.posx+=self.changex
     self.posy+=self.changey
     if self.posx>screenWidth-20:#to stay in the borders of the screen
         self.changex=-3
     elif self.posx<20:
         self.changex=3
     if self.posy>screenHeight-20:
         self.changey=-3
     elif self.posy<20:
         self.changey=3
     for x in range(0,15,3):#The whisps
         gfxdraw.filled_circle(themap.screenmap[self.screen[0]][self.screen[1]],int(self.posx),int(self.posy),int(x),(255,238,0,50))
예제 #45
0
    def __init__(self):
        PG.sprite.Sprite.__init__(self)
        if Speedometer.IMAGE is None:
            Speedometer.IMAGE = \
                PI.load("images/sprites/hud/speed_dial.png").convert()
            Speedometer.IMAGE.set_colorkey((0, 0, 0))
            Speedometer.NEEDLE = PI.load(
                "images/sprites/hud/needle.png").convert_alpha()

        self.image = Speedometer.IMAGE
        self.rect = self.image.get_rect()
        self.rect.topleft = (0, 0)
        PD.filled_circle(Speedometer.IMAGE, self.image.get_width() / 2,
                         self.image.get_height() / 2, 8, Speedometer.RED)
        self.speed = 0
        self.needle = Speedometer.NEEDLE
        self.needle.get_rect(center=self.rect.center)
        Speedometer.NEEDLE.get_rect().center = self.rect.center
예제 #46
0
def demod_menu_response():
	global mn,opt,retf
	global dostronger, autosint_enable, intrascan_enable
	global top_sf
	global top_sf
	global rec

	if opt.value == 1:				# llamar menu node
		retf = demod_mode_response
		demod_mode()
		return
	if opt.value == 2:				# AutoSINT
		autosint_enable = not autosint_enable
		dostronger = autosint_enable
	if opt.value == 3:				# grabar
		rec = not rec 				# pinta el punto en fft_frame
		if not rec: pgd.filled_circle(top_sf, smx+sml+TOPALTO/2, TOPALTO/2, TOPALTO/4, BGCOLOR)	#Borra botón rojo izquierda smeter

	mn = None
예제 #47
0
	def update(self):
	
		CommandableSprite.update(self)
		
		mx = int(self.get_x())
		my = int(self.get_y())
		
		l = int(self.get_left())
		t = int(self.get_top())
		
		if self.circled:
			if self.border_width == 0: # no border --- just draw the background
				pygame.draw.circle(self.screen, self.circle_color, (mx, my), min(self.width/2,self.height/2) )
			else: 
				filled_circle(self.screen, mx, my, min(self.width/2,self.height/2), (0,0,0) ) # draw a black outer rim
				aacircle(self.screen, mx, my, min(self.width/2,self.height/2), (0,0,0) ) # draw a black outer rim
				
				filled_circle(self.screen, mx, my, min(self.width/2-self.border_width,self.height/2-self.border_width), self.circle_color) 
				aacircle(self.screen, mx, my, min(self.width/2-self.border_width,self.height/2-self.border_width), self.circle_color) # and the inside the color we want
				
		# And draw each dot position
		for i in xrange(self.N):
			dx,dy = self.dot_positions[i]
			r = self.radii[i]
			
			# here we draw twice to antialias the edges
			filled_circle(self.screen, int(dx+l), int(dy+t), int(r), self.dot_color)
			aacircle(self.screen, int(dx+l), int(dy+t), int(r), self.dot_color)
예제 #48
0
    def draw(self, transparent_colour, zoom):
        """
        Main draw function for nodes. It will return a surface containing the drawing of the node.
        :return:
        """

        print zoom
        size = int(self.size / zoom)

        # Create the surface for this node
        surface = pygame.surface.Surface((self.size, self.size))
        surface.fill(transparent_colour)

        third_size = size / 3

        x = surface.get_rect().centerx
        y = surface.get_rect().centery

        draw.aacircle(surface, x, y, third_size, (0, 255, 128))
        draw.filled_circle(surface, x, y, third_size, (0, 255, 128))

        return surface
예제 #49
0
파일: clock.py 프로젝트: mastensg/horology
def draw(screen, now):
    w, h = screen.get_size()

    sunrise, noon, sunset = [((t - time.timezone) / 3600) % 12 for t in horology.sun_events(now, lon, lat)]

    local_now = now - time.timezone
    minutes = (local_now / 60) % 60
    hours = (local_now / 3600) % 12

    draw_dial(screen)

    xo = w // 2
    yo = h // 2
    ro = 0.04 * min(w, h)

    a = hours / 12
    r = 0.22 * min(w, h)
    x, y = artoxy(a, r, xo, yo)

    points = (x, y), artoxy(a - 0.25, ro, xo, yo), artoxy(a + 0.25, ro, xo, yo)
    gfxdraw.filled_polygon(screen, points, fg)

    a = minutes / 60
    r *= 1.61803
    x, y = artoxy(a, r, xo, yo)

    points = (x, y), artoxy(a - 0.25, ro, xo, yo), artoxy(a + 0.25, ro, xo, yo)
    gfxdraw.filled_polygon(screen, points, fg)

    gfxdraw.filled_circle(screen, xo, yo, int(ro), fg)

    r = 0.25 * min(w, h)

    a = sunrise / 12
    x, y = artoxy(a, r, xo, yo)
    gfxdraw.filled_circle(screen, x, y, int(0.25 * ro), fg)

    a = sunset / 12
    x, y = artoxy(a, r, xo, yo)
    gfxdraw.filled_circle(screen, x, y, int(0.25 * ro), fg)
예제 #50
0
    #for x in stars:
     #   pixel_pos = CoorsAndPixels.coor_to_pixel(x, scale, size)
      #  screen.blit(star_image, [int(pixel_pos[0]-radius*2.5), int(pixel_pos[1]-radius*2.5)])

    #draw player ball
    pixel_points = CoorsAndPixels.coor_to_pixel(my_dot_pos, scale, size, True)
    screen.blit(my_dot_image, [pixel_points[0]-radius, pixel_points[1]-radius])

    #gfxdraw.filled_circle(screen, pixel_points[0], pixel_points[1], radius, my_dot_color)
    #if radius > 1:
    #    gfxdraw.aacircle(screen, pixel_points[0], pixel_points[1], radius, my_dot_color)

    #draw line if aiming to shoot
    if clicked_my_dot:
        pygame.draw.aaline(screen, (0, 0, 0), pixel_points, mouse_pos)

    #pixel_square_coors = coor_to_pixel([square[0], square[1]])
    #pixel_square_to = [square[2]/scale, size, square[3]/scale]
    #screen.fill((0, 255, 0), [pixel_square_coors[0], pixel_square_coors[1], pixel_square_to[0], pixel_square_to[1]])
    #draw objective
    pixel_points = CoorsAndPixels.coor_to_pixel(objective, scale, size)
    gfxdraw.filled_circle(screen, pixel_points[0], pixel_points[1], int((objective_size)**(1.0/3.0)*scale), (0, 255, 0))
    gfxdraw.aacircle(screen, pixel_points[0], pixel_points[1], int((objective_size)**(1.0/3.0)*scale), (0, 255, 0))

    display_info()
    pygame.display.update()
    elapsed = clock.tick(60) #60 hz refresh rate

#save level locks
with open("level_locks.txt", 'w') as lock_files:
    lock_files.writelines(locks)
예제 #51
0
def draw_body(screen, body):
    gfxdraw.filled_circle(screen, int(body.x), int(body.y), body.r, body.color)
예제 #52
0
 def circle(surf,c,coord,r,w):
     x,y = coord
     x,y,r = int(x),int(y),int(r)
     filled_circle(surf,x,y,r,(20,20,60))
     aacircle(surf,x,y,r,c)
     aacircle(surf,x,y,r-1,c)
예제 #53
0
def draw(surf):
    surf.fill((80,80,80))
    
    x,y = pygame.mouse.get_pos()
    gfxdraw.filled_circle(surf, x, y, 8, (0,0,0))
    gfxdraw.filled_circle(surf, x, y, 5, (0,0,255))
예제 #54
0
def draw_powerup(powerup):
     gfxdraw.aacircle(DISPLAYSURF,int(powerup.pos_x), int(powerup.pos_y),int(powerup.size),PINK)
     gfxdraw.filled_circle(DISPLAYSURF,int(powerup.pos_x), int(powerup.pos_y),int(powerup.size),PINK)
     font = pygame.font.SysFont("comicsansms", 12)
     text = font.render(powerup.feature, True, WHITE)
     DISPLAYSURF.blit(text,(powerup.pos_x - 20, powerup.pos_y - 10))
예제 #55
0
def draw_circ(circle, color, screen):
    '''A nice wrapper for pygame's ugly-ass draw syntax. '''
    gfxdraw.filled_circle(screen, int(circle.coord[0]), int(circle.coord[1]),
        circle.radius, color)
예제 #56
0
 def draw(self):
     gfxdraw.filled_circle(window, self.globalX ,self.globalY ,jewelSize-1,self.color)
     if(self.removeMark==1): gfxdraw.filled_circle(window, self.globalX ,self.globalY ,jewelSize-5,(255,255,255))
예제 #57
0
def drawplant(head_node):
    devprint("drawing plant")
    
    surface = Surface((40, 43), SRCALPHA)
    rootpos = (surface.get_width()/2, surface.get_height()-3)
    
    
    # the stack has the node, the currentx, and the currenty for each node in it
    # currentx and currenty are without resizing of the surface
    stack = []
    # keeps track of offset needed because of resizing the surface
    resizeoffset = (0, 0)

    for i in range(head_node.repeatnumseparate):
        stack.append(head_node)
        firstx = potwidth * random.random() * head_node.brancharea + rootpos[0]
        stack.append(firstx)
        stack.append(rootpos[1])
        stack.append(math.pi/2) # base angle strait up to start with
    
    callcount = 0

    while len(stack) != 0 and callcount < 1000:
        
        callcount += 1
        base_angle = stack.pop()
        currenty = stack.pop()
        currentx = stack.pop()
        node = stack.pop()
        
        randomspacings = [0]
        spacingLength = 0
        for i in range(node.repeatnumcircle-1):
            randomspacings.append(random.uniform(node.anglespace-node.anglevariance*node.anglespace, node.anglespace+node.anglevariance*node.anglespace))
            spacingLength += randomspacings[i+1]

        startspacing = random.uniform(-node.anglevariance*node.anglespace, node.anglevariance*node.anglespace)/2 * random.choice((-1, 1))
        
        # start angle so that it points up on average
        angle = base_angle + startspacing - (spacingLength/2)  + node.angleoffset*random.choice((-1, 1))

        # update the random spacing to be final angles
        for i in range(len(randomspacings)):
            angle = angle + randomspacings[i]
            randomspacings[i] = angle

        for i in range(node.repeatnumcircle):
            # draw all the plantshapes at this angle
            # pick a random angle out of the list
            angle = randomspacings.pop(random.randint(0, len(randomspacings)-1))

            widthscalar = 1 + random.random()*node.widthvariance
            heightscalar = 1 + random.random()*node.heightvariance

            # now add the current node
            surface, mainltranslated, mainloffset, new_resize_offset = surface_with_node(surface, node, angle, (currentx, currenty), resizeoffset,  widthscalar, heightscalar)
            resizeoffset = new_resize_offset

            
            # find the new currentx and currenty
            mainlistlen = len(mainltranslated)

            
            # add all the children at the current position
            for childnode in node.children:
                futureindexpositions = getfuturenodeindexpositions(childnode.repeatnumseparate, mainlistlen, childnode.brancharea)
                for i in range(childnode.repeatnumseparate):
                    futurex = mainltranslated[futureindexpositions[i]][0]+mainloffset[0]
                    futurey = mainltranslated[futureindexpositions[i]][1]+mainloffset[1]
                    stack.append(childnode)
                    stack.append(futurex)
                    stack.append(futurey)
                    futureangle = listangleatindex(mainltranslated, futureindexpositions[i])
                    stack.append(futureangle)

    finalsurfaceanchor = (rootpos[0] + resizeoffset[0], rootpos[1]+resizeoffset[1])
                
    # draw dirt clumps at bottom
    clumpradius = 4
    clumprange = 14
    clumpnum = 4
    
    for i in range(clumpnum):
        gfxdraw.filled_circle(surface, int(finalsurfaceanchor[0] + i * clumprange/clumpnum - clumprange/2)+1,
                       int(finalsurfaceanchor[1]),
                       int(random.uniform(clumpradius/3, clumpradius)),
                        brighten(dirtcolor, -10))
        
    return surface, finalsurfaceanchor 
예제 #58
0
def pantalla_refresh(sf):
	global pts,mpts
	global xbw,xdev
	global fq,fqc,bw
	global modelabel,bwlabel,fqlabel1,fqlabel2
	global ftqc, numx
	global maxfill_enable, maxpts_enable, refreshfq
	global azoom, base
	global fft_sf,top_sf
	global sq,xsq,asq,smval,smvaladj,possq,sqstate
	global frame, count
	global menusf, stereosf

	a = FFTANCHO/2 										# media pantalla
	pleft = fqlabel1.get_size()[0]/2 + fqlabel2.get_size()[0]/2 

	fft_sf.fill(BGCOLOR) 									# Borra BW Más rapido que reescribir.

	# PINTA ESCALA
	for x in range(12):										# Escala FFT
		y = int(FFTALTO - (x*(FFTALTO/12))*azoom) + base
		if y > 0 :
			pgd.hline(fft_sf,0,FFTANCHO,y,ESCCOLOR)
			lb = ftdev1.render(str((12-x)*-10), 0, ESCCOLOR,BGCOLOR) # pinta db text
			fft_sf.blit(lb, (0,y-10))	# Pinta db label

	# Pinta BW
	if nobaile: txdev = FFTANCHO/2;
	else:		txdev = xdev
	txbw 	= 2*xbw
	tcodo 	= txdev - txbw/2
	if not nobaile or (nobaile and (frame % 10) > 4 ):			# parapedea dev si introscan
		if 	tmode != "FM W" and tmode != "FM ST":			# WFM no tiene ancho de banda
			if 	tmode == "USB":						
				txbw /= 2	
				tcodo = txdev
			elif tmode == "LSB": 	
				txbw /= 2	
				tcodo = txdev - txbw
			fft_sf.fill(BWCOLOR2,(tcodo,BWY,txbw,FFTALTO-BWY),0) 		# Pinta BW
			pgd.rectangle(fft_sf,(tcodo,BWY,txbw,FFTALTO-BWY),BWCOLOR)
	pgd.vline(fft_sf,int(txdev),0,FFTALTO,DEVCOLOR)		# Pinta linea dev

	# PINTA MAX
	if maxpts_enable:												# Pintta puntos de max
		mpts += [(FFTANCHO,FFTALTO),(0,FFTALTO)]
		pgd.polygon(fft_sf,mpts,MAXCOLOR)

	# PINTA FILL
	if fftfill_enable:												# Pintta FFT relleno (Más rápido que el fill)
		for x in pts: pgd.vline(fft_sf,x[0],x[1],FFTALTO,FILLCOLOR)				

	# PINTA FFT
	pgd.polygon(fft_sf,pts,FGCOLOR)									# pinta FFT

	# PINTA DETECT
	if detect_enable :												# Pinta detector picos
		for x in dtc :	pgd.circle(fft_sf,x[0],x[1],10,DETECTCOLOR)

	# PINTA DEV text
	if not nobaile or (nobaile and  (frame % 10) > 4):
		if 	tmode != "FM W" and tmode != "FM ST":
			fft_sf.blit(bwlabel,  (txdev-bwlabel.get_size()[0]/2,BWY+2))	# Pinta bw label
			fft_sf.blit(fqlabel1, (txdev-pleft,BWY-22))						# Pinta dev label 
			fft_sf.blit(fqlabel2, (txdev-pleft+fqlabel1.get_size()[0]+4,BWY-20))	
		fft_sf.blit(modelabel,(txdev-modelabel.get_size()[0]/2,BWY-40))	# Pinta mode label

	# pinta Sqelch
	tc 	= SQCOLOR
	if not sqstate:	tc = (0,200,0)			# Si está levantado pinta verde
	pgd.hline(fft_sf,0,FFTANCHO,xsq+base, tc)
	fsq = ftdev2.render(' SQ '+str(sq)+ ' ', 0, DEVCOLORHZ,(100,25,25))
	fft_sf.blit(fsq, (FFTANCHO-fsq.get_size()[0],xsq-10+base))		# Pinta bw label

	possq = (FFTANCHO-fsq.get_size()[0]+25,xsq-12+base+12)	# Guardo posicion para el botón
	#pgd.circle(fft_sf,possq[0],possq[1],50,(200,200,200))
	#asq = tsq

	# pinta smeter
	pgd.box(top_sf,(smx+13,25,sml-28,9),(0,0,0))
	pgd.box(top_sf,(smx+13,27,smval*smvaladj,6),(255,50,50))

	# PINTA CIFRAS DE FREQ SI HAN CAMBIADO
	if refreshfq:	
		sp 	 = 4
		size = 24
		numx = []	# Repinta el indicador de frecuencia
		txt = format(fqc,'010d')
		txt = txt[:-9]+'.'+txt[-9:-6]+'.'+txt[-6:-3]+','+txt[-3:]
		lon = len(txt)
		anc = 0
		for x in range(lon):
			if txt[x] in ['.',','] : 
				col = BGCOLOR
				anc = size / 2
			else :	
				col = BGFQCCOLOR
				anc = size
			px = (TOPANCHO/2) - (lon+sp)*size/2 + (x*(size+sp)) 	# Calcula posición
			fqclabel = ftqc.render(txt[x], 1, FQCCOLOR, col)		# pinta fqc text
			top_sf.blit(fqclabel,(px,0))							# blit
			if txt[x] not in ['.',','] : numx += [px]				# Almacena la coordenada del numero

	# PARPADEA BOTON ROJO IF REC
	if rec:
		if frame == FPS/2: 
			pgd.filled_circle(top_sf, smx+sml+TOPALTO/2, TOPALTO/2, TOPALTO/4, BGCOLOR)		#Borra botón rojo izquierda smeter
		if frame == 1:
			pgd.filled_circle(top_sf, smx+sml+TOPALTO/2, TOPALTO/2, TOPALTO/4, tc)			#Pinta botón del color del smeter

	# Pinta STEREO si STEREO
	if REAL and tmode == "FM ST":
		if (sdr.probe_st.level() > 0.5 ): 
			top_sf.blit(stereosf,(250,8))
		else:
			pgd.box(top_sf,(250,0,40,TOPALTO),BGCOLOR)

	# Pinta BIRDIES
	for i in birds:
		fft_sf.blit(fbd, (i+((birdsize-16)/2),FFTALTO-16))

	# PINTA MENU IF ANY
	if mn : mn.refresca()

	# Flipea/Vuelca la pantalla
	pg.display.flip()							
	refreshfq = False
	frame = (frame % FPS) +1	
	count += 1
예제 #59
-1
 def render(self):
     # ~ draw magnetradius
     if self.magnetradius:
         # ~ gfxdraw.aacircle(scr,self.centerx,self.centery,int(self.magnetradius),(150,130,110,int(self.magnetradius)))
         m = image.load("img/magnetichalo.png")
         m = transform.smoothscale(m, [int(self.magnetradius * 2)] * 2)
         scr.blit(m, m.get_rect(center=self.center))
     # ~ draw shieldbar
     r = draw.rect(scr, (50, 50, 50), (10, 500, 380, 18), 1)
     osdlayer.fill((100, 100, 200, self.shieldfxttl * 4 + 150), (10, 0, self.shield_ / self.shieldmax * 380, 18))
     # scr.blit(self.SHIELDTEXT,self.SHIELDRECT)
     # ~ draw lazerstate
     r = draw.rect(scr, (50, 50, 50), (10, 520, 380, 18), 1)
     osdlayer.blit(self.lazertempfx, (10, 20), (0, 0, DoubleLazer.temper / DoubleLazer.tempmax * 380, 18))
     # scr.blit(self.LAZERTEXT,self.LAZERRECT)
     # ~ draw bonusbar
     self.settingbonus_.render()
     self.loader1_.render()
     # ~ draw shieldcircle
     if self.shieldfxttl:
         self.shieldcolor.a = int(4 * self.shieldfxttl)
         gfxdraw.filled_circle(scr, self.centerx, self.centery, self.w, self.shieldcolor)
         self.shieldfxttl -= 1
     if self.foo:
         self.foo -= 1
         scr.blit(self.img2, ship)
         return
     # ~ draw ship
     scr.blit(self.img, ship)