TGUI  0.9.5
Loading...
Searching...
No Matches
tgui::Duration Class Reference

Wrapper for durations. More...

#include <TGUI/Duration.hpp>

Public Member Functions

TGUI_CONSTEXPR Duration ()
 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.
 
TGUI_CONSTEXPR Duration (int milliseconds)
 Creates the duration from a given amount of milliseconds.
 
 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
  • 200 // unit is milliseconds

Constructor & Destructor Documentation

◆ Duration()

TGUI_CONSTEXPR tgui::Duration::Duration ( int  milliseconds)
inline

Creates the duration from a given amount of milliseconds.

Parameters
millisecondsAmount of milliseconds to store in the duration

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