Jump to content
  • Advertisement

Archived

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

nodnarb

Help with bitmaps.

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

Well first off I want to say that every book in the "For Dummies" series sucks. I have the C++ and the Windows Game Programming for dummies books. I understand C++ due to other books like Sams teach yourself in 21 days or something like that. But still I haven''t been able to learn shit out of the dummies books. They piss me off save your money for something better. Anyways, I know how to make a window, use keyboard input, draw shapes, but it beats the hell out of me how you''re supposed to load and display bitmaps.Any examples or links would be appreciated. By the way, I feel I should learn everything about Windows programming before I go into DirectX so don''t confuse me with that yet.

Share this post


Link to post
Share on other sites
Advertisement
Sorry, this doesn't seem to have anything to do with games so if you wanna move it to another forum you can. A reminder to only do drugs when you're not on a computer.

[edited by - nodnarB on May 2, 2003 10:02:35 AM]

Share this post


Link to post
Share on other sites
Get the book by Charles Petzold, Programming Windows 5th edition or http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_87eb.asp. MSDN rocks!

Share this post


Link to post
Share on other sites
3 steps: Create a dc, load a bitmap into a HBITMAP, put the HBITMAP into the dc and voila

Creating a DC:


HDC dc;

dc = CreateCompatibleDC(NULL);


Loading a bitmap


HBITMAP bitmap;

bitmap = (HBITMAP) LoadImage(NULL, filename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);


Put the bitmap in DC:


SelectObject(dc, bitmap);


Then just use BitBlt to draw the bitmap from the dc to the window dc. You''ll also want to look up the return values for error checking of each of these functions at msdn.microsoft.com under graphics->GDI or something like that. And google for tutorials on using masks.

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!