usleep() did not work on Windows - modified ag.cc to use Sleep()

git-svn-id: svn://anubis/anaglym/trunk@38 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
Josh Holtrop 2009-09-29 18:44:59 +00:00
parent 9d95158176
commit 4bca35ee69

7
ag.cc
View File

@ -10,6 +10,9 @@
#include <string> #include <string>
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h> #include <GL/glu.h>
#ifdef _WIN32
#include <windows.h> /* Sleep() */
#endif
using namespace std; using namespace std;
namespace ag namespace ag
@ -157,7 +160,11 @@ namespace ag
if (lua_type(L, -1) == LUA_TNUMBER) if (lua_type(L, -1) == LUA_TNUMBER)
{ {
double seconds = lua_tonumber(L, -1); double seconds = lua_tonumber(L, -1);
#ifdef _WIN32
Sleep((DWORD)(seconds * 1000));
#else
usleep((useconds_t) (seconds * 1000000)); usleep((useconds_t) (seconds * 1000000));
#endif
} }
} }