class Fidgit::Cursor

Constants

ARROW
HAND

Public Class Methods

new(options = {}) click to toggle source
Calls superclass method
# File lib/fidgit/cursor.rb, line 8
def initialize(options = {})
  options = {
    image: Gosu::Image[ARROW],
    rotation_center: :top_left,
    zorder: Float::INFINITY
  }.merge!(options)

  super(options)

  nil
end

Public Instance Methods

draw() click to toggle source
Calls superclass method
# File lib/fidgit/cursor.rb, line 33
def draw
  # Prevent system and game mouse from being shown at the same time.
  super if inside_window? and $window.current_game_state.is_a? GuiState and not $window.needs_cursor?
end
inside_window?() click to toggle source

Is the mouse pointer position inside the game window pane?

# File lib/fidgit/cursor.rb, line 21
def inside_window?
  x >= 0 and y >= 0 and x < $window.width and y < $window.height
end
update() click to toggle source
Calls superclass method
# File lib/fidgit/cursor.rb, line 25
def update
  self.x, self.y = $window.mouse_x, $window.mouse_y

  super

  nil
end