async function loadImageAsync(url) {
    return new Promise((resolve, reject) => {
        const img = new Image();
        img.onload = () => resolve(img); // Resolve the promise when the image loads
        img.onerror = (error) => reject(new Error(`Failed to load image at ${url}`)); // Reject on error
        img.src = url; // Start loading the image
    });
}
export class GdImage {
    static async addImagesAsync(gdRoot) {
        const images = [
            "projectile.svg",
            "tower-0.svg",
            "cell-highlighted.svg",
            "cell-entry-1.svg",
            "cell-entry-2.svg",
            "cell-entry-3.svg",
            "cell-entry-4.svg",
            "cell-entry-6.svg",
            "cell-entry-8.svg",
            "cell-entry-12.svg",
            "cell-entry-16.svg",
            "cell-entry-24.svg",
            "cell-entry-32.svg",
            "cell-entry-33.svg",
            "cell-entry-48.svg",
            "cell-blocked-0.svg",
            "cell-blocked-1.svg",
            "cell-blocked-2.svg",
            "cell-blocked-3.svg",
            "cell-blocked-4.svg",
            "cell-blocked-5.svg",
            "cell-blocked-6.svg",
            "cell-blocked-7.svg",
            "cell-blocked-8.svg",
            "cell-blocked-9.svg",
            "cell-blocked-10.svg",
            "cell-blocked-11.svg",
            "cell-blocked-12.svg",
            "cell-blocked-13.svg",
            "cell-blocked-14.svg",
            "cell-blocked-15.svg",
            "cell-blocked-16.svg",
            "cell-blocked-17.svg",
            "cell-blocked-18.svg",
            "cell-blocked-19.svg",
            "cell-blocked-20.svg",
            "cell-blocked-21.svg",
            "cell-blocked-22.svg",
            "cell-blocked-23.svg",
            "cell-blocked-24.svg",
            "cell-blocked-25.svg",
            "cell-blocked-26.svg",
            "cell-blocked-27.svg",
            "cell-blocked-28.svg",
            "cell-blocked-29.svg",
            "cell-blocked-30.svg",
            "cell-blocked-31.svg",
            "cell-blocked-32.svg",
            "cell-blocked-33.svg",
            "cell-blocked-34.svg",
            "cell-blocked-35.svg",
            "cell-blocked-36.svg",
            "cell-blocked-37.svg",
            "cell-blocked-38.svg",
            "cell-blocked-39.svg",
            "cell-blocked-40.svg",
            "cell-blocked-41.svg",
            "cell-blocked-42.svg",
            "cell-blocked-43.svg",
            "cell-blocked-44.svg",
            "cell-blocked-45.svg",
            "cell-blocked-46.svg",
            "cell-blocked-47.svg",
            "cell-blocked-48.svg",
            "cell-blocked-49.svg",
            "cell-blocked-50.svg",
            "cell-blocked-51.svg",
            "cell-blocked-52.svg",
            "cell-blocked-53.svg",
            "cell-blocked-54.svg",
            "cell-blocked-55.svg",
            "cell-blocked-56.svg",
            "cell-blocked-57.svg",
            "cell-blocked-58.svg",
            "cell-blocked-59.svg",
            "cell-blocked-60.svg",
            "cell-blocked-61.svg",
            "cell-blocked-62.svg",
            "cell-blocked-63.svg",
            "cell.svg",
            "enemy-0.svg",
            "wall.png",
        ];
        for (const url of images)
            await this.loadAsync(gdRoot, url);
    }
    static async loadAsync(gdRoot, url) {
        const image = await loadImageAsync("images/" + url);
        gdRoot.images[url] = image;
    }
}
//# sourceMappingURL=GdImage.js.map