TGUI  0.9-dev
tgui::Duration Class Reference

Wrapper for durations. More...

#include <TGUI/Duration.hpp>

Public Member Functions

 Creates an zero-length duration.
template<typename Rep , typename Period >
TGUI_CONSTEXPR Duration (std::chrono::duration< Rep, Period > duration)
 Creates the duration from any kind of std::chrono::duration.
 Duration (sf::Time duration)
 Creates the duration from an sf::Time instance.
TGUI_CONSTEXPR float asSeconds () const
 Returns the duration in seconds.
TGUI_CONSTEXPR operator std::chrono::nanoseconds () const
 Convert the duration to std::chrono::nanoseconds.
template<typename Rep , typename Period >
TGUI_CONSTEXPR operator std::chrono::duration< Rep, Period > () const
 Convert the duration to std::chrono::duration.
 operator sf::Time () const
 Convert the duration to sf::Time.

Detailed Description

Wrapper for durations.

You do not have to use class directly in your code unless you want to store the duration. Functions taking tgui::Duration as parameter can be directly passed arguments like:

  • sf::microseconds(500)
  • std::chrono::nanoseconds(20000)
  • std::chrono::milliseconds(10) / 2.0f

The documentation for this class was generated from the following file: