CursaTetra icon indicating copy to clipboard operation
CursaTetra copied to clipboard

Configurable Keybinds

Open nyxical420 opened this issue 2 years ago • 2 comments

im way too dumb to understand curses and how you bind the keys to the new one, any way to implement this feature to this?

nyxical420 avatar Dec 12 '22 10:12 nyxical420

In the main file, I have several dictionaries ending with the suffix Codes that convert ASCII values (derived from the ord function) into strings to check for button presses (they start on line 42). One need simply edit the keys of these dictionaries and leave the value-strings be and the keys are rebound.

I'm planning to add a Game-B mode soon, I'll see about expanding the config file I have to allow for remapping, shouldn't be too hard to do. In the meantime, as an example, say you wanted the Z key to swap in the held piece; simply replace all ord('H') and ord('h') occurrences in the dictionaries in cursatetra.py, will leaving the string literal 'H' on the right side alone, and Z will now do what H did.

cSquaerd avatar Dec 26 '22 04:12 cSquaerd

Addendum: if the key you want to use is not an alphanumeric key, it may require a special curses constant to get the code number. You can see this with crs.KEY_LEFT and so on for the arrow keys. A list of all these special code constants in this section of the docs.

cSquaerd avatar Dec 26 '22 04:12 cSquaerd