I am loading 2 images (sprite and mask) into DC that I have created using the CreateCompatibleDC api, and then I blit them into the screen. My question is: How do I create another dc so I can blit the new transparent image (result of mask + sprite) into it, and not into the form.
The code I am using is the following, but it doesn't work, even though I don't get any errors. But is works OK when I blit them into the screen.
VB Code:
Private Sub Form_Activate() 'Create DC MaskDC = CreateCompatibleDC(Me.hdc) SpriteDC = CreateCompatibleDC(Me.hdc) FinalImageDC = CreateCompatibleDC(Me.hdc) 'Load images MaskIM = LoadImage(0, "C:\WINDOWS\Desktop\Henrique\Shooter\Images\target_hit_mask.bmp", 0, 0, 0, &H10) SpriteIM = LoadImage(0, "C:\WINDOWS\Desktop\Henrique\Shooter\Images\target_hit_sprite.bmp", 0, 0, 0, &H10) 'Link DC with image SelectObject MaskDC, MaskIM SelectObject SpriteDC, SpriteIM 'Go through each separate part of the images Do DoEvents Me.Cls 'This is what does not work, the FinalImageDC BitBlt FinalImageDC, 10, 10, 30, 74, MaskDC, x, 0, vbSrcAnd BitBlt FinalImageDC, 10, 10, 30, 74, SpriteDC, x, 0, vbSrcPaint x = x + 31 If x >= 740 Then x = 0 End If Loop Until GameOver = True End Sub
Is this the right way of doing this, or is there another API call for this?
Thanks




Reply With Quote