mirror of
https://github.com/felixangell/phi.git
synced 2024-10-26 17:18:31 +03:00
27 lines
370 B
Go
27 lines
370 B
Go
package gui
|
|
|
|
type Cursor struct {
|
|
x, y int
|
|
rx, ry int
|
|
}
|
|
|
|
func (c *Cursor) gotoStart() {
|
|
for c.x > 1 {
|
|
c.move(-1, 0)
|
|
}
|
|
}
|
|
|
|
func (c *Cursor) move(x, y int) {
|
|
c.moveRender(x, y, x, y)
|
|
}
|
|
|
|
// moves the cursors position, and the
|
|
// rendered coordinates by the given amount
|
|
func (c *Cursor) moveRender(x, y, rx, ry int) {
|
|
c.x += x
|
|
c.y += y
|
|
|
|
c.rx += rx
|
|
c.ry += ry
|
|
}
|