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

Author Topic: Getting Crazy with them DateTime  (Read 3467 times)

0 Members and 1 Guest are viewing this topic.

Falke88

  • Jr. Member
  • **
  • Posts: 74
    • View Profile
Getting Crazy with them DateTime
« 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!

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: Getting Crazy with them DateTime
« Reply #1 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.
« Last Edit: September 11, 2014, 10:36:43 pm by Ixrec »

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Getting Crazy with them DateTime
« Reply #2 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, 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.


Quote
Edit: Forgot this was the DotNet subforum.

That easy to miss eh? xD
« Last Edit: September 11, 2014, 11:00:19 pm by zsbzsb »
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Getting Crazy with them DateTime
« Reply #3 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.

Ztormi

  • Jr. Member
  • **
  • Posts: 71
  • Web developer by day. Game developer by night.
    • View Profile
Re: Getting Crazy with them DateTime
« Reply #4 on: September 12, 2014, 08:22:06 am »
Use
System.Diagnostics.Stopwatch
It's fine for the most applications.
« Last Edit: September 12, 2014, 08:24:14 am by Ztormi »

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Getting Crazy with them DateTime
« Reply #5 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.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Ztormi

  • Jr. Member
  • **
  • Posts: 71
  • Web developer by day. Game developer by night.
    • View Profile
Re: Getting Crazy with them DateTime
« Reply #6 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.