Sign in to follow this  

TransparentBlt not working

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

Hiya I have bought a bokk called "Sam Teach Yourself Game Programming in 24 hours". I have been trying to make a simple game that moves a sprite around the screen, so far I have managed to make the sprite and background appear, modifying the game Henway from the book. The first time I tried to run I had loads of linking problesms with the objects, I sorted this out by removing all the lines that involved joystick functions, and a few involving bitmap drawing. Now I can run the program but unfortunatly it still shows any magenta (rgb(255,0,255)) parts I have put in the pictures even though they shouldn't be drawn. I have traced this to the function: void Bitmap::Draw(HDC hDC, int x, int y, BOOL bTrans, COLORREF crTransColor) { if (m_hBitmap != NULL) { // Create a memory device context for the bitmap HDC hMemDC = CreateCompatibleDC(hDC); // Select the bitmap into the device context HBITMAP hOldBitmap = (HBITMAP)SelectObject(hMemDC, m_hBitmap); // Draw the bitmap to the destination device context // if (bTrans) // TransparentBlt(hDC, x, y, GetWidth(), GetHeight(), hMemDC, 0, 0, // GetWidth(), GetHeight(), crTransColor); // else BitBlt(hDC, x, y, GetWidth(), GetHeight(), hMemDC, 0, 0, SRCCOPY); // Restore and delete the memory device context SelectObject(hMemDC, hOldBitmap); DeleteDC(hMemDC); } } I cannot run the program without commenting out the lines otherwise it will come up with: Bitmap.obj : error LNK2001: unresolved external symbol __imp__TransparentBlt@44 Debug/Movement Feature.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. I am currently using MS Visual C++ 6, can someone please tell me how to make this work?

Share this post


Link to post
Share on other sites

This topic is 4419 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this