-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmatch.go
52 lines (42 loc) · 912 Bytes
/
match.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
package helios
import (
"time"
)
type Match struct {
Region
screen *Screen
img *Image
highlighter *Highlighter
clicker *Clicker
confidence float32
}
func NewMatch(img *Image, confidence float32, screen *Screen, highlighter *Highlighter, region *Region) *Match {
return &Match{
screen: screen,
img: img,
Region: *region,
highlighter: highlighter,
confidence: confidence,
}
}
func (m *Match) GetConfidence() float32 {
return m.confidence
}
func (m *Match) Highlight(t time.Duration) {
if m == nil {
return
}
m.highlighter.Highlight(&HighlightRequest{
ScreenWidth: m.screen.width,
ScreenHeight: m.screen.height,
X: m.topLeft.x,
Y: m.topLeft.y,
Width: float64(m.width),
Height: float64(m.height),
Duration: t.Seconds(),
})
}
func (m *Match) Click() *Match {
m.clicker.Click(m)
return m
}