kaplay-ui 0.9.2 β 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 +26 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,27 +22,46 @@ You can install Kaplay UI via npm:
|
|
|
22
22
|
npm install kaplay-ui
|
|
23
23
|
```
|
|
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
|
|
42
61
|
|
|
43
62
|
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
44
63
|
|
|
45
|
-
##
|
|
64
|
+
## Contact
|
|
46
65
|
|
|
47
66
|
Have questions or suggestions? Reach out via:
|
|
48
67
|
|