Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / index / TouchControls

Class: TouchControls ​

Defined in: input/touchControls.ts:133

Constructors ​

Constructor ​

ts
new TouchControls(config?, visibility?): TouchControls;

Defined in: input/touchControls.ts:157

Parameters ​

ParameterTypeDefault value
config?TouchControlsConfigundefined
visibility?TouchVisibility"auto"

Returns ​

TouchControls

Methods ​

isTouchDevice() ​

ts
static isTouchDevice(): boolean;

Defined in: input/touchControls.ts:147

Whether this device can be touched at all.

Returns ​

boolean


configure() ​

ts
configure(config): void;

Defined in: input/touchControls.ts:165

Change the layout. Takes effect at once.

Parameters ​

ParameterType
configTouchControlsConfig

Returns ​

void


getConfig() ​

ts
getConfig(): Required<TouchControlsConfig>;

Defined in: input/touchControls.ts:171

Returns ​

Required<TouchControlsConfig>


setVisibility() ​

ts
setVisibility(visibility): void;

Defined in: input/touchControls.ts:176

auto shows them while touch is the last input; always and never force it.

Parameters ​

ParameterType
visibilityTouchVisibility

Returns ​

void


getVisibility() ​

ts
getVisibility(): TouchVisibility;

Defined in: input/touchControls.ts:181

Returns ​

TouchVisibility


setSuspended() ​

ts
setSuspended(suspended): void;

Defined in: input/touchControls.ts:186

Hide while a menu is up (the world pauses), and come back after.

Parameters ​

ParameterType
suspendedboolean

Returns ​

void


noteDevice() ​

ts
noteDevice(isTouch): void;

Defined in: input/touchControls.ts:193

The input system tells the controls which device the player used last.

Parameters ​

ParameterType
isTouchboolean

Returns ​

void


isVisible() ​

ts
isVisible(): boolean;

Defined in: input/touchControls.ts:200

Returns ​

boolean


mount() ​

ts
mount(container): void;

Defined in: input/touchControls.ts:206

Put the controls in container (the canvas's parent). Safe to call again.

Parameters ​

ParameterType
containerHTMLElement

Returns ​

void


unmount() ​

ts
unmount(): void;

Defined in: input/touchControls.ts:231

Returns ​

void


buttonHeld() ​

ts
buttonHeld(id): boolean;

Defined in: input/touchControls.ts:239

Parameters ​

ParameterType
idstring

Returns ​

boolean


stickVector() ​

ts
stickVector(): {
  x: number;
  y: number;
};

Defined in: input/touchControls.ts:243

Returns ​

ts
{
  x: number;
  y: number;
}
NameTypeDefined in
xnumberinput/touchControls.ts:243
ynumberinput/touchControls.ts:243

consumeLookDelta() ​

ts
consumeLookDelta(): {
  x: number;
  y: number;
};

Defined in: input/touchControls.ts:248

Look drag since the last call, in CSS px, y down.

Returns ​

ts
{
  x: number;
  y: number;
}
NameTypeDefined in
xnumberinput/touchControls.ts:248
ynumberinput/touchControls.ts:248

labelFor() ​

ts
labelFor(id): string | undefined;

Defined in: input/touchControls.ts:255

The text a prompt shows for touch:<id>.

Parameters ​

ParameterType
idstring

Returns ​

string | undefined


dispose() ​

ts
dispose(): void;

Defined in: input/touchControls.ts:259

Returns ​

void