Class: Fzeet::Windows::POINT

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/fzeet/windows/core/Point.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.[](x, y) ⇒ Object Also known as: from



10
# File 'lib/fzeet/windows/core/Point.rb', line 10

def self.[](x, y) new.set(x, y) end

Instance Method Details

#==(other) ⇒ Object



26
# File 'lib/fzeet/windows/core/Point.rb', line 26

def ==(other) self[:x] == other[:x] && self[:y] == other[:y] end

#clearObject



24
# File 'lib/fzeet/windows/core/Point.rb', line 24

def clear; set(0, 0) end

#client(window) ⇒ Object



33
# File 'lib/fzeet/windows/core/Point.rb', line 33

def client(window) dup.client!(window) end

#client!(window) ⇒ Object



34
# File 'lib/fzeet/windows/core/Point.rb', line 34

def client!(window) tap { |pt| Windows.Detonate(0, :ScreenToClient, window.handle, pt) } end

#dupObject



17
# File 'lib/fzeet/windows/core/Point.rb', line 17

def dup; self.class[self[:x], self[:y]] end

#getObject Also known as: to_a



19
# File 'lib/fzeet/windows/core/Point.rb', line 19

def get; [self[:x], self[:y]] end

#inside?(r) ⇒ Boolean

Returns:

  • (Boolean)


27
# File 'lib/fzeet/windows/core/Point.rb', line 27

def inside?(r) r.include?(self) end

#offset(dx, dy) ⇒ Object



30
# File 'lib/fzeet/windows/core/Point.rb', line 30

def offset(dx, dy) dup.offset!(dx, dy) end

#offset!(dx, dy) ⇒ Object



31
# File 'lib/fzeet/windows/core/Point.rb', line 31

def offset!(dx, dy) tap { |pt| pt[:x] += dx; pt[:y] += dy } end

#outside?(r) ⇒ Boolean

Returns:

  • (Boolean)


28
# File 'lib/fzeet/windows/core/Point.rb', line 28

def outside?(r) !inside?(r) end

#screen(window) ⇒ Object



36
# File 'lib/fzeet/windows/core/Point.rb', line 36

def screen(window) dup.screen!(window) end

#screen!(window) ⇒ Object



37
# File 'lib/fzeet/windows/core/Point.rb', line 37

def screen!(window) tap { |pt| Windows.Detonate(0, :ClientToScreen, window.handle, pt) } end

#set(x, y) ⇒ Object



22
# File 'lib/fzeet/windows/core/Point.rb', line 22

def set(x, y) tap { |pt| pt[:x], pt[:y] = x, y } end