gd-controls/README.md

34 lines
1.4 KiB
Markdown

# gd-controls
Standardize game controls framework
- Input detection for keyboard/mouse, PC/XBox/Playstation/Nintendo controller
- Custom GameControlLabel that changes the symbols based on the input detection
## Default Mapping
gd-controls comes with a [default mapping](key_mapping/names.csv) and mapping to the [promptfont icon font set](key_mapping/promptfont.csv).
## Install
1. Drop this addon into your project under `addons/gd-controls/` (clone, copy, or add as a submodule).
2. Enable the plugin: **Project → Project Settings → Plugins → gd-controls → Enable**.
3. Install the standard input actions into `project.godot`:
```sh
python3 addons/gd-controls/install.py
```
This reads `key_mapping/names.csv` and adds one Godot input action per row to the `[input]` section. Existing actions whose names don't match a CSV row are preserved; same-named actions are overwritten. Re-run the script any time you edit `names.csv`.
4. Reopen the project in Godot so it picks up the new input actions and the prompt-font resources.
Requires Python 3.9+ for `install.py`.
## Regenerating the prompt-font mapping
`src/prompt_font_mapping.gd` is generated from `key_mapping/promptfont.csv`. After editing the CSV, run:
```sh
python3 addons/gd-controls/src/gen.py
```
The generator splices its output between the `# === STARTGEN ===` / `# === ENDGEN ===` markers in the `.gd` file; the surrounding scaffolding is left intact.