• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang draw.Pt函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中exp/draw.Pt函数的典型用法代码示例。如果您正苦于以下问题:Golang Pt函数的具体用法?Golang Pt怎么用?Golang Pt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Pt函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: mleft

func mleft() {
	if !collide(draw.Pt(pos.X-pcsz, pos.Y), piece) &&
		!collide(draw.Pt(pos.X-pcsz, pos.Y+pcsz-DY), piece) {
		undrawpiece()
		pos.X -= pcsz
		drawpiece()
		display.FlushImage()
	}
}
开发者ID:edisonwsk,项目名称:golang-on-cygwin,代码行数:9,代码来源:xs.go


示例2: newBox

func newBox(cvs *canvas.Canvas, r draw.Rectangle) *box {
	var b box
	red := image.Uniform{image.Red}
	b.n = canvas.NewLine(red, r.Min, draw.Pt(r.Max.X, r.Min.Y), 1)
	b.e = canvas.NewLine(red, draw.Pt(r.Max.X, r.Min.Y), r.Max, 1)
	b.s = canvas.NewLine(red, r.Max, draw.Pt(r.Min.X, r.Max.Y), 1)
	b.w = canvas.NewLine(red, draw.Pt(r.Min.X, r.Max.Y), r.Min, 1)
	cvs.AddItem(b.n)
	cvs.AddItem(b.e)
	cvs.AddItem(b.s)
	cvs.AddItem(b.w)
	return &b
}
开发者ID:zenoss,项目名称:rog-go,代码行数:13,代码来源:mandel.go


示例3: interactiveJulia

func (ctxt *context) interactiveJulia(m draw.Mouse, mc <-chan draw.Mouse) {
	var i canvas.ImageItem
	i.IsOpaque = true
	i.R = draw.Rect(0, 0, ThumbSize, ThumbSize).Add(ctxt.cvs.Rect().Max).Sub(draw.Pt(ThumbSize, ThumbSize))
	i.Image = image.NewRGBA(image.Rect(0, 0, ThumbSize, ThumbSize))
	ctxt.cvs.AddItem(&i)
	defer func() {
		ctxt.cvs.Delete(&i)
		ctxt.cvs.Flush()
	}()
	delta := ctxt.mouseDelta()
	for {
		f := ctxt.f.Associated(m.Point.Add(delta))
		if f == nil {
			for m.Buttons != 0 {
				m = <-mc
			}
			return
		}
		r := draw.Rect(0, 0, ThumbSize, ThumbSize)
		f = f.Resize(r)
		ctxt.cvs.Atomically(func(flush canvas.FlushFunc) {
			NewTile(r, f, i.Image.(*image.RGBA), true)
			flush(i.Bbox(), nil)
		})
		ctxt.cvs.Flush()
		if m.Buttons == 0 {
			ctxt.julia(m.Point)
			return
		}
		m = <-mc
	}
}
开发者ID:zenoss,项目名称:rog-go,代码行数:33,代码来源:mandel.go


示例4: horiz

func horiz() bool {
	var lev [MAXN]int
	h := 0
	for i := 0; i < NY; i++ {
		for j := 0; board[i][j] != 0; j++ {
			if j == NX-1 {
				lev[h] = i
				h++
				break
			}
		}
	}
	if h == 0 {
		return false
	}
	r := rboard
	newscreen = false
	for j := 0; j < h; j++ {
		r.Min.Y = rboard.Min.Y + lev[j]*pcsz
		r.Max.Y = r.Min.Y + pcsz
		draw.Draw(screen, r, draw.White, whitemask, draw.ZP)
		display.FlushImage()
	}
	PlaySound(whoosh)
	for i := 0; i < 3; i++ {
		pause(250)
		if newscreen {
			drawboard()
			break
		}
		for j := 0; j < h; j++ {
			r.Min.Y = rboard.Min.Y + lev[j]*pcsz
			r.Max.Y = r.Min.Y + pcsz
			draw.Draw(screen, r, draw.White, whitemask, draw.ZP)
		}
		display.FlushImage()
	}
	r = rboard
	for j := 0; j < h; j++ {
		i := NY - lev[j] - 1
		score(250 + 10*i*i)
		r.Min.Y = rboard.Min.Y
		r.Max.Y = rboard.Min.Y + lev[j]*pcsz
		draw.Draw(screen, r.Add(draw.Pt(0, pcsz)), screen, nil, r.Min)
		r.Max.Y = rboard.Min.Y + pcsz
		draw.Draw(screen, r, draw.White, nil, draw.ZP)
		for k := lev[j] - 1; k >= 0; k-- {
			board[k+1] = board[k]
		}
		board[0] = [NX]byte{}
	}
	display.FlushImage()
	return true
}
开发者ID:edisonwsk,项目名称:golang-on-cygwin,代码行数:54,代码来源:xs.go


示例5: movepiece

func movepiece() bool {
	var mask image.Image
	if collide(draw.Pt(pos.X, pos.Y+pcsz), piece) {
		return false
	}
	if collider(pos, br2.Max) {
		mask = bb2mask
	}
	draw.Draw(screen, br2.Add(pos), bb2, mask, bb2r.Min)
	pos.Y += DY
	display.FlushImage()
	return true
}
开发者ID:edisonwsk,项目名称:golang-on-cygwin,代码行数:13,代码来源:xs.go


示例6: choosepiece

func choosepiece() {
	for {
		i := rand.Intn(len(pieces))
		setpiece(&pieces[i])
		pos = rboard.Min
		pos.X += rand.Intn(NX) * pcsz
		if !collide(draw.Pt(pos.X, pos.Y+pcsz-DY), piece) {
			break
		}
	}
	drawpiece()
	display.FlushImage()
}
开发者ID:edisonwsk,项目名称:golang-on-cygwin,代码行数:13,代码来源:xs.go


示例7: drawboard

func drawboard() {
	draw.Border(screen, rboard.Inset(-2), 2, draw.Black, draw.ZP)
	draw.Draw(screen, draw.Rect(rboard.Min.X, rboard.Min.Y-2, rboard.Max.X, rboard.Min.Y),
		draw.White, nil, draw.ZP)
	for i := 0; i < NY; i++ {
		for j := 0; j < NX; j++ {
			if board[i][j] != 0 {
				drawsq(screen, draw.Pt(rboard.Min.X+j*pcsz, rboard.Min.Y+i*pcsz), int(board[i][j]-16))
			}
		}
	}
	score(0)
	if suspended {
		draw.Draw(screen, screenr, draw.White, whitemask, draw.ZP)
	}
}
开发者ID:edisonwsk,项目名称:golang-on-cygwin,代码行数:16,代码来源:xs.go


示例8: setpiece

func setpiece(p *Piece) {
	draw.Draw(bb, bbr, draw.White, nil, draw.ZP)
	draw.Draw(bbmask, bbr, draw.Transparent, nil, draw.ZP)
	br = draw.Rect(0, 0, 0, 0)
	br2 = br
	piece = p
	if p == nil {
		return
	}
	var op draw.Point
	var r draw.Rectangle
	r.Min = bbr.Min
	for i, pt := range p.d {
		r.Min.X += pt.X * pcsz
		r.Min.Y += pt.Y * pcsz
		r.Max.X = r.Min.X + pcsz
		r.Max.Y = r.Min.Y + pcsz
		if i == 0 {
			draw.Draw(bb, r, draw.Black, nil, draw.ZP)
			draw.Draw(bb, r.Inset(1), txpix[piece.tx], nil, draw.ZP)
			draw.Draw(bbmask, r, draw.Opaque, nil, draw.ZP)
			op = r.Min
		} else {
			draw.Draw(bb, r, bb, nil, op)
			draw.Draw(bbmask, r, bbmask, nil, op)
		}
		if br.Max.X < r.Max.X {
			br.Max.X = r.Max.X
		}
		if br.Max.Y < r.Max.Y {
			br.Max.Y = r.Max.Y
		}
	}
	br.Max = br.Max.Sub(bbr.Min)
	delta := draw.Pt(0, DY)
	br2.Max = br.Max.Add(delta)
	r = br.Add(bb2r.Min)
	r2 := br2.Add(bb2r.Min)
	draw.Draw(bb2, r2, draw.White, nil, draw.ZP)
	draw.Draw(bb2, r.Add(delta), bb, nil, bbr.Min)
	draw.Draw(bb2mask, r2, draw.Transparent, nil, draw.ZP)
	draw.Draw(bb2mask, r, draw.Opaque, bbmask, bbr.Min)
	draw.Draw(bb2mask, r.Add(delta), draw.Opaque, bbmask, bbr.Min)
}
开发者ID:edisonwsk,项目名称:golang-on-cygwin,代码行数:44,代码来源:xs.go


示例9: setRect

func (b *box) setRect(r draw.Rectangle) {
	b.n.SetEndPoints(r.Min, draw.Pt(r.Max.X, r.Min.Y))
	b.e.SetEndPoints(draw.Pt(r.Max.X, r.Min.Y), r.Max)
	b.s.SetEndPoints(r.Max, draw.Pt(r.Min.X, r.Max.Y))
	b.w.SetEndPoints(draw.Pt(r.Min.X, r.Max.Y), r.Min)
}
开发者ID:zenoss,项目名称:rog-go,代码行数:6,代码来源:mandel.go


示例10: centre

func centre(r draw.Rectangle) draw.Point {
	return draw.Pt((r.Min.X+r.Max.X)/2, (r.Min.Y+r.Max.Y)/2)
}
开发者ID:zenoss,项目名称:rog-go,代码行数:3,代码来源:mandel.go



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang draw.Context类代码示例发布时间:2022-05-24
下一篇:
Golang draw.Draw函数代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap