Skip to main content
gamedev.net
🔒 Locked

Help with bitmaps.

Started by nodnarb 2 replies 450+ views
Original Post
nodnarb
nodnarb
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.
Freedom is a state of mind. [cOrPoRaTe AvEnGeR!]
nodnarb
nodnarb
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]
Freedom is a state of mind. [cOrPoRaTe AvEnGeR!]
code_conspiracy
code_conspiracy
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!
Kyo
Kyo
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.

Topic Locked

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

Sign in to reply to this topic.