background image

wndcls.style=CS_HREDRAW | CS_VREDRAW;
RegisterClass(&wndcls);

//Game_Tetris
HWND hwnd;

hwnd=CreateWindow("Game_tetris","Game_Snake(http://blog.ednchina.com/zook0k/)",WS_OV
ERLAPPEDWINDOW   &   ~WS_MAXIMIZEBOX   &   ~WS_MINIMIZEBOX   & 
~WS_THICKFRAME,

0,0,C_W,C_H,NULL,NULL,hInstance,NULL);

ShowWindow(hwnd,SW_SHOWNORMAL);

//initial snake

HDC hdc;
hdc=GetDC(hwnd);

        HBRUSH hbr;

RECT rect;   

        rect.left   = 0;
        rect.top    = 0;
        rect.right  = 16;
        rect.bottom = 8;
        hbr= CreateSolidBrush(RGB(255,0,0)); 
        FillRect(hdc,&rect,hbr);

ReleaseDC(hwnd,hdc);
game_map[0][0]=1;
game_map[0][1]=1;

//initial rand

SetTimer(hwnd,1,100,NULL) ;
srand((int)time(0));

UpdateWindow(hwnd);

MSG msg;
while(GetMessage(&msg,NULL,0,0))
{
//

TranslateMessage(&msg);
DispatchMessage(&msg);

}
return 0;

}