Sha256: feb4391ce49d7064646eb797f92ab83eec5dad9113d7875b65b3178c5715cacc
Contents?: true
Size: 852 Bytes
Versions: 21
Compression:
Stored size: 852 Bytes
Contents
# encoding: utf-8 module Fidgit class Cursor < Chingu::GameObject ARROW = 'arrow.png' HAND = 'hand.png' def initialize(options = {}) options = { image: Gosu::Image[ARROW], rotation_center: :top_left, zorder: Float::INFINITY }.merge!(options) super(options) nil end # Is the mouse pointer position inside the game window pane? def inside_window? x >= 0 and y >= 0 and x < $window.width and y < $window.height end def update self.x, self.y = $window.mouse_x, $window.mouse_y super nil end 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 end end
Version data entries
21 entries across 21 versions & 1 rubygems