Ok, thanks for that. Having searched my comp for it I've just discovered that It was in lib file all along, I just didn't see it.
Any I've now got a new problem. One of the examples uses two functions: max() and min()
When I try to comile however I get:
"ufo.cpp": E2268 Call to undefined function 'max' in function HandleKeys() at line 84
The thing is the book comes with a source code disk and I have litteraly inported the project from the disk. As they seem to to be missing from the main code, and the book says nothing about them, I'm stuck what to do. Unless anyone knows where they are defined or can help me get round the problem.
Just incase it helps, I've included how they are used:
Code:
void GameCycle()
{
// Update the saucer position
g_iSaucerX = min(500 - g_pSaucer->GetWidth(), max(0, g_iSaucerX + g_iSpeedX));
g_iSaucerY = min(320, max(0, g_iSaucerY + g_iSpeedY));
// Force a repaint to redraw the saucer
InvalidateRect(g_pGame->GetWindow(), NULL, FALSE);
}
void HandleKeys()
{
// Change the speed of the saucer in response to arrow key presses
if (GetAsyncKeyState(VK_LEFT) < 0)
g_iSpeedX = max(-g_iMAXSPEED, --g_iSpeedX);
else if (GetAsyncKeyState(VK_RIGHT) < 0)
g_iSpeedX = min(g_iMAXSPEED, ++g_iSpeedX);
if (GetAsyncKeyState(VK_UP) < 0)
g_iSpeedY = max(-g_iMAXSPEED, --g_iSpeedY);
else if (GetAsyncKeyState(VK_DOWN) < 0)
g_iSpeedY = min(g_iMAXSPEED, ++g_iSpeedY);
}
Thanks in advance.