WebRuntime
clay.base.BaseRuntime → clay.web.WebRuntime (Class)
Static Members
timestamp(): Float| Returns |
|---|
| Float |
defaultConfig(): clay.RuntimeConfig| Returns |
|---|
| clay.RuntimeConfig |
Instance Members
gamepadsSupported: Boolwindow: WindowHandleThe runtime window canvas
webglVersion: FloatThe actual webgl version being used by the runtime
skipMouseEvents: BoolFor advanced usage: disable handling of mouse events
skipKeyboardEvents: BoolFor advanced usage: disable handling of keyboard events
init(): Voidready(): Voidrun(): 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: Floatinternal start time, allowing 0 based time values
webWindowId: IntThe window id to use for events
windowX: IntThe window x position. Internal, set by update_window_bounds
windowY: IntThe window y position. Internal, set by update_window_bounds
windowW: IntwindowH: IntwindowDpr: Floattouches: clay.IntMapkeyDownStates: ceramic.IntMap<Bool>didEmitTickOnce: BoolnextFrameCallbacks: Array<Function>Runtime loop, run at every frame
| Name | Type | Default |
|---|---|---|
t |
Float | 0.016 |
| Returns |
|---|
| Bool |
createWindow(): VoidcreateRenderContext(window: WindowHandle): Bool| Name | Type |
|---|---|
window |
WindowHandle |
| Returns |
|---|
| Bool |
createRenderContextFailed(): VoidapplyGLAttributes(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(): VoidhandleKeyDown(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.KeyCodeThis takes a DOM keycode and returns a clay KeyCode value
| Name | Type |
|---|---|
domKeyCode |
Int |
| Returns |
|---|
| clay.KeyCode |
convertScanCode(rawCode: String, keyCode: clay.KeyCode): clay.ScanCodeThis 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(): VoidinitGamepads(): VoidgetGamepadList(): 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 |