Drawing - JakeTurner616/pygame-lua-bindings GitHub Wiki
draw_text(surface, x, y, text, font_name, font_size, hex_color)
Draw text on the given surface at the specified coordinates.
Parameters::
surface
: The surface to draw the text on.x
: The x-coordinate for the text position.y
: The y-coordinate for the text position.text
: The text string to draw.font_name
: The name of the font to use.font_size
: The size of the font.hex_color
: The color of the text in hexadecimal format or as a string:"red"
.
Returns:: The rectangle area of the rendered text.
Maps to::
pygame.font.SysFont
: This function creates a font object with the specified font name and size.pygame.Surface.blit
: This method blits the rendered text surface onto the target surface.
draw_circle(surface, hex_color, center, radius, width=0, draw_top_right=False, draw_top_left=False, draw_bottom_left=False, draw_bottom_right=False)
Draw a circle on the given surface.
Parameters::
surface
: The surface to draw the circle on.hex_color
: The color of the circle in hexadecimal format.center
: The center point of the circle as a tuple(x, y)
.radius
: The radius of the circle.width
: The thickness of the circle's border. 0 for filled circle.draw_top_right
: Flag to draw only the top-right quarter.draw_top_left
: Flag to draw only the top-left quarter.draw_bottom_left
: Flag to draw only the bottom-left quarter.draw_bottom_right
: Flag to draw only the bottom-right quarter.
Returns:: The rectangle area of the drawn circle.
Maps to::
pygame.draw.circle
: This function draws a circle onto a surface.
draw_rectangle(surface, x, y, width, height, hex_color, line_width=0, border_radius=0, border_top_left_radius=-1, border_top_right_radius=-1, border_bottom_left_radius=-1, border_bottom_right_radius=-1)
Draw a rectangle on the given surface at the specified coordinates.
Parameters::
surface
: The surface to draw the rectangle on.x
: The x-coordinate for the rectangle's top-left corner.y
: The y-coordinate for the rectangle's top-left corner.width
: The width of the rectangle.height
: The height of the rectangle.hex_color
: The color of the rectangle in hexadecimal format.line_width
: The thickness of the rectangle's border. 0 for filled rectangle.border_radius
: The radius of the rectangle's corners.border_top_left_radius
: The radius of the top-left corner.border_top_right_radius
: The radius of the top-right corner.border_bottom_left_radius
: The radius of the bottom-left corner.border_bottom_right_radius
: The radius of the bottom-right corner.
Returns:: The rectangle area of the drawn rectangle.
Maps to::
pygame.Rect
: This function creates a rectangle object with the specified position and dimensions.pygame.draw.rect
: This function draws a rectangle onto a surface.
draw_ellipse(surface, hex_color, rect, line_width=0)
Draw an ellipse inside the given rectangle area on the specified surface.
Parameters::
surface
: The surface to draw the ellipse on.hex_color
: The color of the ellipse in hexadecimal format.rect
: The rectangle defining the bounds of the ellipse.line_width
: The thickness of the ellipse's border. 0 for filled ellipse.
Returns:: The rectangle area of the drawn ellipse.
Maps to::
pygame.draw.ellipse
: This function draws an ellipse onto a surface.
draw_arc(surface, hex_color, rect, start_angle, stop_angle, line_width=1)
Draw an elliptical arc inside the given rectangle area on the specified surface.
Parameters::
surface
: The surface to draw the arc on.hex_color
: The color of the arc in hexadecimal format.rect
: The rectangle defining the bounds of the arc.start_angle
: The starting angle of the arc in radians.stop_angle
: The stopping angle of the arc in radians.line_width
: The thickness of the arc's border.
Returns:: The rectangle area of the drawn arc.
Maps to::
pygame.draw.arc
: This function draws an arc onto a surface.
draw_line(surface, hex_color, start_pos, end_pos, line_width=1)
Draw a straight line on the given surface between two points.
Parameters::
surface
: The surface to draw the line on.hex_color
: The color of the line in hexadecimal format.start_pos
: The starting position of the line(x, y)
.end_pos
: The ending position of the line(x, y)
.line_width
: The thickness of the line.
Returns:: The rectangle area of the drawn line.
Maps to::
pygame.draw.line
: This function draws a line onto a surface.
draw_lines(surface, hex_color, closed, points, line_width=1)
Draw multiple connected lines on the given surface.
Parameters::
surface
: The surface to draw the lines on.hex_color
: The color of the lines in hexadecimal format.closed
: Whether the lines should form a closed shape.points
: A list of points(x, y)
to connect with lines.line_width
: The thickness of the lines.
Returns:: The rectangle area of the drawn lines.
Maps to::
pygame.draw.lines
: This function draws connected lines onto a surface.
draw_aaline(surface, hex_color, start_pos, end_pos, blend=1)
Draw an anti-aliased line on the given surface between two points.
Parameters::
surface
: The surface to draw the line on.hex_color
: The color of the line in hexadecimal format.start_pos
: The starting position of the line(x, y)
.end_pos
: The ending position of the line(x, y)
.blend
: Whether to blend the colors.
Returns:: The rectangle area of the drawn line.
Maps to::
pygame.draw.aaline
: This function draws an anti-aliased line onto a surface.
draw_aalines(surface, hex_color, closed, points, blend=1)
Draw multiple connected anti-aliased lines on the given surface.
Parameters::
surface
: The surface to draw the lines on.hex_color
: The color of the lines in hexadecimal format.closed
: Whether the lines should form a closed shape.points
: A list of points(x, y)
to connect with lines.blend
: Whether to blend the colors.
Returns:: The rectangle area of the drawn lines.
Maps to::
pygame.draw.aalines
: This function draws connected anti-aliased lines onto a surface.
draw_polygon(surface, hex_color, points, width=0)
Draw a polygon on the given surface.
Parameters::
surface
: The surface to draw the polygon on.hex_color
: The color of the polygon in hexadecimal format.points
: A list of points(x, y)
to form the vertices of the polygon.width
: The thickness of the polygon's border. 0 for filled polygon.
Returns:: The rectangle area of the drawn polygon.
Maps to::
pygame.draw.polygon
: This function draws a polygon onto a surface.
clear_canvas(surface)
Clear the canvas by filling it with black.
Parameters::
surface
: The surface to clear.
Maps to::
pygame.Surface.fill
: This method fills the entire surface with the specified color.