summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2025-08-09 07:38:02 +0200
committerMitja Felicijan <mitja.felicijan@gmail.com>2025-08-09 07:38:02 +0200
commite64ca6ffbbfc989d68a41f21a0f537bd2e9973ee (patch)
tree4c7b8881a8a3382b92abf169f18cb114c5006553
parent68584aabc41b906e4cd9fea6aa91db1d772e75e6 (diff)
downloadbidi-e64ca6ffbbfc989d68a41f21a0f537bd2e9973ee.tar.gz
Added documentation to readme
-rw-r--r--README.md143
1 files changed, 78 insertions, 65 deletions
diff --git a/README.md b/README.md
index 1406d70..185bc1e 100644
--- a/README.md
+++ b/README.md
@@ -17,77 +17,90 @@ sounds.
### Included functions
-| Function | Description | Arguments | Returns |
-|---------------------|-------------|-----------|---------|
-| `open_window` | | | |
-| `close_window` | | | |
-| `window_running` | | | bool |
-| `start_drawing` | | | |
-| `stop_drawing` | | | |
-| `clear_window` | | | |
-| `start_camera` | | | |
-| `stop_camera` | | | |
-| `move_camera` | | | |
-| `set_fps` | | | |
-| `get_fps` | | | number |
-| `get_dt` | | | number |
-| `get_width` | | | number |
-| `get_height` | | | number |
-| `draw_info` | | | |
-| `draw_rect` | | | |
-| `draw_text` | | | |
-| `draw_pixel` | | | |
-| `draw_line` | | | |
-| `draw_circle` | | | |
-| `draw_ellipse` | | | |
-| `draw_triangle` | | | |
-| `load_image` | | | |
-| `load_audio` | | | |
-| `button_down` | | | bool |
-| `button_pressed` | | | bool |
+| Function | Arguments | Returns |
+| ---------------- | ------------------------------------------------------------------------------------------- | -------- |
+| `open_window` | `number width`, `number height`, `string title` | |
+| `close_window` | | |
+| `window_running` | | `bool` |
+| `start_drawing` | | |
+| `stop_drawing` | | |
+| `clear_window` | `color color` | |
+| `start_camera` | | |
+| `stop_camera` | | |
+| `move_camera` | `number x`, `number y` | |
+| `set_fps` | `number fps` | |
+| `get_fps` | | `number` |
+| `get_dt` | | `number` |
+| `get_width` | | `number` |
+| `get_height` | | `number` |
+| `draw_info` | | |
+| `draw_rect` | `number x`, `number y`, `number width`, `number height`, `color color` | |
+| `draw_text` | `string text`, `number x`, `number y`, `number font_size`, `color color` | |
+| `draw_pixel` | `number x`, `number y`, `color color` | |
+| `draw_line` | `number x1`, `number y1`, `number x2`, `number y2`, `color color` | |
+| `draw_circle` | `number center_x`, `number center_y`, `number radius`, `color color` | |
+| `draw_ellipse` | `number center_x`, `number center_y`, `number radius_h`, `number radius_v`, `color color` | |
+| `draw_triangle` | `number x1`, `number y1`, `number x2`, `number y2`, `number x3`, `number y3`, `color color` | |
+| `load_image` | `TODO` | |
+| `load_audio` | `TODO` | |
+| `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 |
-|------------------|----------|------|-------------|----------|
-| button.PAD_UP | W | N/A | | |
-| button.PAD_DOWN | S | N/A | | |
-| button.PAD_LEFT | A | N/A | | |
-| button.PAD_RIGHT | D | N/A | | |
-| button.A | L | N/A | | |
-| button.B | P | N/A | | |
-| button.X | K | N/A | | |
-| button.Y | O | N/A | | |
-
+| ---------------- | -------- | ---- | ----------- | -------- |
+| button.PAD_UP | W | N/A | N/A | N/A |
+| button.PAD_DOWN | S | N/A | N/A | N/A |
+| button.PAD_LEFT | A | N/A | N/A | N/A |
+| button.PAD_RIGHT | D | N/A | N/A | N/A |
+| button.A | L | N/A | N/A | N/A |
+| button.B | P | N/A | N/A | N/A |
+| button.X | K | N/A | N/A | N/A |
+| button.Y | O | N/A | N/A | N/A |
+
### Default colors
-| Color Name | Red (r) | Green (g) | Blue (b) | Alpha (a) |
-|---------------------|---------|-----------|----------|-----------|
-| `color.LIGHTGRAY` | 200 | 200 | 200 | 255 |
-| `color.GRAY` | 130 | 130 | 130 | 255 |
-| `color.DARKGRAY` | 80 | 80 | 80 | 255 |
-| `color.YELLOW` | 253 | 249 | 0 | 255 |
-| `color.GOLD` | 255 | 203 | 0 | 255 |
-| `color.ORANGE` | 255 | 161 | 0 | 255 |
-| `color.PINK` | 255 | 109 | 194 | 255 |
-| `color.RED` | 230 | 41 | 55 | 255 |
-| `color.MAROON` | 190 | 33 | 55 | 255 |
-| `color.GREEN` | 0 | 228 | 48 | 255 |
-| `color.LIME` | 0 | 158 | 47 | 255 |
-| `color.DARKGREEN` | 0 | 117 | 44 | 255 |
-| `color.SKYBLUE` | 102 | 191 | 255 | 255 |
-| `color.BLUE` | 0 | 121 | 241 | 255 |
-| `color.DARKBLUE` | 0 | 82 | 172 | 255 |
-| `color.PURPLE` | 200 | 122 | 255 | 255 |
-| `color.VIOLET` | 135 | 60 | 190 | 255 |
-| `color.DARKPURPLE` | 112 | 31 | 126 | 255 |
-| `color.BEIGE` | 211 | 176 | 131 | 255 |
-| `color.BROWN` | 127 | 106 | 79 | 255 |
-| `color.DARKBROWN` | 76 | 63 | 47 | 255 |
-| `color.WHITE` | 255 | 255 | 255 | 255 |
-| `color.BLACK` | 0 | 0 | 0 | 255 |
-| `color.BLANK` | 0 | 0 | 0 | 0 |
-| `color.MAGENTA` | 255 | 0 | 255 | 255 |
+| Color Name | Red (r) | Green (g) | Blue (b) | Alpha (a) |
+| ------------------ | ------- | --------- | -------- | --------- |
+| `color.LIGHTGRAY` | 200 | 200 | 200 | 255 |
+| `color.GRAY` | 130 | 130 | 130 | 255 |
+| `color.DARKGRAY` | 80 | 80 | 80 | 255 |
+| `color.YELLOW` | 253 | 249 | 0 | 255 |
+| `color.GOLD` | 255 | 203 | 0 | 255 |
+| `color.ORANGE` | 255 | 161 | 0 | 255 |
+| `color.PINK` | 255 | 109 | 194 | 255 |
+| `color.RED` | 230 | 41 | 55 | 255 |
+| `color.MAROON` | 190 | 33 | 55 | 255 |
+| `color.GREEN` | 0 | 228 | 48 | 255 |
+| `color.LIME` | 0 | 158 | 47 | 255 |
+| `color.DARKGREEN` | 0 | 117 | 44 | 255 |
+| `color.SKYBLUE` | 102 | 191 | 255 | 255 |
+| `color.BLUE` | 0 | 121 | 241 | 255 |
+| `color.DARKBLUE` | 0 | 82 | 172 | 255 |
+| `color.PURPLE` | 200 | 122 | 255 | 255 |
+| `color.VIOLET` | 135 | 60 | 190 | 255 |
+| `color.DARKPURPLE` | 112 | 31 | 126 | 255 |
+| `color.BEIGE` | 211 | 176 | 131 | 255 |
+| `color.BROWN` | 127 | 106 | 79 | 255 |
+| `color.DARKBROWN` | 76 | 63 | 47 | 255 |
+| `color.WHITE` | 255 | 255 | 255 | 255 |
+| `color.BLACK` | 0 | 0 | 0 | 255 |
+| `color.BLANK` | 0 | 0 | 0 | 0 |
+| `color.MAGENTA` | 255 | 0 | 255 | 255 |
## Libraries & Assets