graphics module

graphics.get_key_state(key)

Gets the current state of a keyboard key.

Parameters: key: An ASCII key code or a Key value from the KeyCode enum.

Returns: 1 for pressed, 0 for not pressed

graphics.get_mouse_left_button()

Returns the state of the mouse’s left button.

Returns: 1 for pressed, 0 for not pressed

graphics.get_mouse_middle_button()

Returns the state of the mouse’s middle button.

Returns: 1 for pressed, 0 for not pressed

graphics.get_mouse_position()

Returns the mouse’s current position relative to the top left corner of the graphics window.

Returns: Tuple containing the X and Y coordinates of the mouse position

graphics.get_mouse_right_button()

Returns the state of the mouse’s right button.

Returns: 1 for pressed, 0 for not pressed

graphics.graphics_blit_enc(data, enc, x, y, width, height)

Blits a pixel array onto the graphics context.

Parameters: data: the 1D array of pixel data to blit enc: RGB for a Red-Green-Blue encoding or BGR for a Blue-Green-Red encoding x: The destination x coordinate of the blit (target) y: The destination y coordinate of the blit (target) width: The width of the area to blit height: The height of the area to blit

graphics.graphics_blit_region_enc(data, enc, sx, sy, ex, ey, width, height, dx, dy)

Blits a pixel array region onto the graphics context.

Parameters: data: the 1D array of pixel data to blit enc: RGB for a Red-Green-Blue encoding or BGR for a Blue-Green-Red encoding sx: The start x coordinate of the blit (source) sy: The start y coordinate of the blit (source) ex: The end x coordinate of the blit (source) ey: The end y coordinate of the blit (source) width: The width of the area to blit height: The height of the area to blit dx: The destination x coordinate of the blit (target) dy: The destination y coordinate of the blit (target)

graphics.graphics_circle(cx, cy, radius, r, g, b)

Draw an unfilled circle to the graphics window at the given coordinates and with the given radius.

Parameters: cx: the X coordinate of the center of the circle cy: the Y coordinate of the center of the circle radius: the radius of the circle to be drawn r: the red component of the drawing, from 0 to 255 g: the green component of the drawing, from 0 to 255 b: the blue component of the drawing, from 0 to 255