本文整理匯總了Golang中github.com/banthar/Go-SDL/sdl.Surface.Free方法的典型用法代碼示例。如果您正苦於以下問題:Golang Surface.Free方法的具體用法?Golang Surface.Free怎麽用?Golang Surface.Free使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/banthar/Go-SDL/sdl.Surface
的用法示例。
在下文中一共展示了Surface.Free方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: DrawTextLines
// draw lines of text aligned around center of screen
func DrawTextLines(strings []string) {
var dstrect, srcrect *sdl.Rect
var line *sdl.Surface
var w, h, prevH uint16
centerX := int16(Width / 2)
centerY := int16(Height / 2)
for _, str := range strings {
line = RenderText(str, Red)
line.GetClipRect(srcrect)
w, h = uint16(line.W), uint16(line.H)
dstrect = &sdl.Rect{
X: centerX - int16(w/2),
Y: (centerY + int16(prevH)) - int16(h/2),
W: w,
H: h,
}
prevH += h
Screen.Blit(dstrect, line, srcrect)
line.Free()
}
}