Archived

This topic is now archived and is closed to further replies.

Ructions

All Messed Up

Recommended Posts

Ructions    116
I am making a arkanoid type game and am new to opengl i am finding it difficult to understand the positions of objects on the screen. I have got a paddle moving aross the screen using the keys and it stays in side the window. but when i tryed to use the mouse to move it it messed up. i got this piece of code off the internet and used it but i dont really know what it does if you can answer any of my questions or tell me what this code does. thank you in advance. Code: paddle.x=(float) mpos.x/640*5.4f-9.4f;

Share this post


Link to post
Share on other sites
zander76    122
Hello,

I am not sure what you are using for input but the mouse is usually relative. If it moves one pixel over then you should get a result of 1 but the mouse is very sensitive, so you may have to reduce the amount.

paddel.x += mouse.x/speed

dividing by speed give you the ability to slow or speed up the mouse reaction.

Ben

Share this post


Link to post
Share on other sites