engine: github.com/g3n/engine/util Index | Files | Directories

package util

import "github.com/g3n/engine/util"


Package Files


type FrameRater Uses

type FrameRater struct {
    // contains filtered or unexported fields

FrameRater implements a frame rate controller

func NewFrameRater Uses

func NewFrameRater(targetFPS uint) *FrameRater

NewFrameRater returns a frame rate controller object for the specified number of target frames per second

func (*FrameRater) FPS Uses

func (f *FrameRater) FPS(t time.Duration) (float64, float64, bool)

FPS calculates and returns the current measured FPS and the maximum potential FPS after the specified time interval has elapsed. It returns an indication if the results are valid

func (*FrameRater) Start Uses

func (f *FrameRater) Start()

Start should be called at the start of the frame

func (*FrameRater) Wait Uses

func (f *FrameRater) Wait()

Wait should be called at the end of the frame If necessary it will sleep to achieve the desired frame rate


loggerPackage logger implements an hierarchical logger used by other packages.

Package util imports 1 packages (graph) and is imported by 1 packages. Updated 2019-10-03. Refresh now. Tools for package owners.