CSFML 3.0.0
Loading...
Searching...
No Matches
Functions
Clock.h File Reference
`#include <CSFML/System/Export.h>`
`#include <CSFML/System/Time.h>`
`#include <CSFML/System/Types.h>`

Go to the source code of this file.

## Functions

sfClock * | sfClock_create (void)
| Create a new clock and start it.
sfClock * | sfClock_copy (const sfClock *clock)
| Create a new clock by copying an existing one.
void | sfClock_destroy (const sfClock *clock)
| Destroy a clock.
sfTime | sfClock_getElapsedTime (const sfClock *clock)
| Get the time elapsed in a clock.
bool | sfClock_isRunning (const sfClock *clock)
| Check whether the clock is running.
void | sfClock_start (sfClock *clock)
| Start the clock.
void | sfClock_stop (sfClock *clock)
| Stop the clock.
sfTime | sfClock_restart (sfClock *clock)
| Restart a clock.
sfTime | sfClock_reset (sfClock *clock)
| Reset the clock.

## Function Documentation

## ◆ sfClock_copy()

sfClock * sfClock_copy | ( | const sfClock * | clock | ) |

Create a new clock by copying an existing one.

Parameters

  clock | Clock to copy

Returns
  A new sfClock object which is a copy of clock

## ◆ sfClock_create()

sfClock * sfClock_create | ( | void |  | ) |

Create a new clock and start it.

Returns
  A new sfClock object

## ◆ sfClock_destroy()

void sfClock_destroy | ( | const sfClock * | clock | ) |

Destroy a clock.

Parameters

  clock | Clock to destroy

## ◆ sfClock_getElapsedTime()

sfTime sfClock_getElapsedTime | ( | const sfClock * | clock | ) |

Get the time elapsed in a clock.

This function returns the time elapsed since the last call to sfClock_restart (or the construction of the object if sfClock_restart has not been called).

Parameters

  clock | Clock object

Returns
  Time elapsed

## ◆ sfClock_isRunning()

bool sfClock_isRunning | ( | const sfClock * | clock | ) |

Check whether the clock is running.

Parameters

  clock | Clock object

Returns
  true if the clock is running, false otherwise

## ◆ sfClock_reset()

sfTime sfClock_reset | ( | sfClock * | clock | ) |

Reset the clock.

This function puts the time counter back to zero, returns the elapsed time, and leaves the clock in a paused state.

Parameters

  clock | Clock object

Returns
  Time elapsed

See also
  restart

## ◆ sfClock_restart()

sfTime sfClock_restart | ( | sfClock * | clock | ) |

Restart a clock.

This function puts the time counter back to zero. It also returns the time elapsed since the clock was started.

Parameters

  clock | Clock object

Returns
  Time elapsed

## ◆ sfClock_start()

void sfClock_start | ( | sfClock * | clock | ) |

Start the clock.

Parameters

  clock | Clock object

See also
  stop

## ◆ sfClock_stop()

void sfClock_stop | ( | sfClock * | clock | ) |

Stop the clock.

Parameters

  clock | Clock object

See also
  start