@@ -71,6 +71,35 @@ function draw() {
71
71
}
72
72
```
73
73
74
+ ### Functions to draw shapes
75
+
76
+ You can use the following functions to draw shapes:
77
+
78
+ - `rect(x, y, width, height, color)` draw a rectangle outline
79
+ - `rectfill(x, y, width, height, color)` draw a color-filled rectangle
80
+ - `circ(x, y, radius, color)` draw a circle outline
81
+ - `circfill(x, y, radius, color)` draw a color-filled circle
82
+ - `oval(x, y, rx, ry, color)` draw a ellipse outline
83
+ - `ovalfill(x, y, rx, ry, color)` draw a color-filled ellipse
84
+
85
+ ```js
86
+ litecanvas()
87
+
88
+ function draw() {
89
+ cls(0)
90
+
91
+ // draw a color filled rectangle at x=0 and y=0
92
+ // with width=32 and height=32
93
+ // with white color
94
+ rectfill(0, 0, 32, 32, 3)
95
+
96
+ // draw a rectangle outline at x=64 and y=32
97
+ // with width=40 and height=30
98
+ // with red color
99
+ rect(64, 32, 40, 30, 4)
100
+ }
101
+ ```
102
+
74
103
### Click and Touch
75
104
76
105
```js
@@ -144,6 +173,9 @@ rotate(radians)
144
173
// Sets the alpha (opacity) value to apply when drawing new shapes and images
145
174
// Use a value between 0 and 1
146
175
alpha(value)
176
+
177
+ // Returns the canvas rendering context 2d
178
+ ctx()
147
179
```
148
180
149
181
### Variables declared by Litecanvas
@@ -159,5 +191,5 @@ Like `MX` and `MY`, Litecanvas also declares these other variables:
159
191
160
192
## Useful links
161
193
162
- - [Cheatsheet](https://litecanvas.js.org)
194
+ - [Cheatsheet](https://litecanvas.js.org/about.html )
163
195
- [Github](https://github.com/litecanvas/game-engine)
0 commit comments