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