aboutsummaryrefslogtreecommitdiff
path: root/pkg/field/utils.go
blob: ab5ff7a0987afa628d4f82f6ed6d59d1bf578c1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package field

func (f Field) Get(x, y int) int {
	if y >= f.y && y < f.y+f.ly {
		l := f.lines[y-f.y]
		if x >= l.x && x < l.x+l.l {
			return l.columns[x-l.x]
		}
	}
	return ' '
}

func (f Field) isIn(x, y int) bool {
	return x >= f.x && x < f.x+f.lx && y >= f.y && y < f.y+f.ly
}

func (f Field) Dump() (int, int, int, int) {
	return f.x, f.y, f.lx, f.ly
}