-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathTabletLib.ahk
More file actions
42 lines (38 loc) · 735 Bytes
/
TabletLib.ahk
File metadata and controls
42 lines (38 loc) · 735 Bytes
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
/*
Common functions for Tablet Library
*/
#include %A_LineFile%\..\JSON.ahk ; JSON library is used to save / load data as it is easier than using INIRead / INIWrite
LoadBoxes(filename){
global JSON
boxes := {}
FileRead, j, % filename
if (ERRORLEVEL == 0){
j := JSON.Load(j)
for name, b in j {
box := new Box(name)
box.StartX := b.StartX
box.StartY := b.StartY
box.EndX := b.EndX
box.EndY := b.EndY
boxes[name] := box
}
}
return boxes
}
FindBoxName(x, y, boxes){
for name, box in boxes {
if (x >= box.StartX && x <= box.EndX && y >= box.StartY && y <= box.EndY){
return name
}
}
return ""
}
Class Box {
StartX := 0
StartY := 0
EndX := 0
EndY := 0
__New(name){
this.BoxName := name
}
}