本文整理汇总了Golang中github.com/krig/Go-SDL2/sdl.Renderer.SetDrawColor方法的典型用法代码示例。如果您正苦于以下问题:Golang Renderer.SetDrawColor方法的具体用法?Golang Renderer.SetDrawColor怎么用?Golang Renderer.SetDrawColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/krig/Go-SDL2/sdl.Renderer
的用法示例。
在下文中一共展示了Renderer.SetDrawColor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: DrawLink
func (node *Node) DrawLink(rend *sdl.Renderer) {
if node.next != nil {
rend.SetDrawColor(hexcolor(0x15f0e1))
p0 := node.Pos
p1 := node.next.Pos
rend.DrawLine(p0.X+p0.W/2, p0.Y+p0.H/2, p1.X+p1.W/2, p1.Y+p1.H/2)
}
}
示例2: Draw
func (node *Node) Draw(rend *sdl.Renderer) {
if node.dragging {
node.curr.X += (node.goal.X - node.curr.X) * (15.0 / 30.0)
node.curr.Y += (node.goal.Y - node.curr.Y) * (15.0 / 30.0)
node.Pos.X = int32(node.curr.X)
node.Pos.Y = int32(node.curr.Y)
node.label.Pos = node.Pos
}
clr := node.color
if !node.dragging {
rend.SetDrawColor(clr)
rend.FillRect(&node.Pos)
}
rend.SetDrawColor(lighten(clr, 19))
rend.DrawRect(&node.Pos)
node.label.Draw(rend)
if node.menu.Visible {
node.menu.Draw(rend)
}
}
示例3: studioUpdate
func studioUpdate(window *sdl.Window, rend *sdl.Renderer, screen *Screen) bool {
var event sdl.Event
running := true
for (&event).Poll() {
switch e := (&event).Get().(type) {
case sdl.QuitEvent:
running = false
case sdl.KeyboardEvent:
if e.Keysym.Keycode == sdl.K_ESCAPE {
running = false
}
case sdl.MouseMotionEvent:
screen.stack.OnMouseMotionEvent(&e)
case sdl.MouseButtonEvent:
screen.stack.OnMouseButtonEvent(&e)
}
}
neww, newh := window.GetSize()
screen.UpdateLayout(sdl.Rect{0, 0, int32(neww), int32(newh)})
//screen.UpdateAnimations(framerate.Delta())
rend.SetDrawBlendMode(sdl.BLENDMODE_NONE)
rend.SetDrawColor(screen.rsc.BackgroundColor)
rend.Clear()
rend.SetDrawBlendMode(sdl.BLENDMODE_BLEND)
screen.Draw(rend)
rend.Present()
screen.framerate.FramerateDelay()
return running
}
示例4: Draw
// Draw a popup menu
func (menu *PopupMenu) Draw(rend *sdl.Renderer) {
if !menu.Visible {
return
}
rend.SetDrawColor(hexcolor(0x303030))
rend.FillRect(&menu.Pos)
rend.SetDrawColor(hexcolor(0x363636))
rend.DrawRect(&menu.Pos)
if menu.hover != -1 && menu.hover < len(menu.entries) {
rend.SetDrawColor(hexcolor(0x406f40))
rend.FillRect(&menu.entries[menu.hover].label.Pos)
}
for _, e := range menu.entries {
e.Draw(rend)
}
}