Skip to main content
gamedev.net
🔒 Locked

Bitmaps-How?

Started by Zeke Jul 1, 2000 at 1:54 PM 3 replies 650+ views
Original Post
Zeke
Zeke
How much C/C++ knowledge do you need to just get a bitmap up on the screen? I have found tutorials and articles all over the place on most aspects of this language but i have been unable to find one that teaches how to load up a bitmap. Can anyone help? Thanks
Just my thoughts take them as you will. "People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
ARCHIGAMER
ARCHIGAMER
You need to learn Win32 API for Windows bitmap loading or make your own loader. Most of this is covered TOFTWGPG also Windows game programming for dummies has it. If you want to use Win32 API "Programming Windows with Win32 API" you can get it at Amazon.com for a nice price.
I wish there was a button on my monitor to turn up the intellegince. Theres a button called 'brightness' but it doesn't work
Muzzafarath
Muzzafarath
Go to Wotsit and get a description of the bitmap format. Then you have to display it on the screen, which is rather platform-dependant, so if you want us to tell you how to it, you're going to have to tell us what OS you're running.

If you're new to C++, then you shouldn't get in to graphics and stuff like that. Start with something a little bit easier.

- Muzzafarath

Mad House Software
The Field Marshals

Edited by - Muzzafarath on July 2, 2000 6:22:15 AM
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
NBGH
NBGH
Loading a bitmap is quite easy under Windows (if wrong platform then ignore all this crap). Do you want to put it on the screen in DirectX, or Windows GDI? Either way:

1) look up LoadImage() in the SDK, it will return a HBITMAP given a filename.

2) Use GetObject() to return a BITMAP which holds information about its bit depth, width and height, and the actual bitmap data. Look this one up as well.

3) Create a compatible DC (the hint is in the name), select the HBITMAP to that DC, and then use the DC to StretchBlt onto the DC of the target surface (be that a GDI surface or a DirectX surface).

Its a five to six step operation. look up LoadImage(), GetObject(), CreateCompatibleDC() i think, SelectObject() and StretchBlt(). Its all quite easy. Good luck, it sucks - I know. This stuff is all covered in the Win32 SDK (and don''t quote me against it, because its all off the top of my head!).
Zeke
Zeke
Thanks a lot guys, it looks like I''ve got a lot of reading to do
Thanks again

Just my thoughts take them as you will. "People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face

Topic Locked

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

Sign in to reply to this topic.