[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with Glut and mouse
On Mon, Jun 17, 2002 at 01:04:51PM +0200, voidstar wrote:
> I've a problem using GLUT. I'm coding an arkanoid game
> and I've attacched the right mouse button to the menu:
>
> glutAttachMenu(GLUT_RIGHT_BUTTON);
>
> The problem is that I would like that the game stops
> when I press the right mouse button, so I added this:
>
> void glutMouseEvent(int button, int state, int x, int y){
> if((button==GLUT_RIGHT_BUTTON)&&(state==GLUT_DOWN))
> stop=0;
> else
> if((button==GLUT_RIGHT_BUTTON)&&(state==GLUT_UP))
> stop=1;
> }
>
> But this only works if I don't attach the right mouse button
> to the menu. It seems that they cannot work together.
> Is there any way to do it?
> PS:Sorry for my bad english
You could try using glutMenuStatusFunc() like so:
void MenuStatus(int status, int x, int y)
{
switch (status)
{
case GLUT_MENU_IN_USE:
stop = 1;
break;
case GLUT_MENU_NOT_IN_USE:
stop = 0;
break;
}
}
glutMenuStatusFunc(&MenuStatus);
--
Christopher John Purnell | I thought I'd found a reason to live
http://www.lost.org.uk/ | Just like before when I was a child
--------------------------| Only to find that dreams made of sand
What gods do you pray to? | Would just fall apart and slip through my hands