summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2025-08-09 07:41:59 +0200
committerMitja Felicijan <mitja.felicijan@gmail.com>2025-08-09 07:41:59 +0200
commit54e8cfcf42f2f3bb698c44e1ca6f799ebf0e809e (patch)
tree6929424a589c7866d27970ea340c20e57bb60c72
parente64ca6ffbbfc989d68a41f21a0f537bd2e9973ee (diff)
downloadbidi-54e8cfcf42f2f3bb698c44e1ca6f799ebf0e809e.tar.gz
Updated readme
-rw-r--r--README.md42
1 files 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 |