本文整理匯總了Golang中github.com/veandco/go-sdl2/sdl.Surface.FillRect方法的典型用法代碼示例。如果您正苦於以下問題:Golang Surface.FillRect方法的具體用法?Golang Surface.FillRect怎麽用?Golang Surface.FillRect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/veandco/go-sdl2/sdl.Surface
的用法示例。
在下文中一共展示了Surface.FillRect方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Render
// Render renders the intro state
func (ps *PlayState) Render(mainWindowSurface *sdl.Surface) {
ps.update()
mainWindowSurface.FillRect(nil, ps.bgColor)
ps.interludeTextEntity.Visible = ps.state.state == stateInterlude
ps.rootEntity.Render(mainWindowSurface)
}
示例2: CreateMenus
func CreateMenus(window *sdl.Window, surface *sdl.Surface, renderer *sdl.Renderer, controlManager *inputManager.ControlManager) inputManager.Update {
progress := float64(0)
mutex := sync.Mutex{}
dx := 4 * surface.W / 8
startRect := sdl.Rect{surface.W / 4, 4 * surface.H / 7, 0, 2 * surface.H / 7}
midBackgroundRect := sdl.Rect{surface.W / 4, 4 * surface.H / 7, dx, 2 * surface.H / 7}
backgroundRect := sdl.Rect{surface.W/4 - 5, 4*surface.H/7 - 5, dx + 10, 2*surface.H/7 + 10}
var mainMenu *Menu
go asyncMenuCreator(renderer, &mutex, &progress, &mainMenu, surface.W, surface.H, window, controlManager)
return func(state int) int {
if controlManager.Player1.BF || controlManager.Player2.BF {
controlManager.Running = false
return -1
}
mutex.Lock()
startRect.W = int32(float64(dx) * progress)
surface.FillRect(&backgroundRect, 0xffff0000)
surface.FillRect(&midBackgroundRect, 0xff000000)
surface.FillRect(&startRect, 0xffff0000)
window.UpdateSurface()
if progress == 1 {
menuInfo := MenuInfo{0, controlManager, renderer, &sdl.Rect{0, 0, surface.W, surface.H}}
inputManager.UpdateFunctions = append(inputManager.UpdateFunctions, mainMenu.Open(0, &menuInfo))
return -1
}
mutex.Unlock()
return 0
}
}
示例3: Render
// Render renders the intro state
func (is *IntroState) Render(mainWindowSurface *sdl.Surface) {
rootEntity := is.rootEntity
mainWindowSurface.FillRect(nil, is.bgColor)
rootEntity.Render(mainWindowSurface)
}