Help with bitmaps.
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.
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]
[edited by - nodnarB on May 2, 2003 10:02:35 AM]
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!
3 steps: Create a dc, load a bitmap into a HBITMAP, put the HBITMAP into the dc and voila
Creating a DC:
Loading a bitmap
Put the bitmap in DC:
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement