kaplay-ui 0.6.2 → 0.8.0
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 +3 -3
- package/index.js +5 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Kaplay UI is a component library designed specifically for KAPLAY. It will provi
|
|
|
12
12
|
|
|
13
13
|
## 📦 Installation
|
|
14
14
|
|
|
15
|
-
You can install
|
|
15
|
+
You can install Kaplay UI via npm:
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
npm install kaplay-ui
|
|
@@ -31,7 +31,7 @@ import { addTextButton } from "kaplay-ui";
|
|
|
31
31
|
kaplay();
|
|
32
32
|
|
|
33
33
|
// Add a UI button
|
|
34
|
-
addTextButton(
|
|
34
|
+
addTextButton("Start", () => go("main"));
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
## 📄 License
|
|
@@ -42,4 +42,4 @@ This project is licensed under the MIT License - see the LICENSE file for detail
|
|
|
42
42
|
|
|
43
43
|
Have questions or suggestions? Reach out via:
|
|
44
44
|
|
|
45
|
-
- GitHub Issues
|
|
45
|
+
- GitHub Issues
|
package/index.js
CHANGED
|
@@ -48,9 +48,12 @@ export const addTextButton = (
|
|
|
48
48
|
btn.add([text(txt, { size: txtSize }), anchor("center"), color(0, 0, 0)]);
|
|
49
49
|
|
|
50
50
|
// On click handler
|
|
51
|
-
btn.onClick(
|
|
51
|
+
btn.onClick(() => {
|
|
52
|
+
setCursor("default");
|
|
53
|
+
onClick();
|
|
54
|
+
});
|
|
52
55
|
|
|
53
|
-
btn.
|
|
56
|
+
btn.onHover(() => {
|
|
54
57
|
setCursor("pointer");
|
|
55
58
|
if (hoverFx) {
|
|
56
59
|
btn.scale = vec2(1.03);
|