Why won't my tetris blocks Blit onto my playing field map?
my Win32 program has no errors or warnings and does indeed execute... but the only thing that u see when u run it is my background and a primary playing feild map bmp created within the program initialized with a color for debugging purposes..it keep blinking to represent the blocks falling but there not there!!! the second map is just for the preview tetris block piece...but anyway how come my blocks wont blit onto my map??? isnt it supposed to overwrite the map with my blocks on top of it? hmm here are some sections of my program where i think the problem might be but i can't figure it out... can anyone please help me?? thank you
-paul
void GameStart(HWND hWindow)
{
HDC hDC = GetDC(hWindow);
COLORREF crColor;
g_pBackground = new Bitmap(hDC, IDB_BCKGRND, g_hInstance);
g_p_bmoBlocks = new Bitmap(hDC, IDB_BLOCKS, g_hInstance);
g_p_bmoMap = new Bitmap(hDC, MAPWIDTH*TILESIZE, MAPHEIGHT*TILESIZE,crColor = RGB(160,60,30));
g_p_bmoMap2 = new Bitmap(hDC, 192,224);
ReleaseDC(hWindow,hDC);
NewGame();
}
void DrawTile(int x,int y,int tile)//put a tile
{
//mask first
BitBlt(g_p_bmoMap->hdcMemory,x*TILESIZE,y*TILESIZE,TILESIZE,TILESIZE,g_p_bmoBlocks->hdcMemory,tile*TILESIZE,TILESIZE,SRCAND);
//then image
BitBlt(g_p_bmoMap->hdcMemory,x*TILESIZE,y*TILESIZE,TILESIZE,TILESIZE,g_p_bmoBlocks->hdcMemory,tile*TILESIZE,0,SRCPAINT);
}
void GamePaint(HDC hDC)
{
// Draw the the background
g_pBackground->Draw(hDC, 0, 0);
//Draw the playing feilds
g_p_bmoMap->Draw(hDC,32,96);
g_p_bmoMap2->Draw(hDC,544,96);
}
(by the way i made the hdc in a bitmap class to be public so that i can easily reference it in the BitBlt function)
Well I'm used to using SDL, so this might not be true for what you're doing, but you might need to set it to update the board after it draws a block.
Quote:Original post by BringBackFuturama
Well I'm used to using SDL, so this might not be true for what you're doing, but you might need to set it to update the board after it draws a block.
But isn't the library function BitBlt supposed draw it on and update it automatically?
what function does that then?... hmm
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement