Sign in to follow this  
jor1980

Updatetime slimdx pHysx

Recommended Posts

Hi am trying to make some tutorials of physx in slimdx and i need a function to update time in the tutorial of physx for c++ i saw this one:
NxReal UpdateTime()
{
    NxReal deltaTime;
#ifndef LINUX
    static __int64 gTime,gLastTime;
    __int64 freq;
    QueryPerformanceCounter((LARGE_INTEGER *)&gTime);  // Get current count
    QueryPerformanceFrequency((LARGE_INTEGER *)&freq); // Get processor freq
    deltaTime = (double)(gTime - gLastTime)/(double)freq;
    gLastTime = gTime;
#else
    struct timeval tv;
    static struct timeval lasttv = { 0 , 0 };
    if (lasttv.tv_usec == 0 && lasttv.tv_sec == 0)
        gettimeofday(&lasttv, NULL);
    gettimeofday(&tv, NULL);
    deltaTime = (tv.tv_usec - lasttv.tv_usec)/1000000.f
        + (tv.tv_sec - lasttv.tv_sec);
    lasttv = tv;
#endif
    return deltaTime;
}

And in the physx wrapper i saw another example for xna which uses this other function:
public void Update( GameTime gameTime )
		{
			// Update Physics
			this.Scene.Simulate( (float)gameTime.ElapsedGameTime.TotalMilliseconds / 1000.0f );
			//_scene.Simulate( 1.0f / 60.0f );
			this.Scene.FlushStream();
			this.Scene.FetchResults( SimulationStatus.RigidBodyFinished, true );

			this.Camera.Update( gameTime );
		}

How can i adaptone of this functions to visual basic to my slimdx test?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this