github.com/acrespo/mobile@v0.0.0-20190107162257-dc0771356504/exp/sprite/clock/clock.go (about)

     1  // Copyright 2014 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Package clock provides a clock and time functions for a sprite engine.
     6  package clock // import "golang.org/x/mobile/exp/sprite/clock"
     7  
     8  // A Time represents an instant in sprite time.
     9  //
    10  // The application using the sprite engine is responsible for
    11  // determining sprite time.
    12  //
    13  // Typically time 0 is when the app is initialized and time is
    14  // quantized at the intended frame rate. For example, an app may
    15  // record wall time when it is initialized
    16  //
    17  //	var start = time.Now()
    18  //
    19  // and then compute the current instant in time for 60 FPS:
    20  //
    21  //	now := clock.Time(time.Since(start) * 60 / time.Second)
    22  //
    23  // An application can pause or reset sprite time, but it must be aware
    24  // of any stateful sprite.Arranger instances that expect time to
    25  // continue.
    26  type Time int32