kaplay-ui 0.11.0 → 0.12.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.
Files changed (2) hide show
  1. package/buttons/index.js +9 -7
  2. package/package.json +1 -1
package/buttons/index.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import "kaplay/global";
2
2
 
3
3
  /**
4
- * Adds a clickable button with custom text
4
+ * Adds a text button with shadow and hover effect
5
5
  * @param {string} txt - Button text to display
6
6
  * @param {number} x - The x postion to set (default is center().x).
7
7
  * @param {number} y - The x postion to set (default is center().y)
8
- * @param {number} w - Width of button (default is 120)
9
- * @param {number} h - Height of button (default is 50)
8
+ * @param {number} width - Width of button (default is 120)
9
+ * @param {number} height - Height of button (default is 50)
10
+ * @param {number} btnRadius - Border radius of button (default is 8)
10
11
  * @param {number} txtSize - Text size of button (default is 15)
11
12
  * @param {boolean} [hoverFx] - Add hover effect (default is true)
12
13
  * @returns {GameObj}
@@ -15,14 +16,15 @@ export const addTextButton = (
15
16
  txt,
16
17
  x = center().x,
17
18
  y = center().y,
18
- w = 120,
19
- h = 50,
19
+ width = 120,
20
+ height = 50,
21
+ btnRadius = 8,
20
22
  txtSize = 15,
21
23
  hoverFx = true
22
24
  ) => {
23
25
  // Shadow effect
24
26
  const shadow = add([
25
- rect(w, h, { radius: 8 }),
27
+ rect(width, height, { radius: btnRadius }),
26
28
  pos(x + 2, y + 2),
27
29
  area(),
28
30
  scale(1),
@@ -33,7 +35,7 @@ export const addTextButton = (
33
35
 
34
36
  // Button
35
37
  const btn = add([
36
- rect(w, h, { radius: 8 }),
38
+ rect(width, height, { radius: btnRadius }),
37
39
  pos(x, y),
38
40
  area(),
39
41
  scale(1),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kaplay-ui",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "UI components for KAPLAY",
5
5
  "main": "index.js",
6
6
  "repository": {