# default | pokemon-rogue-battle
Documentation for pokemon-rogue-battle

# Class default

- Defined in src/touch-controls.ts:7

##### Index

### Constructors

constructor

### Properties

events

### Methods

bindKey
deactivatePressedKey
disable
enable
init
preventElementZoom
simulateKeyboardEvent
touchButtonDown
touchButtonUp

## Constructors

### constructor

- new default(): default

  #### Returns default

  - Defined in src/touch-controls.ts:16

## Properties

### events

events: EventEmitter

- Defined in src/touch-controls.ts:8

## Methods

### bindKey

- bindKey(node: HTMLElement, key: string): void

  Binds a node to a specific key to simulate keyboard events on touch.

  #### Parameters

  - node: HTMLElement

    The DOM element to bind the key to.

  - key: string

    The key to simulate.

  #### Returns void

  #### Remarks

  This function binds touch events to a node to simulate 'keydown' and 'keyup' keyboard events. It adds the key to the keys map and tracks the keydown state. When a touch starts, it simulates a 'keydown' event and adds an 'active' class to the node. When the touch ends, it simulates a 'keyup' event, removes the keydown state, and removes the 'active' class from the node and the last touched element.

  - Defined in src/touch-controls.ts:63

### deactivatePressedKey

- deactivatePressedKey(): void

  Deactivates all currently pressed keys.

  #### Returns void

  - Defined in src/touch-controls.ts:178

### disable

- disable(): void

  Disable touch controls

  #### Returns void

  - Defined in src/touch-controls.ts:24

### enable

- enable(): void

  Enable touch controls

  #### Returns void

  - Defined in src/touch-controls.ts:32

### init

- init(): void

  Initialize touch controls by binding keys to buttons.

  #### Returns void

  - Defined in src/touch-controls.ts:40

### preventElementZoom

- preventElementZoom(element: null | HTMLElement): void

  https://stackoverflow.com/a/39778831/4622620|Source

  Prevent zoom on specified element

  #### Parameters

  - element: null | HTMLElement

  #### Returns void

  - Defined in src/touch-controls.ts:148

### simulateKeyboardEvent

- simulateKeyboardEvent(eventType: string, key: string): boolean

  Simulates a keyboard event on the canvas if the button is not disabled.

  #### Parameters

  - eventType: string

    The type of the keyboard event ('keydown' or 'keyup').

  - key: string

    The key to simulate.

  #### Returns boolean

  Whether the simulation was successful.

  #### Remarks

  This function checks if the key exists in the Button enum. If it does, it retrieves the corresponding button and emits the appropriate event ('input_down' or 'input_up') based on the event type.

  - Defined in src/touch-controls.ts:116

### touchButtonDown

- touchButtonDown(node: HTMLElement, key: string): void

  #### Parameters

  - node: HTMLElement
  - key: string

  #### Returns void

  - Defined in src/touch-controls.ts:75

### touchButtonUp

- touchButtonUp(node: HTMLElement, key: string, id: string): void

  #### Parameters

  - node: HTMLElement
  - key: string
  - id: string

  #### Returns void

  - Defined in src/touch-controls.ts:92