What would be the best way to go about allowing the player to change their keybindings?
I had the idea of using a text file and reading the bindings from that but im wondering if there are smarter ways to go about this (there probably are).
Could anyone help?
Changing key bindings
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Citizen
- Posts: 87
- Joined: Tue Dec 30, 2014 6:07 pm
Re: Changing key bindings
I think have all your project code detect if certain 'keys' are pressed to do things ins response but these keys are to be variables or entries in a table of keybindings where the user can change their string value to change key either via a GUI that writes/reads their preferences to a file or by manually editing the file. A GUI would certainly be much more user friendly and helpful on mobile devices. I think last time I was trying to do something similar to this I used tserial to encode/decode the file contents into a lua table so I could then read out of it to get the key-value pairs for thing that is meant to have a key binding and the key binding - except I was saving volume data instead of strings, but it's the same concept.
- Guard13007
- Party member
- Posts: 134
- Joined: Sat Oct 25, 2014 3:42 am
- Location: Internet, USA
- Contact:
Re: Changing key bindings
In addition to what Skeletonxf said, take a look at existing keybinding libraries, such as this one and this. The second one is more up to date, but not as featured as the other. Note that I haven't checked if these still work in current versions of Love, which is why I'm suggesting you reference them to design your own library...or test them and use them if they do work. Your choice.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 6 guests