-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patharrows.go
63 lines (50 loc) · 1.54 KB
/
arrows.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package main
import (
"github.com/fogleman/gg"
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/text"
)
func generateRightArrow() *ebiten.Image {
var textHeight = text.BoundString(*regular, "X").Dy()
dc := gg.NewContext(textHeight, textHeight)
dc.MoveTo(0, 0)
dc.LineTo(float64(textHeight), float64(textHeight/2))
dc.LineTo(0, float64(textHeight))
dc.LineTo(0, 0)
dc.SetColor(fg)
dc.Fill()
return ebiten.NewImageFromImage(dc.Image())
}
func generateLeftArrow() *ebiten.Image {
var textHeight = text.BoundString(*regular, "X").Dy()
dc := gg.NewContext(textHeight, textHeight)
dc.MoveTo(float64(textHeight), 0)
dc.LineTo(float64(textHeight), float64(textHeight))
dc.LineTo(0, float64(textHeight/2))
dc.MoveTo(float64(textHeight), 0)
dc.SetColor(fg)
dc.Fill()
return ebiten.NewImageFromImage(dc.Image())
}
func generateDownArrow() *ebiten.Image {
var textHeight = text.BoundString(*regular, "X").Dy()
dc := gg.NewContext(textHeight, textHeight)
dc.MoveTo(0, 0)
dc.LineTo(float64(textHeight), 0)
dc.LineTo(float64(textHeight/2), float64(textHeight))
dc.LineTo(0, 0)
dc.SetColor(fg)
dc.Fill()
return ebiten.NewImageFromImage(dc.Image())
}
func generateUpArrow() *ebiten.Image {
var textHeight = text.BoundString(*regular, "X").Dy()
dc := gg.NewContext(textHeight, textHeight)
dc.MoveTo(float64(textHeight/2), 0)
dc.LineTo(float64(textHeight), float64(textHeight))
dc.LineTo(0, float64(textHeight))
dc.LineTo(float64(textHeight/2), 0)
dc.SetColor(fg)
dc.Fill()
return ebiten.NewImageFromImage(dc.Image())
}