Drawing - Batch#
arcade.Shape#
arcade.ShapeElementList#
- class arcade.ShapeElementList[source]#
A program can put multiple drawing primitives in a ShapeElementList, and then move and draw them as one. Do this when you want to create a more complex object out of simpler primitives. This also speeds rendering as all objects are drawn in one operation.
arcade.create_ellipse#
- arcade.create_ellipse(center_x: float, center_y: float, width: float, height: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], border_width: float = 1, tilt_angle: float = 0, num_segments: int = 32, filled=True) Shape [source]#
This creates an ellipse vertex buffer object (VBO).
The function returns a Shape object that can be drawn with
my_shape.draw()
. Don’t create the shape in the draw method, create it in the setup method and then draw it inon_draw
.For even faster performance, add multiple shapes into a ShapeElementList and draw that list. This allows nearly unlimited shapes to be drawn just as fast as one.
arcade.create_ellipse_filled#
- arcade.create_ellipse_filled(center_x: float, center_y: float, width: float, height: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], tilt_angle: float = 0, num_segments: int = 128) Shape [source]#
Create a filled ellipse. Or circle if you use the same width and height.
The function returns a Shape object that can be drawn with
my_shape.draw()
. Don’t create the shape in the draw method, create it in the setup method and then draw it inon_draw
.For even faster performance, add multiple shapes into a ShapeElementList and draw that list. This allows nearly unlimited shapes to be drawn just as fast as one.
arcade.create_ellipse_filled_with_colors#
- arcade.create_ellipse_filled_with_colors(center_x: float, center_y: float, width: float, height: float, outside_color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], inside_color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], tilt_angle: float = 0, num_segments: int = 32) Shape [source]#
Draw an ellipse, and specify inside/outside color. Used for doing gradients.
The function returns a Shape object that can be drawn with
my_shape.draw()
. Don’t create the shape in the draw method, create it in the setup method and then draw it inon_draw
.For even faster performance, add multiple shapes into a ShapeElementList and draw that list. This allows nearly unlimited shapes to be drawn just as fast as one.
arcade.create_ellipse_outline#
- arcade.create_ellipse_outline(center_x: float, center_y: float, width: float, height: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], border_width: float = 1, tilt_angle: float = 0, num_segments: int = 128) Shape [source]#
Create an outline of an ellipse.
The function returns a Shape object that can be drawn with
my_shape.draw()
. Don’t create the shape in the draw method, create it in the setup method and then draw it inon_draw
.For even faster performance, add multiple shapes into a ShapeElementList and draw that list. This allows nearly unlimited shapes to be drawn just as fast as one.
arcade.create_line#
- arcade.create_line(start_x: float, start_y: float, end_x: float, end_y: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], line_width: float = 1) Shape [source]#
Create a line to be rendered later. This works faster than draw_line because the vertexes are only loaded to the graphics card once, rather than each frame.
arcade.create_line_generic#
- arcade.create_line_generic(point_list: Sequence[Tuple[float, float]], color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], shape_mode: int, line_width: float = 1) Shape [source]#
This function is used by
create_line_strip
andcreate_line_loop
, just changing the OpenGL type for the line drawing.
arcade.create_line_generic_with_colors#
- arcade.create_line_generic_with_colors(point_list: Sequence[Tuple[float, float]], color_list: Iterable[Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]]], shape_mode: int, line_width: float = 1) Shape [source]#
This function is used by
create_line_strip
andcreate_line_loop
, just changing the OpenGL type for the line drawing.
arcade.create_line_loop#
- arcade.create_line_loop(point_list: Sequence[Tuple[float, float]], color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], line_width: float = 1)[source]#
Create a multi-point line loop to be rendered later. This works faster than draw_line because the vertexes are only loaded to the graphics card once, rather than each frame.
- Parameters:
point_list (PointList) –
color (Color) –
line_width (float) –
- Returns Shape:
arcade.create_line_strip#
- arcade.create_line_strip(point_list: Sequence[Tuple[float, float]], color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], line_width: float = 1)[source]#
Create a multi-point line to be rendered later. This works faster than draw_line because the vertexes are only loaded to the graphics card once, rather than each frame.
Internally, thick lines are created by two triangles.
- Parameters:
point_list (PointList) –
color (Color) –
line_width (PointList) –
- Returns Shape:
arcade.create_lines#
- arcade.create_lines(point_list: Sequence[Tuple[float, float]], color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], line_width: float = 1)[source]#
Create a multi-point line loop to be rendered later. This works faster than draw_line because the vertexes are only loaded to the graphics card once, rather than each frame.
- Parameters:
point_list (PointList) –
color (Color) –
line_width (float) –
- Returns Shape:
arcade.create_lines_with_colors#
arcade.create_polygon#
- arcade.create_polygon(point_list: Sequence[Tuple[float, float]], color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]])[source]#
Draw a convex polygon. This will NOT draw a concave polygon. Because of this, you might not want to use this function.
The function returns a Shape object that can be drawn with
my_shape.draw()
. Don’t create the shape in the draw method, create it in the setup method and then draw it inon_draw
.For even faster performance, add multiple shapes into a ShapeElementList and draw that list. This allows nearly unlimited shapes to be drawn just as fast as one.
- Parameters:
point_list (PointList) –
color –
- Returns Shape:
arcade.create_rectangle#
- arcade.create_rectangle(center_x: float, center_y: float, width: float, height: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], border_width: float = 1, tilt_angle: float = 0, filled=True) Shape [source]#
This function creates a rectangle using a vertex buffer object.
The function returns a Shape object that can be drawn with
my_shape.draw()
. Don’t create the shape in the draw method, create it in the setup method and then draw it inon_draw
.For even faster performance, add multiple shapes into a ShapeElementList and draw that list. This allows nearly unlimited shapes to be drawn just as fast as one.
arcade.create_rectangle_filled#
- arcade.create_rectangle_filled(center_x: float, center_y: float, width: float, height: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], tilt_angle: float = 0) Shape [source]#
Create a filled rectangle.
The function returns a Shape object that can be drawn with
my_shape.draw()
. Don’t create the shape in the draw method, create it in the setup method and then draw it inon_draw
.For even faster performance, add multiple shapes into a ShapeElementList and draw that list. This allows nearly unlimited shapes to be drawn just as fast as one.
arcade.create_rectangle_filled_with_colors#
- arcade.create_rectangle_filled_with_colors(point_list, color_list) Shape [source]#
This function creates one rectangle/quad using a vertex buffer object.
The function returns a Shape object that can be drawn with
my_shape.draw()
. Don’t create the shape in the draw method, create it in the setup method and then draw it inon_draw
.For even faster performance, add multiple shapes into a ShapeElementList and draw that list. This allows nearly unlimited shapes to be drawn just as fast as one.
arcade.create_rectangle_outline#
- arcade.create_rectangle_outline(center_x: float, center_y: float, width: float, height: float, color: Union[Tuple[int, int, int], List[int], Tuple[int, int, int, int]], border_width: float = 1, tilt_angle: float = 0) Shape [source]#
Create a rectangle outline.
The function returns a Shape object that can be drawn with
my_shape.draw()
. Don’t create the shape in the draw method, create it in the setup method and then draw it inon_draw
.For even faster performance, add multiple shapes into a ShapeElementList and draw that list. This allows nearly unlimited shapes to be drawn just as fast as one.
- Parameters:
Returns: Shape
arcade.create_rectangles_filled_with_colors#
- arcade.create_rectangles_filled_with_colors(point_list, color_list) Shape [source]#
This function creates multiple rectangle/quads using a vertex buffer object.
The function returns a Shape object that can be drawn with
my_shape.draw()
. Don’t create the shape in the draw method, create it in the setup method and then draw it inon_draw
.For even faster performance, add multiple shapes into a ShapeElementList and draw that list. This allows nearly unlimited shapes to be drawn just as fast as one.
arcade.create_triangles_filled_with_colors#
- arcade.create_triangles_filled_with_colors(point_list, color_list) Shape [source]#
This function creates multiple rectangle/quads using a vertex buffer object.
The function returns a Shape object that can be drawn with
my_shape.draw()
. Don’t create the shape in the draw method, create it in the setup method and then draw it inon_draw
.For even faster performance, add multiple shapes into a ShapeElementList and draw that list. This allows nearly unlimited shapes to be drawn just as fast as one.
arcade.get_rectangle_points#
- arcade.get_rectangle_points(center_x: float, center_y: float, width: float, height: float, tilt_angle: float = 0) Sequence[Tuple[float, float]] [source]#
Utility function that will return all four coordinate points of a rectangle given the x, y center, width, height, and rotation.
- Parameters:
Returns: PointList