Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/NicoM1/InputMacro
Simple, remappable, macro-based input handling
https://github.com/NicoM1/InputMacro
Last synced: 2 months ago
JSON representation
Simple, remappable, macro-based input handling
- Host: GitHub
- URL: https://github.com/NicoM1/InputMacro
- Owner: NicoM1
- Created: 2014-11-08T22:56:08.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-09T05:33:11.000Z (about 9 years ago)
- Last Synced: 2024-02-01T01:45:32.137Z (5 months ago)
- Language: Haxe
- Size: 126 KB
- Stars: 8
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Lists
- awesome-snowkit - Input Macro - based input handling. (People / Snippets)
README
#InputMacro
######a simple macro-based system for JSON-based, remappable input handling
**Dependencies**: requires Luxe for input handling and codes, but can be easily changed for other frameworks
**Usage:**
- add an `input.json` file to your project:```
{
"actions": [
{
"name": "playerleft",
"codes": ["key_a", "left"] //codes are by the name they have in 'snow.input.Keycodes'
},
{
"name": "playerright",
"codes": ["key_d", "right"]
},
{
"name": "playerup",
"codes": ["key_w", "up"]
},
{
"name": "playerdown",
"codes": ["key_s", "down"]
},
{
"name": "playerjump",
"codes": ["space"]
}
]
}
```- type `InputManager.*`, all your actions will show up as members, each having `pressed()`, `released()`, and `down()` functions for checking state
- if you wish to allow the player to remap keys (will not work by default), add `InputRemapper.reMap();` somewhere in your startup functions, this will cause any actions that are changed in the JSON file to be overridden at runtime. currently this will throw an error on web targets, as the sys package is unavailable, just add an `#if !web` before calling