pixijs / pixi-compressed-textures

Compressed textures and retina support for pixijs. Loader can choose textures depends on platform and rendering mode.
MIT License
93 stars 25 forks source link

pixi-compressed-textures TypeScript Definition #19

Open SirMaxeN opened 6 years ago

SirMaxeN commented 6 years ago

Is it possible to get somewhere, somehow typescript definition to pixi-compressed-texuters (d.ts)? Maybe someone already made it? Thanks for your attention. I’m looking forward to your reply.

ivanpopelyshev commented 6 years ago

It has to be small, there are only a few methods. DIY.

declare module PIXI.compressedTextures {
    detectExtensions(renderer: WebGLRenderer): Array[string];
}
hellraisercenobit commented 6 years ago

I got this error => Property 'before' does not exist on type 'Loader'. How we are supposed to override d.ts file from PIXI.js?

SirMaxeN commented 6 years ago

In pixi.js 4.5.3 loader has option pre, I use it to extensionChooser.

My whole d.ts file look like this: declare module PIXI.compressedTextures { function detectExtensions(renderer: WebGLRenderer): Array<string>; function extensionChooser(extension: any):any; function imageParser():any; }

and it was enough for me

hellraisercenobit commented 6 years ago

haaaaaaaaaa okkkkk I was thinking compressedTexture extends PIXI.js loader ^^. Thx you @SirMaxeN !

However in my case it's not enough In a more strict way we need:

declare module PIXI.compressedTextures { function extensionChooser(ext: string[]): Function; function detectExtensions(renderer: WebGLRenderer | CanvasRenderer): string[]; function imageParser(): Function; }