kaplay-ui 0.0.1 → 0.2.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/index.js +14 -3
  2. package/package.json +4 -3
package/index.js CHANGED
@@ -1,7 +1,18 @@
1
- import kaplay from "kaplay";
2
1
  import "kaplay/global";
3
2
 
4
- export const addButton = (w, h, x, y) => {
5
- const btn = add([rect(w, h), pos(x, y), area(), anchor("center")]);
3
+ export const addTextButton = (x, y, txt, f = () => {}) => {
4
+ const btn = add([
5
+ rect(240, 80, { radius: 8 }),
6
+ pos(x, y),
7
+ area(),
8
+ anchor("center"),
9
+ outline(4),
10
+ color(255, 255, 255),
11
+ ]);
12
+
13
+ btn.add([text(txt), anchor("center"), color(0, 0, 0)]);
14
+
15
+ btn.onClick(f);
16
+
6
17
  return btn;
7
18
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kaplay-ui",
3
- "version": "0.0.1",
3
+ "version": "0.2.0",
4
4
  "description": "UI components for KAPLAY",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -9,10 +9,11 @@
9
9
  },
10
10
  "keywords": [
11
11
  "kaplay",
12
- "ui"
12
+ "ui",
13
+ "games"
13
14
  ],
14
15
  "author": "Jonas Bak Phillipson",
15
- "license": "ISC",
16
+ "license": "MIT",
16
17
  "bugs": {
17
18
  "url": "https://github.com/jbakchr/kaplay-ui/issues"
18
19
  },