Added documentation to readme

Author Mitja Felicijan <mitja.felicijan@gmail.com> 2025-08-09 07:38:02 +0200
Committer Mitja Felicijan <mitja.felicijan@gmail.com> 2025-08-09 07:38:02 +0200
Commit e64ca6ffbbfc989d68a41f21a0f537bd2e9973ee (patch)
-rw-r--r-- README.md 143
1 files changed, 78 insertions, 65 deletions
diff --git a/README.md b/README.md
...
17
  
17
  
18
### Included functions
18
### Included functions
19
  
19
  
20
| Function            | Description | Arguments | Returns |
20
| Function         | Arguments                                                                                   | Returns  |
21
|---------------------|-------------|-----------|---------|
21
| ---------------- | ------------------------------------------------------------------------------------------- | -------- |
22
| `open_window`       |             |           |         |
22
| `open_window`    | `number width`, `number height`, `string title`                                             |          |
23
| `close_window`      |             |           |         |
23
| `close_window`   |                                                                                             |          |
24
| `window_running`    |             |           | bool    |
24
| `window_running` |                                                                                             | `bool`   |
25
| `start_drawing`     |             |           |         |
25
| `start_drawing`  |                                                                                             |          |
26
| `stop_drawing`      |             |           |         |
26
| `stop_drawing`   |                                                                                             |          |
27
| `clear_window`      |             |           |         |
27
| `clear_window`   | `color color`                                                                               |          |
28
| `start_camera`      |             |           |         |
28
| `start_camera`   |                                                                                             |          |
29
| `stop_camera`       |             |           |         |
29
| `stop_camera`    |                                                                                             |          |
30
| `move_camera`       |             |           |         |
30
| `move_camera`    | `number x`, `number y`                                                                      |          |
31
| `set_fps`           |             |           |         |
31
| `set_fps`        | `number fps`                                                                                |          |
32
| `get_fps`           |             |           | number  |
32
| `get_fps`        |                                                                                             | `number` |
33
| `get_dt`            |             |           | number  |
33
| `get_dt`         |                                                                                             | `number` |
34
| `get_width`         |             |           | number  |
34
| `get_width`      |                                                                                             | `number` |
35
| `get_height`        |             |           | number  |
35
| `get_height`     |                                                                                             | `number` |
36
| `draw_info`         |             |           |         |
36
| `draw_info`      |                                                                                             |          |
37
| `draw_rect`         |             |           |         |
37
| `draw_rect`      | `number x`, `number y`, `number width`, `number height`, `color color`                      |          |
38
| `draw_text`         |             |           |         |
38
| `draw_text`      | `string text`, `number x`, `number y`, `number font_size`, `color color`                    |          |
39
| `draw_pixel`        |             |           |         |
39
| `draw_pixel`     | `number x`, `number y`, `color color`                                                       |          |
40
| `draw_line`         |             |           |         |
40
| `draw_line`      | `number x1`, `number y1`, `number x2`, `number y2`, `color color`                           |          |
41
| `draw_circle`       |             |           |         |
41
| `draw_circle`    | `number center_x`, `number center_y`, `number radius`, `color color`                        |          |
42
| `draw_ellipse`      |             |           |         |
42
| `draw_ellipse`   | `number center_x`, `number center_y`, `number radius_h`, `number radius_v`, `color color`   |          |
43
| `draw_triangle`     |             |           |         |
43
| `draw_triangle`  | `number x1`, `number y1`, `number x2`, `number y2`, `number x3`, `number y3`, `color color` |          |
44
| `load_image`        |             |           |         |
44
| `load_image`     | `TODO`                                                                                      |          |
45
| `load_audio`        |             |           |         |
45
| `load_audio`     | `TODO`                                                                                      |          |
46
| `button_down`       |             |           | bool    |
46
| `button_down`    | `button button`                                                                             | `bool`   |
47
| `button_pressed`    |             |           | bool    |
47
| `button_pressed` | `button button`                                                                             | `bool`   |
  
48
  
  
49
**Short example of function use**
  
50
  
  
51
```lua
  
52
draw_rect(100, 100, 300, 200, color.YELLOW)
  
53
draw_text("Label text", 10, 10, 20, color.VIOLET)
  
54
draw_line(400, 10, 500, 100, color.RED)
  
55
draw_circle(500, 500, 100, color.BLUE)
  
56
draw_ellipse(200, 500, 100, 50, color.BLUE)
  
57
draw_triangle(20, 20, 100, 20, 50, 100, color.BLUE)
  
58
draw_text(string.format("fps: %d", get_fps()), 10, 30, 20, color.VIOLET)
  
59
draw_text(string.format("dt: %.3f", get_dt()), 10, 50, 20, color.VIOLET)
  
60
```
48
  
61
  
49
### Controller mappings
62
### Controller mappings
50
  
63
  
51
| Button           | Keyboard | Xbox | Playstation | Nintendo |
64
| Button           | Keyboard | Xbox | Playstation | Nintendo |
52
|------------------|----------|------|-------------|----------|
65
| ---------------- | -------- | ---- | ----------- | -------- |
53
| button.PAD_UP    | W        | N/A  |             |          |
66
| button.PAD_UP    | W        | N/A  | N/A         | N/A      |
54
| button.PAD_DOWN  | S        | N/A  |             |          |
67
| button.PAD_DOWN  | S        | N/A  | N/A         | N/A      |
55
| button.PAD_LEFT  | A        | N/A  |             |          |
68
| button.PAD_LEFT  | A        | N/A  | N/A         | N/A      |
56
| button.PAD_RIGHT | D        | N/A  |             |          |
69
| button.PAD_RIGHT | D        | N/A  | N/A         | N/A      |
57
| button.A         | L        | N/A  |             |          |
70
| button.A         | L        | N/A  | N/A         | N/A      |
58
| button.B         | P        | N/A  |             |          |
71
| button.B         | P        | N/A  | N/A         | N/A      |
59
| button.X         | K        | N/A  |             |          |
72
| button.X         | K        | N/A  | N/A         | N/A      |
60
| button.Y         | O        | N/A  |             |          |
73
| button.Y         | O        | N/A  | N/A         | N/A      |
61
  
74
                                                        
62
### Default colors
75
### Default colors
63
  
76
  
64
| Color Name          | Red (r) | Green (g) | Blue (b) | Alpha (a) |
77
| Color Name         | Red (r) | Green (g) | Blue (b) | Alpha (a) |
65
|---------------------|---------|-----------|----------|-----------|
78
| ------------------ | ------- | --------- | -------- | --------- |
66
| `color.LIGHTGRAY`   | 200     | 200       | 200      | 255       |
79
| `color.LIGHTGRAY`  | 200     | 200       | 200      | 255       |
67
| `color.GRAY`        | 130     | 130       | 130      | 255       |
80
| `color.GRAY`       | 130     | 130       | 130      | 255       |
68
| `color.DARKGRAY`    | 80      | 80        | 80       | 255       |
81
| `color.DARKGRAY`   | 80      | 80        | 80       | 255       |
69
| `color.YELLOW`      | 253     | 249       | 0        | 255       |
82
| `color.YELLOW`     | 253     | 249       | 0        | 255       |
70
| `color.GOLD`        | 255     | 203       | 0        | 255       |
83
| `color.GOLD`       | 255     | 203       | 0        | 255       |
71
| `color.ORANGE`      | 255     | 161       | 0        | 255       |
84
| `color.ORANGE`     | 255     | 161       | 0        | 255       |
72
| `color.PINK`        | 255     | 109       | 194      | 255       |
85
| `color.PINK`       | 255     | 109       | 194      | 255       |
73
| `color.RED`         | 230     | 41        | 55       | 255       |
86
| `color.RED`        | 230     | 41        | 55       | 255       |
74
| `color.MAROON`      | 190     | 33        | 55       | 255       |
87
| `color.MAROON`     | 190     | 33        | 55       | 255       |
75
| `color.GREEN`       | 0       | 228       | 48       | 255       |
88
| `color.GREEN`      | 0       | 228       | 48       | 255       |
76
| `color.LIME`        | 0       | 158       | 47       | 255       |
89
| `color.LIME`       | 0       | 158       | 47       | 255       |
77
| `color.DARKGREEN`   | 0       | 117       | 44       | 255       |
90
| `color.DARKGREEN`  | 0       | 117       | 44       | 255       |
78
| `color.SKYBLUE`     | 102     | 191       | 255      | 255       |
91
| `color.SKYBLUE`    | 102     | 191       | 255      | 255       |
79
| `color.BLUE`        | 0       | 121       | 241      | 255       |
92
| `color.BLUE`       | 0       | 121       | 241      | 255       |
80
| `color.DARKBLUE`    | 0       | 82        | 172      | 255       |
93
| `color.DARKBLUE`   | 0       | 82        | 172      | 255       |
81
| `color.PURPLE`      | 200     | 122       | 255      | 255       |
94
| `color.PURPLE`     | 200     | 122       | 255      | 255       |
82
| `color.VIOLET`      | 135     | 60        | 190      | 255       |
95
| `color.VIOLET`     | 135     | 60        | 190      | 255       |
83
| `color.DARKPURPLE`  | 112     | 31        | 126      | 255       |
96
| `color.DARKPURPLE` | 112     | 31        | 126      | 255       |
84
| `color.BEIGE`       | 211     | 176       | 131      | 255       |
97
| `color.BEIGE`      | 211     | 176       | 131      | 255       |
85
| `color.BROWN`       | 127     | 106       | 79       | 255       |
98
| `color.BROWN`      | 127     | 106       | 79       | 255       |
86
| `color.DARKBROWN`   | 76      | 63        | 47       | 255       |
99
| `color.DARKBROWN`  | 76      | 63        | 47       | 255       |
87
| `color.WHITE`       | 255     | 255       | 255      | 255       |
100
| `color.WHITE`      | 255     | 255       | 255      | 255       |
88
| `color.BLACK`       | 0       | 0         | 0        | 255       |
101
| `color.BLACK`      | 0       | 0         | 0        | 255       |
89
| `color.BLANK`       | 0       | 0         | 0        | 0         |
102
| `color.BLANK`      | 0       | 0         | 0        | 0         |
90
| `color.MAGENTA`     | 255     | 0         | 255      | 255       |
103
| `color.MAGENTA`    | 255     | 0         | 255      | 255       |
91
  
104
  
92
## Libraries & Assets
105
## Libraries & Assets
93
  
106
  
...