@urso/core 0.9.3-dev → 0.9.5-dev

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/index.html ADDED
@@ -0,0 +1,63 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Document</title>
7
+ <style>
8
+ * {
9
+ margin: 0;
10
+ padding: 0;
11
+ box-sizing: border-box;
12
+ }
13
+ body {
14
+ background-color: #f0f0f0;
15
+ font-family: Arial, sans-serif;
16
+ color: #333;
17
+ }
18
+ </style>
19
+ </head>
20
+ <body>
21
+ <script src="./build/js/index.js"></script>
22
+ <script>
23
+ // Example of using the imported function
24
+ // Urso.runGame();
25
+ // return;
26
+ (async () => {
27
+ const app = new PIXI.Application();
28
+ await app.init({ background: "#1099bb", resizeTo: window });
29
+ document.body.appendChild(app.canvas);
30
+ const cntr = new PIXI.Graphics();
31
+ cntr.beginFill(0x66f542);
32
+ cntr.drawRect(0, 0, 100, 100);
33
+ cntr.endFill();
34
+ cntr.y = 100;
35
+ cntr.x = 100;
36
+ app.stage.addChild(cntr);
37
+
38
+ let from = { y: 100 };
39
+ let to = { y: 600 };
40
+
41
+ const run = () => {
42
+ const t = gsap.timeline();
43
+
44
+ t.to(from, {
45
+ ...to,
46
+ yoyo: true,
47
+ duration: 1,
48
+ onUpdate: () => {
49
+ cntr.y = from.y;
50
+ },
51
+ onComplete: () => {
52
+ cntr.y = 100;
53
+ from = { y: 100 };
54
+ to = { y: 600 };
55
+ run();
56
+ },
57
+ });
58
+ };
59
+ run();
60
+ })();
61
+ </script>
62
+ </body>
63
+ </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urso/core",
3
- "version": "0.9.3-dev",
3
+ "version": "0.9.5-dev",
4
4
  "description": "HTML5 game engine",
5
5
  "main": "build/js/index.js",
6
6
  "author": "Megbrimef",
@@ -9,7 +9,8 @@
9
9
  "scripts": {
10
10
  "dev": "vite",
11
11
  "build:prod": "vite build",
12
- "serve": "vite preview"
12
+ "serve": "vite preview",
13
+ "watch": "vite build --watch"
13
14
  },
14
15
  "repository": {
15
16
  "type": "git",
@@ -24,10 +25,11 @@
24
25
  },
25
26
  "homepage": "https://github.com/megbrimef/urso#readme",
26
27
  "dependencies": {
27
- "@esotericsoftware/spine-pixi-v8": "^4.2.80",
28
- "gsap": "^3.12.0",
29
- "howler": "^2.2.4",
30
- "pixi.js": "^8.9.1"
28
+ "pixi.js": "^8.10.2",
29
+ "@urso/revolt-fx": "^0.2.0",
30
+ "@esotericsoftware/spine-pixi-v8": "^4.2.84",
31
+ "gsap": "^3.13.0",
32
+ "howler": "^2.2.4"
31
33
  },
32
34
  "devDependencies": {
33
35
  "@vitejs/plugin-legacy": "^6.1.1",
@@ -11,16 +11,16 @@ class ComponentsDebugTemplate {
11
11
  name: 'debugCoords',
12
12
  text: 'x:0, y:0',
13
13
  fontFamily: 'Helvetica',
14
- fontSize: 15,
14
+ fontSize: 30,
15
15
  fill: '#00FF00'
16
16
  },
17
17
  {
18
18
  type: Urso.types.objects.TEXT,
19
19
  name: 'debugFps',
20
20
  text: 'fps: 0',
21
- y: 15,
21
+ y: 30,
22
22
  fontFamily: 'Helvetica',
23
- fontSize: 15,
23
+ fontSize: 30,
24
24
  fill: '#00FF00'
25
25
  },
26
26
  {
@@ -1,66 +1,45 @@
1
- import ComponentsBaseController from './../base/controller';
1
+ import ComponentsBaseController from "./../base/controller";
2
2
 
3
3
  class ComponentsLoaderController extends ComponentsBaseController {
4
+ loadUpdate(loadProgress) {
5
+ this.setLoadProgress(loadProgress);
6
+ }
4
7
 
5
- constructor(options) {
6
- super(options);
8
+ create() {
9
+ this.setMask();
10
+ }
7
11
 
8
- //load own assets
12
+ setMask() {
13
+ if (this.loaderBg && this.loaderBgMask)
14
+ this.loaderBg._baseObject.mask = this.loaderBgMask._baseObject;
15
+ }
9
16
 
10
- //then create loader objects
11
- Urso.objects.create(this.getInstance('Template').objects);
12
- }
17
+ formatAmountText(text) {
18
+ return `${text}%`;
19
+ }
13
20
 
14
- assetsMount() {
15
- return false;
16
- }
21
+ setLoadProgress(val) {
22
+ if (!this.componentCreated) return;
17
23
 
18
- objectsMount() {
19
- return false;
20
- }
24
+ this.loaderBgMask._baseObject.scale.x = val;
25
+ this.loadAmountText.text = this.formatAmountText(val);
26
+ }
21
27
 
22
- loadUpdate(loadProgress) {
23
- this.setLoadProgress(loadProgress);
24
- }
28
+ get componentCreated() {
29
+ return !!this.loadAmountText && !!this.loaderBg && !!this.loaderBgMask;
30
+ }
25
31
 
26
- create() {
27
- this.setMask();
28
- //todo remove all objects
29
- }
32
+ get loadAmountText() {
33
+ return Urso.findOne(".loadAmountText");
34
+ }
30
35
 
31
- setMask() {
32
- if (this.loaderBg && this.loaderBgMask)
33
- this.loaderBg._baseObject.mask = this.loaderBgMask._baseObject
34
- }
35
-
36
- formatAmountText(text) {
37
- return `${text}%`;
38
- }
39
-
40
- setLoadProgress(val) {
41
- if (!this.componentCreated)
42
- return;
43
-
44
- this.loaderBgMask._baseObject.scale.x = val;
45
- this.loadAmountText.text = this.formatAmountText(val);
46
- }
47
-
48
- get componentCreated() {
49
- return !!this.loadAmountText && !!this.loaderBg && !!this.loaderBgMask;
50
- }
51
-
52
- get loadAmountText() {
53
- return Urso.findOne('.loadAmountText');
54
- }
55
-
56
- get loaderBg() {
57
- return Urso.findOne('^loaderBg');
58
- }
59
-
60
- get loaderBgMask() {
61
- return Urso.findOne('^loaderBgMask');
62
- }
36
+ get loaderBg() {
37
+ return Urso.findOne("^loaderBg");
38
+ }
63
39
 
40
+ get loaderBgMask() {
41
+ return Urso.findOne("^loaderBgMask");
42
+ }
64
43
  }
65
44
 
66
45
  export default ComponentsLoaderController;
@@ -4,66 +4,78 @@ class ComponentsLoaderTemplate {
4
4
  '.loadingTextStyle': {
5
5
  fill: 0xFFFFFF,
6
6
  fontSize: 32,
7
- fontWeight: 'bold'
7
+ fontWeight: 'bold',
8
+ fontStyle: 'italic',
8
9
  }
9
10
  };
10
11
 
11
12
  this.assets = [];
12
13
 
13
14
  this.objects = [
14
- {
15
- type: Urso.types.objects.CONTAINER,
16
- name: 'loaderContainer',
17
- contents: [
18
- {
19
- type: Urso.types.objects.GRAPHICS,
20
- name: 'bgLoader',
21
- figure: {
22
- rectangle: [0, 20, 500, 20],
23
- fillColor: 0x66f542
24
- }
25
- },
26
- {
27
- type: Urso.types.objects.CONTAINER,
28
- contents: [
29
- {
30
- type: Urso.types.objects.GRAPHICS,
31
- figure: {
32
- rectangle: [4, 24, 492, 13],
33
- }
34
- },
35
- {
36
- type: Urso.types.objects.GRAPHICS,
37
- name: 'loaderBg',
38
- figure: {
39
- rectangle: [4, 24, 492, 13],
40
- fillColor: 0x66f542
41
- }
42
- },
43
- {
44
- type: Urso.types.objects.GRAPHICS,
45
- name: 'loaderBgMask',
46
- figure: {
47
- rectangle: [4, 24, 492, 13]
48
- }
49
- },
50
- {
51
- type: Urso.types.objects.CONTAINER,
52
- x: 260,
53
- y: 50,
54
- contents: [
55
- {
56
- type: Urso.types.objects.TEXT,
57
- class: 'loadingTextStyle loadAmountText',
58
- anchorX: 0.5,
59
- text: '100%'
60
- }
61
- ]
62
- }
63
- ]
64
- }
65
- ]
66
- }
15
+ // {
16
+ // type: Urso.types.objects.GRAPHICS,
17
+ // x: 100,
18
+ // y: 100,
19
+ // name: 'qqqq',
20
+ // figure: {
21
+ // rectangle: [0, 0, 100, 100],
22
+ // fillColor: 0x66f542
23
+ // }
24
+ // },
25
+ // {
26
+ // type: Urso.types.objects.CONTAINER,
27
+ // name: 'loaderContainer',
28
+ // visible: false,
29
+ // contents: [
30
+ // {
31
+ // type: Urso.types.objects.GRAPHICS,
32
+ // name: 'bgLoader',
33
+ // figure: {
34
+ // rectangle: [0, 20, 500, 20],
35
+ // fillColor: 0x66f542
36
+ // }
37
+ // },
38
+ // {
39
+ // type: Urso.types.objects.CONTAINER,
40
+ // contents: [
41
+ // {
42
+ // type: Urso.types.objects.GRAPHICS,
43
+ // figure: {
44
+ // rectangle: [4, 24, 492, 13],
45
+ // }
46
+ // },
47
+ // {
48
+ // type: Urso.types.objects.GRAPHICS,
49
+ // name: 'loaderBg',
50
+ // figure: {
51
+ // rectangle: [4, 24, 492, 13],
52
+ // fillColor: 0x66f542
53
+ // }
54
+ // },
55
+ // {
56
+ // type: Urso.types.objects.GRAPHICS,
57
+ // name: 'loaderBgMask',
58
+ // figure: {
59
+ // rectangle: [4, 24, 492, 13]
60
+ // }
61
+ // },
62
+ // {
63
+ // type: Urso.types.objects.CONTAINER,
64
+ // x: 260,
65
+ // y: 50,
66
+ // contents: [
67
+ // {
68
+ // type: Urso.types.objects.TEXT,
69
+ // class: 'loadingTextStyle loadAmountText',
70
+ // anchorX: 0.5,
71
+ // text: '100%'
72
+ // }
73
+ // ]
74
+ // }
75
+ // ]
76
+ // }
77
+ // ]
78
+ // }
67
79
  ];
68
80
  };
69
81
  };