Exemple #1
0
// 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)
}
Exemple #2
0
// 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)
}
Exemple #3
0
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)
}