wave-roll
Version:
JavaScript Library for Comparative MIDI Piano-Roll Visualization
58 lines • 1.69 kB
TypeScript
/**
* Sprite pool management for efficient rendering
*/
import * as PIXI from 'pixi.js';
/**
* Generic sprite pool manager for reusing display objects
*/
export declare class SpritePoolManager<T extends {
visible: boolean;
destroy: () => void;
}> {
private factory;
private container;
private onSetup?;
private pool;
constructor(factory: () => T, container: PIXI.Container, onSetup?: ((sprite: T, index: number) => void) | undefined);
/**
* Resize the pool to match target size
*/
resizePool(targetSize: number): T[];
/**
* Get a sprite at specific index
*/
getSprite(index: number): T | undefined;
/**
* Get all sprites in the pool
*/
getAllSprites(): T[];
/**
* Update all sprites with a callback
*/
updateAll(callback: (sprite: T, index: number) => void): void;
/**
* Hide sprites beyond a certain index
*/
hideAfterIndex(index: number): void;
/**
* Show all sprites
*/
showAll(): void;
/**
* Get current pool size
*/
get size(): number;
/**
* Clear and destroy all sprites
*/
destroyPool(): void;
}
/**
* Helper to create a sprite pool for PIXI.Sprite
*/
export declare function createSpritePool(container: PIXI.Container, texture?: PIXI.Texture, onSetup?: (sprite: PIXI.Sprite, index: number) => void): SpritePoolManager<PIXI.Sprite>;
/**
* Helper to create a sprite pool for PIXI.Graphics
*/
export declare function createGraphicsPool(container: PIXI.Container, onSetup?: (graphics: PIXI.Graphics, index: number) => void): SpritePoolManager<PIXI.Graphics>;
//# sourceMappingURL=sprite-pool-manager.d.ts.map