01-14-2019, 01:24 AM
(This post was last modified: 01-27-2019, 04:38 AM by JaumeAlcazo.)
Hello! I need more keys for my application and wish to keep using the supplied Window.
For instance I needed to take control of ESC key so I asked mark and he pointed me towards Window.c, 663, I commented that and assigned INPUT_START to ESC and voila! TLN_DefineInputKey(PLAYER1,INPUT_START,SDLK_ESCAPE);
ESC is mine again.
So now I need more keys but I noticed bizarre errors when a certain number of buttons is reached. For instance:
The first buttons added worked great, but I started to have problems on INPUT_BUTTON_KP_4 (keypad), it didn't work, furthermore KEYPAD 2 took the behaviour of INPUT_BUTTON8 and ESC stopped working.
I think the culprit is here: (540 Window.c)
I would like a little explanation of that shift << and the operator |= to get what is happening here and be able to add INPUT_BUTTONS add leisure and associate with the SDLK keys that I wish.
Thanks for your time and patience.
For instance I needed to take control of ESC key so I asked mark and he pointed me towards Window.c, 663, I commented that and assigned INPUT_START to ESC and voila! TLN_DefineInputKey(PLAYER1,INPUT_START,SDLK_ESCAPE);
ESC is mine again.
So now I need more keys but I noticed bizarre errors when a certain number of buttons is reached. For instance:
Code:
TLN_DefineInputKey(PLAYER1,INPUT_BUTTON7,SDLK_KP_7);
TLN_DefineInputKey(PLAYER1,INPUT_BUTTON8,SDLK_KP_8);
TLN_DefineInputKey(PLAYER1,INPUT_BUTTON9,SDLK_KP_9);
TLN_DefineInputKey(PLAYER1,INPUT_BUTTON_KP_4,SDLK_KP_4);
TLN_DefineInputKey(PLAYER1,INPUT_BUTTON_KP_5,SDLK_KP_5);
TLN_DefineInputKey(PLAYER1,INPUT_BUTTON_KP_6,SDLK_KP_6);
TLN_DefineInputKey(PLAYER1,INPUT_BUTTON_KP_2,SDLK_KP_2);
The first buttons added worked great, but I started to have problems on INPUT_BUTTON_KP_4 (keypad), it didn't work, furthermore KEYPAD 2 took the behaviour of INPUT_BUTTON8 and ESC stopped working.
I think the culprit is here: (540 Window.c)
Code:
static void SetInput (TLN_Player player, TLN_Input input){
player_inputs[player].inputs |= (1 << input);
last_key = input;
}
I would like a little explanation of that shift << and the operator |= to get what is happening here and be able to add INPUT_BUTTONS add leisure and associate with the SDLK keys that I wish.
Thanks for your time and patience.