-
Notifications
You must be signed in to change notification settings - Fork 3
App.API
new App(canvas) → {App}
Base class for all Foam applications.
Name | Type | Argument | Description |
---|---|---|---|
canvas |
HTMLCanvasElement |
<optional> |
Target canvas |
- Source:
- Type
- App
-
Reference to WebGLRenderingContext
- CanvasRenderingContext2D
- Source:
-
<protected> _glDraw :glDraw
-
Reference to glDraw.
- Source:
-
<protected> _glTrans :glTrans
-
Reference to glTrans
- Source:
-
<static> getInstance() → {App}
-
Get an instance of the current program.
- Source:
- Type
- App
-
Factory method. Inititates a program.
Name Type Description resource
Object | Array.<Object> The resource / resource-bundle {path, type} to be loaded
obj
Object A program object {setup,update}
- Source:
-
Factory method. Inititates a program. Called on window load.
Name Type Description obj
Object A program object {setup,update}
- Source:
-
Factory method. Initiates a program providing loaded resources. Called on window load.
Name Type Argument Default Description resource
Object | Array.<Object> The resource / resource-bundle {path, type} to be loaded
obj
Object A program object {setup,update}
callbackError
function <optional>
Callback if an error occured
{Function)
[callbackProcess] - Callback on load
strict
bool <optional>
true Abort if at least one resource could not be loaded
- Source:
-
Factory method. Initiates a program providing loaded resources.
Name Type Argument Default Description resource
Object | Array.<Object> The resource / resource-bundle {path, type} to be loaded
obj
Object A program object {setup,update}
callbackError
function <optional>
Callback if an error occured
{Function)
[callbackProcess] - Callback on load
strict
bool <optional>
true Abort if at least one resource could not be loaded
- Source:
-
Return the current target framerate
- Source:
- Type
- Number
-
Return the number of frames elapsed since the program started.
- Source:
- Type
- Number
-
Return the number of seconds elapsed since the program started.
- Source:
- Type
- Number
-
Return the current time.
- Source:
- Type
- Number
-
Return the time the between now and the last update call.
- Source:
- Type
- Number
-
Return the time at program start.
- Source:
- Type
- Number
-
Return the current window aspect ratio.
- Source:
- Type
- number
-
Return the current window's bounds.
Name Type Description rect
Rect Out rect
- Source:
- Type
- Rect
-
Return the window´s current height.
- Source:
- Type
- Number
-
Return the current window scale.
- Source:
- Type
- number
-
getWindowSize(v) → {Vec2}
-
Return the window´s current size.
Name Type Argument Description v
Vec2 <optional>
Out size
- Source:
- Type
- Vec2
-
Return the window´s current width.
- Source:
- Type
- Number
-
Set if the program should continously call update.
Name Type Description loop
Boolean - Source:
-
Callback if webgl is not available.
- Source:
-
Callback on window resize.
- Source:
-
Set the target framerate.
Name Type Description fps
Number The framerate
- Source:
-
Setup
- Source:
-
Set the window size.
Name Type Argument Description width
Number The width
height
Number The height
scale
Number <optional>
The ratio of pixels per window pixel (default: 1:1)
- Source:
-
Update
- Source: