2.9.0resets the timer, does not call subscribed functions
void:
@memberof IdleTimer
void:
@memberof IdleTimer
Calls all subscribed functions, and resets the timer.
void:
@memberof IdleTimer
Adds a function to be called when timer is dispatched
(any)
void:
@memberof IdleTimer
Removes a function from being called when timer is dispatched
(any)
void:
@memberof IdleTimer
Manages data between SpringRoll Container and SpringRoll
Utility class for date-related operations.
Checks if the current date falls within a provided date range.
boolean:
True if current date is within the range, false otherwise
// Check if current date is within Christmas season
import { DateUtil } from "springroll";
if (DateUtil.isInSeason('2024-12-01', '2024-12-31')) {
showChristmasContent();
}
// Using Date objects
import { DateUtil } from "springroll";
const summerStart = new Date(2024, 5, 21); // June 21, 2024
const summerEnd = new Date(2024, 8, 22); // September 22, 2024
if (DateUtil.isInSeason(summerStart, summerEnd)) {
showSummerContent();
}
callback to used move game entities
Type: Function
(Point)
position relative to anchor direction
Used to fix positions to a relative point in the viewport.
callback to used scale game and canvas
Type: Function
Handles scaling the game
(Object)
| Name | Description |
|---|---|
$0.width any
|
|
$0.height any
|
|
$0.safeWidth any
(default Infinity)
|
|
$0.safeHeight any
(default Infinity)
|
|
$0.callback any
(default ()=>{})
|
(object)
Adds and anchor to be updated during resize
((ScaledEntity | Array<ScaledEntity>))
Type: Array<ScaledEntity>
Type: EntityResizeEvent
Removes an anchor
(ScaledEntity)
void:
@memberof SafeScaleManager
Enables the scale manager listener. Will not be enabled if a callback is not supplied.
(ScaleCallback)
The function to be called on resize events.
Disables the scale manager.
Utility class that handles resize events for ScaleManager and SafeScaleManager.
(function)
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.
(any)
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.
(EntityResizeEvent)
void:
@memberof ScaledEntity
[Deprecated]
Simplifies listening to resize events by passing the relevant data to a provided callback.
(Function
= undefined)
(Function?)
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
(object)
| Name | Description |
|---|---|
params.voice number
(default 0)
|
Indicates what voice to use. |
params.rate number
(default 1)
|
The rate at which the text is said. Supports a range from 0.1 to 10. |
params.pitch number
(default 0)
|
Voice Pitch. Supports a pitch from 0 to 2. |
params.volume number
(default 1)
|
Volume. Supports 0 to 1. |
(boolean)
: voices are loaded async. This is will be set to true when they are loaded.
Type:
("protanopia" | "protanomaly" | "deuteranopia" | "deuteranomaly" | "tritanopia" | "tritanomaly" | "achromatopsia" | "achromatomaly")
The Color filter allows you to simulate colorblindness.
Applies the specified filter to the element.
(HTMLElement)
(filterType)
Changes the currently applied filter to the element if the color filter has it.
(filterType)
any:
Removes the filter from the element.
Type:
(0 | 1 | 2)
Controller interface class to simplify working with key presses.
(Array<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.
Calls all functions for buttons that are currently set to enabled.
Called on keyup. Sets flag to 1 if key is being watched.
(KeyboardEvent)
Called on keyup. Sets flag to 2 if key is being watched.
(KeyboardEvent)
Called on window blur, sets button state to up if button was down;
void:
@memberof Controller
Represents a single key on the keyboard and the functions related to it.
(string)
What this object represents.
(Function
= ()=>{})
Function to be called while the key is held down.
(Function
= ()=>{})
Function to be called when the key is lifted up.
((0 | 1 | 2))
: The current state of the key. 0 = inactive, 1 = active, 2 = to be set to inactive.
(string)
: The name of the key we are targeting.
Main entry point for a game. Provides a single focal point for plugins and functionality to attach.
(object)
: A configuration object denoting which features are enabled for this application
features.captions boolean?
A boolean value denoting that this game supports captions
features.sound boolean?
A boolean value denoting that this game has some audio in it
features.vo boolean?
A boolean denoting that this game has mutable voice-over audio in it
features.music boolean?
A boolean denoting that this game has mutable music in it
features.sfx boolean?
A boolean denoting that this game has mutable sound effects in it
features.soundVolume boolean?
A boolean denoting that this game has adjustable sound volume in it
features.musicVolume boolean?
A boolean denoting that this game has adjustable music volume in it
features.voVolume boolean?
A boolean denoting that this game has adjustable voice-over volume in it
features.sfxVolume boolean?
A boolean denoting that this game has adjustable sound effects volume in it
features.pointerSize boolean?
A boolean denoting that this game has adjustable pointer size in it
features.controlSensitivity boolean?
A boolean denoting that this game has adjustable control sensitivity in it
features.buttonSize boolean?
A boolean denoting that this game has adjustable button sizes in it
features.removableLayers boolean?
A boolean denoting that this game has removable game layers in it
features.hudPosition boolean?
A boolean denoting that this game has custom HUD positions.
features.hitAreaScale boolean?
A boolean denoting that this game has adjustable hit areas.
features.dragThresholdScale boolean?
A boolean denoting that this game has adjustable drag thresholds.
features.health boolean?
A boolean denoting that this game has adjustable health.
features.objectCount boolean?
A boolean denoting that this game has adjustable object count requirements.
features.completionPercentage boolean?
A boolean denoting that this game has adjustable completion percentage requirements.
features.speedScale boolean?
A boolean denoting that this game has adjustable speed.
features.timersScale boolean?
A boolean denoting that this game has adjustable timers.
features.inputCount boolean?
A boolean denoting that this game has adjustable input count requirements.
features.keyBinding boolean?
A boolean denoting that this game has re-mappable key bindings.
features.colorVision boolean?
A boolean denoting that this game has color blindess filters
features.fullScreen boolean?
A boolean denoting that this game has fullScreen capabilities
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.
(SpringRoll.ApplicationPlugin)
The plugin to register.
Type: object
Returns the params of the debugger.
DebuggerParams:
Console logs all supplied arguments if the log level is low enough for them to be logged.
(("log" | "general" | "warn" | "error" | "debug" | "info")
= 'log')
minimum level for this log to run at
(Array<any>)
Arguments you wish to log.
Returns the global params key.
Hint Player interface to help enforce minimum requirements for hint players
(function)
: called by application to
A class for representing changeable/subscribable properties.
(any)
: the value of the property
([])
: all the objects listening to this property
(boolean)
: Determines if the property will notify a value change regardless if it's a new value or not.
(any)
Collection of functions for creating Captions
(any)
(any)
CaptionPlayer is used to start, stop and update captions. It applies the content of an active caption to a given CaptionRenderer.
Sets line's content. Removes HTML formatting for text.
(any)
void:
@memberof TimedLine
Render interface to help enforce minimum requirements for caption renderers
DOMRender is a incomplete renderer that is intended to supply just the basic start and stop functions
(HTMLElement)
(Object)
HTML Renderer is intended for rendering raw html in the use case of wanting to display styled captions
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
(string)
String template that will be rendered with the supplied arguments
(Object)
//An Object contain data to be inserted into the template This will match based on key values
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
(any)
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
(any)
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.
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