Module gamejs/image
Load images as Surfaces.
Sounds & Images are loaded relative to your game's html page (the html which includes the GameJs code) or relative to the property window.$g.resourceBaseHref
if it is set.
Functions
- load(uriOrImage)
load (uriOrImage)
Load image and return it on a Surface.
All images must be preloaded before they can be used.
Example
gamejs.preload(["./images/ship.png", "./images/sunflower.png"]); // ...later... display.blit(gamejs.image.load('images/ship.png'))
Parameters
String|dom.Image | uriOrImage | resource uri for image |
Returns
gamejs.graphics.Surface | surface with the image on it. |