« Go back


pure nothrow @nogc float asSeconds(uint n);
Convert the Clock milliseconds to seconds

pure nothrow @nogc float asMinutes(uint n);
Convert the Clock milliseconds to minutes

pure nothrow @nogc uint asHours(uint n);
Convert the Clock milliseconds to hours

pure nothrow @nogc @property uint seconds(uint n);
Returns the given seconds in milliseconds

int n = 5.seconds; // n is 5000 because 5 seconds are 5000 milliseconds

StopWatch sw;

pure nothrow @nogc @property uint minutes(uint n);
Returns the given minutes in milliseconds

int n = 5.minutes; // n is 300_000 because 5 minutes are 300 seconds are 300_000 milliseconds

StopWatch sw;

struct Time;
The Time struct converts ticks to msecs, seconds, minutes and hours.

Randy Schuett (rswhite4@googlemail.com)

uint msecs;
Milliseconds = Ticks

float seconds;
Seconds = Milliseconds / 1000

float minutes;
Minutes = Seconds / 60

uint hours;
Hours = Minutes / 60

pure nothrow @nogc this(uint msecs);

static pure nothrow @nogc Time remain(Time time);
Calculate the remaining time.

struct StopWatch;
This class handles timer functions and the window class use these class to calculate the current fps.

Randy Schuett (rswhite4@googlemail.com)

nothrow @nogc void reset();
Reset the clock time

const nothrow @nogc Time getElapsedTime();
Returns the elapsed Time since the last reset.

const nothrow @nogc uint getElapsedTicks();
Returns only the milliseconds since the last reset.

nothrow @nogc uint getCurrentFPS(uint* frame_ms = null);
Returns the current framerate per seconds. If frame_ms is not null, the average ms per frame is stored there

static nothrow @nogc uint getTicks();
Returns the milliseconds since the application was started.

static nothrow @nogc Time getTime();
Returns the Time since the application was started.

static nothrow @nogc void wait(uint msecs);
Wait for msecs milliseconds, which means that the application freeze for this time.

Page generated by Ddoc.

» Dgame.System.StopWatch on Github


« Go back