🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

There seems to be a small logic problem here

Started by
0 comments, last by VECTOR 24 years ago
if (mouseclk & MK_RBUTTON) { MRfirst=FALSE; } else { MRfirst=TRUE; } if (mouseclk & MK_RBUTTON) { if (MRfirst=TRUE) { startx=mx; starty=my; MRfirst=FALSE; } } if (mouseclk & MK_RBUTTON) { viewangle_x = viewangle_x + -( my - starty ); viewangle_y = viewangle_y + -( mx - startx ); startx=mx; starty=my; MRfirst = 0.0f; } What I''m trying to do is rotate the view angle with mouse with right mouse button pressed. I want it to be just like Homeworlds. But the problem is that when I press right mouse button and move, it springs the angles to a totally new angle instead of just modifying the current angle.
The object of war is not to die for your country, but to make the other bastard die for his . . -General MacArthur
Advertisement
// this should be in WM_RBUTTONDOWN
startx = mx;
starty = my;


// this should be in WM_MOUSEMOVE
if (mouseclk & MK_RBUTTON)
{
viewangle_x = viewangle_x + ( my - starty );
viewangle_y = viewangle_y + ( mx - startx );
}


I think you should to the viewangle and not subtract...

also, the code you''ve supplied is not detailed enough to tell what variables you have.. of what types they are and so on... where the portions of code are located..etc..

that''s as far as i can help with the info you''ve given.. also, there were some syntax mistakes in your code...

if (MRfirst = TRUE) will always be true.. etc.. some other minor mistakes too..

..-=ViKtOr=-..

This topic is closed to new replies.

Advertisement