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

Golang image.Image类代码示例

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

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



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

示例1: drawGameNextPiece

func drawGameNextPiece(screen *image.Image, world *World, engine *mygameengine.MyGameEngine) {
	piece := world.GetNextPiece()
	pieceBlocks := piece.GetBlocks()
	pieceSize := piece.GetSize()

	marginLeft := uint(15)
	marginTop := uint(8)
	width := uint(6)

	// border
	for y := uint(0); y < width; y++ {
		for x := uint(0); x < width; x++ {
			if x == 0 || y == 0 || x == 5 || y == 5 {
				screen.BlitAt(
					engine.Assets().Get(IMG_BLOCK_05),
					int(BLOCK_SIZE*marginLeft+uint(x)*BLOCK_SIZE),
					int(BLOCK_SIZE*marginTop+uint(y)*BLOCK_SIZE),
				)
			}
		}
	}
	// piece
	for y := uint(0); y < pieceSize; y++ {
		for x := uint(0); x < pieceSize; x++ {
			if pieceBlocks[y][x] != nil {
				image := blockToImage(pieceBlocks[y][x], engine)
				screen.BlitAt(
					image,
					int(BLOCK_SIZE*(marginLeft+1)+uint(x)*BLOCK_SIZE),
					int(BLOCK_SIZE*(marginTop+1)+uint(y)*BLOCK_SIZE),
				)
			}
		}
	}
}
开发者ID:syndr0m,项目名称:gotris,代码行数:35,代码来源:game.go


示例2: drawIntroMask

func drawIntroMask(screen *image.Image, frame uint64, fps uint) {
	var maxFrame uint64 = uint64(maskDuration * fps)

	if frame < maxFrame {
		black := mygameengine.COLOR_BLACK
		black.A = uint8(math.Max(0, 255-float64(frame)*(255/float64(maxFrame))))
		screen.DrawRectangle(0, 0, 640, 480, black)
	}
}
开发者ID:syndr0m,项目名称:gotris,代码行数:9,代码来源:intro.go


示例3: drawGameGrid

func drawGameGrid(screen *image.Image, world *World, engine *mygameengine.MyGameEngine) {
	gridWidth := world.GetGridWidth()
	gridHeight := world.GetGridHeight()
	blocks := world.GetGrid()
	for y := uint(0); y < gridHeight; y++ {
		for x := uint(0); x < gridWidth; x++ {
			if blocks[y][x] != nil {
				image := blockToImage(blocks[y][x], engine)
				screen.BlitAt(image, int(BLOCK_SIZE+x*BLOCK_SIZE), int(y*BLOCK_SIZE))
			}
		}
	}
}
开发者ID:syndr0m,项目名称:gotris,代码行数:13,代码来源:game.go


示例4: drawGameCurrentPiece

func drawGameCurrentPiece(screen *image.Image, world *World, engine *mygameengine.MyGameEngine) {
	piece := world.GetPiece()
	pieceBlocks := piece.GetBlocks()
	pieceSize := int(piece.GetSize())
	pieceY := world.GetPieceY()
	pieceX := world.GetPieceX()

	for y := 0; y < pieceSize; y++ {
		for x := 0; x < pieceSize; x++ {
			if pieceBlocks[y][x] != nil {
				image := blockToImage(pieceBlocks[y][x], engine)
				screen.BlitAt(
					image,
					int(BLOCK_SIZE+uint(pieceX+x)*BLOCK_SIZE),
					int(uint(pieceY+y)*BLOCK_SIZE),
				)
			}
		}
	}
}
开发者ID:syndr0m,项目名称:gotris,代码行数:20,代码来源:game.go


示例5: drawIntroBackground

func drawIntroBackground(screen *image.Image, frame uint64, imageIntroRotatingBg *image.Image) {
	var y int = int(math.Mod(float64(frame), 217))

	screen.BlitAt(imageIntroRotatingBg, 0, y-217)
	screen.BlitAt(imageIntroRotatingBg, 0, y)
	screen.BlitAt(imageIntroRotatingBg, 0, y+217)
	screen.BlitAt(imageIntroRotatingBg, 0, y+434)
}
开发者ID:syndr0m,项目名称:gotris,代码行数:8,代码来源:intro.go


示例6: drawGameGridBorders

func drawGameGridBorders(screen *image.Image, world *World, engine *mygameengine.MyGameEngine) {
	gridWidth := world.GetGridWidth()
	gridHeight := world.GetGridHeight()
	for y := uint(0); y < gridHeight; y++ {
		screen.BlitAt(engine.Assets().Get(IMG_BLOCK_05), 0, int(y*BLOCK_SIZE))
		screen.BlitAt(engine.Assets().Get(IMG_BLOCK_06), int(gridWidth*BLOCK_SIZE+BLOCK_SIZE), int(y*BLOCK_SIZE))
	}
	for x := uint(0); x < gridWidth+2; x++ {
		screen.BlitAt(engine.Assets().Get(IMG_BLOCK_06), int(x*BLOCK_SIZE), int(gridHeight*BLOCK_SIZE))
	}
}
开发者ID:syndr0m,项目名称:gotris,代码行数:11,代码来源:game.go


示例7: drawGameBackground

func drawGameBackground(screen *image.Image) {
	screen.DrawRectangle(0, 0, 640, 480, mygameengine.COLOR_BLACK)
}
开发者ID:syndr0m,项目名称:gotris,代码行数:3,代码来源:game.go


示例8: drawGameFlash

func drawGameFlash(screen *image.Image, flash int) {
	white := mygameengine.COLOR_WHITE
	white.A = uint8(25 * flash)
	screen.DrawRectangle(0, 0, 640, 480, white)
}
开发者ID:syndr0m,项目名称:gotris,代码行数:5,代码来源:game.go


示例9: drawIntroText

func drawIntroText(screen *image.Image, frame uint64, imageIntroText *image.Image) {
	var v int = int(math.Mod(float64(frame), 50))
	if v > 25 {
		screen.BlitAt(imageIntroText, 210, 370)
	}
}
开发者ID:syndr0m,项目名称:gotris,代码行数:6,代码来源:intro.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Golang capability.NewPid函数代码示例发布时间:2022-05-29
下一篇:
Golang upgrade.LatestRelease函数代码示例发布时间:2022-05-29
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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