Module: Common

Included in:
Rubynk
Defined in:
lib/app.rb

Overview

Methods for general purpose

Instance Method Summary collapse

Instance Method Details

#alert(message) ⇒ Object



16
17
18
# File 'lib/app.rb', line 16

def alert(message)
  $window.alert(message)
end

#blackObject



20
21
22
# File 'lib/app.rb', line 20

def black
  $p.background(1)
end

#over?(x, y, l, h) ⇒ Boolean

Check if “mouse” is hovering over given rectangle

Returns:

  • (Boolean)


25
26
27
28
29
30
# File 'lib/app.rb', line 25

def over?(x,y,l,h)
  true if $p.mouseX >= x &&
          $p.mouseX <= l+x &&
          $p.mouseY >= y &&
          $p.mouseY <= h+y      
end

#ynk_setupObject



11
12
13
14
# File 'lib/app.rb', line 11

def ynk_setup
  $window = Native(`window`)  # Get Page Window
  $p = Native(`p`) #Set global Processing hook
end