Jump to content
  • Advertisement

Archived

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

JinJo

Windows API

This topic is 6016 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

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!

Share this post


Link to post
Share on other sites
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[ i].left && MouseX < Button[i ].right &&
MouseY > Button[ i].top && MouseY < Button[i ].bottom)
{
ReturnVal = ButtonState[i ];
}
}
}


Maybe that'll be of some use...

Later,
ZE.


//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

[if you have a link proposal, email me.]
EDITED for formatting.


[edited by - zealouselixir on May 29, 2002 4:29:01 PM]

Share this post


Link to post
Share on other sites
Thanks alot, that ws what i was thinking i just thought windows could help me cut code.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!