void MouseMove(int x, int y)
{
CurrMousePos.x = x;
CurrMousePos.y = y;
ChangeMouse.x = CurrMousePos.x - PrevMousePos.x;
ChangeMouse.y = CurrMousePos.y - PrevMousePos.y;
PrevMousePos.x = CurrMousePos.x;
PrevMousePos.y = CurrMousePos.y;
}
//ChangeMouse, CurrMousePos, and PrevMousePos are simple
//structs with two GLfloats x and y
//I call this each frame
block.UpdatePos(ChangeMouse.y);
//and after drawing the board I do this
glTranslatef(-10.5, CurrMousePos.y, 0.0f);
void CBlock::UpdatePos(GLfloat Mousey)
{
position += Mousey;
if(position > maxY)
position = maxY;
if(position < minY)
position = minY;
}
I know there will probably be a problem with the screen cords not working well with the GL coords (too much movement) but it doesnt move at all unless I resize the window, which makes me think that the problem is not with my movement detection code.
Simple Mouse Movement
I am an idiot. This must be expressly understood to answer my question with yelling at me. I am using glut to make pong. I want to get the mouse working, so I am trying to get the mouse to move a paddle. (for no real reason I made a block class, as in paddle)
have you tried dividing Mousey by, say, 1000? because your problem could be to do with
if(position > maxY) position = maxY; if(position < minY) position = minY;
I did try to do that, but I have the same problem. Moving my mouse around on the screen has no effect. Only sometimes when I move it on the title bar, or when I hit the maximize/minimize button will it move.
[EDIT:Deleted answer, I did not read you used Glut and not Win32]
[edited by - Red Ghost on May 10, 2004 5:35:48 AM]
[edited by - Red Ghost on May 10, 2004 5:35:48 AM]
Sounds like you are only getting mouse coordinates when you get a redraw call. Look at where your mouse gets updated.
-Greg
-Greg
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement