- IdleTimer
- UserData
- Point
- Point
- PositionCallback
- Anchor
- ScaleCallback
- SafeScaleManager
- EntityResizeEvent
- ScaledEntity
- ScaleManager
- ResizeHelper
- SpeechSynth
- filterType
- ColorFilter
- KeyState
- Controller
- Key
- Application
- Debugger
- HintSequencePlayer
- IHintPlayer
- Property
- Caption
- Caption
- CaptionFactory
- CaptionPlayer
- CaptionPlayer
- TimedLine
- IRender
- DOMRenderer
- HtmlRenderer
- TemplateRenderer
- TextRenderer
- Localizer.Options
- Localizer
- ApplicationPlugin
timeNumber time in milliseconds (optional, default15000)
Returns void @memberof IdleTimer
resets the timer, does not call subscribed functions
Returns void @memberof IdleTimer
Returns void @memberof IdleTimer
Calls all subscribed functions, and resets the timer.
Returns void @memberof IdleTimer
Adds a function to be called when timer is dispatched
callback
Returns void @memberof IdleTimer
Removes a function from being called when timer is dispatched
callbackany
Returns void @memberof IdleTimer
Manages data between SpringRoll Container and SpringRoll
Gets data from SpringRoll Container
namestring
Returns Promise
Sends data to SpringRoll Container
namestringvalueany
Returns Promise
Removes data from SpringRoll Container
namestring
Opens a connection with the indexedDB database
dbNamedbVersion(optional, defaultnull)additions(optional, default{})deletions(optional, default{})namestring
Adds a record to the indexedDB database
storeNamevaluekey(optional, defaultnull)namestring
Removes data from SpringRoll Container
storeNamekeynamestring
Removes data from SpringRoll Container
storeNamekeynamestring
storeNamestring The name of the store to read fromcountinteger Specifies the number of values to return if more than one is found. (optional, defaultnull)
Close the connection with the database
Delete a given database
dbNameDBNamestring The name of the database to be deleted
callback to used move game entities
Type: Function
positionPoint position relative to anchor direction
Used to fix positions to a relative point in the viewport.
Returns void @memberof Anchor
callback to used scale game and canvas
Type: Function
widthNumber width canvas should beheightNumber height canvas should bescalePoint x/y scale valuesscaleRatioNumber minimum aspect ratio that fit's in the screen.viewAreaObject Rectangle defining the total viewable area of game content.
Handles scaling the game
-
$0Object$0.width$0.height$0.safeWidth(optional, defaultInfinity)$0.safeHeight(optional, defaultInfinity)$0.callback(optional, default()=>{})
-
paramobject
Type: Array<ScaledEntity>
Type: EntityResizeEvent
Removes an anchor
entityScaledEntity
Returns void @memberof SafeScaleManager
Enables the scale manager listener. Will not be enabled if a callback is not supplied.
callbackScaleCallback The function to be called on resize events.
Disables the scale manager.
Calculates the offset for anchors.
scalePoint scale value
Returns Point
Adds and anchor to be updated during resize
entity(ScaledEntity | Array<ScaledEntity>)
Type: {offset: Point, gameSize: Point, scale: Point}
eventEntityResizeEvent
Returns void @memberof ScaledEntity
[Deprecated]
Simplifies listening to resize events by passing the relevant data to a provided callback.
callbackFunction (optional, defaultundefined)
callbackFunction?
Enables the scale manager listener. Will not be enabled if a callback is not supplied.
callbackFunction The function to be called on resize events.
Disables the scale manager.
Utility class that handles resize events for ScaleManager and SafeScaleManager.
resizeCallbackfunction
Whether or not the application is running on an iOS device.
Returns the enabled state of the ResizeHelper.
Sets the enabled state of the ResizeHelper. Forces a resize event.
value
Handler for window resize events. Forwards this event to the scale manager if enabled.
Sets the window width and window height values of the ResizeHelper.
SpeechSync makes it easy to convert text to speech. Note: This is not supported on IE11 and below because of the underlying APIs are not implemented in those browsers
-
paramsobjectparams.voicenumber Indicates what voice to use. (optional, default0)params.ratenumber The rate at which the text is said. Supports a range from 0.1 to 10. (optional, default1)params.pitchnumber Voice Pitch. Supports a pitch from 0 to 2. (optional, default0)params.volumenumber Volume. Supports 0 to 1. (optional, default1)
voicesLoadedboolean voices are loaded async. This is will be set to true when they are loaded.
Pauses the announcer.
Resumes the announcer.
Pauses the announcer and clears the queue.
Causes the announcer to say whatever message is passed to it. If the announcer is already saying something then it will be added to a queue.
messagestring
Sets the voice by array index.
indexnumber
Returns the voice object.
Returns (object | null)
Rate at which text is spoken.
ratenumber
Returns rate which text is spoken.
Returns number
Sets the pitch at which text is spoken.
pitchnumber
Returns the pitch at which text is spoken.
Returns number
Sets the current volume of the announcer.
volumenumber
Returns the current volume of the announcer.
Returns number
Type: ("protanopia" | "protanomaly" | "deuteranopia" | "deuteranomaly" | "tritanopia" | "tritanomaly" | "achromatopsia" | "achromatomaly")
The Color filter allows you to simulate colorblindness.
Applies the specified filter to the element.
elementHTMLElementtypefilterType
Changes the currently applied filter to the element if the color filter has it.
typefilterType
Returns any
Removes the filter from the element.
Supported filter types.
Returns object Returns an object { name, value } with the colorblindness type: (Protanopia, Protanomaly, Deuteranopia, Deuteranomaly, Tritanopia, Tritanomaly, Achromatopsia, Achromatomaly)
Type: (0 | 1 | 2)
Controller interface class to simplify working with key presses.
buttonsArray<KeyTemplate> An object containing all keys you want to watch and their functions. e.g. {enter: () => {}}. See https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values for potential values. (optional, default[])
Called on window blur, sets button state to up if button was down;
Returns void @memberof Controller
Calls all functions for buttons that are currently set to enabled.
Called on keyup. Sets flag to 1 if key is being watched.
Called on keyup. Sets flag to 2 if key is being watched.
Sets an object of button functions to the controller to be called.
keysArray<KeyTemplate>
Represents a single key on the keyboard and the functions related to it.
keystring What this object represents.downFunction Function to be called while the key is held down. (optional, default()=>{})upFunction Function to be called when the key is lifted up. (optional, default()=>{})
-
state(0|1|2) The current state of the key. 0 = inactive, 1 = active, 2 = to be set to inactive. -
keystring The name of the key we are targeting. -
actionsobject
Updates the internal state of the key. Accepts a range between 0-2. Will set key state to 0 if nothing is passed.
state(0|1|2) (optional, default0)
Calls the relevant action for the current state of the key.
Returns the current state of the key.
Returns number
Main entry point for a game. Provides a single focal point for plugins and functionality to attach.
-
featuresobject A configuration object denoting which features are enabled for this applicationfeatures.captionsboolean? A boolean value denoting that this game supports captionsfeatures.soundboolean? A boolean value denoting that this game has some audio in itfeatures.voboolean? A boolean denoting that this game has mutable voice-over audio in itfeatures.musicboolean? A boolean denoting that this game has mutable music in itfeatures.sfxboolean? A boolean denoting that this game has mutable sound effects in itfeatures.soundVolumeboolean? A boolean denoting that this game has adjustable sound volume in itfeatures.musicVolumeboolean? A boolean denoting that this game has adjustable music volume in itfeatures.voVolumeboolean? A boolean denoting that this game has adjustable voice-over volume in itfeatures.sfxVolumeboolean? A boolean denoting that this game has adjustable sound effects volume in itfeatures.pointerSizeboolean? A boolean denoting that this game has adjustable pointer size in itfeatures.controlSensitivityboolean? A boolean denoting that this game has adjustable control sensitivity in itfeatures.buttonSizeboolean? A boolean denoting that this game has adjustable button sizes in itfeatures.removableLayersboolean? A boolean denoting that this game has removable game layers in itfeatures.hudPositionboolean? A boolean denoting that this game has custom HUD positions.features.hitAreaScaleboolean? A boolean denoting that this game has adjustable hit areas.features.dragThresholdScaleboolean? A boolean denoting that this game has adjustable drag thresholds.features.healthboolean? A boolean denoting that this game has adjustable health.features.objectCountboolean? A boolean denoting that this game has adjustable object count requirements.features.completionPercentageboolean? A boolean denoting that this game has adjustable completion percentage requirements.features.speedScaleboolean? A boolean denoting that this game has adjustable speed.features.timersScaleboolean? A boolean denoting that this game has adjustable timers.features.inputCountboolean? A boolean denoting that this game has adjustable input count requirements.features.keyBindingboolean? A boolean denoting that this game has re-mappable key bindings.features.colorVisionboolean? A boolean denoting that this game has color blindess filtersfeatures.fullScreenboolean? A boolean denoting that this game has fullScreen capabilitiesfeatures.indexedDbboolean? A boolean denoting that this game has fullScreen capabilities
returns instance of a plugin.
namestring
Returns (SpringRoll.ApplicationPlugin | undefined)
Validates that appropriate listeners are added for the features that were enabled in the constructor
- Throws any Error
Sets default values of application state properties.
preloads, initializes and starts plugins.
Returns Promise<void>
The list of plugins that are currently registered to run on Applications.
Registers a plugin to be used by applications, sorting it by priority order.
pluginSpringRoll.ApplicationPlugin The plugin to register.
Finds a plugin by name.
namestring The name of the plugin.
Returns (SpringRoll.ApplicationPlugin | undefined)
Type: object
-
paramsObject Optionsparams.emitEnabledboolean If this should emit events to the window. (optional, defaultfalse)params.minLevel("GENERAL"|"DEBUG"|"INFO"|"WARN"|"ERROR") The starting log level for the logger. (optional, default'GENERAL')
Returns the params of the debugger.
Returns DebuggerParams
Sets the logging level of the debugger.
Returns void
If emitting is enabled for this instance, then it will dispatch an event on the window.
eventNamestring Name of the event (optional, default'Debugger')
Returns logging levels.
Returns object
Console logs all supplied arguments if the log level is low enough for them to be logged.
type("log"|"general"|"warn"|"error"|"debug"|"info") minimum level for this log to run at (optional, default'log')argsArray<any> Arguments you wish to log.
Will throw if statement is false.
isTrueboolean The expression to evaluate.
Returns a boolean indicating if the debugger has been enabled or not.
Returns boolean
Disables or enables all debugger instances. TODO: Remove the parameter here, and add a disable method as well
flagboolean
Returns void
Returns the global params key.
invokes the next hint
Returns void @memberof HintSequencePlayer
removes all hints
Returns void @memberof HintSequencePlayer
callbacksArray<function ()>
Returns void @memberof HintSequencePlayer
callbacksArray<function ()>
Returns void @memberof HintSequencePlayer
Hint Player interface to help enforce minimum requirements for hint players
playfunction called by application to
A class for representing changeable/subscribable properties.
_valueany the value of the propertylisteners[] all the objects listening to this propertyalwaysNotifyboolean Determines if the property will notify a value change regardless if it's a new value or not.
The current value of the property
Type: any
Setting this value notifies all listeners of the change.
Type: any
value
Adds a subscriber to this property.
callbackfunction The callback to call whenever the property changes.
Unsubscribes a listener from this property.
callbackfunction The callback to unsubscribe.
Whether or not this property has any subscribed listeners
Type: Boolean
lines
Updates content based on time passed. This should be called every frame that the caption is active.
deltaTimeNumber Time in seconds since last frame.
Handles calling callbacks and updating caption's current state.
Checks if caption has completed.
Returns Boolean
Sets time and line index of caption.
timeNumber Time in milliseconds. (optional, default0)renderer(optional, default{lineBegin:()=>{},lineEnd:()=>{}})
Updates the current time and index of the caption instance
timeNumber (optional, default0)
Updates content based on time passed. This should be called every frame that the caption is active.
deltaTimeNumber Time in seconds since last frame.
Handles calling callbacks and updating caption's current state.
Checks if caption has completed.
Returns Boolean
Sets time and line index of caption.
timeNumber Time in milliseconds. (optional, default0)renderer(optional, default{lineBegin:()=>{},lineEnd:()=>{}})
Updates the current time and index of the caption instance
timeNumber (optional, default0)
Collection of functions for creating Captions
Creates a new Object<String, Caption>.
dataJSON
Returns Object
Creates a new Caption from JSON data.
captionDataany
Returns Caption new Caption
Creates a new TimedLine from JSON data.
lineDataany
Returns TimedLine new TimedLine;
captionsrenderer
Updates any currently playing caption. This should be called every frame.
deltaTimeNumber Time passed in seconds since last update call.
Starts playing a caption.
nameString Name of caption.timenumber Atart time in milliseconds. (optional, default0)argsobject Arguments that will get passed to the renderer (optional, default{})
Stops any caption currently playing.
CaptionPlayer is used to start, stop and update captions. It applies the content of an active caption to a given CaptionRenderer.
Updates any currently playing caption. This should be called every frame.
deltaTimeNumber Time passed in seconds since last update call.
Starts playing a caption.
nameString Name of caption.timenumber Atart time in milliseconds. (optional, default0)argsobject Arguments that will get passed to the renderer (optional, default{})
Stops any caption currently playing.
Sets line's content. Removes HTML formatting for text.
contentany
Returns void @memberof TimedLine
Render interface to help enforce minimum requirements for caption renderers
startfunction called when the Caption Player starts playing captionsstopfunction called when the Caption Player stops playing captionslineBeginfunction called when rendering a new line of textlineEndfunction called when finished rendering a new of text
DOMRender is a incomplete renderer that is intended to supply just the basic start and stop functions
elementHTMLElementtemplateVariablesObject
Makes target element visible and ready to present captions
templateVariablesobject Variables that can used during caption play time (optional, default{})
H
HTML Renderer is intended for rendering raw html in the use case of wanting to display styled captions
Called by Caption Player when a new line needs to be displayed
line
Called by Caption Player when a line is complete
TemplateRenderer accepts a string template e.g.The ball is {{color}} and a args object e.g. {color: 'red'}
and swaps out the placeholder inside the double brackets with the matching key inside the args object
templatestring String template that will be rendered with the supplied argumentsargsObject //An Object contain data to be inserted into the template This will match based on key values
Returns string
TextRenderer is intended for just rendering test. It will attempt to sanitize any strings passed to it by removing html syntax
Called by Caption Player when a new line needs to be displayed
line
Called by Caption Player when a line is complete
Will attempt to remove all html from a string before it's renderer to the page
htmlany
Type: {language: string, fallback: string}
pathstringoptionsany (optional, default{})
Returns {path: string, language: string}
localeKeystring
Returns boolean True if language is set.
localeKeystring
Returns boolean True if fallback is set.
localeKeystring
Returns string
Represents a single plugin for applications. Allows developers to inject code in the start up process of an application providing new features to the application.
A preload method for the plugin which allows for asynchronous setup tasks. Either takes a callback as first parameter, or should return a Promise indicating that loading is finished.
Returns Promise A promise indicating when the plugin is finished loading.
An init method for the plugin. This method is ran synchronously in the constructor of the Application. After all plugins preloads has completed
A start method for the plugin. This method is ran synchronously in the constructor of the Application. After all plugins inits has completed