本文整理匯總了Golang中github.com/veandco/go-sdl2/sdl.Renderer.CopyEx方法的典型用法代碼示例。如果您正苦於以下問題:Golang Renderer.CopyEx方法的具體用法?Golang Renderer.CopyEx怎麽用?Golang Renderer.CopyEx使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/veandco/go-sdl2/sdl.Renderer
的用法示例。
在下文中一共展示了Renderer.CopyEx方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Draw
// Draw draws the loaded texture
func Draw(renderer *sdl.Renderer, id string, x, y, width, height int32, angle float64, flip sdl.RendererFlip) {
src := sdl.Rect{0, 0, width, height}
dst := sdl.Rect{x, y, width, height}
renderer.CopyEx(textureMap[id], &src, &dst, angle, nil, flip)
}
示例2: DrawFrame
// DrawFrame draws a part of the loaded texture
// A Frame is simply a cropped section of the texture by the width and height provided
func DrawFrame(renderer *sdl.Renderer, id string, x, y, width, height, currentRow, currentFrame, spacing, margin int32, angle float64, flip sdl.RendererFlip) {
src := sdl.Rect{margin + spacing*currentFrame + width*currentFrame, margin + height*(currentRow-1), width, height}
dst := sdl.Rect{x, y, width, height}
renderer.CopyEx(textureMap[id], &src, &dst, angle, nil, flip)
}
示例3: Draw
func (t *Texture) Draw(renderer *sdl.Renderer) {
//renderer.Copy(t.texture, nil, t.Dest)
// NB t.Dest is the frame from the entire texture
renderer.CopyEx(t.texture, nil, t.Dest, t.Angle, nil, sdl.FLIP_NONE)
}