本文整理汇总了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)
}