class Cura::Cursor

The text cursor controller.

Should only ever have one single Cursor instance at one time. TODO: Rename Cursor::Text, need Cursor::Mouse

Public Class Methods

new(attributes={}) click to toggle source
Calls superclass method Cura::Attributes::HasCoordinates::new
# File lib/cura/cursor.rb, line 18
def initialize(attributes={})
  @hidden = true

  super

  raise ArgumentError, "application must be set" if application.nil?
end

Public Instance Methods

hide() click to toggle source

Hide the cursor.

@return [Cursor]

# File lib/cura/cursor.rb, line 50
def hide
  @hidden = true

  self
end
show() click to toggle source

Show the cursor.

@return [Cursor]

# File lib/cura/cursor.rb, line 41
def show
  @hidden = false

  self
end
update() click to toggle source

Draw (set) the cursor.

@return [Cursor]

# File lib/cura/cursor.rb, line 59
def update # TODO: Refactor for speed, this can't be effecient
  if @hidden
    application.adapter.hide_cursor
  else
    application.adapter.set_cursor(@x, @y)
  end

  self
end