engine
 
载入中...
搜索中...
未找到
类 | Public 成员函数 | 静态 Public 成员函数 | Protected 属性 | 所有成员列表
FTicker类 参考

Ticker class. 更多...

#include <Ticker.h>

+ 类 FTicker 继承关系图:

类

struct  FElement
 Element of the priority queue 更多...
 

Public 成员函数

CORE_API FDelegateHandle AddTicker (const FTickerDelegate &InDelegate, float InDelay=0.0f)
 Add a new ticker with a given delay / interval 更多...
 
CORE_API FDelegateHandle AddTicker (const TCHAR *InName, float InDelay, TFunction< bool(float)> Function)
 Add a new ticker with a given delay / interval. 更多...
 
CORE_API void RemoveTicker (FDelegateHandle Handle)
 Removes a previously added ticker delegate. 更多...
 
CORE_API void Tick (float DeltaTime)
 Fire all tickers who have passed their delay and reschedule the ones that return true 更多...
 

静态 Public 成员函数

static CORE_API FTicker & GetCoreTicker ()
 Singleton used for the ticker in Core / Launch. 更多...
 

Protected 属性

bool bCurrentElementRemoved
 State to track whether the CurrentElement removed itself during its own delegate execution.
 
bool bInTick
 State to track whether CurrentElement is valid.
 
FElement CurrentElement
 Current element being ticked (only valid during tick).
 
double CurrentTime
 Current time of the ticker
 
TArray< FElement, TInlineAllocator< 1 > > Elements
 Future delegates to fire
 
TArray< FElement, TInlineAllocator< 1 > > TickedElements
 List of delegates that have been considered during Tick. 更多...
 

详细描述

Ticker class.

Fires delegates after a delay.

Note: Do not try to add the same delegate instance twice, as there is no way to remove only a single instance (see member RemoveTicker).

成员函数说明

◆ AddTicker() [1/2]

CORE_API FDelegateHandle FTicker::AddTicker ( const FTickerDelegate &  InDelegate,
float  InDelay = 0.0f 
)

Add a new ticker with a given delay / interval

参数
InDelegateDelegate to fire after the delay
InDelayDelay until next fire; 0 means "next frame"

◆ AddTicker() [2/2]

CORE_API FDelegateHandle FTicker::AddTicker ( const TCHAR *  InName,
float  InDelay,
TFunction< bool(float)>  Function 
)

Add a new ticker with a given delay / interval.

参数
InNameName of this ticker for profiling
InDelayDelay until next fire; 0 means "next frame"
FunctionFunction to execute. Should return true to fire after another InDelay time

◆ GetCoreTicker()

static CORE_API FTicker & FTicker::GetCoreTicker ( )
static

Singleton used for the ticker in Core / Launch.

If you add a new ticker for a different subsystem, do not put that singleton here!

◆ RemoveTicker()

CORE_API void FTicker::RemoveTicker ( FDelegateHandle  Handle)

Removes a previously added ticker delegate.

Note: will remove ALL tickers that use this handle, as there's no way to uniquely identify which one you are trying to remove.

参数
HandleThe handle of the ticker to remove.

◆ Tick()

CORE_API void FTicker::Tick ( float  DeltaTime)

Fire all tickers who have passed their delay and reschedule the ones that return true

Note: This reschedule has timer skew, meaning we always wait a full Delay period after each invocation even if we missed the last interval by a bit. For instance, setting a delay of 0.1 seconds will not necessarily fire the delegate 10 times per second, depending on the Tick() rate. What this DOES guarantee is that a delegate will never be called MORE FREQUENTLY than the Delay interval, regardless of how far we miss the scheduled interval.

参数
DeltaTimetime that has passed since the last tick call

类成员变量说明

◆ TickedElements

TArray<FElement, TInlineAllocator<1> > FTicker::TickedElements
protected

List of delegates that have been considered during Tick.

Either they been fired or are not yet ready.


该类的文档由以下文件生成: