kaplay-ui 0.9.3 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,18 +24,37 @@ npm install kaplay-ui
|
|
|
24
24
|
|
|
25
25
|
## Usage
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
### Buttons
|
|
28
|
+
|
|
29
|
+
### Text Button
|
|
30
|
+
|
|
31
|
+
Here's some quick examples of how to add text buttons using Kaplay UI:
|
|
28
32
|
|
|
29
33
|
```javascript
|
|
30
34
|
import kaplay from "kaplay";
|
|
31
35
|
import "kaplay/global";
|
|
32
36
|
|
|
33
|
-
import { addTextButton } from "kaplay-ui";
|
|
37
|
+
import { addTextButton } from "kaplay-ui/buttons";
|
|
34
38
|
|
|
35
39
|
kaplay();
|
|
36
40
|
|
|
37
|
-
// Add a
|
|
38
|
-
addTextButton("Start"
|
|
41
|
+
// Add a text button
|
|
42
|
+
addTextButton("Start");
|
|
43
|
+
|
|
44
|
+
// Add a text button with an onClick handler
|
|
45
|
+
addTextButton("Start", () => go("game"));
|
|
46
|
+
|
|
47
|
+
// Add a text button with x and y position
|
|
48
|
+
addTextButton("Start", () => go("game"), 200, 200);
|
|
49
|
+
|
|
50
|
+
// Add a text button with width and height
|
|
51
|
+
addTextButton("Start", () => go("game"), 200, 200, 200, 70);
|
|
52
|
+
|
|
53
|
+
// Add a text button with text size
|
|
54
|
+
addTextButton("Start", () => go("game"), 200, 200, 200, 70, 20);
|
|
55
|
+
|
|
56
|
+
// Add a text button with disabled hover effect
|
|
57
|
+
addTextButton("Start", () => go("game"), 200, 200, 200, 70, 20, false);
|
|
39
58
|
```
|
|
40
59
|
|
|
41
60
|
## License
|