Skip to main content
GameDev.net gamedev.net
🔒 Locked

window movement

Started by adam17 Oct 4, 2005 at 11:47 PM 2 replies 700+ views
Original Post
adam17
adam17
ok i started this thread in a different forum but i need more detail on GLUT. i need to know how this can be done. right now my program starts constantly moving the window while the mouse button is down. the window doesnt stay with the cursor. is there a GLUT function that allows for a single update from the mouse, kinda like how windows processes clicks?
adam17
adam17
ok let me rephrase my question.

if i have a function called processMouse, and its used with glutMouseFunc(processMouse). when is it called and how is the button state changed? when i press a button, the state is changed to GLUT_DOWN. is the processMouse function called once or does it consistently pass the button, state, and x & y coordinates to it?
adam17
adam17
ok, im finally back up and running. i bought a new mobo and proc and it was a pain in the ass to get up and running. anyway im finally back to working on my editor. with that time off i had the chance to develop a better understanding of how to move the window around. unfortunately, i keep getting a jittering of the window even though i call glutPositionWindow() once during a cycle. any ideas?

heres some code from my active mouse function:
void processMaterialWindMouseActive(int x, int y){        /*adjust the window position with the         new mouse coordinates*/	mat_wind.x += (x - prevMatWindMousePosx);	mat_wind.y += (y - prevMatWindMousePosy);        /*adjust window position if it goes        outside of the viewing area*/	if(mat_wind.x<0)		mat_wind.x = 0;	if((mat_wind.x+mat_wind.w)>SCREEN_WIDTH)		mat_wind.x = SCREEN_WIDTH - mat_wind.w;	if(mat_wind.y<0)		mat_wind.y = 0;	if((mat_wind.y+mat_wind.h)>SCREEN_HEIGHT)		mat_wind.y = SCREEN_HEIGHT - mat_wind.        /*update window position and        update the previous mouse coords*/	glutPositionWindow(mat_wind.x, mat_wind.y);	prevMatWindMousePosx = x;	prevMatWindMousePosy = y;}

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.