当前位置: 首页>>代码示例>>Golang>>正文


Golang clock.Time函数代码示例

本文整理汇总了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)
}
开发者ID:Christeefym,项目名称:lantern,代码行数:7,代码来源:main.go

示例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)
}
开发者ID:pankona,项目名称:gomobile_sprite_test,代码行数:7,代码来源:main.go

示例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)
}
开发者ID:toohsk,项目名称:gomobile-study,代码行数:7,代码来源:main.go

示例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()
			}
		}
	})
}
开发者ID:golang-samples,项目名称:gomobile,代码行数:34,代码来源:main.go

示例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)
}
开发者ID:viru,项目名称:berrybot,代码行数:7,代码来源:main.go

示例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)
}
开发者ID:mccordnate,项目名称:gogam,代码行数:7,代码来源:engine.go

示例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 = &currentBottomRight

		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)
}
开发者ID:porty,项目名称:experiments,代码行数:25,代码来源:game.go

示例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)
}
开发者ID:tenntenn,项目名称:gomoxy,代码行数:9,代码来源:main.go

示例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)
}
开发者ID:tendermint,项目名称:mobile,代码行数:10,代码来源:main.go

示例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)
}
开发者ID:handong890,项目名称:mobile,代码行数:10,代码来源:main.go

示例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)
	}
}
开发者ID:acsellers,项目名称:ofs,代码行数:12,代码来源:main.go

示例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)
}
开发者ID:samanalysis,项目名称:mobile,代码行数:13,代码来源:main.go

示例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)
}
开发者ID:sassy,项目名称:gomo-simra,代码行数:13,代码来源:peer.go

示例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)
	}
}
开发者ID:vanadium,项目名称:croupier,代码行数:14,代码来源:main.go

示例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)
}
开发者ID:geraldstanje,项目名称:slides,代码行数:15,代码来源:main.go


注:本文中的golang.org/x/mobile/exp/sprite/clock.Time函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。