Esempio n. 1
0
 def on_draw(self):
     arcade.start_render()
     self.track_sprites.draw()
     if DEBUG and len(self.distance_lines):
         arcade.draw_lines(self.distance_lines, arcade.color.BLUE, 3)
         self.front_left_car_corner.draw(arcade.color.WHITE)
         self.front_right_car_corner.draw(arcade.color.GREEN)
     self.car.draw()
Esempio n. 2
0
    def on_draw(self):
        arcade.start_render()
        arcade.draw_lines([segment_shape1.a, segment_shape1.b],
                          arcade.color.RED, 4)
        arcade.draw_lines([segment_shape2.a, segment_shape2.b],
                          arcade.color.RED, 4)

        self.sprites.draw()
Esempio n. 3
0
 def draw_grid_lines(self):
     """ Megrajzolja a Rács (Grid) vonalakat. """
     # Vertikális vonalak
     for x in range(self.width):
         arcade.draw_lines([[x * 64, 0], [x * 64, 960]], self.line_color, 1)
     # Horizontális vonalak
     for y in range(self.height):
         arcade.draw_lines([[0, y * 64], [768, y * 64]], self.line_color, 1)
 def on_draw(self):
     arcade.start_render()
     points_per_color: Dict[arcade.Color, arcade.PointList] = {}
     for l in self.lines:
         color_specific_point_list = points_per_color.setdefault(l.color, [])
         color_specific_point_list.append((l.x, l.y))
         color_specific_point_list.append((l.x + l.length, l.y))
     # Need to sort by key so the colors are always drawn in a stable order.
     # Without sorting, the draw order of the colors would pop occasionally
     # because dicts do not preserve key ordering.
     for color in sorted(points_per_color.keys()):
         # draw_lines() is much faster than draw_line()
         arcade.draw_lines(points_per_color[color], color, LINE_WIDTH)
Esempio n. 5
0
def drawBackground():
    #Drawing points on the screen
    point_list = ((150, 60), (400, 60), (700, 60), (950, 60), (60, 260),
                  (250, 260), (450, 260), (650, 260), (850, 260), (1060, 260),
                  (60, 460), (380, 460), (500, 460), (650, 460), (750, 460),
                  (1060, 460), (60, 660), (480, 660), (550, 660), (600, 660),
                  (680, 660), (1060, 660), (600, 800))
    arcade.draw_points(point_list, arcade.color.PURPLE, 75)
    #Drawing the lines shwoing the board play point connections
    point_list = ((600, 800), (150, 60), (600, 800), (400, 60), (600, 800),
                  (700, 60), (600, 800), (950, 60), (60, 660), (1060, 660),
                  (60, 460), (1060, 460), (60, 260), (1060, 260), (150, 60),
                  (950, 60), (60, 660), (60, 260), (1060, 660), (1060, 260))
    arcade.draw_lines(point_list, arcade.color.PURPLE, 4)
Esempio n. 6
0
def draw_solar_panels(position_x, position_y):
    arcade.draw_rectangle_filled(position_x, position_y, 40, 120,
                                 (65, 88, 140))
    point_list = ((
        position_x - 10,
        position_y - 30,
    ), (position_x - 10, position_y + 30), (position_x + 10, position_y - 30),
                  (position_x + 10, position_y + 30))
    arcade.draw_points(point_list, arcade.color.BLACK, 10)
    point_list = ((position_x + 27, position_y - 12), (position_x - 27,
                                                       position_y - 12))
    arcade.draw_points(point_list, (121, 123, 128), 10)
    point_list = ((position_x + 23, position_y + 60), (position_x + 23,
                                                       position_y - 60),
                  (position_x - 23, position_y + 60), (position_x - 23,
                                                       position_y - 60))
    arcade.draw_lines(point_list, (121, 123, 128), 5)
Esempio n. 7
0
    def on_draw(self):
        arcade.start_render()

        # Sprites:
        self.static_sprites.draw()
        arcade.draw_lines(point_list=self.line_point_list,
                          color=arcade.color.PINK_LACE,
                          line_width=1)

        # Buttons:
        if self.started:
            self.asm.draw()
            self.csm.draw()
        else:
            self.start_button_player.draw()
            self.start_button_opponent.draw()

        if self.choosing_offer_gift or self.choosing_offer_comp:
            self.choose_offer_btn.draw()

        if self.started and not self.choosing_offer_comp and not self.choosing_offer_gift and not self.ended:
            self.finish_turn_btn.draw()

        # Texts:
        arcade.draw_text('YOU',
                         start_x=20,
                         start_y=30,
                         color=arcade.color.WHITE,
                         font_size=20)
        arcade.draw_text('AI',
                         start_x=20,
                         start_y=self.height - 30,
                         color=arcade.color.WHITE,
                         font_size=20)

        if self.ended:
            arcade.draw_text(f'Enemy_score: {self.opponent_score}',
                             start_x=self.width / 2 - 200,
                             start_y=self.height - 200,
                             color=arcade.color.WHITE,
                             font_size=50)
            arcade.draw_text(f'Your score: {self.player_score}',
                             start_x=self.width / 2 - 200,
                             start_y=200,
                             color=arcade.color.WHITE,
                             font_size=50)
Esempio n. 8
0
    def draw(self):
        """ Draw the balls with the instance variables we have. """

        arcade.draw_lrwh_rectangle_textured(self.background_x, 0,
                                            self.background.width,
                                            self.background.height,
                                            self.background)
        if (self.background_x %
                self.background.width) < self.background.width - SCREEN_WIDTH:
            arcade.draw_lrwh_rectangle_textured(
                self.background_x + self.background.width, 0,
                self.background.width, self.background.height, self.background)
            arcade.draw_lines(
                [(self.background_x + self.background.width, 0),
                 (self.background_x + self.background.width, SCREEN_HEIGHT)],
                arcade.color.RED, 2)

        arcade.draw_circle_filled(self.position_x, self.position_y,
                                  self.radius, self.color)
Esempio n. 9
0
    def on_draw(self):
        arcade.start_render()

        # Draw tetris grid board
        arcade.draw_lines(self.TETRIS_V_POINTS, arcade.color.BLACK, 1)
        arcade.draw_lines(self.TETRIS_H_POINTS, arcade.color.BLACK, 1)

        # Draw shapes
        self.t1.recalculate_points()
        for point in self.t1.rect_points:
            screen_x, screen_y = \
                self.tetris_grid_board.convert_to_screen_coordinates(point[0], point[1])

            arcade.draw_rectangle_filled(
                screen_x, screen_y,
                self.tetris_grid_board.BOARD_LINE_DIST,
                self.tetris_grid_board.BOARD_LINE_DIST,
                arcade.color.GREEN,
                0
            ) 
Esempio n. 10
0
 def draw(self):
     if self.texture is not None:
         arcade.draw_texture_rectangle(self.x, self.y, self.size,
                                       self.size, self.texture)
     else:
         size = self.size
         if self.shape == "SQUARE":
             arcade.draw_rectangle_filled(self.x, self.y, size, size,
                                          self.color)
         elif self.shape == "TICK":
             start = (self.x - (size / 2), self.y)
             turn = (self.x - (size / 4), self.y - (size / 2))
             end = (self.x + (size / 2), self.y + (size / 2))
             arcade.draw_lines((start, turn, turn, end), self.color, 3)
         elif self.shape == "CROSS":
             l_top = (self.x - (size / 2), self.y + (size / 2))
             l_bottom = (self.x - (size / 2), self.y - (size / 2))
             r_top = (self.x + (size / 2), self.y + (size / 2))
             r_bottom = (self.x + (size / 2), self.y - (size / 2))
             arcade.draw_lines((l_top, r_bottom, l_bottom, r_top),
                               self.color, 3)
Esempio n. 11
0
    def shade_oval(self, loc_x, loc_y, color):
        border_width = 4
        point_list = (
            (loc_x - 24, loc_y + 52),
            (loc_x + 24, loc_y + 52),
            (loc_x - 28, loc_y + 39),
            (loc_x + 28, loc_y + 39),
            (loc_x - 28, loc_y + 26),
            (loc_x + 28, loc_y + 26),
            (loc_x - 28, loc_y + 13),
            (loc_x + 28, loc_y + 13),
            (loc_x - 28, loc_y),
            (loc_x + 28, loc_y),
            (loc_x - 24, loc_y - 52),
            (loc_x + 24, loc_y - 52),
            (loc_x - 28, loc_y - 39),
            (loc_x + 28, loc_y - 39),
            (loc_x - 28, loc_y - 26),
            (loc_x + 28, loc_y - 26),
            (loc_x - 28, loc_y - 13),
            (loc_x + 28, loc_y - 13)
        )

        arcade.draw_lines(point_list, color, border_width)
Esempio n. 12
0
    def shade_squiggle(self, loc_x, loc_y, color):
        border_width = 4
        point_list = (
            (loc_x - 36, loc_y + 52),
            (loc_x + 16, loc_y + 52),
            (loc_x - 29, loc_y + 39),
            (loc_x + 26, loc_y + 39),
            (loc_x - 23, loc_y + 26),
            (loc_x + 28, loc_y + 26),
            (loc_x - 23, loc_y + 13),
            (loc_x + 28, loc_y + 13),
            (loc_x - 28, loc_y),
            (loc_x + 26, loc_y),
            (loc_x - 16, loc_y - 52),
            (loc_x + 35, loc_y - 52),
            (loc_x - 26, loc_y - 39),
            (loc_x + 28, loc_y - 39),
            (loc_x - 29, loc_y - 26),
            (loc_x + 22, loc_y - 26),
            (loc_x - 28, loc_y - 13),
            (loc_x + 22, loc_y - 13)
        )

        arcade.draw_lines(point_list, color, border_width)
Esempio n. 13
0
    def shade_diamond(self, loc_x, loc_y, color):
        border_width = 4
        point_list = (
            (loc_x - 6, loc_y + 52),
            (loc_x + 6, loc_y + 52),
            (loc_x - 12, loc_y + 39),
            (loc_x + 12, loc_y + 39),
            (loc_x - 19, loc_y + 26),
            (loc_x + 19, loc_y + 26),
            (loc_x - 23, loc_y + 13),
            (loc_x + 23, loc_y + 13),
            (loc_x - 28, loc_y),
            (loc_x + 28, loc_y),
            (loc_x - 6, loc_y - 52),
            (loc_x + 6, loc_y - 52),
            (loc_x - 12, loc_y - 39),
            (loc_x + 12, loc_y - 39),
            (loc_x - 19, loc_y - 26),
            (loc_x + 19, loc_y - 26),
            (loc_x - 23, loc_y - 13),
            (loc_x + 23, loc_y - 13)
        )

        arcade.draw_lines(point_list, color, border_width)
Esempio n. 14
0
    def on_draw(self):
        """
        Render the screen.
        """

        # Start the render process. This must be done before any drawing commands.
        arcade.start_render()

        # Draw a grid
        # Draw vertical lines every 120 pixels
        for x in range(0, 601, 120):
            arcade.draw_line(x, 0, x, 600, arcade.color.BLACK, 2)

        # Draw horizontal lines every 200 pixels
        for y in range(0, 601, 200):
            arcade.draw_line(0, y, 800, y, arcade.color.BLACK, 2)

        # Draw a point
        arcade.draw_text("draw_point", 3, 405, arcade.color.BLACK, 12)
        arcade.draw_point(60, 495, arcade.color.RED, 10)

        # Draw a set of points
        arcade.draw_text("draw_points", 123, 405, arcade.color.BLACK, 12)
        point_list = ((165, 495), (165, 480), (165, 465), (195, 495),
                      (195, 480), (195, 465))
        arcade.draw_points(point_list, arcade.color.ZAFFRE, 10)

        # Draw a line
        arcade.draw_text("draw_line", 243, 405, arcade.color.BLACK, 12)
        arcade.draw_line(270, 495, 300, 450, arcade.color.WOOD_BROWN, 3)

        # Draw a set of lines
        arcade.draw_text("draw_lines", 363, 405, arcade.color.BLACK, 12)
        point_list = ((390, 450), (450, 450), (390, 480), (450, 480),
                      (390, 510), (450, 510))
        arcade.draw_lines(point_list, arcade.color.BLUE, 3)

        # Draw a line strip
        arcade.draw_text("draw_line_strip", 483, 405, arcade.color.BLACK, 12)
        point_list = ((510, 450), (570, 450), (510, 480), (570, 480),
                      (510, 510), (570, 510))
        arcade.draw_line_strip(point_list, arcade.color.TROPICAL_RAIN_FOREST,
                               3)
        arcade.draw_line_strip(point_list, arcade.color.BEIGE)

        # Draw a polygon
        arcade.draw_text("draw_polygon_outline", 3, 207, arcade.color.BLACK, 9)
        point_list = ((30, 240), (45, 240), (60, 255), (60, 285), (45, 300),
                      (30, 300))
        arcade.draw_polygon_outline(point_list, arcade.color.SPANISH_VIOLET, 3)

        # Draw a filled in polygon
        arcade.draw_text("draw_polygon_filled", 123, 207, arcade.color.BLACK,
                         9)
        point_list = ((150, 240), (165, 240), (180, 255), (180, 285),
                      (165, 300), (150, 300))
        arcade.draw_polygon_filled(point_list, arcade.color.SPANISH_VIOLET)

        # Draw an outline of a circle
        arcade.draw_text("draw_circle_outline", 243, 207, arcade.color.BLACK,
                         10)
        arcade.draw_circle_outline(300, 285, 18, arcade.color.WISTERIA, 3)
        arcade.draw_circle_outline(350, 285, 18, arcade.color.WISTERIA)

        # Draw a filled in circle
        arcade.draw_text("draw_circle_filled", 363, 207, arcade.color.BLACK,
                         10)
        arcade.draw_circle_filled(420, 285, 18, arcade.color.GREEN)

        # Draw an ellipse outline, and another one rotated
        arcade.draw_text("draw_ellipse_outline", 483, 207, arcade.color.BLACK,
                         10)
        arcade.draw_ellipse_outline(540, 273, 15, 36, arcade.color.AMBER, 3)
        arcade.draw_ellipse_outline(540, 336, 15, 36, arcade.color.BLACK_BEAN,
                                    3, 45)

        # Draw a filled ellipse, and another one rotated
        arcade.draw_text("draw_ellipse_filled", 3, 3, arcade.color.BLACK, 10)
        arcade.draw_ellipse_filled(60, 81, 15, 36, arcade.color.AMBER)
        arcade.draw_ellipse_filled(60, 144, 15, 36, arcade.color.BLACK_BEAN,
                                   45)

        # Draw an arc, and another one rotated
        arcade.draw_text("draw_arc/filled_arc", 123, 3, arcade.color.BLACK, 10)
        arcade.draw_arc_outline(150, 81, 15, 36, arcade.color.BRIGHT_MAROON,
                                90, 360)
        arcade.draw_arc_filled(150, 144, 15, 36, arcade.color.BOTTLE_GREEN, 90,
                               360, 45)

        # Draw an rectangle outline
        arcade.draw_text("draw_rect", 243, 3, arcade.color.BLACK, 10)
        arcade.draw_rectangle_outline(295, 100, 45, 65,
                                      arcade.color.BRITISH_RACING_GREEN)
        arcade.draw_rectangle_outline(295, 160, 20, 45,
                                      arcade.color.BRITISH_RACING_GREEN, 3, 45)

        # Draw a filled in rectangle
        arcade.draw_text("draw_filled_rect", 363, 3, arcade.color.BLACK, 10)
        arcade.draw_rectangle_filled(420, 100, 45, 65, arcade.color.BLUSH)
        arcade.draw_rectangle_filled(420, 160, 20, 40, arcade.color.BLUSH, 45)

        # Load and draw an image to the screen
        # Image from kenney.nl asset pack #1
        arcade.draw_text("draw_bitmap", 483, 3, arcade.color.BLACK, 12)
        texture = arcade.load_texture("images/playerShip1_orange.png")
        scale = .6
        arcade.draw_texture_rectangle(540, 120, scale * texture.width,
                                      scale * texture.height, texture, 0)
        arcade.draw_texture_rectangle(540, 60, scale * texture.width,
                                      scale * texture.height, texture, 45)

        color = arcade.get_pixel(100, 100)
        assert color == (255, 255, 255)

        image = arcade.get_image()
Esempio n. 15
0
 def do_draw_lines(self):
     arcade.draw_lines(self.line_list, (255, 0, 0, 10))
Esempio n. 16
0
 def on_draw(self):
     arcade.draw_lines(self.grid_lines, arcade.color.BLACK, 3)
Esempio n. 17
0
arcade.draw_triangle_filled(100, 350, 180, 350, 235, 300,
                            arcade.csscolor.PURPLE)
arcade.draw_triangle_filled(0, 300, 100, 370, 180, 300,
                            arcade.color.DARK_PASTEL_PURPLE)
arcade.draw_triangle_filled(100, 300, 175, 325, 225, 300,
                            arcade.color.DARK_PASTEL_PURPLE)
arcade.draw_triangle_filled(600, 300, 600, 400, 365, 300,
                            arcade.csscolor.PURPLE)
arcade.draw_triangle_filled(500, 350, 420, 350, 365, 300,
                            arcade.csscolor.PURPLE)
arcade.draw_triangle_filled(600, 300, 500, 370, 420, 300,
                            arcade.color.DARK_PASTEL_PURPLE)
arcade.draw_triangle_filled(500, 300, 425, 325, 375, 300,
                            arcade.color.DARK_PASTEL_PURPLE)
arcade.draw_lines((
    (250, 300),
    (200, 0),
), arcade.csscolor.BLUE)
arcade.draw_lines((
    (350, 300),
    (400, 0),
), arcade.csscolor.BLUE)
arcade.draw_lines((
    (200, 300),
    (100, 0),
), arcade.csscolor.BLUE)
arcade.draw_lines((
    (150, 300),
    (-25, 0),
), arcade.csscolor.BLUE)
arcade.draw_lines((
    (100, 300),
Esempio n. 18
0
import arcade

arcade.open_window(800, 600, "Drawing Example")

# Background color
arcade.set_background_color(arcade.color.BEAU_BLUE)

arcade.start_render()

# Draw the road
arcade.draw_lrtb_rectangle_filled(0, 800, 100, 0, arcade.color.BLACK)

# Set of lines through road

point_list = ((100, 50), (250, 50), (300, 50), (450, 50), (500, 50), (650, 50))

arcade.draw_lines(point_list, arcade.color.YELLOW, 300)

arcade.finish_render()

arcade.run()
Esempio n. 19
0
arcade.set_background_color(arcade.color.LIGHT_PINK)

arcade.start_render()

arcade.draw_lrtb_rectangle_filled(0, 650, 325, 0, arcade.color.ELECTRIC_BLUE)

arcade.draw_triangle_filled(175, 325, 300, 325, 225, 350, arcade.color.HOT_PINK)
arcade.draw_triangle_filled(0, 325, 225, 325, 100, 400, arcade.color.HOT_PINK)

arcade.draw_triangle_filled(475, 325, 350, 325, 425, 350, arcade.color.HOT_PINK)
arcade.draw_triangle_filled(650, 325, 425, 325, 550, 400, arcade.color.HOT_PINK)

arcade.draw_circle_filled(325, 500, 90, arcade.color.LIGHT_CORAL)
arcade.draw_lines(((0, 420),(650, 420)),
                    arcade.color.LIGHT_PINK, 
                    8)
arcade.draw_lines(((0, 440),(650, 440)),
                    arcade.color.LIGHT_PINK,
                    7)
arcade.draw_lines(((0, 460),(650, 460)),
                    arcade.color.LIGHT_PINK,
                    6)
arcade.draw_lines(((0, 475),(650, 475)),
                    arcade.color.LIGHT_PINK,
                    5)
arcade.draw_lines(((0, 487.5),(650, 487.5)),
                    arcade.color.LIGHT_PINK,
                    4)

arcade.draw_polygon_filled(((300, 326), (350, 326), (475, 0), (175, 0)), arcade.color.LIGHT_SKY_BLUE)
Esempio n. 20
0
arcade api (application programing interface)
This is a list of all the various arcade functions, methods, classes
and all the detail you need to program with arcade and Python
 http://arcade.academy/index.html
 http://arcade.academy/quick_index.html
 http://arcade.academy/arcade.color.html
"""
######## setup stuff ##########################
screen_width = 600
screen_height = 300
arcade.open_window(screen_width,screen_height,"Lines")
arcade.set_background_color(arcade.color.BLUE)
#################################################
arcade.start_render()

for point in range(100):
	point=( (random.randint(0,screen_width),random.randint(0,screen_height)))
	arcade.draw_point(point[0],point[1], arcade.color.GREEN, 9)

arcade.draw_line(0,0,30,30,arcade.color.BLACK,5)

lines=((20,30),(60,90),(40,50),(90,120))
arcade.draw_lines(lines,arcade.color.BLACK, 1)

for point in range(1000):
	point=( (random.randint(0,screen_width),random.randint(0,screen_height)))
	arcade.draw_line(point[0],point[1],100,100, arcade.color.RED, 1)

arcade.finish_render()
arcade.run()   # game loop
Esempio n. 21
0
arcade.draw_points(point_list, arcade.color.ZAFFRE, 10)

# Draw a line
arcade.draw_text("draw_line", 243, 405, arcade.color.WHITE, 12)
arcade.draw_line(270, 495, 300, 450, arcade.color.BURNT_ORANGE, 3)

# Draw a set of lines
arcade.draw_text("draw_lines", 363, 405, arcade.color.WHITE, 12)
point_list = ((390, 450),
              (450, 450),
              (390, 480),
              (450, 480),
              (390, 510),
              (450, 510)
              )
arcade.draw_lines(point_list, arcade.color.BLUE, 3)

# Draw a line strip
arcade.draw_text("draw_line_strip", 483, 405, arcade.color.WHITE, 12)
point_list = ((510, 450),
              (570, 450),
              (510, 480),
              (570, 480),
              (510, 510),
              (570, 510)
              )
arcade.draw_line_strip(point_list, arcade.color.TROPICAL_RAIN_FOREST, 3)

# Draw a polygon
arcade.draw_text("draw_polygon_outline", 3, 207, arcade.color.WHITE, 9)
point_list = ((30, 240),
Esempio n. 22
0
    def on_draw(self):
        global physics_calc, exploded
        arcade.start_render()

        # shelf done
        arcade.draw_rectangle_filled(150, 300, 300, 350, arcade.color.DARK_BROWN, 0)
        arcade.draw_rectangle_filled(150, 370, 10, 300, arcade.color.LIGHT_BROWN, 90)
        arcade.draw_rectangle_filled(150, 300, 10, 300, arcade.color.LIGHT_BROWN, 90)

        # books
        arcade.draw_rectangle_filled(20, 400, 25, 50, arcade.color.GREEN, 0)
        arcade.draw_rectangle_filled(100, 400, 25, 50, arcade.color.GREEN_YELLOW, 0)
        arcade.draw_rectangle_filled(130, 400, 25, 50, arcade.color.PURPLE, 0)
        arcade.draw_rectangle_filled(160, 400, 25, 50, arcade.color.BLUE, 0)
        arcade.draw_rectangle_filled(190, 400, 25, 50, arcade.color.ASH_GREY, 0)

        arcade.draw_rectangle_filled(70, 330, 25, 50, arcade.color.GREEN_YELLOW, 0)
        arcade.draw_rectangle_filled(100, 330, 25, 50, arcade.color.PURPLE, 0)
        arcade.draw_rectangle_filled(130, 330, 25, 50, arcade.color.PURPLE, 0)
        arcade.draw_rectangle_filled(160, 330, 25, 50, arcade.color.ASH_GREY, 0)
        arcade.draw_rectangle_filled(220, 330, 25, 50, arcade.color.BLUE, 145)

        # Body of pumpkin
        arcade.draw_rectangle_filled(530, 250, 150, 170, arcade.color.ORANGE)
        arcade.draw_ellipse_filled(450, 249, 175, 100, arcade.color.ORANGE, 90, 60)
        arcade.draw_ellipse_filled(600, 249, 175, 100, arcade.color.ORANGE, 90, 60)

        # Stem of Pumpkin
        arcade.draw_rectangle_filled(520, 360, 20, 50, arcade.color.BROWN)

        # Face of Pumpkin
        # Eyes
        arcade.draw_triangle_filled(460, 290, 480, 315, 500, 290, arcade.color.BLACK)
        arcade.draw_triangle_filled(540, 290, 560, 315, 580, 290, arcade.color.BLACK)

        # Nose
        arcade.draw_triangle_filled(500, 265, 520, 240, 540, 265, arcade.color.BLACK)

        # Mouth
        arcade.draw_arc_filled(520, 180, 50, 50, arcade.color.BLACK, 0, 180, 360, 128)

        # ghost
        arcade.draw_ellipse_filled(50, 100, 30, 110, arcade.color.WHITE)
        arcade.draw_ellipse_filled(70, 100, 30, 100, arcade.color.WHITE)
        arcade.draw_ellipse_filled(90, 100, 30, 100, arcade.color.WHITE)
        arcade.draw_ellipse_filled(110, 100, 30, 100, arcade.color.WHITE)
        arcade.draw_ellipse_filled(130, 100, 30, 100, arcade.color.WHITE)
        arcade.draw_ellipse_filled(150, 100, 30, 110, arcade.color.WHITE)
        arcade.draw_circle_filled(100, 190, 80, arcade.color.WHITE)
        arcade.draw_circle_filled(80, 190, 20, arcade.color.BLACK)
        arcade.draw_circle_filled(130, 190, 20, arcade.color.BLACK)
        arcade.draw_ellipse_filled(100, 140, 30, 40, arcade.color.BLACK)

        # blood
        arcade.draw_ellipse_filled(500, 80, 100, 500, arcade.color.RED_DEVIL, 90)
        arcade.draw_rectangle_filled(330, 100, 5, 50, arcade.color.WHITE_SMOKE, 65)
        arcade.draw_rectangle_filled(400, 100, 5, 35, arcade.color.WHITE_SMOKE, 20)

        # Banner
        arcade.draw_rectangle_filled(SCREEN_WIDTH // 2, 530, 800, 100, arcade.color.ORANGE_RED, 0)
        arcade.draw_text("HAPPY GALLOWEEEEN", 170, 500, arcade.color.WHITE, 50)

        # Balloon strings
        arcade.draw_rectangle_filled(800, 150, 2, 500, arcade.color.WHITE)
        arcade.draw_ellipse_filled(800, 350, 200, 150, arcade.color.FERRARI_RED, 90)

        if exploded is False:
            self.pumpkin.display()
            self.pumpkin.move()

        if exploded is True:
            self.shapes.draw()
            self.candle.display()
            self.candle.move()
            if self.candle.up == True:
                self.shapes.move(0, self.candle.baseyincr)
            if self.candle.up == False:
                self.shapes.move(0,-self.candle.baseyincr)

        self.mouse.display_loc()

        if press_num == 3:
            for i in range(pcs_num):
                pcs_list[i].display()
                pcs_list[i].move(pcs_coords[i].position.x, pcs_coords[i].position.y)
                physics_calc = False
                exploded = True

        arcade.draw_lines([floor.a, floor.b], arcade.color.TROLLEY_GREY, 40)
arcade.draw_points(point_list, arcade.color.ZAFFRE, 10)

# Draw a line
arcade.draw_text("draw_line", 243, 405, arcade.color.BLACK, 12)
arcade.draw_line(270, 495, 300, 450, arcade.color.WOOD_BROWN, 3)

# Draw a set of lines
arcade.draw_text("draw_lines", 363, 405, arcade.color.BLACK, 12)
point_list = ((390, 450),
              (450, 450),
              (390, 480),
              (450, 480),
              (390, 510),
              (450, 510)
              )
arcade.draw_lines(point_list, arcade.color.BLUE, 3)

# Draw a line strip
arcade.draw_text("draw_line_strip", 483, 405, arcade.color.BLACK, 12)
point_list = ((510, 450),
              (570, 450),
              (510, 480),
              (570, 480),
              (510, 510),
              (570, 510)
              )
arcade.draw_line_strip(point_list, arcade.color.TROPICAL_RAIN_FOREST, 3)

# Draw a polygon
arcade.draw_text("draw_polygon_outline", 3, 207, arcade.color.BLACK, 9)
point_list = ((30, 240),
Esempio n. 24
0
    def on_draw(self):
        """
        Render the screen.
        """

        # Start the render process. This must be done before any drawing commands.
        arcade.start_render()

        # Draw a grid
        # Draw vertical lines every 120 pixels
        for x in range(0, 601, 120):
            arcade.draw_line(x, 0, x, 600, arcade.color.BLACK, 2)

        # Draw horizontal lines every 200 pixels
        for y in range(0, 601, 200):
            arcade.draw_line(0, y, 800, y, arcade.color.BLACK, 2)

        # Draw a point
        arcade.draw_text("draw_point", 3, 405, arcade.color.BLACK, 12)
        arcade.draw_point(60, 495, arcade.color.RED, 10)

        # Draw a set of points
        arcade.draw_text("draw_points", 123, 405, arcade.color.BLACK, 12)
        point_list = ((165, 495), (165, 480), (165, 465), (195, 495),
                      (195, 480), (195, 465))
        arcade.draw_points(point_list, arcade.color.ZAFFRE, 10)

        # Draw a line
        arcade.draw_text("draw_line", 243, 405, arcade.color.BLACK, 12)
        arcade.draw_line(270, 495, 300, 450, arcade.color.WOOD_BROWN, 3)

        # Draw a set of lines
        arcade.draw_text("draw_lines", 363, 405, arcade.color.BLACK, 12)
        point_list = ((390, 450), (450, 450), (390, 480), (450, 480),
                      (390, 510), (450, 510))
        arcade.draw_lines(point_list, arcade.color.BLUE, 3)

        # Draw a line strip
        arcade.draw_text("draw_line_strip", 483, 405, arcade.color.BLACK, 12)
        point_list = ((510, 450), (570, 450), (510, 480), (570, 480),
                      (510, 510), (570, 510))
        arcade.draw_line_strip(point_list, arcade.color.TROPICAL_RAIN_FOREST,
                               3)
        arcade.draw_line_strip(point_list, arcade.color.BEIGE)

        # Draw a polygon
        arcade.draw_text("draw_polygon_outline", 3, 207, arcade.color.BLACK, 9)
        point_list = ((30, 240), (45, 240), (60, 255), (60, 285), (45, 300),
                      (30, 300))
        arcade.draw_polygon_outline(point_list, arcade.color.SPANISH_VIOLET, 3)

        # Draw a filled in polygon
        arcade.draw_text("draw_polygon_filled", 123, 207, arcade.color.BLACK,
                         9)
        point_list = ((150, 240), (165, 240), (180, 255), (180, 285),
                      (165, 300), (150, 300))
        arcade.draw_polygon_filled(point_list, arcade.color.SPANISH_VIOLET)

        # Draw an outline of a circle
        arcade.draw_text("draw_circle_outline", 243, 207, arcade.color.BLACK,
                         10)
        arcade.draw_circle_outline(300, 285, 18, arcade.color.WISTERIA, 3)
        arcade.draw_circle_outline(350, 285, 18, arcade.color.WISTERIA)

        # Draw a filled in circle
        arcade.draw_text("draw_circle_filled", 363, 207, arcade.color.BLACK,
                         10)
        arcade.draw_circle_filled(420, 285, 18, arcade.color.GREEN)

        # Draw an ellipse outline, and another one rotated
        arcade.draw_text("draw_ellipse_outline", 483, 207, arcade.color.BLACK,
                         10)
        arcade.draw_ellipse_outline(540, 273, 15, 36, arcade.color.AMBER, 3)
        arcade.draw_ellipse_outline(540, 336, 15, 36, arcade.color.BLACK_BEAN,
                                    3, 45)

        # Draw a filled ellipse, and another one rotated
        arcade.draw_text("draw_ellipse_filled", 3, 3, arcade.color.BLACK, 10)
        arcade.draw_ellipse_filled(60, 81, 15, 36, arcade.color.AMBER)
        arcade.draw_ellipse_filled(60, 144, 15, 36, arcade.color.BLACK_BEAN,
                                   45)

        # Draw an arc, and another one rotated
        arcade.draw_text("draw_arc/filled_arc", 123, 3, arcade.color.BLACK, 10)
        arcade.draw_arc_outline(150, 81, 15, 36, arcade.color.BRIGHT_MAROON,
                                90, 360)
        arcade.draw_arc_filled(150, 144, 15, 36, arcade.color.BOTTLE_GREEN, 90,
                               360, 45)

        # Draw an rectangle outline
        arcade.draw_text("draw_rect", 243, 3, arcade.color.BLACK, 10)
        arcade.draw_rectangle_outline(295, 100, 45, 65,
                                      arcade.color.BRITISH_RACING_GREEN)
        arcade.draw_rectangle_outline(295, 160, 20, 45,
                                      arcade.color.BRITISH_RACING_GREEN, 3, 45)

        # Draw a filled in rectangle
        arcade.draw_text("draw_filled_rect", 363, 3, arcade.color.BLACK, 10)
        arcade.draw_rectangle_filled(420, 100, 45, 65, arcade.color.BLUSH)
        arcade.draw_rectangle_filled(420, 160, 20, 40, arcade.color.BLUSH, 45)

        # Load and draw an image to the screen
        # Image from kenney.nl asset pack #1
        arcade.draw_text("draw_bitmap", 483, 3, arcade.color.BLACK, 12)
        texture = arcade.load_texture(
            ":resources:images/space_shooter/playerShip1_orange.png")
        scale = .6
        # arcade.draw_texture_rectangle(540, 120, scale * texture.width,
        #                               scale * texture.height, texture, 0)
        # arcade.draw_texture_rectangle(540, 60, scale * texture.width,
        #                               scale * texture.height, texture, 45)
        #
        # Overlapping, with transparency test
        # Draw
        arcade.draw_rectangle_filled(650, 100, 50, 50, (255, 0, 0))
        arcade.draw_rectangle_filled(670, 100, 50, 50, (0, 255, 0, 127))

        import sys
        # TODO: Fix. See https://github.com/pvcraven/arcade/issues/539
        if sys.platform != "darwin":
            # Test colors
            color = arcade.get_pixel(635, 100)
            assert color == (255, 0, 0)
            color = arcade.get_pixel(670, 100)
            assert color == (128, 127, 0)
            color = arcade.get_pixel(690, 100)
            assert color == (128, 255, 128)

            # Test this other thing
            color = arcade.get_pixel(100, 100)
            assert color == (255, 255, 255)

        # Run the get image. Ideally we'd test the output
        arcade.get_image()