49 lines
1.8 KiB
JavaScript
49 lines
1.8 KiB
JavaScript
(function() {
|
|
if(typeof PIXI!="object") {
|
|
if(typeof loadfail=="function") {
|
|
loadfail("libtapfx.js: PIXI(type of "+(typeof PIXI)+") is not an object");
|
|
} else {
|
|
window.alert("libtapfx.js: PIXI(type of "+(typeof PIXI)+") is not an object");
|
|
}
|
|
return;
|
|
}
|
|
if(typeof libmain!="object") {
|
|
if(typeof loadfail=="function") {
|
|
loadfail("libtapfx.js: libmain(type of "+(typeof libmain)+") is not an object");
|
|
} else {
|
|
window.alert("libtapfx.js: libmain(type of "+(typeof libmain)+") is not an object");
|
|
}
|
|
return;
|
|
}
|
|
|
|
var libtapfx= {};
|
|
|
|
libmain.scenes.tap_fx.root.interactiveChildren=false;
|
|
libmain.scenes.tap_fx.root.eventMode="static";
|
|
libmain.scenes.tap_fx.root.on("tap", add_tap_fx);
|
|
libmain.scenes.tap_fx.root.on("mousedown", add_tap_fx);
|
|
|
|
libmain.scenes.tap_fx.judge_bg=new PIXI.Sprite({"texture": PIXI.Texture.WHITE});
|
|
libmain.scenes.tap_fx.judge_bg.x=0;
|
|
libmain.scenes.tap_fx.judge_bg.y=0;
|
|
libmain.scenes.tap_fx.judge_bg.anchor.set(0, 0);
|
|
|
|
libmain.scenes.tap_fx.root.addChildAt(libmain.scenes.tap_fx.judge_bg, 0);
|
|
|
|
//libmain.settings.hud.show_tapfx
|
|
|
|
// resize handler
|
|
libtapfx.onresize=function() {
|
|
var res=[document.body.clientWidth, document.body.clientHeight, 0, 0];
|
|
if(libmain.settings.render.use_fixed_aspect_ratio) {
|
|
res=libutil.calcresize(document.body.clientWidth, document.body.clientHeight, libmain.settings.render.fixed_ratio);
|
|
}
|
|
libmain.scenes.tap_fx.judge_bg.width=res[0];
|
|
libmain.scenes.tap_fx.judge_bg.height=res[1];
|
|
};
|
|
window.addEventListener("resize", libtapfx.onresize);
|
|
requestAnimationFrame(libtapfx.onresize);
|
|
|
|
window.libtapfx=libtapfx;
|
|
console.log("[libtapfx] initialized successfully.");
|
|
})(); |