FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

a little derelict.sdl.mouse (fix?)

 
Post new topic   Reply to topic     Forum Index -> Derelict
View previous topic :: View next topic  
Author Message
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Mon Aug 23, 2004 9:19 pm    Post subject: a little derelict.sdl.mouse (fix?) Reply with quote

hello. I've been using derelict sdl and I've been using

if(SDL_GetMouseState(null, null)&SDL_BUTTON_RIGHT)
// right mouse button is down, do right mouse button stuff

well, the problem is the right mouse button doesn't seem to be clicking, that is until I changed

const Uint8 SDL_BUTTON_RIGHT = 3;

to

const Uint8 SDL_BUTTON_RIGHT = 4;

in derelict.sdl.mouse.d

and then the right mouse button works.

Anyone else have this type of problem? I'm no SDL expert but i've tested this 'fix' in both linux and windows and it works. So it's good for me, it just doesn't make much sense numerically (doesn't follow the +1 scheme).

Anyhow, good luck to Derelict I hope to see derelictAL in the future! Smile

byebye

- clayasaurus

ps. I havn't figured how the WHEELUP WHEELDOWN works so I don't know if it messes that up or not.
Back to top
View user's profile Send private message AIM Address
aldacron



Joined: 05 May 2004
Posts: 1322
Location: Seoul, South Korea

PostPosted: Tue Aug 24, 2004 7:16 am    Post subject: Re: a little derelict.sdl.mouse (fix?) Reply with quote

clayasaurus wrote:
hello. I've been using derelict sdl and I've been using

if(SDL_GetMouseState(null, null)&SDL_BUTTON_RIGHT)
// right mouse button is down, do right mouse button stuff

well, the problem is the right mouse button doesn't seem to be clicking, that is until I changed

const Uint8 SDL_BUTTON_RIGHT = 3;

to

const Uint8 SDL_BUTTON_RIGHT = 4;

in derelict.sdl.mouse.d

and then the right mouse button works.


The problem is not the constant, but the way you are using SDL_GetMouseState. Revert SDL_BUTTON_RIGHT to its original value and try this:

Code:

if(SDL_GetMouseState() & SDL_BUTTON_RMASK)
   ...


I haven't documented anything in Derelict because documentation for everything is available elsewhere. SDL_GetMouseState does not appear to be in the SDL docs, but there is commented in the c header that the SDL_BUTTON macro should be used. SDL_BUTTON_RMASK is defined as SDL_BUTTON(SDL_BUTTON_RIGHT), which is the same thing. I took the liberty of leaving the SDL_BUTTON macro out of mouse.d (I don't like converting macros to functions unless absolutely necessary). One day I suppose I need to get around to documenting the differences, because there are a few.

Quote:

Anyhow, good luck to Derelict I hope to see derelictAL in the future! Smile


Heh, is that a hint? Wink
Back to top
View user's profile Send private message Send e-mail
clayasaurus



Joined: 21 May 2004
Posts: 857

PostPosted: Tue Aug 24, 2004 9:12 pm    Post subject: ok, thanks Reply with quote

aldacron wrote:

The problem is not the constant, but the way you are using SDL_GetMouseState. Revert SDL_BUTTON_RIGHT to its original value and try this:

Code:

if(SDL_GetMouseState() & SDL_BUTTON_RMASK)
   ...


I haven't documented anything in Derelict because documentation for everything is available elsewhere. SDL_GetMouseState does not appear to be in the SDL docs, but there is commented in the c header that the SDL_BUTTON macro should be used. SDL_BUTTON_RMASK is defined as SDL_BUTTON(SDL_BUTTON_RIGHT), which is the same thing. I took the liberty of leaving the SDL_BUTTON macro out of mouse.d (I don't like converting macros to functions unless absolutely necessary). One day I suppose I need to get around to documenting the differences, because there are a few.


ok. yea i don't like those macros that much anyway.

aldacron wrote:


Quote:

Anyhow, good luck to Derelict I hope to see derelictAL in the future! Smile


Heh, is that a hint? Wink


maybe Smile
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Derelict All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group