Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Event masks are broken #202

Closed
jtpalmer opened this Issue Sep 11, 2011 · 2 comments

Comments

Projects
None yet
1 participant
Owner

jtpalmer commented Sep 11, 2011

I haven't checked all of the mask constants, but SDL_MOUSEEVENTMASK doesn't work as advertised.

From SDL::Event:

This way you can check if a given "type" matches a mask:

(SDL_JOYBUTTONDOWN   & SDL_MOUSEEVENTMASK) # is false
(SDL_MOUSEBUTTONDOWN & SDL_MOUSEEVENTMASK) # is true
(SDL_MOUSEBUTTONUP   & SDL_MOUSEEVENTMASK) # is true
(SDL_MOUSEMOTION     & SDL_MOUSEEVENTMASK) # is true

but it doesn't work:

use strict;
use warnings;
use 5.010;
use SDL;
use SDL::Event;

say (SDL_JOYBUTTONDOWN   & SDL_MOUSEEVENTMASK); # is false
say (SDL_MOUSEBUTTONDOWN & SDL_MOUSEEVENTMASK); # is true
say (SDL_MOUSEBUTTONUP   & SDL_MOUSEEVENTMASK); # is true
say (SDL_MOUSEMOTION     & SDL_MOUSEEVENTMASK); # is true

output:

0
0
0
0
Owner

jtpalmer commented Sep 11, 2011

On closer inspection it appears that the masks may be fine, just need a doc fix.

(SDL_EVENTMASK(SDL_JOYBUTTONDOWN)   & SDL_MOUSEEVENTMASK); # is false     
(SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN) & SDL_MOUSEEVENTMASK); # is true      
(SDL_EVENTMASK(SDL_MOUSEBUTTONUP)   & SDL_MOUSEEVENTMASK); # is true      
(SDL_EVENTMASK(SDL_MOUSEMOTION)     & SDL_MOUSEEVENTMASK); # is true 
Owner

jtpalmer commented Sep 11, 2011

Fixed in experimental

@jtpalmer jtpalmer closed this Sep 11, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment