git auto update
This commit is contained in:
parent
017ca0b8a8
commit
1e0246507f
@ -3,52 +3,52 @@
|
||||
(async function() {
|
||||
if(typeof PIXI!="object") {
|
||||
if(typeof loadfail=="function") {
|
||||
loadfail("libmain.js: object PIXI(type of "+(typeof PIXI)+") is not defined");
|
||||
loadfail("libmain.js: PIXI(type of "+(typeof PIXI)+") is not an object");
|
||||
} else {
|
||||
window.alert("libmain.js: object PIXI(type of "+(typeof PIXI)+") is not defined");
|
||||
window.alert("libmain.js: PIXI(type of "+(typeof PIXI)+") is not an object");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var main_stage= {};
|
||||
main_stage.settings= {};
|
||||
main_stage.api= {};
|
||||
var libmain= {};
|
||||
libmain.settings= {};
|
||||
libmain.api= {};
|
||||
|
||||
/////////////////////////////////////// set default settings
|
||||
|
||||
main_stage.settings.fixed_ratio=16/9;
|
||||
main_stage.settings.use_fixed_aspect_ratio=true;
|
||||
libmain.settings.fixed_ratio=16/9;
|
||||
libmain.settings.use_fixed_aspect_ratio=true;
|
||||
|
||||
/////////////////////////////////////// init canvas and frame
|
||||
|
||||
console.log("[libmain] setting up basic pixi application...");
|
||||
// set up main canvas element
|
||||
main_stage.mainframe=document.getElementById("mainframe");
|
||||
main_stage.canvas=document.getElementById("maincanvas");
|
||||
if(main_stage.mainframe==null) {
|
||||
main_stage.mainframe=document.createElement("div");
|
||||
main_stage.mainframe.id="mainframe";
|
||||
document.body.appendChild(main_stage.mainframe);
|
||||
libmain.mainframe=document.getElementById("mainframe");
|
||||
libmain.canvas=document.getElementById("maincanvas");
|
||||
if(libmain.mainframe==null) {
|
||||
libmain.mainframe=document.createElement("div");
|
||||
libmain.mainframe.id="mainframe";
|
||||
document.body.appendChild(libmain.mainframe);
|
||||
}
|
||||
main_stage.mainframe.style.display="inline-block";
|
||||
main_stage.mainframe.style.zIndex=0;
|
||||
main_stage.mainframe.style.backgroundColor="#000000";
|
||||
if(main_stage.canvas==null) {
|
||||
main_stage.canvas=document.createElement("canvas");
|
||||
main_stage.canvas.id="maincanvas";
|
||||
main_stage.mainframe.appendChild(main_stage.canvas);
|
||||
libmain.mainframe.style.display="inline-block";
|
||||
libmain.mainframe.style.zIndex=0;
|
||||
libmain.mainframe.style.backgroundColor="#000000";
|
||||
if(libmain.canvas==null) {
|
||||
libmain.canvas=document.createElement("canvas");
|
||||
libmain.canvas.id="maincanvas";
|
||||
libmain.mainframe.appendChild(libmain.canvas);
|
||||
}
|
||||
main_stage.canvas.style.width="100%";
|
||||
main_stage.canvas.style.height="100%";
|
||||
main_stage.canvas.style.display="inline-block";
|
||||
main_stage.canvas.style.position="absolute";
|
||||
main_stage.canvas.style.zIndex=1;
|
||||
libmain.canvas.style.width="100%";
|
||||
libmain.canvas.style.height="100%";
|
||||
libmain.canvas.style.display="inline-block";
|
||||
libmain.canvas.style.position="absolute";
|
||||
libmain.canvas.style.zIndex=1;
|
||||
|
||||
// document resize handler
|
||||
main_stage.resize=function() {
|
||||
libmain.resize=function() {
|
||||
var res=[document.body.clientWidth, document.body.clientHeight, 0, 0];
|
||||
if(main_stage.settings.use_fixed_aspect_ratio) {
|
||||
res=libutil.calcresize(document.body.clientWidth, document.body.clientHeight, main_stage.settings.fixed_ratio);
|
||||
if(libmain.settings.use_fixed_aspect_ratio) {
|
||||
res=libutil.calcresize(document.body.clientWidth, document.body.clientHeight, libmain.settings.fixed_ratio);
|
||||
}
|
||||
mainframe.style.width=res[0]+"px";
|
||||
mainframe.style.height=res[1]+"px";
|
||||
@ -56,29 +56,39 @@
|
||||
mainframe.style.top=res[3]+"px";
|
||||
};
|
||||
|
||||
window.addEventListener("resize", main_stage.resize);
|
||||
main_stage.resize();
|
||||
window.addEventListener("resize", libmain.resize);
|
||||
libmain.resize();
|
||||
|
||||
// setup pixi application
|
||||
main_stage.renderer=await PIXI.autoDetectRenderer({
|
||||
libmain.renderer=await PIXI.autoDetectRenderer({
|
||||
"preference":"webgpu",
|
||||
"canvas":main_stage.canvas,
|
||||
"canvas":libmain.canvas,
|
||||
"antialias":true,
|
||||
"backgroundAlpha":0,
|
||||
"width":main_stage.width,
|
||||
"height":main_stage.height
|
||||
"width":libmain.width,
|
||||
"height":libmain.height
|
||||
});
|
||||
|
||||
main_stage.stage=new PIXI.Container();
|
||||
main_stage.stage.sortableChildren=true;
|
||||
main_stage.render=function() {
|
||||
requestAnimationFrame(main_stage.render);
|
||||
main_stage.renderer.render(main_stage.stage);
|
||||
libmain.stageroot=new PIXI.Container();
|
||||
libmain.stageroot.sortableChildren=true;
|
||||
libmain.render=function() {
|
||||
try {
|
||||
libmain.renderer.render(libmain.stageroot);
|
||||
} catch(e) {
|
||||
console.error(e);
|
||||
if(typeof loadfail=="function") {
|
||||
loadfail(e.message+"\n"+e.stack);
|
||||
} else {
|
||||
window.alert(e.message+"\n"+e.stack);
|
||||
}
|
||||
return;
|
||||
}
|
||||
requestAnimationFrame(libmain.render);
|
||||
};
|
||||
requestAnimationFrame(main_stage.render);
|
||||
requestAnimationFrame(libmain.render);
|
||||
|
||||
/////////////////////////////////////// end of setup
|
||||
|
||||
window.main_stage=main_stage;
|
||||
window.libmain=libmain;
|
||||
console.log("[libmain] all components initialized successfully.");
|
||||
})();
|
||||
|
@ -2,27 +2,27 @@
|
||||
|
||||
if(typeof libutil!="object") {
|
||||
if(typeof loadfail=="function") {
|
||||
loadfail("libtransition.js: object libutil(type of "+(typeof libutil)+") is not defined");
|
||||
loadfail("libtransition.js: libutil(type of "+(typeof libutil)+") is not an object");
|
||||
} else {
|
||||
window.alert("libtransition.js: object libutil(type of "+(typeof libutil)+") is not defined");
|
||||
window.alert("libtransition.js: libutil(type of "+(typeof libutil)+") is not an object");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(typeof Bezier!="function") {
|
||||
if(typeof loadfail=="function") {
|
||||
loadfail("libtransition.js: class Bezier(type of "+(typeof Bezier)+") is not defined");
|
||||
loadfail("libtransition.js: Bezier(type of "+(typeof Bezier)+") is not a function");
|
||||
} else {
|
||||
window.alert("libtransition.js: class Bezier is not defined");
|
||||
window.alert("libtransition.js: Bezier(type of "+(typeof Bezier)+") is not a function");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(typeof requestAnimationFrame!="function") {
|
||||
if(typeof loadfail=="function") {
|
||||
loadfail("libtransition.js: function requestAnimationFrame(type of "+(typeof requestAnimationFrame)+") is not defined");
|
||||
loadfail("libtransition.js: requestAnimationFrame(type of "+(typeof requestAnimationFrame)+") is not a function");
|
||||
} else {
|
||||
window.alert("libtransition.js: function requestAnimationFrame is not defined");
|
||||
window.alert("libtransition.js: requestAnimationFrame(type of "+(typeof requestAnimationFrame)+") is not a function");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user