Module: LUIT

Defined in:
lib/luit.rb

Defined Under Namespace

Classes: Button, ClickArea, ClickPoint, Icon, LUITElement, List, ScannerInput, Slider, TextArea, Toggle, VerticalSlider

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.touchDownObject

Returns the value of attribute touchDown.



13
14
15
# File 'lib/luit.rb', line 13

def touchDown
  @touchDown
end

.uiColorObject

Returns the value of attribute uiColor.



13
14
15
# File 'lib/luit.rb', line 13

def uiColor
  @uiColor
end

.uiColorLightObject

Returns the value of attribute uiColorLight.



13
14
15
# File 'lib/luit.rb', line 13

def uiColorLight
  @uiColorLight
end

.windowObject (readonly)

Returns the value of attribute window.



14
15
16
# File 'lib/luit.rb', line 14

def window
  @window
end

.zObject (readonly)

Returns the value of attribute z.



14
15
16
# File 'lib/luit.rb', line 14

def z
  @z
end

Class Method Details

.config(window:, uiColor: 0xff_555555, uiColorLight: 0xff_888888, z: 100) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/luit.rb', line 17

def self.config(window:, uiColor: 0xff_555555, uiColorLight: 0xff_888888, z: 100)
  @window = window
  @uiColor = uiColor
  @uiColorLight = uiColorLight
  @z = z
  @touchDown = false
end

.mXObject



25
26
27
# File 'lib/luit.rb', line 25

def self.mX
  @window.mouse_x
end

.mYObject



29
30
31
# File 'lib/luit.rb', line 29

def self.mY
  @window.mouse_y
end

.to_roman(number) ⇒ Object



401
402
403
404
405
406
407
408
409
410
411
# File 'lib/luit.rb', line 401

def self.to_roman(number)
  return '0' if number == 0
  romanized = ''
  for index in 0...@decimalValue.length do
    while @decimalValue[index] <= number do
      romanized += @romanNumeral[index]
      number -= @decimalValue[index]
    end
  end
  return romanized
end

.updateTouchObject

Raspberry pi touchscreen hack



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/luit.rb', line 34

def self.updateTouch()
  if @touchDown
    @window.mouse_x = 0
    @window.mouse_y = 0
    @touchDown = false
  else
    if @window.mouse_x != 0 or @window.mouse_y != 0
      @touchDown = true
    end
  end
end