E
elsi11
Guest
Hey guys!
I am trying to make a key remapping system, and this is what I have for now. (0) Please tell me which parts are good, and which need changing:
(3) Where do I find that list of numbers that I need to convert numbers into readable keys? How do I draw it on screen? Do I convert "lastkey" to a string as soon as I get it? The numbers are ascii, right? But chr() gives me random characters for the arrow keys, and nothing for enter and special letters.
(4) Do I have to have some special code for controllers? I don't mind if a generic controller gives me a number instead of "button X", as long as it works. I know people always have problems with controllers and gamemaker games.
(5) Should I have a special key that is constant? Like: enter is always the key for editing a key. But it is kinda meh. But, then again, if someone changes his key to some cyrillyc letter that is alien to modern computing, and then forgets which one he assigned, and he only sees a number or maybe even nothing, and the key he messed up is THE key for changing assignements, what then? Put a disclaimer that you can manually change assignments in the settings file? But again, the game might not recognize a random hieroglyph. Maybe have a special button like F12 or something that resets everything to default, and you have to press it 5 times or smt. But what about people who have a controller? Hardcode the x360 controller to have up button presed for x seconds? What about generic controllers? What If I play the game with a guitar hero guitar? How do you do it?
In short: Please help me make a working key remapping system where if I assign space, it will tell me "Space".
Tnx!
I am trying to make a key remapping system, and this is what I have for now. (0) Please tell me which parts are good, and which need changing:
Code:
//STEP
if (keyboard_check_pressed(vk_enter) && !change)
{
change = 1;
io_clear(); //prevents haxx with people holding down buttons while we "listen"
//clears all input so the next pressed button is the one we use
}
if (change && keyboard_check_pressed(vk_anykey)) // (1) what about controller?
{
lastkey = keyboard_lastkey;
keyboard_lastkey = -1;
change = 0;
}
//DRAW
draw_text(10,10,chr(lastkey)); //chr() gives you a letter instead of number, works with most letters
if (change)
{
// (2) dimming the screen here would be nice. How do?
draw_text(view_hview[0]/2,view_wview[0]/2,"assign new key");
}
(4) Do I have to have some special code for controllers? I don't mind if a generic controller gives me a number instead of "button X", as long as it works. I know people always have problems with controllers and gamemaker games.
(5) Should I have a special key that is constant? Like: enter is always the key for editing a key. But it is kinda meh. But, then again, if someone changes his key to some cyrillyc letter that is alien to modern computing, and then forgets which one he assigned, and he only sees a number or maybe even nothing, and the key he messed up is THE key for changing assignements, what then? Put a disclaimer that you can manually change assignments in the settings file? But again, the game might not recognize a random hieroglyph. Maybe have a special button like F12 or something that resets everything to default, and you have to press it 5 times or smt. But what about people who have a controller? Hardcode the x360 controller to have up button presed for x seconds? What about generic controllers? What If I play the game with a guitar hero guitar? How do you do it?
In short: Please help me make a working key remapping system where if I assign space, it will tell me "Space".
Tnx!