WebRuntime
clay.base.BaseRuntime → clay.web.WebRuntime (Class)
Static Members
timestamp(): Float
Returns |
---|
Float |
defaultConfig(): clay.RuntimeConfig
Returns |
---|
clay.RuntimeConfig |
Instance Members
gamepadsSupported: Bool
window: WindowHandle
The runtime window canvas
webglVersion: Float
The actual webgl version being used by the runtime
skipMouseEvents: Bool
For advanced usage: disable handling of mouse events
skipKeyboardEvents: Bool
For advanced usage: disable handling of keyboard events
init(): Void
ready(): Void
run(): Bool
Returns |
---|
Bool |
windowDevicePixelRatio(): Float
Returns |
---|
Float |
windowWidth(): Int
Returns |
---|
Int |
windowHeight(): Int
Returns |
---|
Int |
Name | Type |
---|---|
fullscreen |
Bool |
Returns |
---|
Bool |
Name | Type |
---|---|
title |
String |
startGamepadRumble(gamepadId: Int, lowFrequency: Float, highFrequency: Float, duration: Float): Void
Name | Type |
---|---|
gamepadId |
Int |
lowFrequency |
Float |
highFrequency |
Float |
duration |
Float |
Name | Type |
---|---|
gamepadId |
Int |
Name | Type |
---|---|
index |
Int |
Returns |
---|
String |
Name | Type |
---|---|
app |
clay.Clay |
Private Members
timestampStart: Float
internal start time, allowing 0 based time values
webWindowId: Int
The window id to use for events
windowX: Int
The window x position. Internal, set by update_window_bounds
windowY: Int
The window y position. Internal, set by update_window_bounds
windowW: Int
windowH: Int
windowDpr: Float
touches: clay.IntMap
keyDownStates: ceramic.IntMap<Bool>
didEmitTickOnce: Bool
nextFrameCallbacks: Array<Function>
Runtime loop, run at every frame
Name | Type | Default |
---|---|---|
t |
Float | 0.016 |
Returns |
---|
Bool |
createWindow(): Void
createRenderContext(window: WindowHandle): Bool
Name | Type |
---|---|
window |
WindowHandle |
Returns |
---|
Bool |
createRenderContextFailed(): Void
applyGLAttributes(config: clay.RenderConfig): js.html.webgl.ContextAttributes
Name | Type |
---|---|
config |
clay.RenderConfig |
Returns |
---|
js.html.webgl.ContextAttributes |
postRenderContext(window: WindowHandle): Void
Name | Type |
---|---|
window |
WindowHandle |
setupEvents(): Void
Name | Type |
---|---|
_ |
Dynamic |
handleContextMenu(ev: js.html.MouseEvent): Void
Name | Type |
---|---|
ev |
js.html.MouseEvent |
handleFullscreenChange(ev: js.html.Event): Void
Name | Type |
---|---|
ev |
js.html.Event |
handleFullscreenError(ev: js.html.Event): Void
Name | Type |
---|---|
ev |
js.html.Event |
handleMouseEnter(ev: js.html.MouseEvent): Void
Name | Type |
---|---|
ev |
js.html.MouseEvent |
handleMouseLeave(ev: js.html.MouseEvent): Void
Name | Type |
---|---|
ev |
js.html.MouseEvent |
handleMouseDown(ev: js.html.MouseEvent): Void
Name | Type |
---|---|
ev |
js.html.MouseEvent |
handleMouseUp(ev: js.html.MouseEvent): Void
Name | Type |
---|---|
ev |
js.html.MouseEvent |
handleMouseMove(ev: js.html.MouseEvent): Void
Name | Type |
---|---|
ev |
js.html.MouseEvent |
handleWheel(ev: js.html.WheelEvent): Void
Name | Type |
---|---|
ev |
js.html.WheelEvent |
handleTouchStart(ev: js.html.TouchEvent): Void
Name | Type |
---|---|
ev |
js.html.TouchEvent |
handleTouchEnd(ev: js.html.TouchEvent): Void
Name | Type |
---|---|
ev |
js.html.TouchEvent |
handleTouchMove(ev: js.html.TouchEvent): Void
Name | Type |
---|---|
ev |
js.html.TouchEvent |
clearPendingKeyUps(): Void
handleKeyDown(ev: js.html.KeyboardEvent): Void
Name | Type |
---|---|
ev |
js.html.KeyboardEvent |
handleKeyUp(ev: js.html.KeyboardEvent): Void
Name | Type |
---|---|
ev |
js.html.KeyboardEvent |
handleKeyPress(ev: js.html.KeyboardEvent): Void
Name | Type |
---|---|
ev |
js.html.KeyboardEvent |
handleGamepadConnected(ev: js.html.GamepadEvent): Void
Name | Type |
---|---|
ev |
js.html.GamepadEvent |
handleGamepadDisconnected(ev: js.html.GamepadEvent): Void
Name | Type |
---|---|
ev |
js.html.GamepadEvent |
convertKeyCode(domKeyCode: Int): clay.KeyCode
This takes a DOM keycode and returns a clay KeyCode value
Name | Type |
---|---|
domKeyCode |
Int |
Returns |
---|
clay.KeyCode |
convertScanCode(rawCode: String, keyCode: clay.KeyCode): clay.ScanCode
This taks a KeyboardEvent.code value and returns a clay ScanCode value
Name | Type |
---|---|
rawCode |
String |
keyCode |
clay.KeyCode |
Returns |
---|
clay.ScanCode |
modStateFromEvent(keyEvent: js.html.KeyboardEvent): clay.ModState
Name | Type |
---|---|
keyEvent |
js.html.KeyboardEvent |
Returns |
---|
clay.ModState |
getWindowX(bounds: js.html.DOMRect): Int
Name | Type |
---|---|
bounds |
js.html.DOMRect |
Returns |
---|
Int |
getWindowY(bounds: js.html.DOMRect): Int
Name | Type |
---|---|
bounds |
js.html.DOMRect |
Returns |
---|
Int |
translateMouseX(ev: js.html.MouseEvent): Int
Name | Type |
---|---|
ev |
js.html.MouseEvent |
Returns |
---|
Int |
translateMouseY(ev: js.html.MouseEvent): Int
Name | Type |
---|---|
ev |
js.html.MouseEvent |
Returns |
---|
Int |
updateWindowBounds(): Void
initGamepads(): Void
getGamepadList(): Array<js.html.Gamepad>
Returns |
---|
Array<js.html.Gamepad> |
initGamepadCacheIfNeeded(gamepad: js.html.Gamepad): Void
Name | Type |
---|---|
gamepad |
js.html.Gamepad |
deleteGamepadCache(gamepad: js.html.Gamepad): Void
Name | Type |
---|---|
gamepad |
js.html.Gamepad |
pollGamepads(): Void
Name | Type |
---|---|
n |
Float |
Returns |
---|
Float |
Metadata
Name | Parameters |
---|---|
:access |
clay.Clay |
:access |
clay.Input |
:access |
clay.Screen |