frametimer

package
v2.1.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2025 License: Apache-2.0 Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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) Pause

func (fg *FrameGroup) Pause()

Pause 暂停定时器组

func (*FrameGroup) Resume

func (fg *FrameGroup) Resume()

Resume 唤醒定时器组

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

type FrameTimer struct {
	service.Module
	// contains filtered or unexported fields
}

func (*FrameTimer) NewGroup

func (ft *FrameTimer) NewGroup() *FrameGroup

NewGroup 创建定时器组

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL