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) } }
func (tb *TopBar) Draw(rend *sdl.Renderer) { rend.SetDrawColor(tb.BackgroundColor) rend.FillRect(&tb.Pos) rend.SetDrawColor(lighten(tb.BackgroundColor, 9)) rend.DrawLine(tb.Pos.X, tb.Pos.Y+tb.Pos.H-1, tb.Pos.X+tb.Pos.W, tb.Pos.Y+tb.Pos.H-1) rend.SetDrawColor(darken(tb.BackgroundColor, 9)) rend.DrawLine(tb.Pos.X, tb.Pos.Y+tb.Pos.H, tb.Pos.X+tb.Pos.W, tb.Pos.Y+tb.Pos.H) for _, w := range tb.elements_left { w.Draw(rend) } if tb.element_center != nil { tb.element_center.Draw(rend) } for _, w := range tb.elements_right { w.Draw(rend) } }
func (canvas *CanvasPane) Draw(rend *sdl.Renderer) { for _, n := range canvas.nodes { n.DrawLink(rend) } for _, n := range canvas.nodes { n.Draw(rend) } canvas.menu.Draw(rend) if canvas.new_link != nil { _, x, y := sdl.GetMouseState() n0 := canvas.nodes[*canvas.new_link] rend.SetDrawColor(hexcolor(0xffffff)) pos := n0.GetPos() rend.DrawRect(&pos) rend.SetDrawColor(hexcolor(0x694ae9)) rend.DrawLine(n0.GetPos().X+n0.GetPos().W/2, n0.GetPos().Y+n0.GetPos().H/2, int32(x), int32(y)) } }