Module: Cursor

Defined in:
lib/vr/sysmod.rb

Constant Summary collapse

GetCursorPos =

Cursor

This is for System cursor handling.

Class Methods

— get_screenposition

Returns x,y in the screen coordinate.

— set_screenposition(x,y)

Sets cursor position into (x,y) in the screen coordinate.
Win32API.new("user32","GetCursorPos","P","I")
SetCursorPos =
Win32API.new("user32","SetCursorPos","II","I")
POINTSTRUCT =
"II"

Class Method Summary collapse

Class Method Details

.get_screenpositionObject



191
192
193
194
195
# File 'lib/vr/sysmod.rb', line 191

def self.get_screenposition
  r=[0,0].pack(POINTSTRUCT)
  GetCursorPos.call(r)
  r.unpack(POINTSTRUCT)
end

.set_screenposition(x, y) ⇒ Object



197
198
199
# File 'lib/vr/sysmod.rb', line 197

def self.set_screenposition(x,y)
  SetCursorPos.call(x.to_i,y.to_i)
end