コード例 #1
0
ファイル: main.py プロジェクト: pben95/space-rpg-v2
 def draw(self, game, x, y):
     game.draw_list.append(
         arcade.create_ellipse_outline(x, y, self.size_x, self.size_y,
                                       colors["db"], 4))
     game.draw_list.append(
         arcade.create_ellipse_filled(x, y, self.size_x / 3,
                                      self.size_y / 3, colors["sky"]))
コード例 #2
0
ファイル: main.py プロジェクト: pben95/space-rpg-v2
 def scene3_render(self):
     self.draw_list = arcade.ShapeElementList()
     # self.stars_render()
     self.draw_list.append(
         arcade.create_rectangle_filled(400, 0, 800, 200,
                                        arcade.color.BLUE_GRAY, 0))
     # self.draw_list.append(arcade.create_rectangle_filled(400, 800, 800, 200, arcade.color.BLUE_GRAY, 0))
     self.draw_list.append(
         arcade.create_rectangle_filled(400, 113, 800, 25,
                                        arcade.color.LIGHT_GRAY, 0))
     self.draw_list.append(
         arcade.create_line(2, 0, 2, 124, arcade.color.DARK_BLUE, 4))
     self.draw_list.append(
         arcade.create_line(200, 0, 200, 101, arcade.color.DARK_BLUE, 4))
     self.draw_list.append(
         arcade.create_line(400, 0, 400, 101, arcade.color.DARK_BLUE, 4))
     self.draw_list.append(
         arcade.create_line(600, 0, 600, 101, arcade.color.DARK_BLUE, 4))
     self.draw_list.append(
         arcade.create_line(798, 0, 798, 124, arcade.color.DARK_BLUE, 4))
     self.draw_list.append(
         arcade.create_line(0, 100, 800, 100, arcade.color.DARK_BLUE, 4))
     self.draw_list.append(
         arcade.create_line(0, 124, 800, 124, arcade.color.DARK_BLUE, 4))
     self.draw_list.append(
         arcade.create_rectangle_outline(100 + (self.battle_cursor * 200),
                                         50, 175, 75, colors["black"], 3))
     self.draw_list.append(
         arcade.create_ellipse_outline(400, 600, self.enemy.size_x,
                                       self.enemy.size_y, colors["db"], 4))
     self.draw_list.append(
         arcade.create_ellipse_filled(400, 600, self.enemy.size_x / 3,
                                      self.enemy.size_y / 3, colors["sky"]))
コード例 #3
0
    def __init__(self, width, height, title):
        super().__init__(width, height, title)
        self.center_window()

        # A batch ami egy ShapeElementList objektum
        self.batch = arcade.ShapeElementList()

        # Ellipses - Ellipszisek
        ellipse1 = arcade.create_ellipse_filled(440, 360, 50, 50,
                                                arcade.color.ROSE)
        ellipse2 = arcade.create_ellipse_outline(640, 360, 50, 80,
                                                 arcade.color.RED)
        ellipse3 = arcade.create_ellipse_filled_with_colors(
            840, 360, 50, 80, arcade.color.RED, arcade.color.BLUE, 45)

        # Triangle - Háromszög
        triangle = arcade.create_polygon([[0, 0], [100, 0], [50, 100]],
                                         arcade.color.BLUE)
        # Rectangle - Téglalap
        rect = arcade.create_rectangle_filled(100, 360, 100, 150,
                                              arcade.color.GREEN)
        # Invisible Rectangle 1 pixel - Láthatalan 1 pixel átmérőjű négyzet
        invisible_rect = arcade.create_rectangle_filled(
            0, 0, 1, 1, arcade.color.BLACK)

        # Itt adjuk hozzá a batch-oz a geometriai alakzatokat
        self.batch.append(ellipse1)
        self.batch.append(ellipse2)
        self.batch.append(ellipse3)
        self.batch.append(triangle)
        self.batch.append(rect)

        # Ezt mindig utoljára adjuk a batch-hoz, amíg a hibát ki nem javítják az Arcade fejlesztői.
        self.batch.append(invisible_rect)
コード例 #4
0
def main():
    arcade.open_window(700, 700, "Smile Demo")
    arcade.set_background_color(arcade.color.PIGGY_PINK)
    # create objects here
    face = arcade.create_ellipse_outline(350, 350, 200, 200,
                                         arcade.color.BLACK)
    eye1 = arcade.create_ellipse(270, 400, 30, 30, arcade.color.BLACK)
    eye2 = arcade.create_ellipse(420, 400, 30, 30, arcade.color.BLACK)
    nose_points = [(320, 350), (370, 350), (345, 370)]
    nose = arcade.create_polygon(nose_points, arcade.color.DARK_PINK)

    arcade.start_render()
    # draw stuff here
    face.draw()
    eye1.draw()
    eye2.draw()
    nose.draw()
    arcade.draw_arc_outline(350, 350, 200, 125, arcade.color.RADICAL_RED, 180,
                            360, 3)

    arcade.finish_render()

    arcade.run()
コード例 #5
0
def make_objects():
    shape_list = arcade.ShapeElementList()

    center_x = 0
    center_y = 0
    width = 20
    height = 20
    shape = arcade.create_ellipse_filled(center_x, center_y, width, height,
                                         arcade.color.WHITE)
    shape_list.append(shape)

    center_x += 40
    shape = arcade.create_ellipse_outline(center_x,
                                          center_y,
                                          width,
                                          height,
                                          arcade.color.RED,
                                          border_width=1)
    shape_list.append(shape)

    center_x += 40
    shape = arcade.create_ellipse_outline(center_x,
                                          center_y,
                                          width,
                                          height,
                                          arcade.color.DARK_RED,
                                          border_width=1)
    shape_list.append(shape)

    shape = arcade.create_line(0, 0, 80, 0, arcade.color.BLUE, line_width=1)
    shape_list.append(shape)

    shape = arcade.create_line(0,
                               0,
                               80,
                               0,
                               arcade.color.LIGHT_BLUE,
                               line_width=1)
    shape_list.append(shape)

    center_x = 0
    center_y = 50
    width = 20
    height = 20
    outside_color = arcade.color.AERO_BLUE
    inside_color = arcade.color.AFRICAN_VIOLET
    tilt_angle = 45
    shape = arcade.create_ellipse_filled_with_colors(center_x, center_y, width,
                                                     height, outside_color,
                                                     inside_color, tilt_angle)
    shape_list.append(shape)

    center_x = 0
    center_y = -50
    width = 20
    height = 20
    shape = arcade.create_rectangle_filled(center_x, center_y, width, height,
                                           arcade.color.WHITE)
    shape_list.append(shape)
    shape = arcade.create_rectangle_outline(center_x,
                                            center_y,
                                            width,
                                            height,
                                            arcade.color.BLACK,
                                            border_width=1)
    shape_list.append(shape)
    shape = arcade.create_rectangle_outline(center_x,
                                            center_y,
                                            width,
                                            height,
                                            arcade.color.AMERICAN_ROSE,
                                            border_width=1)
    shape_list.append(shape)

    color1 = (215, 214, 165)
    color2 = (219, 166, 123)
    points = (70, 70), (150, 70), (150, 150), (70, 150)
    colors = (color1, color1, color2, color2)
    shape = arcade.create_rectangle_filled_with_colors(points, colors)
    shape_list.append(shape)

    points = (0, 0), (150, 150), (0, 150), (0, 250)
    shape = arcade.create_line_strip(points, arcade.color.AFRICAN_VIOLET)
    shape_list.append(shape)

    points = (0, 0), (75, 90), (60, 150), (90, 250)
    shape = arcade.create_line_generic(points, arcade.color.ALIZARIN_CRIMSON,
                                       gl.GL_TRIANGLE_FAN)
    shape_list.append(shape)

    return shape_list
コード例 #6
0
ファイル: main.py プロジェクト: pben95/space-rpg-v2
 def draw(self, game, x, y):
     game.draw_list.append(
         arcade.create_ellipse_outline(x, y, self.size_x, self.size_y,
                                       colors["sky"], 10, 0))
     game.draw_list.append(
         arcade.create_rectangle_filled(x, y, self.size_x / 2,
                                        self.size_y / 2, colors["sky"], 45))
     game.draw_list.append(
         arcade.create_ellipse_outline(x - 20, y + 20, 10, 10, colors["db"],
                                       5, 0))
     game.draw_list.append(
         arcade.create_ellipse_outline(x - 20, y - 20, 10, 10, colors["db"],
                                       5, 0))
     game.draw_list.append(
         arcade.create_ellipse_outline(x + 20, y + 20, 10, 10, colors["db"],
                                       5, 0))
     game.draw_list.append(
         arcade.create_ellipse_outline(x + 20, y - 20, 10, 10, colors["db"],
                                       5, 0))
     game.draw_list.append(
         arcade.create_rectangle_outline(x, y + 30, 10, 10, colors["db"], 4,
                                         45))
     game.draw_list.append(
         arcade.create_rectangle_outline(x, y - 30, 10, 10, colors["db"], 4,
                                         45))
     game.draw_list.append(
         arcade.create_rectangle_outline(x + 30, y, 10, 10, colors["db"], 4,
                                         45))
     game.draw_list.append(
         arcade.create_rectangle_outline(x - 30, y, 10, 10, colors["db"], 4,
                                         45))
     game.draw_list.append(
         arcade.create_line(x - 80, y, x + 80, y, colors["db"], 2))
     game.draw_list.append(
         arcade.create_line(x, y - 80, x, y + 80, colors["db"], 2))
     game.draw_list.append(
         arcade.create_line(x - 60, y + 60, x + 60, y - 60, colors["db"],
                            1))
     game.draw_list.append(
         arcade.create_line(x - 60, y - 60, x + 60, y + 60, colors["db"],
                            1))
     game.draw_list.append(
         arcade.create_ellipse_filled(x - 60, y + 60, 14, 14, colors["db"]))
     game.draw_list.append(
         arcade.create_ellipse_filled(x + 60, y + 60, 14, 14, colors["db"]))
     game.draw_list.append(
         arcade.create_ellipse_filled(x - 60, y - 60, 14, 14, colors["db"]))
     game.draw_list.append(
         arcade.create_ellipse_filled(x + 60, y - 60, 14, 14, colors["db"]))
     game.draw_list.append(
         arcade.create_ellipse_filled(x - 80, y, 14, 14, colors["db"]))
     game.draw_list.append(
         arcade.create_ellipse_filled(x + 80, y, 14, 14, colors["db"]))
     game.draw_list.append(
         arcade.create_ellipse_filled(x, y + 80, 14, 14, colors["db"]))
     game.draw_list.append(
         arcade.create_ellipse_filled(x, y - 80, 14, 14, colors["db"]))
     game.draw_list.append(
         arcade.create_ellipse_filled(x - 60, y + 60, 6, 6,
                                      colors["white"]))
     game.draw_list.append(
         arcade.create_ellipse_filled(x + 60, y + 60, 6, 6,
                                      colors["white"]))
     game.draw_list.append(
         arcade.create_ellipse_filled(x - 60, y - 60, 6, 6,
                                      colors["white"]))
     game.draw_list.append(
         arcade.create_ellipse_filled(x + 60, y - 60, 6, 6,
                                      colors["white"]))
     game.draw_list.append(
         arcade.create_ellipse_filled(x - 80, y, 6, 6, colors["white"]))
     game.draw_list.append(
         arcade.create_ellipse_filled(x + 80, y, 6, 6, colors["white"]))
     game.draw_list.append(
         arcade.create_ellipse_filled(x, y + 80, 6, 6, colors["white"]))
     game.draw_list.append(
         arcade.create_ellipse_filled(x, y - 80, 6, 6, colors["white"]))
     game.draw_list.append(
         arcade.create_ellipse_filled(x, y, 10, 10, colors["white"]))
コード例 #7
0
ファイル: pool.py プロジェクト: MariaShmilevich/pref
def make_pool(center_x, center_y, width, height):
    radius = 50

    top_right_x = center_x + width / 2
    top_right_y = center_y + height / 2

    bottom_right_x = center_x + width / 2
    bottom_right_y = center_y - height / 2

    center_left_x = center_x - width / 2
    center_left_y = center_y

    offset_x = center_x - width / 2
    offset_y = center_y - height / 2

    a = height * (1 / 5)
    p_width = width * (1 - a / height)
    p_height = height - 2 * a
    p_center_x = offset_x + p_width / 2
    p_center_y = center_y

    b = height / 3
    g_width = width * (1 - b / height)
    g_height = height - 2 * b
    g_center_x = offset_x + g_width / 2
    g_center_y = center_y

    shape_list = arcade.ShapeElementList()

    shape = arcade.create_rectangle_filled(center_x, center_y, width, height,
                                           arcade.color.WHITE)
    shape_list.append(shape)

    shape = arcade.create_ellipse_outline(center_x, center_y, radius, radius,
                                          arcade.color.BLACK)

    shape_list.append(shape)

    shape = arcade.create_line(center_x, center_y, top_right_x, top_right_y,
                               arcade.color.BLACK)

    shape_list.append(shape)

    shape = arcade.create_line(center_x, center_y, bottom_right_x,
                               bottom_right_y, arcade.color.BLACK)

    shape_list.append(shape)

    shape = arcade.create_line(center_x, center_y, center_left_x,
                               center_left_y, arcade.color.BLACK)

    shape_list.append(shape)

    shape = arcade.create_rectangle_outline(p_center_x, p_center_y, p_width,
                                            p_height, arcade.color.BLACK)

    shape_list.append(shape)

    shape = arcade.create_rectangle_outline(g_center_x, g_center_y, g_width,
                                            g_height, arcade.color.BLACK)

    shape_list.append(shape)

    shape = arcade.create_line(p_center_x, offset_y, p_center_x, offset_y + a,
                               arcade.color.BLACK)

    shape_list.append(shape)

    shape = arcade.create_line(p_center_x, offset_y + a + p_height, p_center_x,
                               offset_y + 2 * a + p_height, arcade.color.BLACK)

    shape_list.append(shape)

    shape = arcade.create_line(offset_x + p_width, center_y, offset_x + width,
                               center_y, arcade.color.BLACK)

    shape_list.append(shape)

    return shape_list
コード例 #8
0
arcade.draw_lrtb_rectangle_filled(10, 200, 300, 10, arcade.color.BLACK)
arcade.draw_rectangle_filled(390, 150, 45, 105, arcade.color.BLUSH)

arcade.draw_triangle_filled(500, 500, 400, 300, 600, 300, arcade.color.BLACK)
arcade.draw_xywh_rectangle_filled(500, 200, 100, 100, arcade.color.BLACK)

arcade.finish_render()
arcade.quick_run(3)

import arcade

arcade.open_window(800, 600, "Drawing Example")
arcade.set_background_color(arcade.color.WHITE)
my_list = arcade.ShapeElementList()
my_shape = arcade.create_ellipse_outline(50, 50, 20, 20, arcade.color.RED, 45)
my_list.append(my_shape)
my_shape = arcade.create_ellipse_filled(50, 50, 20, 20, arcade.color.RED, 2,
                                        45)
my_list.append(my_shape)
my_shape = arcade.create_rectangle_filled(250, 50, 20, 20, arcade.color.RED,
                                          45)
my_list.append(my_shape)
my_shape = arcade.create_rectangle_outline(450, 50, 20, 20, (127, 0, 27, 127),
                                           2, 45)
my_list.append(my_shape)
my_shape = arcade.create_lines_with_colors(
    ([0, 400], [700, 400]), ((127, 0, 27, 127), arcade.color.GREEN), 2)
my_list.append(my_shape)
my_list.move(5, 5)
arcade.start_render()