Documentation ¶
Index ¶
- type FrameGroup
- func (fg *FrameGroup) CancelTimer(timerID FrameTimerID)
- func (fg *FrameGroup) Close()
- func (fg *FrameGroup) FrameAfterFunc(timerID *FrameTimerID, d time.Duration, ctx context.Context, cb TimerCB)
- func (fg *FrameGroup) FrameNewTicker(timerID *FrameTimerID, d time.Duration, ctx context.Context, cb TimerCB)
- func (fg *FrameGroup) Pause()
- func (fg *FrameGroup) Resume()
- func (fg *FrameGroup) SetMultiple(multiple uint8) error
- type FrameGroupID
- type FrameNumber
- type FrameTimer
- type FrameTimerID
- type TimerCB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FrameGroup ¶
type FrameGroup struct {
// contains filtered or unexported fields
}
func (*FrameGroup) CancelTimer ¶
func (fg *FrameGroup) CancelTimer(timerID FrameTimerID)
CancelTimer 关闭定时器
func (*FrameGroup) Close ¶
func (fg *FrameGroup) Close()
func (*FrameGroup) FrameAfterFunc ¶
func (fg *FrameGroup) FrameAfterFunc(timerID *FrameTimerID, d time.Duration, ctx context.Context, cb TimerCB)
FrameAfterFunc 创建After定时器
func (*FrameGroup) FrameNewTicker ¶
func (fg *FrameGroup) FrameNewTicker(timerID *FrameTimerID, d time.Duration, ctx context.Context, cb TimerCB)
FrameNewTicker 创建Ticker定时器
func (*FrameGroup) SetMultiple ¶
func (fg *FrameGroup) SetMultiple(multiple uint8) error
SetMultiple 设置倍数,允许倍数范围1-5
type FrameGroupID ¶
type FrameGroupID uint64
type FrameNumber ¶
type FrameNumber uint64
type FrameTimer ¶
func (*FrameTimer) OnInit ¶
func (ft *FrameTimer) OnInit() error
func (*FrameTimer) SetAccuracyInterval ¶
func (ft *FrameTimer) SetAccuracyInterval(interval time.Duration)
SetAccuracyInterval 设置时间间隔精度,在循环中sleep该时间进行判断。实际上因为sleep有误差,所以暂时不使用fps得出。默认为3ms
func (*FrameTimer) SetFps ¶
func (ft *FrameTimer) SetFps(fps uint32)
SetFps 设置帧率,越大误差越低。如果有倍数加速需求,可以适当加大fps,以减少误差。默认50fps
type FrameTimerID ¶
type FrameTimerID uint64
type TimerCB ¶
type TimerCB func(context.Context, FrameTimerID)
Click to show internal directories.
Click to hide internal directories.