int __stdcall WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int iCmdShow)
{
HDC hDC = GetDC(NULL);
InitializeArray();
while( !(GetAsyncKeyState(VK_ESCAPE) & 0x8000))
{
for(int x = 1; x < ARRAY_X - 1; x++)
{
for(int y = 1; y < ARRAY_Y - 1; y++)
{
int n = CheckNeighbours(x, y);
if(n == 3 && iCells[x][y] == DEAD)
iTempArray[x][y] = ALIVE;
else if( (n == 2 || n == 3) && iCells[x][y] == ALIVE)
iTempArray[x][y] = ALIVE;
else
iTempArray[x][y] = DEAD;
}
}
memcpy(iCells, iTempArray, sizeof(int) * ARRAY_X * ARRAY_Y);
for(x = 1; x < ARRAY_X - 1; x++)
{
for(int y = 1; y < ARRAY_Y - 1; y++)
{
if(iCells[x][y] == DEAD)
SetPixel(hDC, x, y, RGB(0, 0, 0));
else
SetPixel(hDC, x, y, RGB(0, 255, 0));
}
}
}
ReleaseDC(NULL, hDC);
return(0);
}
declaration syntax error?
2007-02-06
18:30:59
·
2 answers
·
asked by
Romanianlanguage
2