UNPKG

@tolokoban/tgd

Version:

ToloGameDev library for WebGL2

58 lines 1.65 kB
import type { WebglParams } from "../../context/webgl-params"; import type { TgdTexture2D } from "../../texture"; import { TgdPainter } from "../painter"; export interface TgdPainterBackgroundOptions { texture: TgdTexture2D; zoom: number; x: number; y: number; z: number; /** * By default, we preserve the aspect ratio. * But you can change `scaleX` and `scaleY` if you need * another behavior. */ scaleX: number; /** * By default, we preserve the aspect ratio. * But you can change `scaleX` and `scaleY` if you need * another behavior. */ scaleY: number; /** * Defaults to `cover`. * If you choose `contain`, the image will be totally visible * and taking the maximum space. */ mode: "cover" | "contain"; } export declare class TgdPainterBackground extends TgdPainter { private readonly context; texture: TgdTexture2D | undefined; private readonly program; private readonly vao; /** * With a zoom of **1**, the image will have the smaller size to cover * the whole scene. */ zoom: number; x: number; y: number; z: number; mode: "cover" | "contain"; constructor(context: { gl: WebGL2RenderingContext; webglParams: WebglParams; }, { texture, x, y, z, zoom, scaleX, scaleY, mode, }?: Partial<TgdPainterBackgroundOptions>); delete(): void; paint(): void; getScaleForCover(): { scaleX: number; scaleY: number; }; getScaleForContain(): { scaleX: number; scaleY: number; }; } //# sourceMappingURL=background.d.ts.map