Skip to content

Commit

Permalink
fix: add canvas type to Application constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
miltoncandelero authored Feb 28, 2024
1 parent 9b5d2a4 commit f4e2983
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion source/includes/_01-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Try hitting F12 and finding the Javascript Console. That will be your best frien
```ts
import { Application, Sprite } from 'pixi.js'

const app = new Application({
const app = new Application<HTMLCanvasElement>({
view: document.getElementById("pixi-canvas") as HTMLCanvasElement,
resolution: window.devicePixelRatio || 1,
autoDensity: true,
Expand Down
2 changes: 1 addition & 1 deletion source/includes/_02-putting-stuff-on-screen.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Finally, we have the root of everything, the granddaddy of them all, the greates
```ts
import { Application, Sprite, Container } from 'pixi.js'

const app = new Application({
const app = new Application<HTMLCanvasElement>({
view: document.getElementById("pixi-canvas") as HTMLCanvasElement,
resolution: window.devicePixelRatio || 1,
autoDensity: true,
Expand Down
2 changes: 1 addition & 1 deletion source/includes/_04-splitting-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ See how I passed the screen size as a parameter to the constructor and stored it
import { Application } from 'pixi.js'
import { Scene } from './scenes/Scene'; // This is the import statement

const app = new Application({
const app = new Application<HTMLCanvasElement>({
view: document.getElementById("pixi-canvas") as HTMLCanvasElement,
resolution: window.devicePixelRatio || 1,
autoDensity: true,
Expand Down
2 changes: 1 addition & 1 deletion source/includes/_11-recipes-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class Manager {
Manager._height = height;

// Create our pixi app
Manager.app = new Application({
Manager.app = new Application<HTMLCanvasElement>({
view: document.getElementById("pixi-canvas") as HTMLCanvasElement,
resolution: window.devicePixelRatio || 1,
autoDensity: true,
Expand Down
6 changes: 3 additions & 3 deletions source/includes/_12-recipes-resize.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class Manager {
Manager._width = width;
Manager._height = height;

Manager.app = new Application({
Manager.app = new Application<HTMLCanvasElement>({
view: document.getElementById("pixi-canvas") as HTMLCanvasElement,
resolution: window.devicePixelRatio || 1,
autoDensity: true,
Expand Down Expand Up @@ -121,7 +121,7 @@ export class Manager {

public static initialize(background: number): void {

Manager.app = new Application({
Manager.app = new Application<HTMLCanvasElement>({
view: document.getElementById("pixi-canvas") as HTMLCanvasElement,
resizeTo: window, // This line here handles the actual resize!
resolution: window.devicePixelRatio || 1,
Expand Down Expand Up @@ -168,7 +168,7 @@ You might realize that we no longer have `width` and `height` variables but inst
## Resolution (Device Pixel Ratio)

```ts
new Application({
new Application<HTMLCanvasElement>({
view: document.getElementById("pixi-canvas") as HTMLCanvasElement,
resolution: window.devicePixelRatio || 1, // This bad boy right here...
autoDensity: true, // and his friend
Expand Down

0 comments on commit f4e2983

Please sign in to comment.