Ramu.Utils.imageIsLoaded - HermesPasser/Ramu GitHub Wiki
static bool
Ramu.Utils.imageIsLoaded(img)
Parameters
image
img: Image to be checked.
Return
bool
: Return true if the image is loaded and false if not.
Description
Checks if an image is loaded.
You can test this snippet of code here.
Ramu.init();
const ramuLogo = Ramu.Utils.getImage("https://i.imgur.com/E0Z8YMr.png");
if (Ramu.Utils.imageIsLoaded(ramuLogo)){
let sprite = new Sprite(ramuLogo, 20, 20, 59, 70);
} else {
new Text('the ramuLogo is taking too long', 10, 100, 200);
}
const imgEmpty = Ramu.Utils.getImage("");
if (Ramu.Utils.imageIsLoaded(imgEmpty)){
let sprite2 = new Sprite(imgEmpty, 20, 20, 59, 70);
} else {
new Text('the imgEmpty is taking too long', 10, 200, 200);
}