Skip to content

Commit

Permalink
Upgrade to pixi 8
Browse files Browse the repository at this point in the history
  • Loading branch information
Zikoat committed Aug 2, 2024
1 parent 6f314f1 commit de46769
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"fast-check": "^3.0.1",
"gsap": "^3.6.0",
"node-localstorage": "^2.2.1",
"pixi.js": "7.4.2",
"pixi.js": "^8.2.6",
"prettier": "^3.0.2",
"reflect-metadata": "^0.1.13",
"seedrandom": "^3.0.5",
Expand Down
2 changes: 1 addition & 1 deletion src/Controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const LONG_PRESS_DURATION = 200; // Duration in milliseconds to consider it a lo

type PixiEvent = {
data: {
getLocalPosition: (arg0: PIXI.Container<PIXI.DisplayObject>) => PIXI.Point;
getLocalPosition: (arg0: PIXI.Container) => PIXI.Point;
};
};

Expand Down
3 changes: 1 addition & 2 deletions src/Field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ import { Type } from "class-transformer";
import "reflect-metadata";
import { CellSprite } from "./CellSprite";
import { Layout } from "./Layouts";
const EventEmitter = PIXI.utils.EventEmitter;

export type ChunkedField = Record<number, Record<number, Chunk>>;

export class Field extends EventEmitter {
export class Field extends PIXI.EventEmitter {
public fieldData: ChunkedField;
public probability: number;
public safeRadius: number;
Expand Down
10 changes: 6 additions & 4 deletions src/FieldRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,17 @@ export class FieldRenderer extends PIXI.Application {
}
}

const app = new PIXI.Application({
// todo: bug when i reset the game to reset the camera to 0,0, then the cell at 0,0 flashes with the "zoom out to spawn" animation every time the camera moves a pixel.
const app = new PIXI.Application();

await app.init({
resizeTo: window,
backgroundColor: 0x1099bb,
});

// todo after migration to v8 change with canvas
document.body.appendChild(app.view as unknown as Node);
document.body.appendChild(app.canvas);

PIXI.BaseTexture.defaultOptions.scaleMode = PIXI.SCALE_MODES.NEAREST;
PIXI.TextureSource.defaultOptions.scaleMode = "nearest";

const fieldContainer = new PIXI.Container();
const clickHandler = new PIXI.Container();
Expand Down

0 comments on commit de46769

Please sign in to comment.