Archived

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

nodnarb

Help with bitmaps.

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
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
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