-
Notifications
You must be signed in to change notification settings - Fork 473
Use correct numeric types for events #273
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
Use correct numeric types for events #273
Conversation
I suspect you'll want to deal with the warnings about the deprecated |
Woops, good catch on the suffixes. I missed those on my initial pass since I forgot to rebuild sdl2-sys and missed the warnings. I've fixed them in my PR, so this should probably be rebased. Thanks for doing this though. I was meaning to do it but kept putting it off since it's such a slog to go through every use in every API one by one. |
Use the definition found in SDL_event.h.
Also, avoid unnecessary cast to isize and fix indentation.
Use the definitions found in SDL_events.h and SDL_joystick.h.
Use the definitions found in SDL_events.h and SDL_touch.h.
6363b32
to
34d8fd7
Compare
Rebased. |
Grand, this is brilliant. |
…vents Use correct numeric types for events
After the recent int / uint debacle and rename to isize and usize, I was wondering why their use is so prevalent in rust-sdl2. As far as I can tell they should not be used as a general purpose integer type in Rust.
This pull request changes the integer types used in events to match the definitions found in SDL_event.h. There is much less casting involved after this change. This will likely break a lot of code, but the recent int -> isize transition also breaks the same code, so I felt this would be a good opportunity for this change.
I also noticed that touch and gesture events use f64 where SDL2 uses f32. This implies greater accuracy than SDL2 provides, so I changed those back to f32, but I'm not sure if this is the right way to go -- those commits can be easily dropped if needed.
I assume you will want to pull jpernst's recent 1.0 alpha fixes, so I based this branch on top of those commits.