Fix: 修复python_skulpt板卡下sprite模块不可用

This commit is contained in:
王立帮
2024-08-13 12:27:31 +08:00
parent 89d4b5b52e
commit ddbf2d082d
6 changed files with 16 additions and 13 deletions

View File

@@ -571,8 +571,6 @@ SPRITE.ClearTimer = ()=>{
}
SPRITE.GameLoopDisplay = ()=>{
if( pyengine.programStatus['running'] === false)SPRITE.running = false;
else SPRITE.running = true;
if(SPRITE.processingDisplayEvent) {
const pSE = SPRITE.processingDisplayEvent;
switch (pSE.displayType) {
@@ -662,7 +660,7 @@ SPRITE.GameLoopDisplay = ()=>{
}
SPRITE.ChangeWidth = (w)=>{
const $canvas = $('#spriteContainer canvas');
const $canvas = $(SPRITE.renderer.view);
const canvasWidth = $canvas.width();
const canvasHeight = $canvas.height();
$canvas.width(w);
@@ -682,11 +680,13 @@ SPRITE.kill = ()=>{
SPRITE.ClearTimer();
}
SPRITE.runit = ()=>{
SPRITE.runit = (container) => {
const $container = $(container);
$container.empty();
// Keep the scale mode to nearest
PIXI.SCALE_MODES.DEFAULT = PIXI.SCALE_MODES.NEAREST;
SPRITE.renderer = PIXI.autoDetectRenderer(SPRITE.canvasWidth, SPRITE.canvasHeight,{backgroundColor : 0x00FFFFFF});
document.getElementById("spriteContainer").appendChild(SPRITE.renderer.view);
$container.append(SPRITE.renderer.view);
// Create SPRITE.stage container
// SPRITE.stage = new PIXI.Container();
SPRITE.pointer = {x:0, y:0};