Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Jerry

Pages: [1]
1
System / DeltaTime question
« on: June 27, 2011, 01:40:46 pm »
Lo-X - thanks for the reply but I think my problem is not whether deltaTime is in seconds or milliseconds. Indeed I tried it anyway and my sprite still does not display.

Just to clarify the sprite displays fine if I don't mutiply by deltaTime or I if I set deltaTime some value directly.

E.g:

 
Code: [Select]

float deltaTime = 0.06;

sf::Vector2f moveVector;

moveVector.x = 10.f * deltaTime;

sprite.Move(moveVector);

window.Draw(sprite);


Thanks.

2
System / DeltaTime question
« on: June 27, 2011, 11:27:44 am »
Hi All,

I'm just getting started with SFML and C++ in general so apologies if this is a very basic question.

I'm trying to move a sprite as below using delta time to smooth the movement (simplified for clarity).

Code: [Select]

float deltaTime = 1.0f/window.GetFrameTime();

sf::Vector2f moveVector;

moveVector.x = 10.f * deltaTime;

sprite.Move(moveVector);

window.Draw(sprite);



When using delta time my sprite wont draw which I'm guessing is due to the type conversion between Uint32 and float.

What would an appropriate method of converting the correct value? I have tried a few conversion methods I found on the web but none seem to resolve the problem.

Thanks for your time.

Pages: [1]
anything