Code:const int BITMAPHEIGHT=32; const int BITMAPWIDTH=64; ////////////////////////////////////////////////////////////////////////////// //PROTOTYPES ////////////////////////////////////////////////////////////////////////////// bool Prog_Init();//game data initalizer void Prog_Loop();//main game loop void Prog_Done();//game clean up ////////////////////////////////////////////////////////////////////////////// //GLOBALS ////////////////////////////////////////////////////////////////////////////// HINSTANCE hInstMain=NULL;//main application handle HWND hWndMain=NULL;//handle to our main window //memory dc HDC hdcMem=NULL; //bitmaps HBITMAP hbmNew=NULL; HBITMAP hbmOld=NULL; ////////////////////////////////////////////////////////////////////////////// //WINDOWPROC ////////////////////////////////////////////////////////////////////////////// LRESULT CALLBACK TheWindowProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam) { //which message did we get? switch(uMsg) { case WM_LBUTTONDOWN: { //borrow dc from main window HDC hdc=GetDC(hWndMain); //blit from the memory dc to the window's dc BitBlt(hdc,LOWORD(lParam)-BITMAPWIDTH/2,HIWORD(lParam)-BITMAPHEIGHT/2,BITMAPWIDTH,BITMAPHEIGHT,hdcMem,0,0,SRCCOPY); //return the borrowed dc to the system ReleaseDC(hWndMain,hdc); //handled, so return 0 return(0); }break;
Ok this is a problem I am having with the BitBlt Function.
Warning!!! Some questions might sound stupid, but the problem is that I am really a newbie......
const int BITMAPHEIGHT=32; //Why is this initialized as the size?
const int BITMAPWIDTH=64;//same here
BitBlt(hdc,LOWORD(lParam)-BITMAPWIDTH/2,HIWORD(lParam)-BITMAPHEIGHT/2,BITMAPWIDTH,BITMAPHEIGHT,hdcMem,0,0,SRCCOPY);
Ok, the book says that the second and third parameter are the destion of the x and y coordinate of the bitmap respectively........why is the height of the bitmap divided by two? Warning stupid question coming.........and what does it have that little "-" Sign before the BITMAPWDTH parameter.........
Please help...I need to know this before I continue......



LinkBack URL
About LinkBacks


