You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.1 KiB
57 lines
1.1 KiB
'use strict';
|
|
|
|
let debug = false,
|
|
font: any;
|
|
|
|
let antiCacheQuery = '?_=' + new Date().getTime();
|
|
|
|
let manager: Manager;
|
|
|
|
const p = new p5((p: p5) => {
|
|
|
|
p.preload = () => {
|
|
|
|
font = p.loadFont('data/styles/fonts/Tajawal/Tajawal-Regular.ttf' + antiCacheQuery, (font: any) => {
|
|
console.log('Local font loaded: ', font);
|
|
}, (error: any) => {
|
|
console.log('Local font failed: ', error);
|
|
});
|
|
}
|
|
|
|
p.setup = () => {
|
|
canvasSetup();
|
|
eventsSetup();
|
|
manager = new Manager();
|
|
manager.init();
|
|
interfaceSetup();
|
|
}
|
|
|
|
p.draw = () => {
|
|
p.background(30);
|
|
|
|
if (manager){
|
|
manager.update();
|
|
manager.draw();
|
|
}
|
|
|
|
if (debug) debugInformation();
|
|
}
|
|
});
|
|
|
|
function debugInformation(){
|
|
|
|
}
|
|
|
|
function interfaceSetup(){
|
|
|
|
}
|
|
|
|
function canvasSetup(){
|
|
p.frameRate(60);
|
|
let element = $('#canvas_holder');
|
|
let w = element.width(),
|
|
h = element.height();
|
|
let canvas = p.createCanvas(w, h);
|
|
canvas.parent('canvas_holder');
|
|
p.textFont(font);
|
|
} |