本文整理汇总了Golang中golang.org/x/mobile/exp/sprite/clock.Time函数的典型用法代码示例。如果您正苦于以下问题:Golang Time函数的具体用法?Golang Time怎么用?Golang Time使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Time函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: onPaint
func onPaint(glctx gl.Context, sz size.Event) {
glctx.ClearColor(1, 1, 1, 1)
glctx.Clear(gl.COLOR_BUFFER_BIT)
now := clock.Time(time.Since(startTime) * 60 / time.Second)
game.Update(now)
eng.Render(scene, now, sz)
}
示例2: onPaint
func onPaint(glctx gl.Context, sz size.Event) {
glctx.ClearColor(1, 1, 1, 1) // white background
glctx.Clear(gl.COLOR_BUFFER_BIT)
now := clock.Time(time.Since(startTime) * 60 / time.Second)
eng.Render(scene, now, sz)
fps.Draw(sz)
}
示例3: onPaint
func onPaint(glctx gl.Context, sz size.Event) {
glctx.ClearColor(1, 1, 1, 1) // クリアする色
glctx.Clear(gl.COLOR_BUFFER_BIT) // 塗りつぶし?
now := clock.Time(time.Since(startTime) * 60 / time.Second) // 60FramePerSecで計算し、現在のフレームを計算する
game.Update(now)
eng.Render(scene, now, sz)
}
示例4: main
func main() {
app.Main(func(a app.App) {
var c event.Config
var eng *WritableEngine
var root *sprite.Node
startClock := time.Now()
for e := range a.Events() {
switch e := event.Filter(e).(type) {
case event.Config:
c = e
case event.Draw:
if eng == nil || root == nil {
eng = NewWritableEngine(
glsprite.Engine(),
image.Rect(0, 0, int(c.Width.Px(c.PixelsPerPt)), int(c.Height.Px(c.PixelsPerPt))),
color.White,
)
root = loadScene(eng, loadTextures(eng))
go listen(eng, ":8080")
}
now := clock.Time(time.Since(startClock) * 60 / time.Second)
gl.ClearColor(1, 1, 1, 1)
gl.Clear(gl.COLOR_BUFFER_BIT)
gl.Enable(gl.BLEND)
gl.BlendEquation(gl.FUNC_ADD)
gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
if eng != nil && root != nil {
eng.Render(root, now, c)
}
a.EndDraw()
}
}
})
}
示例5: onPaint
func onPaint(glctx gl.Context, sz size.Event) {
glctx.ClearColor(0, 0, 0, 1)
glctx.Clear(gl.COLOR_BUFFER_BIT)
now := clock.Time(time.Since(startTime) * 60 / time.Second)
eng.Render(scene, now, sz)
log.Draw(sz)
}
示例6: Render
func (e *Engine) Render(sz size.Event) {
gl.ClearColor(1, 1, 1, 1)
gl.Clear(gl.COLOR_BUFFER_BIT)
now := clock.Time(time.Since(e.startTime) * 60 / time.Second)
e.arranger.sz = &sz
e.eng.Render(e.scene, now, sz)
}
示例7: draw
func draw(c event.Config) {
secondsFromStart := time.Since(startTime) * 60 / time.Second
now := clock.Time(secondsFromStart)
currentBottomRight := geom.Point{c.Width, c.Height}
if bottomRight == nil || currentBottomRight != *bottomRight {
bottomRight = ¤tBottomRight
log.Printf("Device Sizing: %vx%v PixelsPerPt:%v",
c.Width,
c.Height,
c.PixelsPerPt,
)
}
if fullScene == nil {
fullScene = setupScene(c.Width, c.Height, secondsFromStart)
}
gl.ClearColor(0, 0, 0, 0)
gl.Clear(gl.COLOR_BUFFER_BIT)
eng.Render(fullScene, now, c)
debug.DrawFPS(c)
}
示例8: onPaint
func onPaint(sz size.Event) {
if scene == nil {
loadScene(sz)
}
gl.ClearColor(1, 1, 1, 1)
gl.Clear(gl.COLOR_BUFFER_BIT)
now := clock.Time(time.Since(startTime) * 60 / time.Second)
eng.Render(scene, now, sz)
}
示例9: onPaint
func onPaint() {
if scene == nil {
loadScene()
}
gl.ClearColor(1, 1, 1, 1)
gl.Clear(gl.COLOR_BUFFER_BIT)
now := clock.Time(time.Since(startTime) * 60 / time.Second)
eng.Render(scene, now, cfg)
debug.DrawFPS(cfg)
}
示例10: draw
func draw(c event.Config) {
if scene == nil {
loadScene(c)
}
gl.ClearColor(1, 1, 1, 1)
gl.Clear(gl.COLOR_BUFFER_BIT)
now := clock.Time(time.Since(startTime) * 60 / time.Second)
eng.Render(scene, now, c)
debug.DrawFPS(c)
}
示例11: onPaint
func onPaint(e size.Event) {
if scene == nil {
loadScene()
}
gl.ClearColor(1, 1, 1, 1)
gl.Clear(gl.COLOR_BUFFER_BIT)
now := clock.Time(time.Since(start) * 60 / time.Second)
eng.Render(scene, now, e)
if *dbg {
debug.DrawFPS(e)
}
}
示例12: onPaint
func onPaint(sz size.Event) {
if scene == nil {
images = glutil.NewImages()
fps = debug.NewFPS(images)
eng = glsprite.Engine(images)
loadScene()
}
gl.ClearColor(1, 1, 1, 1)
gl.Clear(gl.COLOR_BUFFER_BIT)
now := clock.Time(time.Since(startTime) * 60 / time.Second)
eng.Render(scene, now, sz)
fps.Draw(sz)
}
示例13: Update
func (self *GLPeer) Update() {
if self.glctx == nil {
return
}
self.glctx.ClearColor(1, 1, 1, 1) // white background
self.glctx.Clear(gl.COLOR_BUFFER_BIT)
now := clock.Time(time.Since(startTime) * 60 / time.Second)
self.apply()
self.eng.Render(self.scene, now, sz)
self.fps.Draw(sz)
}
示例14: onPaint
func onPaint(glctx gl.Context, sz size.Event, u *uistate.UIState) {
if u.CurView == uistate.None {
u.ScanChan = make(chan bool)
go sync.ScanForSG(u.Ctx, u.ScanChan, u)
view.LoadDiscoveryView(u)
}
glctx.ClearColor(1, 1, 1, 1)
glctx.Clear(gl.COLOR_BUFFER_BIT)
now := clock.Time(time.Since(u.StartTime) * 60 / time.Second)
u.Eng.Render(u.Scene, now, sz)
if u.Debug {
fps.Draw(sz)
}
}
示例15: onPaint
func onPaint(c config.Event) {
if !started {
touchLoc = geom.Point{c.Width / 2, c.Height / 2}
started = true
}
if scene == nil {
loadScene()
}
gl.ClearColor(242/255.0, 240/255.0, 217/255.0, 1) // gophercon bg color
gl.Clear(gl.COLOR_BUFFER_BIT)
now := clock.Time(time.Since(startClock) * 60 / time.Second)
eng.Render(scene, now, c)
debug.DrawFPS(c)
}