Register
4coder»Forums»Using Get_User_Input to detect character + modifier(s)?
Jason
135 posts
Using Get_User_Input to detect character + modifier(s)?
1 week, 5 days ago Edited by Jason on Jan. 5, 2020, 11:52 p.m. Reason: Initial post
So I'm trying to implement a quick command interpreter for a vim like style editor. Right now, I have my initial Bindings calling my custom command interpreter function when certain keys are pressed

example:

1
2
3
4
5
Bind(jason_interpret_command, KeyCode_D);
Bind(jason_interpret_command, KeyCode_Y);
Bind(jason_interpret_command, KeyCode_V);
Bind(jason_interpret_command, KeyCode_R);
Bind(jason_interpret_command, KeyCode_G);


Then, I use get_input and get_next_input functions to interpret the rest of the commands the user presses in order to perform some action. The way I currently expect get_user_input to work is have it return the Input_Event with info on the key and all modifiers pressed, if any. So I would expect something like this scenario when pressing 'ctrl' 'shift' and 'j' together:

1
2
3
4
5
6
User_Input firstCommandInput = get_current_input(app);
User_Input nextCommandInput = get_next_input(app, EventProperty_KeyWithModifiers, EventProperty_Escape);

nextCommandInput.event.key.code //= 'j'
nextCommandInput.event.key.modifiers.mods[0] //= 'shift'
nextCommandInput.event.key.modifiers.mods[1] //= 'ctrl'


But in reality, the only flag to use that captures any key input is the 'EventProperty_AnyKey' and this returns immediately w/ whatever key I hit first, whether that be 'ctrl', 'shift' or 'j', so I can't seem to capture them all together.

So how do I capture a key with all of it's modifiers intact using 4coder's api?