diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 42 |
1 files changed, 29 insertions, 13 deletions
@@ -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 | |
