Sha256: 4f67de6466328ef074a0d3305dfb62b4692caa1645fa7caa63aef4319a13fed1

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

module GGLib

  class Cursor
    attr_reader :img, :visible, :imgObj
    def initialize(img,visible)
      @img=img
      @visible=visible
      @imgObj=Gosu::Image.new($window,img,true)
      @forced=false
    end
    def toggleVisible
      if not @forced
        @visible=!@visible
      end
    end
    def forceVisible(visible=true)
      @forced=true
      @visible=visible
    end
    def unforceVisible
      @forced=false
    end
    def visible?
      return visible
    end
    def visible=(visible)
      if not @forced
        @visible=visible
      end
    end
    def draw
      if @visible
        @imgObj.draw($window.mouse_x,$window.mouse_y,ZOrder::Cursor)
      end
    end
  end
  
  class MouseDragEvent
    attr_reader :start_x, :start_y, :end_x, :end_y, :inprogress, :starting
    def initialize
      @start_x, @start_y = 0
      @end_x, @end_y = 0
      @inprogress = false
      @starting = false
    end
    def start
      @start_x, @start_y = $window.mouse_x, $window.mouse_y
      @starting = true
    end
    def confirmStart
      @starting = false
      @inprogress = true
    end
    def end
      @end_x, @end_y = $window.mouse_x, $window.mouse_y
      @inprogress = false
    end
    def terminate
      @inprogress, @starting = false
    end
  end
  
  end #module GGLib

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gglib-1.2.1 lib/mouse.rb