snipplets.dev/projects/Pixi.js/app.js

44 lines
756 B
JavaScript
Raw Normal View History

2022-10-29 01:12:37 +03:00
const DEBUG = true;
let app;
/** PIXI and PIXI.Assets init */
2022-10-06 17:23:33 +03:00
window.onload = function() {
2022-10-29 01:12:37 +03:00
'use strict';
app = new PIXI.Application({
2022-10-22 23:38:49 +03:00
width: 640,
height: 360,
backgroundColor: 0x2a2a3a,
});
2022-10-06 17:23:33 +03:00
document.body.appendChild(app.view);
2022-10-29 01:12:37 +03:00
// PIXI.Assets.add('texture_name', '/assets/texture.png');
2022-10-06 17:23:33 +03:00
2022-10-29 01:12:37 +03:00
// let promise = PIXI.Assets.load(
// ['texture_name'],
// (progress) => {
// if (DEBUG)
// console.log(`Assets loading progress: ${progress * 100}%`);
// });
2022-10-06 17:23:33 +03:00
2022-10-29 01:12:37 +03:00
// promise.then((value) => {
// backgroundTextures = value;
// initLevel();
// });
}
2022-10-06 17:23:33 +03:00
2022-10-29 01:12:37 +03:00
/** Level init */
function initLevel() {
'use strict';
app.ticker.add(gameLoop);
}
/** Game loop */
function gameLoop(delta) {
'use strict';
//
2022-10-06 17:23:33 +03:00
}