openfrontio / openfrontio/OpenFrontIO

Refactor & simplify InputHandler.ts

Open
#2,759 4 comments 0 reactions 1 assignee Claimed by @bosconian-dynamics View on GitHub
approved Refactor
Dominant language
TypeScript
Stars
2.7k
Forks
1.4k
Avg merge
17h 43m
Merged PRs (30d)
310

Description

Refactor it into a "binding" system to simplify mapping of key => action.

example:

```
{
inputs: [ Keyboard.ButtonDown('A') ],
event: {
type: FooBarGameEvent,
factory: (manager, input, binding) => new FooBarGameEvent(input.value),
},
labelKey: 'user_setting.foobar',
descriptionKey: 'user_setting.foobar_desc',
isEnabled: false,
isConfigurable: true,
}
```

Discord thread: https://discord.com/channels/1359946986937258015/1456342312668893308

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.