hello i am trying to put a pong like game together for my first game. I beleave i am going to try and Blit the Bitmaps of the ball and the pads but i have no info on how to do this could some one help me out?
Ian167@hotmail.com
I coded a small PONG-game not long ago
I''m going to add it to the Workshop when it is back...
I''m going to add it to the Workshop when it is back...
I don''t know what API you use in your game.
If you''re using Windows GDI you might do the Blit like this:
HBITMAP h_image; // handle to a bitmap you want to blit
HDC hdc_image; // handle to the bitmap device context
BITMAP image; // bitmap to be blited
// at first you have to load a bitmap from resouces
h_image = LoadBitmap(hInstance, MAKEINTRESOURCE(ID_OF_YOUR_IMAGE));
GetObject(h_image, sizeof(BITMAP), ℑ);
hdc_image = CreateCompatibleDC(hdc_dest);
SelectObject(hdc_image, h_image);
// now do the Blit
BitBlt(hdc_dest,x,y,width,height,hdc_image,0,0,SRCCOPY);
where hdc_dest is a handle to the destination device context.
If you''re using Windows GDI you might do the Blit like this:
HBITMAP h_image; // handle to a bitmap you want to blit
HDC hdc_image; // handle to the bitmap device context
BITMAP image; // bitmap to be blited
// at first you have to load a bitmap from resouces
h_image = LoadBitmap(hInstance, MAKEINTRESOURCE(ID_OF_YOUR_IMAGE));
GetObject(h_image, sizeof(BITMAP), ℑ);
hdc_image = CreateCompatibleDC(hdc_dest);
SelectObject(hdc_image, h_image);
// now do the Blit
BitBlt(hdc_dest,x,y,width,height,hdc_image,0,0,SRCCOPY);
where hdc_dest is a handle to the destination device context.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement