OpenSiv3D  v0.6.5
C++20 framework for creative coding
s3d::Timer Class Reference

タイマー More...

#include <Timer.hpp>

Public Member Functions

SIV3D_NODISCARD_CXX20 Timer (const Duration &duration=SecondsF{ 0 }, StartImmediately startImmediately=StartImmediately::No, ISteadyClock *pSteadyClock=nullptr)
 タイマーを作成します。 More...
 
bool isStarted () const noexcept
 タイマーが動作中であるかを示します(開始後の一時停止も動作中に含みます)。 More...
 
bool isPaused () const noexcept
 タイマーが一時停止中であるかを示します。 More...
 
bool isRunning () const noexcept
 タイマーが時間を計測中であるかを示します。 More...
 
bool reachedZero () const
 タイマーの残り時間が 0 に達しているかを返します。 More...
 
void start ()
 タイマーを開始・再開します。 More...
 
void pause ()
 開始しているタイマーを一時停止します。 More...
 
void resume ()
 タイマーが一時停止中である場合、再開します。 More...
 
void reset () noexcept
 タイマーを停止し、残り時間を最初の状態にリセットします。 More...
 
void restart ()
 残り時間を最初の状態にリセットしてタイマーを再び開始します。 More...
 
void restart (const Duration &duration)
 カウントダウン時間を変更して、タイマーを再び最初から開始します。 More...
 
void set (const Duration &duration)
 タイマーのカウントダウン時間を変更し、残り時間も最初からにリセットします。 More...
 
void setRemaining (const Duration &remaining)
 タイマーの残り時間を変更します。 More...
 
int32 d () const
 残り時間を [日] で返します。 More...
 
int64 d64 () const
 残り時間を [日] で返します。 More...
 
double dF () const
 残り時間を [日] で返します。 More...
 
int32 h () const
 残り時間を [時] で返します。 More...
 
int64 h64 () const
 残り時間を [時] で返します。 More...
 
double hF () const
 残り時間を [時] で返します。 More...
 
int32 min () const
 残り時間を [分] で返します。 More...
 
int64 min64 () const
 残り時間を [分] で返します。 More...
 
double minF () const
 残り時間を [分] で返します。 More...
 
int32 s () const
 残り時間を [秒] で返します。 More...
 
int64 s64 () const
 残り時間を [秒] で返します。 More...
 
double sF () const
 残り時間を [秒] で返します。 More...
 
int32 ms () const
 残り時間を [ミリ秒] で返します。 More...
 
int64 ms64 () const
 残り時間を [ミリ秒] で返します。 More...
 
double msF () const
 残り時間を [ミリ秒] で返します。 More...
 
int64 us () const
 残り時間を [マイクロ秒] で返します。 More...
 
int64 us64 () const
 残り時間を [マイクロ秒] で返します。 More...
 
double usF () const
 残り時間を [マイクロ秒] で返します。 More...
 
Duration duration () const
 設定されているカウントダウン時間を返します。 More...
 
Duration remaining () const
 残り時間を返します。 More...
 
double progress1_0 () const
 タイマーの進み具合を 1 から 0 の範囲で返します。 More...
 
double progress0_1 () const
 タイマーの進み具合を 0 から 1 の範囲で返します。 More...
 
String format (StringView format=U"H:mm:ss.xx"_sv) const
 残り時間を文字列に変換します。 DD 日 (00-) D 日 (0-) dd 日 (00-) d 日 (0-) HH 時 (00-) H 時 (0-) hh 時 (00-24) h 時 (0-24) MM 分 (00-) M 分 (0-) mm 分 (00-59) m 分 (0-59) SS 秒 (00-) S 秒 (0-) ss 秒 (00-59) s 秒 (0-59) X ミリ秒 (0-) x 小数点以下 1 桁秒 (0-9) xx 小数点以下 2 桁秒 (00-99) xxx 小数点以下 3 桁秒 (000-999) More...
 

Friends

bool operator< (const Timer &t, const MicrosecondsF &time)
 残り時間を比較します。 More...
 
bool operator<= (const Timer &t, const MicrosecondsF &time)
 残り時間を比較します。 More...
 
bool operator> (const Timer &t, const MicrosecondsF &time)
 残り時間を比較します。 More...
 
bool operator>= (const Timer &t, const MicrosecondsF &time)
 残り時間を比較します。 More...
 
bool operator< (const MicrosecondsF &time, const Timer &t)
 残り時間を比較します。 More...
 
bool operator<= (const MicrosecondsF &time, const Timer &t)
 残り時間を比較します。 More...
 
bool operator> (const MicrosecondsF &time, const Timer &t)
 残り時間を比較します。 More...
 
bool operator>= (const MicrosecondsF &time, const Timer &t)
 残り時間を比較します。 More...
 
template<class CharType >
std::basic_ostream< CharType > & operator<< (std::basic_ostream< CharType > &output, const Timer &value)
 
void Formatter (FormatData &formatData, const Timer &value)
 

Detailed Description

タイマー

Constructor & Destructor Documentation

◆ Timer()

SIV3D_NODISCARD_CXX20 s3d::Timer::Timer ( const Duration duration = SecondsF{ 0 },
StartImmediately  startImmediately = StartImmediately::No,
ISteadyClock pSteadyClock = nullptr 
)
explicit

タイマーを作成します。

Parameters
durationカウントダウン時間
startImmediately即座に計測を開始する場合は StartImmediately::Yes
pSteadyClock基準時刻取得用のカスタム関数。nullptr の場合はシステム時刻

Member Function Documentation

◆ d()

int32 s3d::Timer::d ( ) const

残り時間を [日] で返します。

Returns
残り時間 [日]

◆ d64()

int64 s3d::Timer::d64 ( ) const

残り時間を [日] で返します。

Returns
残り時間 [日]

◆ dF()

double s3d::Timer::dF ( ) const

残り時間を [日] で返します。

Returns
残り時間 [日]

◆ duration()

Duration s3d::Timer::duration ( ) const

設定されているカウントダウン時間を返します。

Returns
設定されているカウントダウン時間

◆ format()

String s3d::Timer::format ( StringView  format = U"H:mm:ss.xx"_sv) const

残り時間を文字列に変換します。 DD 日 (00-) D 日 (0-) dd 日 (00-) d 日 (0-) HH 時 (00-) H 時 (0-) hh 時 (00-24) h 時 (0-24) MM 分 (00-) M 分 (0-) mm 分 (00-59) m 分 (0-59) SS 秒 (00-) S 秒 (0-) ss 秒 (00-59) s 秒 (0-59) X ミリ秒 (0-) x 小数点以下 1 桁秒 (0-9) xx 小数点以下 2 桁秒 (00-99) xxx 小数点以下 3 桁秒 (000-999)

Parameters
formatフォーマット指定
Returns
フォーマットされた時間

◆ h()

int32 s3d::Timer::h ( ) const

残り時間を [時] で返します。

Returns
残り時間 [時]

◆ h64()

int64 s3d::Timer::h64 ( ) const

残り時間を [時] で返します。

Returns
残り時間 [時]

◆ hF()

double s3d::Timer::hF ( ) const

残り時間を [時] で返します。

Returns
残り時間 [時]

◆ isPaused()

bool s3d::Timer::isPaused ( ) const
noexcept

タイマーが一時停止中であるかを示します。

Returns
タイマーが開始後一時停止中である場合 true, それ以外の場合は false

◆ isRunning()

bool s3d::Timer::isRunning ( ) const
noexcept

タイマーが時間を計測中であるかを示します。

Returns
タイマーが開始されていて、なおかつ一時停止中でない場合 true, それ以外の場合は false

◆ isStarted()

bool s3d::Timer::isStarted ( ) const
noexcept

タイマーが動作中であるかを示します(開始後の一時停止も動作中に含みます)。

Returns
タイマーが開始されている、または開始後一時停止中である場合 true, それ以外の場合は false

◆ min()

int32 s3d::Timer::min ( ) const

残り時間を [分] で返します。

Returns
残り時間 [分]

◆ min64()

int64 s3d::Timer::min64 ( ) const

残り時間を [分] で返します。

Returns
残り時間 [分]

◆ minF()

double s3d::Timer::minF ( ) const

残り時間を [分] で返します。

Returns
残り時間 [分]

◆ ms()

int32 s3d::Timer::ms ( ) const

残り時間を [ミリ秒] で返します。

Returns
残り時間 [ミリ秒]

◆ ms64()

int64 s3d::Timer::ms64 ( ) const

残り時間を [ミリ秒] で返します。

Returns
残り時間 [ミリ秒]

◆ msF()

double s3d::Timer::msF ( ) const

残り時間を [ミリ秒] で返します。

Returns
残り時間 [ミリ秒]

◆ pause()

void s3d::Timer::pause ( )

開始しているタイマーを一時停止します。

◆ progress0_1()

double s3d::Timer::progress0_1 ( ) const

タイマーの進み具合を 0 から 1 の範囲で返します。

Returns
タイマーの進み具合 (0.0 から始まり、1.0 で終わる), カウントダウン時間が 0 の場合は 1

◆ progress1_0()

double s3d::Timer::progress1_0 ( ) const

タイマーの進み具合を 1 から 0 の範囲で返します。

Returns
タイマーの進み具合 (1.0 から始まり、0.0 で終わる), カウントダウン時間が 0 の場合は 0

◆ reachedZero()

bool s3d::Timer::reachedZero ( ) const

タイマーの残り時間が 0 に達しているかを返します。

Returns
タイマーの残り時間が 0 に達している場合 true, それ以外の場合は false

◆ remaining()

Duration s3d::Timer::remaining ( ) const

残り時間を返します。

Returns
残り時間

◆ reset()

void s3d::Timer::reset ( )
noexcept

タイマーを停止し、残り時間を最初の状態にリセットします。

◆ restart() [1/2]

void s3d::Timer::restart ( )

残り時間を最初の状態にリセットしてタイマーを再び開始します。

◆ restart() [2/2]

void s3d::Timer::restart ( const Duration duration)

カウントダウン時間を変更して、タイマーを再び最初から開始します。

Parameters
duration

◆ resume()

void s3d::Timer::resume ( )

タイマーが一時停止中である場合、再開します。

◆ s()

int32 s3d::Timer::s ( ) const

残り時間を [秒] で返します。

Returns
残り時間 [秒]

◆ s64()

int64 s3d::Timer::s64 ( ) const

残り時間を [秒] で返します。

Returns
残り時間 [秒]

◆ set()

void s3d::Timer::set ( const Duration duration)

タイマーのカウントダウン時間を変更し、残り時間も最初からにリセットします。

Parameters
duration新しいカウントダウン時間

◆ setRemaining()

void s3d::Timer::setRemaining ( const Duration remaining)

タイマーの残り時間を変更します。

Parameters
remainingタイマーの新しい残り時間

◆ sF()

double s3d::Timer::sF ( ) const

残り時間を [秒] で返します。

Returns
残り時間 [秒]

◆ start()

void s3d::Timer::start ( )

タイマーを開始・再開します。

◆ us()

int64 s3d::Timer::us ( ) const

残り時間を [マイクロ秒] で返します。

Returns
残り時間 [マイクロ秒]

◆ us64()

int64 s3d::Timer::us64 ( ) const

残り時間を [マイクロ秒] で返します。

Returns
残り時間 [マイクロ秒]

◆ usF()

double s3d::Timer::usF ( ) const

残り時間を [マイクロ秒] で返します。

Returns
残り時間 [マイクロ秒]

Friends And Related Function Documentation

◆ Formatter

void Formatter ( FormatData formatData,
const Timer value 
)
friend
Parameters
formatData
value

◆ operator< [1/2]

bool operator< ( const MicrosecondsF time,
const Timer t 
)
friend

残り時間を比較します。

Parameters
time比較する時間
tタイマー
Returns
比較の結果

◆ operator< [2/2]

bool operator< ( const Timer t,
const MicrosecondsF time 
)
friend

残り時間を比較します。

Parameters
tタイマー
time比較する時間
Returns
比較の結果

◆ operator<<

template<class CharType >
std::basic_ostream<CharType>& operator<< ( std::basic_ostream< CharType > &  output,
const Timer value 
)
friend
Template Parameters
CharType
Parameters
output
value
Returns

◆ operator<= [1/2]

bool operator<= ( const MicrosecondsF time,
const Timer t 
)
friend

残り時間を比較します。

Parameters
time比較する時間
tタイマー
Returns
比較の結果

◆ operator<= [2/2]

bool operator<= ( const Timer t,
const MicrosecondsF time 
)
friend

残り時間を比較します。

Parameters
tタイマー
time比較する時間
Returns
比較の結果

◆ operator> [1/2]

bool operator> ( const MicrosecondsF time,
const Timer t 
)
friend

残り時間を比較します。

Parameters
time比較する時間
tタイマー
Returns
比較の結果

◆ operator> [2/2]

bool operator> ( const Timer t,
const MicrosecondsF time 
)
friend

残り時間を比較します。

Parameters
tタイマー
time比較する時間
Returns
比較の結果

◆ operator>= [1/2]

bool operator>= ( const MicrosecondsF time,
const Timer t 
)
friend

残り時間を比較します。

Parameters
time比較する時間
tタイマー
Returns
比較の結果

◆ operator>= [2/2]

bool operator>= ( const Timer t,
const MicrosecondsF time 
)
friend

残り時間を比較します。

Parameters
tタイマー
time比較する時間
Returns
比較の結果

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