From 54e8cfcf42f2f3bb698c44e1ca6f799ebf0e809e Mon Sep 17 00:00:00 2001 From: Mitja Felicijan Date: Sat, 9 Aug 2025 07:41:59 +0200 Subject: Updated readme --- README.md | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 185bc1e..0977bf0 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,35 @@ sounds. ## Documentation +### Quick example + +```lua +-- mygame.lua +-- bidi -f mygame.lua + +open_window(800, 800, "My Game") +set_fps(60) + +while window_running() do + start_drawing() + clear_window(color.BLACK) + + draw_rect(100, 100, 300, 200, color.YELLOW) + draw_text("Label text", 10, 10, 20, color.VIOLET) + draw_line(400, 10, 500, 100, color.RED) + draw_circle(500, 500, 100, color.BLUE) + draw_ellipse(200, 500, 100, 50, color.BLUE) + draw_triangle(20, 20, 100, 20, 50, 100, color.BLUE) + draw_text(string.format("fps: %d", get_fps()), 10, 30, 20, color.VIOLET) + draw_text(string.format("dt: %.3f", get_dt()), 10, 50, 20, color.VIOLET) + + draw_info() + stop_drawing() +end + +close_window() +``` + ### Included functions | Function | Arguments | Returns | @@ -46,19 +75,6 @@ sounds. | `button_down` | `button button` | `bool` | | `button_pressed` | `button button` | `bool` | -**Short example of function use** - -```lua -draw_rect(100, 100, 300, 200, color.YELLOW) -draw_text("Label text", 10, 10, 20, color.VIOLET) -draw_line(400, 10, 500, 100, color.RED) -draw_circle(500, 500, 100, color.BLUE) -draw_ellipse(200, 500, 100, 50, color.BLUE) -draw_triangle(20, 20, 100, 20, 50, 100, color.BLUE) -draw_text(string.format("fps: %d", get_fps()), 10, 30, 20, color.VIOLET) -draw_text(string.format("dt: %.3f", get_dt()), 10, 50, 20, color.VIOLET) -``` - ### Controller mappings | Button | Keyboard | Xbox | Playstation | Nintendo | -- cgit v1.2.3