attempted to not blink while moving... didnt work!

This commit is contained in:
Felix Angell 2018-05-06 14:53:31 +01:00
parent a46f211c0d
commit c03af2199f
2 changed files with 21 additions and 2 deletions

View File

@ -837,6 +837,9 @@ func (b *Buffer) HandleEvent(evt strife.StrifeEvent) {
var lastCursorDraw = time.Now()
var renderFlashingCursor = true
var lastTimer = time.Now()
var ldx, ldy = 0, 0
func (b *Buffer) OnUpdate() bool {
return false
}
@ -885,7 +888,7 @@ func (b *Buffer) processInput(pred func(r int) bool) bool {
}
// handle cursor flash
if b.cfg.Cursor.Flash && runtime.GOOS == "spookyghost" {
if b.cfg.Cursor.Flash && 15 == 12 {
if time.Now().Sub(lastCursorDraw) >= time.Duration(b.cfg.Cursor.Flash_Rate)*time.Millisecond {
renderFlashingCursor = !renderFlashingCursor
lastCursorDraw = time.Now()
@ -1098,7 +1101,7 @@ func (b *Buffer) renderAt(ctx *strife.Renderer, rx int, ry int) {
}
// render the ol' cursor
if b.HasFocus() && renderFlashingCursor && b.cfg.Cursor.Draw {
if b.HasFocus() && (renderFlashingCursor || b.curs.moving) && b.cfg.Cursor.Draw {
cursorWidth := b.cfg.Cursor.GetCaretWidth()
if cursorWidth == -1 {
cursorWidth = last_w

View File

@ -3,6 +3,8 @@ package gui
type Cursor struct {
x, y int
rx, ry int
dx, dy int
moving bool
}
func (c *Cursor) gotoStart() {
@ -18,6 +20,20 @@ func (c *Cursor) move(x, y int) {
// moves the cursors position, and the
// rendered coordinates by the given amount
func (c *Cursor) moveRender(x, y, rx, ry int) {
if x > 0 {
c.dx = 1
} else if x < 0 {
c.dx = -1
}
if y > 0 {
c.dy = 1
} else if y < 0 {
c.dy = -1
}
c.moving = true
c.x += x
c.y += y