Skip to main content
gamedev.net
🔒 Locked

ARGHH!!

Started by Feblex 2 replies 300+ views
Original Post
Feblex
Feblex
This is REALLY starting to annoy me... I can't figure out why I can't call functions based on mouse events. Basically, I use the following code to capture button presses:
 	case WM_LBUTTONDOWN:
	{         
				
	if (uMsg == WM_LBUTTONDOWN)
	 {
	     rendershot = 'go';
	 }

	   return 0;
          
        }
          
And I've got this code to render the gun shot effect (Inside the DrawGLScene loop):
 	if (rendershot == 'go')
	{
		Shoot();
	}
          
Now, for some odd reason, these "tasks" refuse to work together. I know the button-push capturing code works, because I threw the function KillGLWindow in there, and it worked. I also know the Shoot function works, because I rendered it in the DrawGLScene() loop by itself. I've tried several methods of making it work (changing "if (rendershot == 'go')" with "if (uMsg == WM_LBUTTONDOWN)" ), but nothing works. Help! [edited by - mrbugg on December 12, 2002 8:15:08 PM]
Hawkeye3
Hawkeye3
Why are you checking the message twice? If the code inside of case WM_LBUTTONDOWN executes, the message was received. Just take out that if( uMsg ... code and try putting rendershot in there by itself.
Feblex
Feblex
Whoohooo!! Thanks AP! You''re solution worked. Hawkeye, I took out the extra if (rendershot...), but that wasn''t the problem, though it cleaned up my code. In any case, thanks for helping out! If this game ever gets anywhere near the download stage, I''ll be sure to acknowledge your help!

Topic Locked

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

Sign in to reply to this topic.