SFML community forums

Bindings - other languages => DotNet => Topic started by: Falke88 on September 11, 2014, 10:04:58 pm

Title: Getting Crazy with them DateTime
Post by: Falke88 on September 11, 2014, 10:04:58 pm
Hey Guys!

I want to make a transitional movement for my sprites. therefore I need a clock/timer or something.
Was reading everything about DateTime but just can't get along with it.

I don't understand the tick parameter here and also I only receive rubbish when calling attributes from the instance like second & minute.

Is there a better class available? If not, please give me an example how you guys solved a transitions with DateTime please.


greets Falke!
Title: Re: Getting Crazy with them DateTime
Post by: Ixrec on September 11, 2014, 10:14:51 pm
There is no "DateTime" in SFML that I'm aware of.  What are you referring to?

The tutorial on using SFML timers is here: http://sfml-dev.org/tutorials/2.1/system-time.php

Of course, if you have access to C++11 you may prefer the standard <chrono> library.

Edit: Forgot this was the DotNet subforum.
Title: Re: Getting Crazy with them DateTime
Post by: zsbzsb on September 11, 2014, 10:57:24 pm
Do not use DateTime, or TimeSpan classes, or for that matter any standard CLI time management classes as they do not provide high enough precision.

SFML.NET since the release of 2.1 has had the System module added (https://github.com/SFML/SFML.Net/commit/f7aeeb196d64b3924391f513f31b03c3336a9d27), so now the standard SFML Time and Clock classes are available. I suggest you download the latest version of SFML.NET from github and also grab a copy of CSFML that includes the blending mode changes. For CSFML you can either compile it yourself or grab a nightly build from here (http://nightlybuilds.ch/project/show/4/CSFML/).


Quote
Edit: Forgot this was the DotNet subforum.

That easy to miss eh? xD
Title: Re: Getting Crazy with them DateTime
Post by: Jesper Juhl on September 11, 2014, 11:14:29 pm
Quote
Edit: Forgot this was the DotNet subforum.

That easy to miss eh? xD
It can be.
If you, like me, usually just view the list of unread posts on the forum, then it can be easy to miss exactly what board a specific post is in.
Title: Re: Getting Crazy with them DateTime
Post by: Ztormi on September 12, 2014, 08:22:06 am
Use
System.Diagnostics.Stopwatch
It's fine for the most applications.
Title: Re: Getting Crazy with them DateTime
Post by: zsbzsb on September 12, 2014, 01:27:08 pm
Use
System.Diagnostics.Stopwatch
It's fine for the most applications.

Did you really not read my reply? There is a reason the SFML timing classes exist.
Title: Re: Getting Crazy with them DateTime
Post by: Ztormi on September 12, 2014, 02:08:52 pm
Use
System.Diagnostics.Stopwatch
It's fine for the most applications.

Did you really not read my reply? There is a reason the SFML timing classes exist.

Just wanted to give him an option incase he doesn't want to mess around with git. For example the available nuget package doesn't have SFML.System namespace.