@urso/core 0.7.4 → 0.7.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@urso/core",
3
- "version": "0.7.4",
3
+ "version": "0.7.6",
4
4
  "description": "HTML5 game engine",
5
5
  "main": "build/js/index.js",
6
6
  "author": "Megbrimef",
package/src/js/app.js CHANGED
@@ -6,6 +6,9 @@ class App {
6
6
  this.setup = this.setup.bind(this);
7
7
  }
8
8
 
9
+ /**
10
+ * global init
11
+ */
9
12
  setup() {
10
13
  this.sayHello();
11
14
 
@@ -32,6 +35,7 @@ class App {
32
35
 
33
36
  //Extra
34
37
  Urso.browserEvents = Urso.getInstance('Extra.BrowserEvents');
38
+ this._addTimeouts();
35
39
 
36
40
  //libs
37
41
  Urso.cache = Urso.getInstance('Lib.Cache'); //all assets cache
@@ -67,13 +71,32 @@ class App {
67
71
  });
68
72
  }
69
73
 
74
+ /**
75
+ * log engine name and its version
76
+ */
70
77
  sayHello() {
71
78
  console.log(`%c ${String.fromCodePoint(0x1F43B)} Urso ${this.version} `, 'background: #222; color: #bada55');
72
79
  }
73
80
 
81
+ /**
82
+ * run default scene
83
+ */
74
84
  run() {
75
85
  Urso.scenes.display(Urso.config.defaultScene);
76
86
  }
87
+
88
+ /**
89
+ * add Urso.setTimeout && Urso.clearTimeout functions. It will helps to manage time
90
+ */
91
+ _addTimeouts() {
92
+ Urso.setTimeout = (callback, delay) => {
93
+ return gsap.delayedCall(delay / 1000, callback);
94
+ }
95
+
96
+ Urso.clearTimeout = (tween) => {
97
+ tween.kill();
98
+ }
99
+ }
77
100
  }
78
101
 
79
102
  module.exports = App;
@@ -14,7 +14,6 @@ require("pixi-text-input");
14
14
 
15
15
  import { gsap } from 'gsap';
16
16
  window.gsap = gsap;
17
- require('./setTimeout');
18
17
 
19
18
  import Howler from 'howler';
20
19
  window.Howler = Howler;
@@ -4,6 +4,14 @@ class ModulesAssetsModelsAtlas extends Urso.Core.Modules.Assets.BaseModel {
4
4
 
5
5
  this.type = Urso.types.assets.ATLAS;
6
6
  }
7
+
8
+ // cacheTextures: if true - add atlas parced textures in Urso textures cache with it's file name as asset key.
9
+ // Example - atlas texture with path 'atlasPath/image/image_01.png' will be saved in cache with a key 'image_01'.
10
+ setupParams(params) {
11
+ super.setupParams(params);
12
+
13
+ this.cacheTextures = Urso.helper.recursiveGet('cacheTextures', params, false);
14
+ }
7
15
  }
8
16
 
9
17
  module.exports = ModulesAssetsModelsAtlas;
@@ -117,6 +117,11 @@ class ModulesAssetsService {
117
117
  newFilename = folderPath + '/' + frame.filename;
118
118
 
119
119
  Urso.cache.addFile(newFilename, texture);
120
+
121
+ if(assetModel.cacheTextures) {
122
+ const textureKey = newFilename.split('/').pop().split('.')[0];
123
+ Urso.cache.addTexture(textureKey, texture);
124
+ }
120
125
  }
121
126
  }
122
127
  }
@@ -1,7 +0,0 @@
1
- Urso.setTimeout = (callback, delay) => {
2
- return gsap.delayedCall(delay / 1000, callback);
3
- }
4
-
5
- Urso.clearTimeout = (tween) => {
6
- tween.kill();
7
- }