-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scancode handling broken #2
Comments
Hi Peter, I'll take a look at the scancode issue you're seeing and see if there isn't something obviously wrong with what I'm doing. Yeah, there is a bit of a risk that the spec could become out of date. We can regenerate the spec files from the official 2.0 release headers if they weren't already. I have been working on cl-sdl2 using the steam-runtime because I feel like that's as close to a canonical release as you can find. :) Chip |
Hello Chip, Thank you for your response! I'm happy to try new code out and maybe make some To reproduce the bug, download and install the official sdl 2.0 library, update (ql:quickload <a pile of things like cl-opengl, cl-ppcre, cl-autowrap>) And then hit escape with the mouse in the window. For me, the key is It appears to me that sdl2:scancode-value maybe should return the keyword (case (sdl2:scancode-value keysym) Was that supposed to be the intention? Thank you! Pete |
Yep, now that SDL2 has been officially released it is my intention for cl-sdl2 to become a complete wrapper of the library. My initial wrapping got as far as events and opengl as you can see since that was the most immediately interesting portion for me to work on. sdl2:scancode= is the function that I should be using in the example to test for :sdl-scancode-esc. Any contributions you might have even if it's just to the readme are absolutely appreciated. :) |
Hello, I tried that function, but (defun scancode= (scancode scancode-key) always signals a type condition problem because (autowrap:enum-value 'sdl2-ffi:sdl-scancode scancode-key) always seems to return NIL even when giving it things like :sdl-scancode-escape. Additionally, as a suggestion, shouldn't scancode= be generic method should have two signatures like: (defmethod scancode= ((scancode integer) (scancode-key symbol)) (defmethod scancode= ((scancode-key symbol) (scancode integer)) From a human usability of view, the current signature of scancode= is hard to remember. Thank you! |
Note that as per the example (when (scancode= scancode :scancode-w) ...) |
Ahhh! That's the mistake I was making. The lispbuilder-sdl api is so ingrained into my mind, it didn't even occur to me that I wrote the wrong thing. Thank you! |
Ok, here is a patch. Thank you!
|
Applied and pushed! Thanks for the contribution. :) |
Hello,
In the basic.lisp example, we see the form (equal :sdl-scancode-escape (sdl2:scancode-value keysym)) This test, for me, never passes. The value returned by sdl:scancode-value keysym) is 27, but I'm not sure how one can compare an integer against a keyword symbol and have that work out. I tried a bunch of iterations, some using autowrap:enum-value/key to try and get it working, but to no avail. Also, are the spec/ files from the SDL2 install on the creator's machine? What happens if the SDL2 that I have on my machine is newer, like say the official release? Is it possible that the spec/ header files and the real header files (that the C library was compiled against) could differ in enums and such?
Thank you.
Peter Keller
The text was updated successfully, but these errors were encountered: