ron example
This commit is contained in:
parent
7c4fe72178
commit
67e23ef490
2 changed files with 18 additions and 0 deletions
BIN
img/ron.png
Normal file
BIN
img/ron.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 400 KiB |
|
|
@ -86,6 +86,24 @@ export async function initDisplay() {
|
|||
// Préchargement des ressources si nécessaire
|
||||
// const deck = new Deck();
|
||||
// await preloadDeck(deck);
|
||||
// Charge et affiche l'image "ron.png" sur la partie gauche du canvas
|
||||
try {
|
||||
const ronImg = new Image();
|
||||
ronImg.src = "img/ron.png";
|
||||
await new Promise<void>((resolve) => {
|
||||
ronImg.onload = () => resolve();
|
||||
ronImg.onerror = () => {
|
||||
console.warn("Impossible de charger img/ron.png");
|
||||
resolve();
|
||||
};
|
||||
});
|
||||
|
||||
// Dessin de l'image en plein écran (remplit tout le canvas)
|
||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
||||
ctx.drawImage(ronImg, 0, 0, canvas.width, canvas.height);
|
||||
} catch (err) {
|
||||
console.error("Erreur lors du rendu de ron.png", err);
|
||||
}
|
||||
}
|
||||
|
||||
// Déclaration globale pour TypeScript
|
||||
|
|
|
|||
Loading…
Reference in a new issue