def draw(self):
		for ring in self.rings:
			outputRing = []
			for point in ring:
				outputRing.append(point.convert_to_tuple())
			#arcade.draw_line_strip(outputRing, arcade.color.TROPICAL_RAIN_FOREST, 2)
			arcade.draw_polygon_outline(outputRing, arcade.color.SPANISH_VIOLET, 3)
    def on_draw(self):
        #circle
        arcade.start_render()
        arcade.draw_circle_filled(240, 360, 30, arcade.color.BLUE)
        arcade.draw_circle_outline(340, 360, 30, arcade.color.BUFF)

        #ellipse
        arcade.draw_ellipse_filled(100, 100, 50, 80, arcade.color.AQUA)
        arcade.draw_ellipse_outline(200, 100, 50, 80, arcade.color.AMETHYST)

        #rectangle
        arcade.draw_rectangle_filled(300, 100, 50, 50,
                                     arcade.color.RASPBERRY_GLACE)
        arcade.draw_rectangle_outline(400, 100, 50, 100,
                                      arcade.color.YANKEES_BLUE, 4)

        #text-szöveg
        arcade.draw_text("Kóder Klub", 20, 720 - 80, arcade.color.ALMOND, 24)
        #arc-iv
        arcade.draw_arc_filled(640, 720 - 80, 120, 120,
                               arcade.color.YELLOW_GREEN, 0, 90)
        arcade.draw_arc_filled(1040, 720 - 80, 120, 120, arcade.color.GLITTER,
                               0, 180)

        #triangle
        arcade.draw_polygon_outline([[0, 0], [50, 0], [25, 50]],
                                    arcade.color.RAZZMIC_BERRY)

        #polygon
        arcade.draw_polygon_outline(
            [[640, 360], [640 + 50, 360], [640 + 75, 360 + 25],
             [640 + 25, 360 + 50], [640 - 25, 360 + 25]],
            arcade.color.EARTH_YELLOW)
Exemplo n.º 3
0
def render_debugs(world):
    for _, (position, hitCircle) in world.get_components(Position, HitCircle):
        if position.level is not None:
            level = world.component_for_entity(position.level, Level)
            if level.active:
                arcade.draw_circle_filled(
                    position.x, position.y, hitCircle.radius, (255, 0, 0, 100)
                )

    for _, (position, hitPoly) in world.get_components(Position, HitPoly):
        level = world.component_for_entity(position.level, Level)
        if level.active:
            arcade.draw_polygon_outline(hitPoly.point_list, (255, 255, 255, 100), 5)

    for level_ent, boundary in world.get_component(ArenaBoundary):
        level = world.component_for_entity(level_ent, Level)
        if level.active:
            arcade.draw_polygon_outline(boundary.poly.point_list, arcade.color.WHITE, 5)
            for i, point in enumerate(boundary.poly.point_list):
                arcade.draw_text(str(i), point[0], point[1], arcade.color.YELLOW)
    
    for _, (pos, vec) in world.get_components(Position, Velocity):
        level = world.component_for_entity(position.level, Level)
        x1 = pos.x
        x2 = pos.x+vec.dx
        y1 = pos.y
        y2 = pos.y+vec.dy
        if level.active:
            arcade.draw_line(x1,y1, x2,y2, arcade.color.YELLOW, 3)
Exemplo n.º 4
0
    def on_draw(self):
        arcade.start_render()

        # Circle - Kör
        arcade.draw_circle_filled(240, 360, 30, arcade.color.BLUE)
        arcade.draw_circle_outline(340, 360, 30, arcade.color.BUFF)

        # Ellipse - Ellipszis
        arcade.draw_ellipse_filled(100, 100, 50, 80, arcade.color.AO)
        arcade.draw_ellipse_outline(200, 100, 50, 80, arcade.color.YELLOW)

        # Rectangle - Téglalap
        arcade.draw_rectangle_filled(300, 100, 50, 50,
                                     arcade.color.ALIZARIN_CRIMSON)
        arcade.draw_rectangle_outline(400, 100, 50, 150,
                                      arcade.color.YANKEES_BLUE, 4)

        # Text - Szöveg
        arcade.draw_text("Kóder Klub", 20, 720 - 80, arcade.color.AQUA, 24)

        # Arc - Ív
        arcade.draw_arc_filled(640, 720 - 80, 120, 120,
                               arcade.color.YELLOW_ORANGE, 0, 90)
        arcade.draw_arc_filled(1040, 720 - 80, 120, 120,
                               arcade.color.YELLOW_ORANGE, 0, 270)

        # Triangle - Háromszög
        arcade.draw_polygon_outline([[0, 0], [50, 0], [25, 50]],
                                    arcade.color.AFRICAN_VIOLET)

        # Pentagon - Ötszög
        arcade.draw_polygon_outline(
            [[640, 360], [640 + 50, 360], [640 + 75, 360 + 25],
             [640 + 25, 360 + 50], [640 - 25, 360 + 25]],
            arcade.color.ALLOY_ORANGE)
Exemplo n.º 5
0
    def draw_hit_box(self, color: Color = BLACK, line_thickness: float = 1):
        """
        Draw a sprite's hit-box. This is slow, but useful for debugging.
        :param color: Color of box
        :param line_thickness: How thick the box should be
        """
        points = self.get_adjusted_hit_box()

        draw_polygon_outline(points, color, line_thickness)
Exemplo n.º 6
0
def draw_polygon(poly: Polygon,
                 fill: bool = True,
                 edge_color: tuple = POLYGON_EDGE_COLOR,
                 fill_color: tuple = POLYGON_FILL_COLOR):
    """ Draws given polygon. """
    if fill:
        arcade.draw_polygon_filled(poly.points, color=fill_color)
    arcade.draw_polygon_outline(poly.points, color=edge_color)
    for p in poly.points:
        draw_point(p, color=edge_color)
Exemplo n.º 7
0
 def bar_outline(self):
     arcade.draw_polygon_outline(
         [[75, SCREEN_HEIGHT - 25], [350, SCREEN_HEIGHT - 25],
          [325, SCREEN_HEIGHT - 50], [75, SCREEN_HEIGHT - 50]],
         arcade.color.BLACK,
         line_width=2)
     arcade.draw_polygon_outline(
         [[75, SCREEN_HEIGHT - 55], [320, SCREEN_HEIGHT - 55],
          [310, SCREEN_HEIGHT - 65], [75, SCREEN_HEIGHT - 65]],
         arcade.color.BLACK,
         line_width=2)
def on_draw_shapes():
    point_list_1 = ((0, 700), (0, 625), (450, 625), (550, 700))
    arcade.draw_polygon_filled(point_list_1, arcade.color.LIGHT_BLUE)

    point_list_2 = ((0, 625), (450, 625), (310, 520), (0, 520))
    arcade.draw_polygon_outline(point_list_2, (210, 255, 248), 5)

    point_list_3 = ((1080, 700), (1080, 580), (590, 580), (750, 700))
    arcade.draw_polygon_filled(point_list_3, (210, 255, 248))

    point_list_4 = ((325, 325), (400, 425), (775, 425), (700, 325))
    arcade.draw_polygon_filled(point_list_4, (210, 255, 248))
Exemplo n.º 9
0
    def on_draw(self):
        """Called whenever we need to draw our window
        """

        # Clear the screen and start drawing
        arcade.start_render()

        # Draw a blue arc
        arcade.draw_arc_filled(100, 100, 40, 40, arcade.color.BLUE, 0, 125)

        # Draw a red ellipse
        arcade.draw_ellipse_outline(300,
                                    100,
                                    60,
                                    30,
                                    arcade.color.RED,
                                    border_width=2)

        # Draw some purple lines
        arcade.draw_line(500, 100, 550, 100, arcade.color.PURPLE)
        arcade.draw_line(500, 90, 550, 90, arcade.color.PURPLE, line_width=2)
        arcade.draw_line(500, 80, 550, 80, arcade.color.PURPLE, line_width=3)

        # Draw an orange parabola
        arcade.draw_parabola_filled(100, 100, 130, 120, arcade.color.ORANGE)

        # Draw a black point
        arcade.draw_point(300, 300, arcade.color.BLACK, 20)

        # Draw a green polygon
        points_list = [
            [500, 300],
            [550, 300],
            [575, 325],
            [550, 350],
            [525, 340],
        ]
        arcade.draw_polygon_outline(points_list,
                                    arcade.color.GREEN,
                                    line_width=5)

        # Draw some rectangles
        arcade.draw_rectangle_filled(100, 500, 150, 75, arcade.color.AZURE)
        arcade.draw_lrtb_rectangle_filled(150, 250, 575, 525,
                                          arcade.color.AMARANTH_PINK)
        arcade.draw_xywh_rectangle_filled(200, 550, 150, 75,
                                          arcade.color.ASPARAGUS)

        # Draw some triangles
        arcade.draw_triangle_filled(400, 500, 500, 500, 450, 575,
                                    arcade.color.DEEP_RUBY)
Exemplo n.º 10
0
def draw_nose_cone(position_x, position_y):
    arcade.draw_ellipse_filled(position_x + 105, position_y - 3, WIDTH + 25,
                               HEIGHT_1 - 5, (224, 188, 40))
    arcade.draw_ellipse_outline(position_x + 105, position_y - 3, WIDTH + 25,
                                HEIGHT_1 - 5, (121, 123, 128), 2)
    point_list_1 = ((position_x, position_y), (position_x + 35,
                                               position_y + 45),
                    (position_x + 185, position_y + 45), (position_x + 215,
                                                          position_y))
    arcade.draw_polygon_filled(point_list_1, (203, 214, 214))
    arcade.draw_polygon_outline(point_list_1, (121, 123, 128), 4)

    arcade.draw_arc_filled(position_x + 112, position_y + 92, WIDTH_1,
                           HEIGHT_1, (203, 214, 214), START_ANGLE, END_ANGLE)
    arcade.draw_arc_outline(position_x + 112, position_y + 92, WIDTH_1,
                            HEIGHT_1, (121, 123, 128), START_ANGLE, END_ANGLE,
                            4)
Exemplo n.º 11
0
 def on_draw(self):
     if self.hover and not self.target:
         draw_polygon_outline(self.points, color.WHITE)
         return
     elif self.target and not self.hover:
         draw_polygon_outline(self.points, color.RED)
         return
     elif self.target and self.hover:
         draw_polygon_outline(self.points, color.ORIOLES_ORANGE)
Exemplo n.º 12
0
    def draw_hit_box(self, color, line_thickness):
        points = self.get_adjusted_hit_box()

        draw_polygon_outline(points, color, line_thickness)
Exemplo n.º 13
0
def draw_nose_cone_1(position_x, position_y):
    point_list = ((position_x, position_y), (position_x + 35, position_y + 45),
                  (position_x + 120, position_y + 45), (position_x + 150,
                                                        position_y))
    arcade.draw_polygon_filled(point_list, (203, 214, 214))
    arcade.draw_polygon_outline(point_list, (121, 123, 128), 4)
Exemplo n.º 14
0
f = 300
g = 233
h = 280
for i in range(3):
    my_list = (
        (0, e),
        (120, f),
        (350, g),
        (580, f),
        (700, h),
        #back around
        (580, f),
        (350, g),
        (120, f),
    )
    arcade.draw_polygon_outline(my_list, arcade.color.BLACK, 4)
    e = e - 30
    f = f - 30
    g = g - 30
    h = h - 30

######STAR#######

my_list = (  ### Bottom point
    (340, 160), (360, 160), (350, 90))
arcade.draw_polygon_filled(my_list, arcade.color.UROBILIN)

## Second bottom left
my_list = (  ###  secpmd left Bottom point
    (310, 180), (340, 160), (300, 150))
arcade.draw_polygon_filled(my_list, arcade.color.UROBILIN)
              (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),
              (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)
Exemplo n.º 16
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()
Exemplo n.º 17
0
 def draw_polygon(self, verts, radious, color1, color2):
     arcade.draw_polygon_outline(verts, arcade.color.WHITE)
Exemplo n.º 18
0
arcade.draw_lrtb_rectangle_filled(0, 799, 530, 520, (20, 99, 255))
arcade.draw_lrtb_rectangle_filled(0, 799, 540, 530, (20, 114, 255))
arcade.draw_lrtb_rectangle_filled(0, 799, 550, 540, (20, 138, 255))
arcade.draw_lrtb_rectangle_filled(0, 799, 600, 550,
                                  arcade.csscolor.WHITE_SMOKE)

# rock
arcade.draw_arc_filled(450, 50, 200, 200, arcade.csscolor.SLATE_GRAY, 0, 180)
arcade.draw_arc_filled(450, 50, 100, 100, arcade.csscolor.BLACK, 0, 180)
# starfish
arcade.draw_polygon_filled(
    ((210, 440), (240, 440), (250, 410), (260, 440), (290, 440), (265, 460),
     (275, 490), (250, 470), (225, 490), (235, 460)),
    arcade.csscolor.LIGHT_PINK)
arcade.draw_polygon_outline(
    ((210, 440), (240, 440), (250, 410), (260, 440), (290, 440), (265, 460),
     (275, 490), (250, 470), (225, 490), (235, 460)),
    arcade.csscolor.DEEP_PINK)
arcade.draw_arc_filled(245, 458, 10, 10, arcade.csscolor.BLACK, 200, 360)
arcade.draw_circle_filled(246, 467, 2, arcade.csscolor.BLACK)
arcade.draw_circle_filled(239, 462, 2, arcade.csscolor.BLACK)

# draw little fish
arcade.draw_triangle_filled(300, 230, 270, 200, 310, 180,
                            arcade.csscolor.TURQUOISE)
arcade.draw_ellipse_filled(260, 200, 57, 27, arcade.csscolor.TURQUOISE)
arcade.draw_arc_filled(240, 197, 10, 10, arcade.csscolor.BLACK, 180, 360)
arcade.draw_circle_filled(245, 205, 2, arcade.csscolor.BLACK)

arcade.draw_triangle_filled(320, 250, 290, 220, 330, 200,
                            arcade.csscolor.DEEP_PINK)
arcade.draw_ellipse_filled(280, 220, 57, 27, arcade.csscolor.DEEP_PINK)
Exemplo n.º 19
0
    def on_draw(self):
        arcade.start_render()
        arcade.set_viewport(-OFFSET, PITCH_L+OFFSET, -OFFSET, PITCH_W+OFFSET)

        point_list = ((0, 0),
                      (0, PITCH_W),
                      (PITCH_L, PITCH_W),
                      (PITCH_L,0))

        arcade.draw_polygon_outline(point_list, arcade.color.WHITE, 3)

        arcade.draw_line(PITCH_L/2, 0, PITCH_L/2, PITCH_W, arcade.color.WHITE, 3)

        R = 9.15
        arcade.draw_points([(PITCH_L/2, PITCH_W/2)], arcade.color.WHITE, 5)
        arcade.draw_circle_outline(PITCH_L/2, PITCH_W/2, R*10, arcade.color.WHITE, 3)

        SMAL_BOX_W = (7.32/2 + 5.5) * 2
        SMAL_BOX_L = 5.5

        point_list = ((0, PITCH_W/2+(SMAL_BOX_W/2)*10),
                      (SMAL_BOX_L*10, PITCH_W/2+(SMAL_BOX_W/2)*10),
                      (SMAL_BOX_L*10, PITCH_W/2-(SMAL_BOX_W/2)*10),
                      (0, PITCH_W/2-(SMAL_BOX_W/2)*10))
        arcade.draw_polygon_outline(point_list, arcade.color.WHITE, 3)

        point_list = ((PITCH_L, PITCH_W/2+(SMAL_BOX_W/2)*10),
                      (PITCH_L-SMAL_BOX_L*10, PITCH_W/2+(SMAL_BOX_W/2)*10),
                      (PITCH_L-SMAL_BOX_L*10, PITCH_W/2-(SMAL_BOX_W/2)*10),
                      (PITCH_L, PITCH_W/2-(SMAL_BOX_W/2)*10)
                     )
        arcade.draw_polygon_outline(point_list, arcade.color.WHITE, 3)

        LARGE_BOX_W = 40.3
        LARGE_BOX_L = 16.5

        point_list = ((0, PITCH_W/2+(LARGE_BOX_W/2)*10),
                      (LARGE_BOX_L*10, PITCH_W/2+(LARGE_BOX_W/2)*10),
                      (LARGE_BOX_L*10, PITCH_W/2-(LARGE_BOX_W/2)*10),
                      (0, PITCH_W/2-(LARGE_BOX_W/2)*10))
        arcade.draw_polygon_outline(point_list, arcade.color.WHITE, 3)

        point_list = ((PITCH_L, PITCH_W/2+(LARGE_BOX_W/2)*10),
                      (PITCH_L-LARGE_BOX_L*10, PITCH_W/2+(LARGE_BOX_W/2)*10),
                      (PITCH_L-LARGE_BOX_L*10, PITCH_W/2-(LARGE_BOX_W/2)*10),
                      (PITCH_L, PITCH_W/2-(LARGE_BOX_W/2)*10)
                     )
        arcade.draw_polygon_outline(point_list, arcade.color.WHITE, 3)

        arcade.draw_points([(11*10, PITCH_W/2), (PITCH_L-11*10, PITCH_W/2)], arcade.color.WHITE, 5)

        for player in self.players_list:
            player.draw()

        if self.mode == 'V':
            for passline in self.passes_list:
                passline.draw()

        elif self.mode == 'P':
            self.p.draw()

            top1 = (pd.Series(self.hits) <= 1).mean()
            top2 = (pd.Series(self.hits) <= 2).mean()
            top3 = (pd.Series(self.hits) <= 3).mean()
            mrr = (1/pd.Series(self.hits)).mean()

            arcade.draw_text(f'MRR: {mrr:.2}, top 1/2/3: {top1:.2}/{top2:.2}/{top3:.2}',
                            30, PITCH_W-30, arcade.color.WHITE, 12)

        arcade.draw_text(f'example {self.cur_example}',
                        PITCH_L-170, PITCH_W-30, arcade.color.WHITE, 12)
def draw_character(x, y):
    # This function will draw the main character, x and y are starting coordinates
    # Open window
    arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, "Main Character")

    # Set the background color
    arcade.set_background_color(arcade.csscolor.WHITE)

    # Get ready to draw
    arcade.start_render()

    # Draw Head
    # Hair
    arcade.draw_xywh_rectangle_filled(x + 4, y - 10, 40, 10,
                                      arcade.csscolor.BLACK)
    # Head itself
    arcade.draw_xywh_rectangle_filled(x + 4, y - 37, 40, 27,
                                      arcade.csscolor.SADDLE_BROWN)
    # Mouth
    arcade.draw_xywh_rectangle_filled(x + 30, y - 31, 14, 3,
                                      arcade.csscolor.BLACK)
    # Eyes
    arcade.draw_xywh_rectangle_filled(x + 36, y - 18, 8, 5,
                                      arcade.csscolor.BLACK)

    # Draw Neck
    arcade.draw_xywh_rectangle_filled(x + 19, y - 44, 11, 7,
                                      arcade.csscolor.SADDLE_BROWN)

    # Draw Body
    arcade.draw_xywh_rectangle_filled(x + 13, y - 79, 21, 35,
                                      arcade.csscolor.INDIANRED)
    arcade.draw_xywh_rectangle_outline(x + 13, y - 79, 21, 35,
                                       arcade.csscolor.DARK_GREY, 1)

    # Draw Arms
    # Right Arm
    arcade.draw_xywh_rectangle_filled(x + 22, y - 65, 7, 14,
                                      arcade.csscolor.INDIANRED)
    arcade.draw_xywh_rectangle_outline(x + 22, y - 65, 7, 14,
                                       arcade.csscolor.DARK_GREY, 1)
    # Left Arm
    arcade.draw_xywh_rectangle_filled(x + 34, y - 57, 14, 6,
                                      arcade.csscolor.INDIANRED)
    arcade.draw_xywh_rectangle_outline(x + 34, y - 57, 14, 6,
                                       arcade.csscolor.DARK_GREY, 1)
    # Right Hand
    arcade.draw_xywh_rectangle_filled(x + 22, y - 72, 7, 7,
                                      arcade.csscolor.BROWN)
    arcade.draw_xywh_rectangle_outline(x + 22, y - 72, 7, 7,
                                       arcade.csscolor.DARK_GREY, 1)
    # Left Hand
    arcade.draw_xywh_rectangle_filled(x + 48, y - 57, 4, 6,
                                      arcade.csscolor.BROWN)
    arcade.draw_xywh_rectangle_outline(x + 48, y - 57, 4, 6,
                                       arcade.csscolor.DARK_GREY, 1)

    # Draw Gun
    arcade.draw_polygon_filled(
        ((x + 52, y - 40), (x + 83, y - 40), (x + 83, y - 46),
         (x + 60, y - 46), (x + 60, y - 57), (x + 52, y - 57)),
        arcade.csscolor.GREY)
    arcade.draw_polygon_outline(
        ((x + 52, y - 40), (x + 83, y - 40), (x + 83, y - 46),
         (x + 60, y - 46), (x + 60, y - 57), (x + 52, y - 57)),
        arcade.csscolor.DARK_GREY, 1)

    # Draw Legs
    # Left Leg
    arcade.draw_xywh_rectangle_filled(x + 13, y - 115, 8, 36,
                                      arcade.csscolor.GRAY)
    # Left Shoe
    arcade.draw_polygon_filled(
        ((x + 13, y - 115), (x + 21, y - 115), (x + 25, y - 118),
         (x + 25, y - 123), (x + 12, y - 123)), arcade.csscolor.GREY)
    # Right Leg
    arcade.draw_xywh_rectangle_filled(x + 26, y - 115, 8, 36,
                                      arcade.csscolor.GRAY)
    # Right Shoe
    arcade.draw_polygon_filled(
        ((x + 26, y - 115), (x + 34, y - 115), (x + 38, y - 118),
         (x + 39, y - 123), (x + 26, y - 123)), arcade.csscolor.GREY)

    # Between Legs
    arcade.draw_xywh_rectangle_filled(x + 21, y - 88, 5, 9,
                                      arcade.csscolor.GRAY)

    # Draw Floor
    arcade.draw_xywh_rectangle_filled(0, 0, SCREEN_WIDTH, 47,
                                      arcade.csscolor.GREEN)

    # Finish drawing
    arcade.finish_render()

    # Keep the window up until someone closes it.
    arcade.run()
Exemplo n.º 21
0
 def draw(self):
     arcade.draw_polygon_outline(self.points, arcade.color.PURPLE, 2)
Exemplo n.º 22
0
arcade.draw_lrtb_rectangle_filled(0, 800, 100, 0, (28, 41, 1))

# Draw a dark green trapeze rounding the field

arcade.draw_polygon_filled(
    [[0, 100], [0, 200], [180, 530], [620, 530], [800, 200], [800, 100]],
    (28, 41, 1))

# Draw a light green trapeze to get depth

arcade.draw_polygon_filled([[0, 100], [210, 500], [590, 500], [800, 100]],
                           (102, 138, 25))

# Remark borders with a white line

arcade.draw_polygon_outline([[0, 100], [210, 500], [590, 500], [800, 100]],
                            (255, 255, 255), 4)

# Big areas

arcade.draw_polygon_outline([[180, 100], [220, 210], [580, 210], [620, 100]],
                            (255, 255, 255), 4)

arcade.draw_polygon_outline([[322, 500], [305, 450], [495, 450], [478, 500]],
                            (255, 255, 255), 4)

# Small areas

arcade.draw_polygon_outline([[253, 100], [270, 155], [530, 155], [547, 100]],
                            (255, 255, 255), 4)

arcade.draw_polygon_outline([[365, 500], [358, 475], [442, 475], [435, 500]],
Exemplo n.º 23
0
                       180)
arcade.draw_arc_filled(185, (440 - 300), 30, 35, arcade.csscolor.BLACK, 0, 180,
                       200)
arcade.draw_arc_filled(206, (440 - 290), 25, 30, arcade.csscolor.BLACK, 0, 180,
                       220)
arcade.draw_arc_filled(218, (440 - 260), 50, 50, arcade.csscolor.BLACK, 0, 180,
                       255)
# fix
arcade.draw_arc_filled(194, (440 - 250), 60, 20, SKIN, 0, 180, 205)

# Mullet
arcade.draw_polygon_filled(
    ((338, (440 - 300)), (310, (440 - 340)), (345, (440 - 344)),
     (375, (440 - 316)), (360, (440 - 287)), (338, (440 - 300))),
    arcade.csscolor.SIENNA)

# Nose
arcade.draw_polygon_filled(
    ((38, (440 - 236)), (74, (440 - 206)), (145, (440 - 224)),
     (166, (440 - 250)), (164, (440 - 300)), (116, (440 - 330)), (78,
                                                                  (440 - 330)),
     (42, (440 - 308)), (34, (440 - 270)), (38, (440 - 236))), SKIN)
arcade.draw_polygon_outline(
    ((38, (440 - 236)), (74, (440 - 206)), (145, (440 - 224)),
     (166, (440 - 250)), (164, (440 - 300)), (116, (440 - 330)), (78,
                                                                  (440 - 330)),
     (42, (440 - 308)), (34, (440 - 270)), (38, (440 - 236))), DARK_SKIN)

arcade.finish_render()
arcade.run()
Exemplo 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()
Exemplo n.º 25
0
import arcade

arcade.open_window(480, 480, "Lab 2 drawing")
arcade.set_background_color(arcade.csscolor.DEEP_SKY_BLUE)
arcade.start_render()

# grass
arcade.draw_lrtb_rectangle_filled(0, 480, 100, 0, arcade.color.OLIVE_DRAB)

# sidewalk
# use trapezoid to show distance / perspective
arcade.draw_polygon_filled(((245, 90), (285, 90), (310, 0), (210, 0)),
                           arcade.csscolor.GRAY)
arcade.draw_polygon_outline(((245, 90), (285, 90), (310, 0), (210, 0)),
                            arcade.csscolor.BLACK, 3)
y = 5
z = 15
for x in range(1, 5):
    arcade.draw_line(245 - (x * y), 90 - (x * z), 285 + ((x * y) - x),
                     90 - (x * z), arcade.csscolor.BLACK, 3)
    y += 1.3
    z += 3

# cabin
arcade.draw_triangle_filled(200, 200, 360, 200, 290, 300,
                            arcade.csscolor.DARK_RED)
arcade.draw_lrtb_rectangle_filled(220, 340, 200, 90, arcade.csscolor.BROWN)
arcade.draw_lrtb_rectangle_outline(220, 340, 200, 90, arcade.csscolor.BLACK, 3)
arcade.draw_triangle_outline(200, 200, 360, 200, 290, 300,
                             arcade.csscolor.BLACK, 3)
Exemplo n.º 26
0
 def draw(self, debug=False):
     super().draw()
     if debug:
         arcade.draw_polygon_outline(self.points, arcade.color.GREEN, 1)
Exemplo n.º 27
0
              (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),
              (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.WHITE, 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.WHITE, 10)
arcade.draw_circle_outline(300, 285, 18, arcade.color.WISTERIA, 3)
Exemplo n.º 28
0
arcade.draw_line(554, 295, 554, 250, (121, 123, 128), 8)

arcade.draw_line(451, 370, 451, 295, (121, 123, 128), 8)
arcade.draw_line(451, 295, 451, 250, (121, 123, 128), 8)

arcade.draw_line(505, 370, 505, 295, (121, 123, 128), 5)
arcade.draw_line(505, 295, 505, 250, (121, 123, 128), 5)
# Draw a yellow ellipse
arcade.draw_ellipse_filled(295, 402, 7, 105, (224, 188, 40), 90)
arcade.draw_ellipse_outline(295, 402, 7, 105, (121, 123, 128), 1, 90)
# draw spacecraft nose cone
point_list = ((195, 405), (225, 450), (370, 450), (400, 405))
arcade.draw_polygon_filled(point_list, (203, 214, 214))

point_list = ((195, 405), (225, 450), (370, 450), (400, 405))
arcade.draw_polygon_outline(point_list, (121, 123, 128), 4)

point_list = ((225, 450), (260, 495), (340, 495), (370, 450))
arcade.draw_polygon_filled(point_list, (203, 214, 214))

point_list = ((225, 450), (260, 495), (340, 495), (370, 450))
arcade.draw_polygon_outline(point_list, (121, 123, 128), 4)

# Load image of spacex and dragon
file_name = "C:\\Users\\Daniel Camacho\\Documents\\CMSC 150\\Lab 02-Draw a Picture\\SpaceX-Logo.svg.png"
texture = arcade.load_texture(file_name)
scale = .05
arcade.draw_texture_rectangle(310, 488, scale * texture.width,
                              scale * texture.height, texture)

file_name = "C:\\Users\\Daniel Camacho\\Documents\\CMSC 150\\Lab 02-Draw a Picture\\LOGO-MagicDragon.png"
Exemplo n.º 29
0
import arcade
arcade.open_window(600,600,"Multiple Images")
arcade.set_background_color(arcade.color.SAPPHIRE_BLUE)
arcade.start_render()
#arcade.draw_arc_filled(center_x: float, center_y: float, width: float, height: float,
# color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], start_angle: float,
# end_angle: float, tilt_angle: float = 0, num_segments: int = 128)
arcade.draw_arc_filled(300,300,80,80,(123,2,34),0,60)
arcade.draw_arc_outline(150,300,80,80,(123,2,34),0,60)
#arcade.draw_polygon_outline(point_list: Sequence[Union[Tuple[float, float]
#, List[float]]], color: Union[Tuple[int, int, int], List[int]
#, Tuple[int, int, int, int]], line_width: float = 1)
arcade.draw_polygon_outline([[0,0],[100,0],[90,90],[123,45],[80,60]],(123,2,34), 5)
arcade.finish_render()
arcade.run()
Exemplo n.º 30
0
    def render(self):
        """Render asteroid"""

        polygon = [(x + self.x, y + self.y) for x, y in self.polygon]

        arcade.draw_polygon_outline(polygon, arcade.color.WHITE)