Jump to content
  • Advertisement

Archived

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

skyx

ShowCursor() function

This topic is 5481 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I used ShowCursor() function in my programme.In DrawGLScene(), I have these codes:
	switch (flow)
	{
	case 0:	//interface

		glMatrixMode(GL_PROJECTION);
		glPushMatrix();									// push projection matrix

		glLoadIdentity();
		// set orth matrix

		glOrtho(0.0f, 640.0f, 0.0f, 480.0f, -1.0f, 1.0f);
		glMatrixMode(GL_MODELVIEW);
		glPushMatrix();									// push modelview matirx

		ShowCursor(TRUE);
		........//render part


		glDisable(GL_TEXTURE_GEN_S);
		glDisable(GL_TEXTURE_GEN_T);	
		glMatrixMode(GL_PROJECTION);
		glPopMatrix();
		glMatrixMode(GL_MODELVIEW);
		glPopMatrix();	
		break;

	case 1: //demo

		//orbit render method

		glMatrixMode(GL_PROJECTION);
		glPushMatrix();									// push projection matrix

		// set orth matrix

		glMatrixMode(GL_MODELVIEW);
		glPushMatrix();									// push modelview matirx

		ShowCursor(FALSE);
	         .......//render part

                  		glMatrixMode(GL_PROJECTION);
		glPopMatrix();
		glMatrixMode(GL_MODELVIEW);
		glPopMatrix();		

		break;
}
but it seems that the second ShowCursor() function dosen''t work.When I show the second scene, the cursor can still be seen. How can I hide it in one scene and display it in another scene.
		

Share this post


Link to post
Share on other sites
Advertisement
I''m pretty sure that Windows basically keeps a count of true calls to SetCursor(TRUE), so that each one adds 1 to the count. See here:

SetCursor(TRUE);
SetCursor(TRUE);

Now you have to call this:

SetCursor(FALSE);
SetCursor(FALSE);

to get it back to where it was before the two TRUE calls.
I''m pretty sure this is how it all works. Maybe there is
a function to see if the cursor is being shown (GetCursor?)
and then you could use a while loop in a wrapper function:

void SetCursor2 (BOOL bShow)
{
while (GetCursor () != bShow)
SetCursor (bShow);
}

I''m not sure if there is such a thing as a GetCursor()
function. Check MSDN and the net.


[JESUS SAVES|Planet Half-Life]

Share this post


Link to post
Share on other sites
Thank you. the display count is returned by the function ShowCorsor() itself which can be used to show cursor.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!