[m-users.] Mapping SDL2 keys to key types -- SOLVED
Sean Charles (emacstheviking)
objitsu at gmail.com
Sat Sep 25 02:18:05 AEST 2021
I lifted the missing code, it seems the FlyingJester was miles ahead of me (no surprise there) and after re-reading the code more closely, I then modified my keydown handler to be like this, everything is perfect, not a crash in site, I am probably suffering premature optimisation at this point though! LOL
287 :- func create_key_down_event(key::in, string::in) = (sdl_event::out) is det.
288
289 create_key_down_event(_Key, Name) = Event :-
290 ( if key_name(Name, K) then
291 Event = key_down(K, Name)
292 else
293 Event = key_down(key_unknown, Name)
294 ).
295
296 :- pragma foreign_export("C", create_key_down_event(in,in)
297 = (out), "createKeyDown”).
This removes all crashes and anything not known maps to a key_unknown which is perfect.
Thanks Martin (I know who FlyingJester is really!)
Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20210924/18621260/attachment.html>
More information about the users
mailing list