|
@@ -1,9 +1,10 @@
|
|
|
-import './app.css'
|
|
|
-import * as PIXI from 'pixi.js'
|
|
|
+import './app.css';
|
|
|
+import * as PIXI from 'pixi.js';
|
|
|
|
|
|
import Router from './Router.js'
|
|
|
import Menu from './views/Menu';
|
|
|
|
|
|
+let DATGUI = require('dat.gui');
|
|
|
|
|
|
class App {
|
|
|
constructor(){
|
|
@@ -13,23 +14,27 @@ class App {
|
|
|
this.app.view.style.display = 'none';
|
|
|
document.body.appendChild(this.app.view);
|
|
|
|
|
|
-
|
|
|
this._router = new Router(this.app.stage);
|
|
|
- this._router.addRoute('Login', new Menu(this.app, 'LoginMenuConfig.js'));
|
|
|
- this._router.addRoute('Test', new Menu(this.app, 'TestMenuConfig.js'));
|
|
|
+ this._gui = new DATGUI.default.GUI();
|
|
|
+ // this._router.addRoute('Login', new Menu(this.app, 'LoginMenuConfig.js'));
|
|
|
+ // this._router.addRoute('Test', new Menu(this.app, 'TestMenuConfig.js'));
|
|
|
}
|
|
|
destroy() {
|
|
|
this.app.view.style.display = 'none';
|
|
|
this.animateables = [];
|
|
|
+ this._router.clear();
|
|
|
}
|
|
|
init() {
|
|
|
this.app.view.style.display = 'block';
|
|
|
- this._router.go("Login");
|
|
|
+ //this._router.go("Login");
|
|
|
}
|
|
|
|
|
|
router() {
|
|
|
return this._router;
|
|
|
}
|
|
|
+ gui() {
|
|
|
+ return this._gui;
|
|
|
+ }
|
|
|
|
|
|
/////////
|
|
|
resize = () => {
|
|
@@ -38,6 +43,7 @@ class App {
|
|
|
this.app.renderer.view.style.width = w + 'px';
|
|
|
this.app.renderer.view.style.height = h + 'px';
|
|
|
}
|
|
|
+
|
|
|
step(dt) {
|
|
|
for (let i=0; i < this.animateables.length; i+=1) {
|
|
|
try{
|
|
@@ -49,15 +55,28 @@ class App {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ animate = (timestamp) => {
|
|
|
+ var progress = timestamp - this._time;
|
|
|
+ this._time = timestamp;
|
|
|
+ this.step(progress);
|
|
|
+ if(this._running) window.requestAnimationFrame(this.animate);
|
|
|
+ }
|
|
|
+
|
|
|
+ stop() {
|
|
|
+ this._running = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ start() {
|
|
|
+ var timeStampInMs = window.performance && window.performance.now && window.performance.timing && window.performance.timing.navigationStart ? window.performance.now() + window.performance.timing.navigationStart : Date.now();
|
|
|
+ this._time = timeStampInMs;
|
|
|
+ this._running = true;
|
|
|
+ }
|
|
|
+
|
|
|
add = (a) => {
|
|
|
this.animateables.push(a);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
const info = (e) => console.log(e);
|
|
|
-
|
|
|
-let singleton = null;
|
|
|
-function getSingleton () {
|
|
|
- return singleton = (singleton === null ? new App() : singleton);
|
|
|
-}
|
|
|
-export default getSingleton();
|
|
|
+export default new App();
|