How to use the arcade.color.BLACK function in arcade

To help you get started, we’ve selected a few arcade examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pvcraven / arcade / arcade / examples / perf_test / stress_test_collision_arcade.py View on Github external
""" Draw everything """

        # Start timing how long this takes
        draw_start_time = timeit.default_timer()

        arcade.start_render()
        self.coin_list.draw()
        self.player_list.draw()

        # Display info on sprites
        output = f"Sprite count: {len(self.coin_list):,}"
        arcade.draw_text(output, 20, SCREEN_HEIGHT - 20, arcade.color.BLACK, 16)

        # Display timings
        output = f"Processing time: {self.processing_time:.3f}"
        arcade.draw_text(output, 20, SCREEN_HEIGHT - 40, arcade.color.BLACK, 16)

        output = f"Drawing time: {self.draw_time:.3f}"
        arcade.draw_text(output, 20, SCREEN_HEIGHT - 60, arcade.color.BLACK, 16)

        fps = self.fps.get_fps()
        output = f"FPS: {fps:3.0f}"
        arcade.draw_text(output, 20, SCREEN_HEIGHT - 80, arcade.color.BLACK, 16)

        self.draw_time = timeit.default_timer() - draw_start_time
        self.fps.tick()
github pvcraven / arcade / tests / unit2 / test_drawing_dimensions.py View on Github external
arcade.draw_ellipse_outline(x, y, width, 50, arcade.color.AFRICAN_VIOLET, 2)
        arcade.draw_line(x - half_width, y, x + half_width, y, arcade.color.RED, 2)

        radius = 50
        width = radius * 2
        x = 400
        y = 100
        arcade.draw_rectangle_outline(x, y, width, width, arcade.color.BLACK, 2)
        arcade.draw_circle_filled(x, y, radius, arcade.color.AFRICAN_VIOLET)
        arcade.draw_line(x - radius, y, x + radius, y, arcade.color.BLACK, 2)

        x = 400
        y = 300
        width = 150
        half_width = width / 2
        arcade.draw_rectangle_outline(x, y, width, 50, arcade.color.BLACK, 2)
        arcade.draw_ellipse_filled(x, y, width, 50, arcade.color.AFRICAN_VIOLET, 2)
        arcade.draw_line(x - half_width, y, x + half_width, y, arcade.color.RED, 2)
github pvcraven / arcade / examples / basketball.py View on Github external
on_draw.ball = arcade.Circle(236, 105, 20, arcade.color.ORANGE)
on_draw.center_line = arcade.Line(236, 85, 236, 125, arcade.color.BLACK, 1)
on_draw.right_arc = arcade.Arc(236, 105, 20, 15,
                               arcade.color.BLACK, 0, 180, 1, 270)
on_draw.left_arc = arcade.Arc(236, 105, 20, 15,
                              arcade.color.BLACK, 0, 180, 1, 90)

# this is the floor
on_draw.floor = arcade.Line(0, 5, 800, 5, arcade.color.BLACK, 5)

# this is the shooter
on_draw.left_leg = arcade.Rectangle(100, 10, 30, 7, arcade.color.RED, 0, 80)
on_draw.right_leg = arcade.Rectangle(110, 10, 30, 7, arcade.color.RED, 0, 100)
on_draw.body = arcade.Rectangle(105, 25, 30, 20, arcade.color.YELLOW, 0, 90)
on_draw.neck = arcade.Rectangle(207, 60, 7, 4, arcade.color.BLACK, 1, 90)
on_draw.head = arcade.Circle(210, 82, 10, arcade.color.BLACK, 3)
on_draw.left_arm = arcade.Rectangle(170, 20, 30, 5, arcade.color.BLACK, 2, 70)
on_draw.right_arm_1 = arcade.Rectangle(210, 50, 15, 5,
                                       arcade.color.BLACK, 2, 50)
on_draw.right_arm_2 = arcade.Rectangle(220, 60, 15, 5,
                                       arcade.color.BLACK, 2, 130)

# this draws the hoop
on_draw.backboard = arcade.Line(730, 370, 730, 470, arcade.color.BLACK, 4)
on_draw.hoop = arcade.Circle(700, 400, 30, arcade.color.DARK_GREEN, 2)

# this is the text on the screen
on_draw.shot_display = arcade.Text("Basketball", 50, 550, 50,
                                   arcade.color.PURPLE)

# declare any variables that will move an object
on_draw.ball_move_x = 2
github pvcraven / arcade_book / source / labs / lab_05_loopy_lab / loopy_lab_template.py View on Github external
def draw_section_outlines():
    # Draw squares on bottom
    arcade.draw_rectangle_outline(150, 150, 300, 300, arcade.color.BLACK)
    arcade.draw_rectangle_outline(450, 150, 300, 300, arcade.color.BLACK)
    arcade.draw_rectangle_outline(750, 150, 300, 300, arcade.color.BLACK)
    arcade.draw_rectangle_outline(1050, 150, 300, 300, arcade.color.BLACK)

    # Draw squares on top
    arcade.draw_rectangle_outline(150, 450, 300, 300, arcade.color.BLACK)
    arcade.draw_rectangle_outline(450, 450, 300, 300, arcade.color.BLACK)
    arcade.draw_rectangle_outline(750, 450, 300, 300, arcade.color.BLACK)
    arcade.draw_rectangle_outline(1050, 450, 300, 300, arcade.color.BLACK)
github pvcraven / arcade / examples / drawing_primitives.py View on Github external
arcade.open_window(600, 600, "Drawing Example")

# Set the background color to white
# For a list of named colors see
# https://pythonhosted.org/arcade/arcade.color.html
# Colors can also be specified in (red, green, blue) format and
# (red, green, blue, alpha) format.
arcade.set_background_color(arcade.color.WHITE)

# 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),
github pvcraven / arcade / arcade / examples / different_screens_pause.py View on Github external
# Draw player, for effect, on pause screen.
        # The previous View (GameView) was passed in
        # and saved in self.game_view.
        player_sprite = self.game_view.player_sprite
        player_sprite.draw()

        # draw an orange filter over him
        arcade.draw_lrtb_rectangle_filled(left=player_sprite.left,
                                          right=player_sprite.right,
                                          top=player_sprite.top,
                                          bottom=player_sprite.bottom,
                                          color=(*arcade.color.ORANGE, 200))

        arcade.draw_text("PAUSED", WIDTH/2, HEIGHT/2+50,
                         arcade.color.BLACK, font_size=50, anchor_x="center")

        # Show tip to return or reset
        arcade.draw_text("Press Esc. to return",
                         WIDTH/2,
                         HEIGHT/2,
                         arcade.color.BLACK,
                         font_size=20,
                         anchor_x="center")
        arcade.draw_text("Press Enter to reset",
                         WIDTH/2,
                         HEIGHT/2-30,
                         arcade.color.BLACK,
                         font_size=20,
                         anchor_x="center")
github pvcraven / arcade / arcade / examples / procedural_caves.py View on Github external
def __init__(self, width, height):
        super().__init__(width, height)

        self.grid = None
        self.wall_list = None
        self.player_list = None
        self.player_sprite = None
        self.view_bottom = 0
        self.view_left = 0
        self.draw_time = 0

        arcade.set_background_color(arcade.color.BLACK)
github pvcraven / arcade / arcade / examples / sprite_bullets_enemy_aims.py View on Github external
def __init__(self, width, height, title):
        super().__init__(width, height, title)

        # Set the working directory (where we expect to find files) to the same
        # directory this .py file is in. You can leave this out of your own
        # code, but it is needed to easily run the examples using "python -m"
        # as mentioned at the top of this program.
        file_path = os.path.dirname(os.path.abspath(__file__))
        os.chdir(file_path)

        arcade.set_background_color(arcade.color.BLACK)

        self.frame_count = 0

        self.enemy_list = None
        self.bullet_list = None
        self.player_list = None
        self.player = None
github pvcraven / arcade / examples / nested_loops_top_left_triangle.py View on Github external
# Start the render process. This must be done before any drawing commands.
arcade.start_render()

# Loop for each row
for row in range(10):
    # Loop for each column
    # Change the number of columns depending on the row we are in
    for column in range(row):
        # Calculate our location
        x = column * COLUMN_SPACING
        y = row * ROW_SPACING

        # Draw the item
        arcade.draw_text("({}, {})".format(column, row),
                         x, y,
                         arcade.color.BLACK, TEXT_SIZE)

# Finish the render.
arcade.finish_render()

# Keep the window up until someone closes it.
arcade.run()
github pvcraven / arcade / arcade / examples / shapes_buffered.py View on Github external
)
            self.shape_list.append(rect_filled)

        point_list = ((100, 100),
                      (50, 150),
                      (100, 200),
                      (200, 200),
                      (250, 150),
                      (200, 100))
        poly = arcade.create_polygon(point_list, (255, 10, 10))
        self.shape_list.append(poly)

        ellipse = arcade.create_ellipse(20, 30, 50, 20, (230, 230, 0))
        self.shape_list.append(ellipse)

        arcade.set_background_color(arcade.color.BLACK)