本文整理汇总了Golang中github.com/veandco/go-sdl2/sdl.Rect.H方法的典型用法代码示例。如果您正苦于以下问题:Golang Rect.H方法的具体用法?Golang Rect.H怎么用?Golang Rect.H使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/veandco/go-sdl2/sdl.Rect
的用法示例。
在下文中一共展示了Rect.H方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: RenderGraphic
// RenderGraphic draws the Graphic, g, on the screen at postion (x,y).
// 'width' and 'height' specifiy the width and height of the Graphic, g.
//
// RenderGraphic will panic if:
// 1. The Graphic, g, does not contain a Graphic type.
//
// 2. The toolbox has not been initialised.
//
// 3. Any one of x, y, width or height are negative
func RenderGraphic(g Graphic, x, y, width, height int) {
if !initialised {
// this stops execution here, so ne need for an else after the if
panic(notInitialisedMessage)
}
if g == nil {
panic(nilGraphicMessage)
}
if x < 0 || y < 0 || width < 0 || height < 0 {
panic("One of x, y, width or height is negative.")
}
var src, dst sdl.Rect
src.X = 0
src.Y = 0
src.W = int32(width)
src.H = int32(height)
dst.X = int32(x)
dst.Y = int32(y)
dst.W = int32(width)
dst.H = int32(height)
renderer.Copy(g, &src, &dst)
}
示例2: renderGameOver
func renderGameOver() {
var src, dst sdl.Rect
src.X = 0
src.Y = 0
src.W = int32(gameOverW)
src.H = int32(gameOverH)
dst.X = int32(gameOverX)
dst.Y = int32(gameOverY)
dst.W = int32(gameOverW)
dst.H = int32(gameOverH)
renderer.Copy(gameOverGfx, &src, &dst)
}
示例3: renderComputersScore
func renderComputersScore() {
var src, dst sdl.Rect
src.X = 0
src.Y = 0
src.W = int32(scoreW)
src.H = int32(scoreH)
dst.X = int32(computersScoreX)
dst.Y = int32(computersScoreY)
dst.W = int32(scoreW)
dst.H = int32(scoreH)
renderer.Copy(scoresGfx[computersScore], &src, &dst)
}
示例4: renderBall
func renderBall() {
var src, dst sdl.Rect
src.X = 0
src.Y = 0
src.W = int32(ballW)
src.H = int32(ballH)
dst.X = int32(ballX)
dst.Y = int32(ballY)
dst.W = int32(ballW)
dst.H = int32(ballH)
renderer.Copy(ball, &src, &dst)
}
示例5: renderComputersBat
func renderComputersBat() {
var src, dst sdl.Rect
src.X = 0
src.Y = 0
src.W = int32(computersBatW)
src.H = int32(computersBatH)
dst.X = int32(computersBatX)
dst.Y = int32(computersBatY)
dst.W = int32(computersBatW)
dst.H = int32(computersBatH)
renderer.Copy(computersBat, &src, &dst)
}