Windows API

Started by
1 comment, last by JinJo 21 years, 10 months ago
Heres a simple question which youll probably laugh at. I have drawn several bitmaps to the screen using the GDI, but what i want to do is make them act like buttons. I was going to use, normal buttons, but i dont know how to show them with bitmaps, also i dont know how to process button messages. If putting the bitmap on the button still shows the back of the button i dont want to do that. Can anyone help, please. Cheers!
Advertisement
Depends on how realistic you want to make them appear. If you want to have different images for mouseover and mouseclick events, this probably won't help much, but here's what I do in my engine:
	const int NumButtons = 4;	RECT Button[NumButtons] = 	//  {left,top,right,bottom}	{		{221,162,419,217}, 		{196,245,434,291}, 		{230,316,403,363}, 		{526,399,571,426}	};	GameState ButtonState[NumButtons] = 	{		GAME_BRIEFING,		GAME_INIT,		GAME_CREDITS,		GAME_SHUTDOWN	};/// insert mouse updating here	if(GameInput->MouseButtonDown(MOUSE_LEFT))	{		for(int i = 0; i < NumButtons; i++)		{			if(MouseX > Button.left && MouseX < Button.right &&<br>			   MouseY > Button.top && MouseY < Button.bottom)<br>			{<br>				ReturnVal =  ButtonState;<br>			}<br>		}<br>	}<br>    </pre>    <br><br>Maybe that'll be of some use…<br><br>Later,<br>ZE.<br><br><br><font color = "#A8A8A8" size = "1" face = "verdana, tahoma, arial, default-sans-serif">//<a href = "mailto:zealouselixir@yahoo.com">email me.</a>//<a href = "http://www.geocities.com/zealouselixir/">zealouselixir software.</a>//<a href = "http://msdn.microsoft.com/library/default.asp">msdn.</a>//<a href = "http://www.gamedev.net/reference/start_here/">n00biez.</a>//<br><a href = "http://www.ojuice.net/">m</a><a href = "http://www.nvidia.com/">i</a><a href = "http://www.gamasutra.com/">s</a><a href = "http://www.gdmag.com/">c</a><a href = "http://www.flipcode.com/">e</a><a href = "http://www.cprogramming.com/">l</a><a href = "http://www.bloodshed.net/">l</a><a href = "http://shilbert.cjb.net/">a</a><a href = "http://www.facehat.com/">n</a><a href = "http://nehe.gamedev.net/">e</a><a href = "http://nexe.gamedev.net/">o</a><a href = "http://www.gamedeveloper.com/">u</a><a href = "http://www.voxelsoft.com/sk/">s </a><a href = "http://www.gamespy.com/">l</a><a href = "http://www.codeproject.com/">i</a><a href = "http://www.sourceforge.com/">n</a><a href = "http://www.codeguru.com/">k</a><a href = "http://www.thinkgeek.com/">s</a><br><br>[if you have a link proposal, email me.]<br>EDITED for formatting.<br></font><br><br><SPAN CLASS=editedby>[edited by - zealouselixir on May 29, 2002 4:29:01 PM]</SPAN>    

[twitter]warrenm[/twitter]

Thanks alot, that ws what i was thinking i just thought windows could help me cut code.

This topic is closed to new replies.

Advertisement