Class: Cukunity::Unity::Screen

Inherits:
JSONContainer show all
Defined in:
lib/cukunity/unity/screen.rb

Instance Attribute Summary collapse

Attributes inherited from JSONContainer

#json

Instance Method Summary collapse

Methods inherited from JSONContainer

#has_key?, #keys, #method_missing, #to_s, #value_of

Methods included from Cukunity::Utils

#check_timeout, #merge_options, #restrict_options, #to_options, #wait_connectivity

Constructor Details

#initialize(client, *args) ⇒ Screen

Returns a new instance of Screen.



6
7
8
9
# File 'lib/cukunity/unity/screen.rb', line 6

def initialize(client, *args)
  @client = client
  super(*args)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Cukunity::Unity::JSONContainer

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



4
5
6
# File 'lib/cukunity/unity/screen.rb', line 4

def client
  @client
end

Instance Method Details

#tap(pos, options = {}) ⇒ Object



11
12
13
14
15
# File 'lib/cukunity/unity/screen.rb', line 11

def tap(pos, options = {})
  options = invert_y(pos, options)
  options[:type] = :tap
  client.platform::TouchInput.touch_screen(options)
end

#touch_down(pos, options = {}) ⇒ Object



17
18
19
20
21
# File 'lib/cukunity/unity/screen.rb', line 17

def touch_down(pos, options = {})
  options = invert_y(pos, options)
  options[:down] = :down
  client.platform::TouchInput.touch_screen(options)
end

#touch_move(pos, options = {}) ⇒ Object



29
30
31
32
33
# File 'lib/cukunity/unity/screen.rb', line 29

def touch_move(pos, options = {})
  options = invert_y(pos, options)
  options[:move] = :move
  client.platform::TouchInput.touch_screen(options)
end

#touch_release(pos, options = {}) ⇒ Object Also known as: touch_up



23
24
25
26
27
# File 'lib/cukunity/unity/screen.rb', line 23

def touch_release(pos, options = {})
  options = invert_y(pos, options)
  options[:up] = :up
  client.platform::TouchInput.touch_screen(options)
end