@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / index / TouchControls
Class: TouchControls ​
Defined in: input/touchControls.ts:133
Constructors ​
Constructor ​
new TouchControls(config?, visibility?): TouchControls;Defined in: input/touchControls.ts:157
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
config? | TouchControlsConfig | undefined |
visibility? | TouchVisibility | "auto" |
Returns ​
TouchControls
Methods ​
isTouchDevice() ​
static isTouchDevice(): boolean;Defined in: input/touchControls.ts:147
Whether this device can be touched at all.
Returns ​
boolean
configure() ​
configure(config): void;Defined in: input/touchControls.ts:165
Change the layout. Takes effect at once.
Parameters ​
| Parameter | Type |
|---|---|
config | TouchControlsConfig |
Returns ​
void
getConfig() ​
getConfig(): Required<TouchControlsConfig>;Defined in: input/touchControls.ts:171
Returns ​
Required<TouchControlsConfig>
setVisibility() ​
setVisibility(visibility): void;Defined in: input/touchControls.ts:176
auto shows them while touch is the last input; always and never force it.
Parameters ​
| Parameter | Type |
|---|---|
visibility | TouchVisibility |
Returns ​
void
getVisibility() ​
getVisibility(): TouchVisibility;Defined in: input/touchControls.ts:181
Returns ​
setSuspended() ​
setSuspended(suspended): void;Defined in: input/touchControls.ts:186
Hide while a menu is up (the world pauses), and come back after.
Parameters ​
| Parameter | Type |
|---|---|
suspended | boolean |
Returns ​
void
noteDevice() ​
noteDevice(isTouch): void;Defined in: input/touchControls.ts:193
The input system tells the controls which device the player used last.
Parameters ​
| Parameter | Type |
|---|---|
isTouch | boolean |
Returns ​
void
isVisible() ​
isVisible(): boolean;Defined in: input/touchControls.ts:200
Returns ​
boolean
mount() ​
mount(container): void;Defined in: input/touchControls.ts:206
Put the controls in container (the canvas's parent). Safe to call again.
Parameters ​
| Parameter | Type |
|---|---|
container | HTMLElement |
Returns ​
void
unmount() ​
unmount(): void;Defined in: input/touchControls.ts:231
Returns ​
void
buttonHeld() ​
buttonHeld(id): boolean;Defined in: input/touchControls.ts:239
Parameters ​
| Parameter | Type |
|---|---|
id | string |
Returns ​
boolean
stickVector() ​
stickVector(): {
x: number;
y: number;
};Defined in: input/touchControls.ts:243
Returns ​
{
x: number;
y: number;
}| Name | Type | Defined in |
|---|---|---|
x | number | input/touchControls.ts:243 |
y | number | input/touchControls.ts:243 |
consumeLookDelta() ​
consumeLookDelta(): {
x: number;
y: number;
};Defined in: input/touchControls.ts:248
Look drag since the last call, in CSS px, y down.
Returns ​
{
x: number;
y: number;
}| Name | Type | Defined in |
|---|---|---|
x | number | input/touchControls.ts:248 |
y | number | input/touchControls.ts:248 |
labelFor() ​
labelFor(id): string | undefined;Defined in: input/touchControls.ts:255
The text a prompt shows for touch:<id>.
Parameters ​
| Parameter | Type |
|---|---|
id | string |
Returns ​
string | undefined
dispose() ​
dispose(): void;Defined in: input/touchControls.ts:259
Returns ​
void

