def draw(self, window): # Draw the Dot on the surface. # - self is the Dot # - window is the game's Window surface = window.get_surface() color = Color(self._color) draw_circle(surface, color, self._center, self._radius)
def draw_dot(dot): # draw the dot on the screen # - game is the Game where the dot should be drawn # - dot is the Dot containing information to be drawn surface = dot.window.get_surface() color = Color(dot.color) draw_circle(surface, color, dot.center, dot.radius)
def draw(self): # draw the dot on the screen # - game is the Game where the dot should be drawn # - dot is the Dot containing information to be drawn surface = self._window.get_surface() color = Color(self._color) draw_circle(surface, color, self._center, self._radius)
def draw_ball(self): # the function draw_ball is used for drawing all the balls according to # ballmap and with the corresponding color in colormap # clear the screen self._window_.fill((0, 0, 0)) # draw the grid self.draw_grid() # calculate the size of each grid grid_h = self._height_ / 11 for i in range(9): for j in range(9): # if ballmap[i][j]==0, it means there is a ball here, # draw it in this position if self._ballmap_[i][j] == 0: draw_circle(self._window_, Color(self._colormap_[i][j]), (int( (i + 1.5) * grid_h), int( (j + 1.5) * grid_h)), int(grid_h / 5 * 2)) # draw score string = "Score: " + str(self._score_) width = self._height_ + (self._width_ - self._height_) / 3 self.message_display(string, width, grid_h, 25) # update the screen pygame.display.flip()
def draw_dot(window, dot): # Draw the dot on the window. # - window is the Window that the game is played in # - dot is the Dot to draw surface = window.get_surface() color = Color(dot.color) draw_circle(surface, color, dot.center, dot.radius)
def draw_dot(window, color_string, center, radius): # draw the dot on the screen # # window is the Window to display in # color_string is the string representing the color of the dot # center is a list representing the X and Y positions of the center of the dot # radius is an int representing the radius of the dot surface = window.get_surface() color = Color(color_string) draw_circle(surface, color, center, radius)
def draw_dot(window, color_string, center, radius): # Draw the dot on the window. # - window is the Window to draw in # - color_string is the str color of the dot # - center is the list of x int and y int coordinates of the center of # the dot # - radius is the int radius of the dot surface = window.get_surface() color = Color(color_string) draw_circle(surface, color, center, radius)
def _redraw_screen(self): """Redraws the screen.""" # fill background with window color self._screen.fill(WINDOW_COLOR) # draw label self._screen.blit(self._label, SHOTS_LABEL_POSITION) # draw paddle and ball draw_rect(self._screen, self._paddle.color, self._paddle) draw_circle(self._screen, self._ball.color, self._ball.center, self._ball.radius) # update whole screen flip_screen()
def render(self, target): target.fill(self.bg_colour) lerped_fill_colour = self.fill_colour_min.lerp(self.fill_colour_max, self.lerp_n) lerped_circ_colour = self.circ_colour_min.lerp(self.circ_colour_max, self.lerp_n) lerped_rect_colour = self.circ_colour_min.lerp(self.circ_colour_max, 1 - self.lerp_n) if self.circs_are_close(): target.fill((255, 0, 0)) else: target.fill(lerped_fill_colour) actual_circ_colour = ((255, 0, 0) if self.circs_are_close() else lerped_circ_colour) actual_rect_colour = ((255, 0, 0) if self.circs_are_close() else lerped_rect_colour) target.blit(self.play_surf, self.play_rect) self.fruit.render(target) circ_pos_tuple = tuple(self.get_lerped_circ_pos()) neg_circ_pos = (circ_pos_tuple[0], self.circ_pos_max[1] - circ_pos_tuple[1]) draw_circle(target, actual_circ_colour, circ_pos_tuple, self.circ_radius) draw_rect(target, actual_rect_colour, Rect((circ_pos_tuple[0] - self.circ_radius // 2, circ_pos_tuple[1] - self.circ_radius // 2), (self.circ_radius, self.circ_radius))) draw_circle(target, actual_circ_colour, neg_circ_pos, self.circ_radius) draw_rect(target, actual_rect_colour, Rect((neg_circ_pos[0] - self.circ_radius // 2, neg_circ_pos[1] - self.circ_radius // 2), (self.circ_radius, self.circ_radius))) target.blit(self.text, (90, 90))
def _redraw_screen(self): """Redraws the screen.""" # fill background with window color self._screen.fill(WINDOW_COLOR) # draw labels self._screen.blit(self._label1, SCORE1_LABEL_POSITION) self._screen.blit(self._label2, SCORE2_LABEL_POSITION) # draw net draw_dashed_line(self._screen, NET_COLOR, (NET_X, 0), (NET_X, WINDOW_HEIGHT)) # draw paddles and ball draw_rect(self._screen, self._paddle1.color, self._paddle1) draw_rect(self._screen, self._paddle2.color, self._paddle2) draw_circle(self._screen, self._ball.color, self._ball.center, self._ball.radius) # update whole screen flip_screen()
def draw(self): surface = self._window.get_surface() color = Color(self._color) draw_circle(surface, color, self._center, self._radius)
def draw(self, toolbar): draw_rect(toolbar, self.color, (self.x, self.y, self.width, self.height)) draw_circle(toolbar, (self.color[0] - 40, self.color[1] - 40, self.color[2] - 40), (self.circle_x, self.circle_y), self.circle_radius)
def draw_dot(dot): surface = dot.window.get_surface() color = Color(dot.color) draw_circle(surface, color, dot.center, dot.radius)
def draw_dot(window, color_string, center, radius): surface = window.get_surface() color = Color(color_string) draw_circle(surface, color, center, radius)
def draw(self): # draw the dot on the screen surface = self._window.get_surface() color = Color(self._color) draw_circle(surface, color, self._center, self._radius)
def draw(self, surface): draw_circle(surface, Color(self._color), self._center, self._radius)
def draw_dot( self ) : surface = self._window.get_surface() color = Color( self._color ) draw_circle( surface, color, [int(self._center[0]),int(self._center[1])], self._radius )