Hey There,
Sorry I can't follow you on how the GitHub SFML.NET build may help me here? I have the latest build I'm sure.
As I said I'm following the book SFML Game Dev. Tutorial.
Here is where I'm at
Stopwatch clock;
Vector2f newPos; // help vector for movement
float playerspeed = 1.0f; // speed of player movement
...
public void Run()
{
while(mWindow.IsOpen())
{
clock.Restart(); //restart clock
ProcessEvents();
Update(clock.Elapsed); //pass the elapsed time
Render();
}
}
private void Update(TimeSpan deltaTime)
{
if (mIsMovingUp)
newPos.Y -= playerspeed;
if (mIsMovingDown)
newPos.Y += playerspeed;
if (mIsMovingLeft)
newPos.X -= playerspeed;
if (mIsMovingRight)
newPos.X += playerspeed;
Console.WriteLine(deltaTime.TotalSeconds);
mPlayer.Position = newPos * deltaTime.TotalSeconds;
}
I really tried to match the .NET Code with the C++ Code from the book here.
But the main issue is with
mPlayer.Position = newPos * deltaTime.TotalSeconds;
Where newPos is a Vector2f object and TotalSeconds is a property of type double.
It's not possible to multiply these two for sure.
Even tho its written that way in the Tutorial:
mPlayer.move(movement * deltaTime.asSeconds());
where movement is from sf::Vector2f and multiplied by at least any number type (int, double etc) - dunno if this might work in C++ and not in C# tho.
I have a hard time to find a fitting solution for .NET so I would appreciate if anybody could help me out here.