I think this is not what the additional function would be good for, since if one has to send keys over network (i think, this is not a good idea in general) he can just use the standard method. But most games will provide an interface to change the key bindings for that game, especially for that user on that platform.
I think there are better solutions, but very much harder to implement:
- Provide all keys on all keyboards via the standard method, here we had to add pages of key codes for some systems,
- Provide a complete key binding management that holds the raw key codes in a black box so programmers are not able to do unwanted things with them (sending key codes over network ;-) )
For the last thing i would suggest a BindingManager class that can be used as follows:
z=enum{C_GAME_EXIT, C_JUMP, C_RIGHT}
A=BindingManager()
A.Learn(C_GAME_EXIT) %waits for user input and saves raw key code internally
while window.GetEvent(event):
if event.Type==sf.Event.Closed:
running=False
if event.Type==sf.Event.KeyPressed:
if A.Get(event)==z.C_GAME_EXIT: %Returns code (z-value) for the event saved in event
running=False