To render a game for the browser use the
Render the game to a canvas. Can return an error if WebGL features are not supported.
game: Your Top-Level Game Sprite called with its props passed in, e.g.
options: (Optional) An object with the following properties:
dimensions: (Optional) A string that is either:
"game-coords": (default) Use the game coordinates as pixels in the browser.
"scale-up": Scales the game so that it fills up the browser window.
nativeSpriteMap: (Optional) A map of Native Sprite names and their web implementation.
canvas: (Optional) A canvas element to render to. If omitted, Replay will create a canvas in the document.
windowSize: (Optional) An object with width and height fields. Use to override the view size, instead of using the window size.
imageResolution: (Optional) Resolution of images provided in assets. E.g. for a DPI of 3 a 30 game coordinate image would be 90 x 90px. Default
maxPixels: (Optional) Adjust default resolution game is rendered at (to reduce # pixels drawn in shaders).
This can be used by Replay Test, see the docs there for more info.
device.inputs parameter of Sprite methods is of type:
The keys of
KeysPressed are based on the
key value of browser keyboard events. See keycode.info for values of
justPressed is only
true for one frame after an input is pressed,
justReleased for one frame after an input is released.