Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hubol committed Sep 5, 2024
1 parent dcf15b6 commit 6971402
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 16 deletions.
1 change: 0 additions & 1 deletion src/igua/core/scene/obj-solid-overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export function objSolidOverlay() {
dirty = true;
await lerp(g, 'alpha').to(value).over(ms);
c.destroy();
console.log('c.destroy()');
})
.show(g);
return new Promise<void>(r => container!.once('destroyed', r));
Expand Down
9 changes: 0 additions & 9 deletions src/igua/launch/prepare-game-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ export function prepareGameEngine(renderer: PixiRenderer) {

const animator = new Animator(60);

const immediates: ((...args: any[]) => any)[] = [];
globalThis.setImmediate = function setImmediate(fn: (...args: any[]) => any) {
immediates.push(fn);
}

setIguaGlobals(renderer, rootStage, iguaInput, forceGameLoop, animator.start.bind(animator), devKeyListener);

iguaInput.start();
Expand All @@ -53,10 +48,6 @@ export function prepareGameEngine(renderer: PixiRenderer) {
if (Environment.isDev)
devKeyListener.tick();
flashPreventer.tick();

while (immediates.length) {
immediates.shift()!();
}
}
while (gameLoopForced);

Expand Down
2 changes: 1 addition & 1 deletion src/igua/ui/iguana-designer/obj-ui-iguana-designer-root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ function objIguanaPreview(minX = 102, maxX = 253) {
if (bigPuppet.gait > 0)
bigPuppet.pedometer += 0.1;
})
.async(async ($c) => {
.async(async () => {
while (true) {
await sleep(1000);
await lerp(bigPuppet, 'ducking').to(1).over(300);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/extensions/pixi-displayobject-async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface DisplayObjectPrivate {

Object.defineProperties(DisplayObject.prototype, {
async: {
value: function (this: DisplayObject & DisplayObjectPrivate, asyncFn: (self?: any, c?: any) => unknown) {
value: function (this: DisplayObject & DisplayObjectPrivate, asyncFn: (self?: any, $c?: any) => unknown) {
if (asyncFn.length)
asyncFn = asyncFn.bind(null, this, this);

Expand Down
1 change: 0 additions & 1 deletion src/lib/game-engine/promise/asshat-microtasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export class AsshatMicrotasks {
const task = this._tasks[i];

if (task.context.cancellationToken.rejectIfCancelled(task.reject)) {
console.log(task.context);
free(task);
shift += 1;
i += 1;
Expand Down
6 changes: 3 additions & 3 deletions src/lib/game-engine/promise/sleep.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { wait } from "./wait";

export function sleep(ms: number) {
export async function sleep(ms: number) {
if (ms <= 0)
return Promise.resolve();
return;

// TODO Fixed FPS
// 60frames / 1000ms
ms *= 0.06;
return wait(() => --ms <= 0);
await wait(() => --ms <= 0);
}

0 comments on commit 6971402

Please sign in to comment.