Gamalto

Fork me on GitHub

Object Scroller Overview

Gamalto. Scroller

new Gamalto.Scroller(surface, doubleBufferopt)

Creates a multi-region scrolling object.

Parameters
Name Type Attributes Description
surface Gamalto.Surface

Surface holding the image to be scrolled.

doubleBuffer boolean <optional>

Whether to active double buffuring. Required for looping and parallax scrolling.

Extends

Members

surface :Gamalto.Surface

readonly

Current surface when double buffer is active or passed surface if not. Using double buffer, you must use this property instead of the original surface.

tag :object

inherited

Utility property to exchange data between objects.

Inherited From

Methods

clone() object

inherited abstract

Clones the object. It will be shallow copy unless otherwise specfied.

Inherited From
Returns
  • New instance of the object. Defaults to null.

draw(dx, dy) Gamalto.Surface

Scrolls and draws the registered regions into the internal buffer.

Parameters
Name Type Description
dx number

Value beween 0 and 1 indicating the horizontal speed ratio. Usually 1 to move or 0 to not.

dy number

Value beween 0 and 1 indicating the vertical speed ratio. Usually 1 to move or 0 to not.

Returns
  • Currently active surface to be displayed.

getRegion(name) Gamalto.ScrollingRegion

Gets the specified registered scrolling region.

Parameters
Name Type Description
name string

Name of the requested region.

Returns
  • Region if it exists.

redraw(partsopt)

Redraws parts of the current surface into the buffer surface. Useful only with double buffering.

Parameters
Name Type Attributes Description
parts array.<Gamalto.IBox> <optional>

List of the parts to be updated. Defaults to the whole surface.

resetRegions()

Removes all regions.

setRegion(name, region)

Regiters a scrolling region.

Parameters
Name Type Description
name string

Name the region to be registered.

region Gamalto.ScrollingRegion

Region instance to be registered.

toString() string

inherited abstract

Converts the object into a string.

Inherited From
Returns
  • string

update(timer, dx, dy)

Updates the internal motion state of the registered regions.

Parameters
Name Type Description
timer Gamalto.ITiming

Timer from which the elapsed time will be read.

dx number

Value beween -1 and +1 indicating the horizontal direction ratio.

dy number

Value beween -1 and +1 indicating the vertical direction ratio.

Documentation generated by JSDoc 3.3.2 on Sun Sep 13 2015 20:13:31 GMT+0200 (CEST)