pylegame
A high-performance 2D game engine module based on Ebitengine.
| Name | Summary |
|---|---|
| debug_print | Draws a quick debug string at the top-left of the screen. |
| draw_image | Draws an image onto the screen at the specified coordinates. |
| draw_rect | Draws a filled rectangle using the vector engine. |
| draw_text | Draws text using a specific font and color. |
| get_fps | Returns the current actual frames per second. |
| init | Initializes the game window with the given size and title. |
| is_key_pressed | Returns true if the specified keyboard key is currently held down. |
| load_font | Loads a TTF or OTF font file. |
| load_image | Loads an image from the specified file path. |
| measure_text | Returns the dimensions of the text if rendered with the given font. |
| run | Starts the game loop. |
fn debug_print(screen, text) -> null
Draws a quick debug string at the top-left of the screen.
Parameters
| screen | The screen image. |
| text | The text to print. |
null
fn draw_image(screen, image, x, y) -> null
Draws an image onto the screen at the specified coordinates.
Parameters
| screen | The target screen image. |
| image | The image to draw. |
| x | X coordinate. |
| y | Y coordinate. |
null
fn draw_rect(screen, x, y, w, h, r, g, b, a) -> null
Draws a filled rectangle using the vector engine.
Parameters
| screen | The target screen image. |
| x | X position. |
| y | Y position. |
| w | Width. |
| h | Height. |
| r, g, b, a | Color components (0-255). |
null
fn draw_text(screen, font, text, x, y, r, g, b, a) -> null
Draws text using a specific font and color.
Parameters
| screen | The target screen image. |
| font | The Font object to use. |
| text | The string to draw. |
| x | X coordinate. |
| y | Y coordinate. |
| r, g, b, a | Optional color components (0-255). |
null
fn get_fps() -> float
Returns the current actual frames per second.
Returns
float
fn init(width, height, title) -> null
Initializes the game window with the given size and title.
Parameters
| width | Window width in pixels. |
| height | Window height in pixels. |
| title | Window title string. |
null
fn is_key_pressed(key) -> bool
Returns true if the specified keyboard key is currently held down.
Parameters
| key | Key name (e.g. 'SPACE', 'A', 'UP'). |
bool
Loads an image from the specified file path.
Parameters
| path | Path to image file. |
result<UserObject>