class Test

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/luit.rb, line 417
def initialize
        super(1000, 1000, false)

        LUIT.config(window: self)

        @LUITElements = []
        @LUITElements << LUIT::Button.new(self, 1, 0, 0, "Test")
        @LUITElements << LUIT::Button.new(self, 2, 111, 111, "Big button", 200, 70)
        @LUITElements << LUIT::Slider.new(self, 3, 300, 300, 300)
        @vslider = LUIT::VerticalSlider.new(self, 3, 250, 250, 300)
        @LUITElements << @vslider
        @LUITElements << LUIT::Toggle.new(self, 4, 500, 500)
        @LUITElements << LUIT::ClickArea.new(self, "click", 900, 900, 100, 100)
        @texter = LUIT::TextArea.new(self, "text", 300, 100, 32, 20)
        @LUITElements << @texter
        @LUITElements << LUIT::TextArea.new(self, "text2", 300, 200, 32, 20)
        @list = LUIT::List.new(self, "list", 0, 200, 300, 0)
        @LUITElements << @list
        20.times do
                @list << LUIT::Button.new(self, 1, 0, 0, "Test", 0, 50)
        end
        @font = Gosu::Font.new(30)
        @scanner = LUIT::ScannerInput.new(self, "dik")
end

Public Instance Methods

button_down(id) click to toggle source
# File lib/luit.rb, line 452
def button_down(id)
        case id
        when Gosu::KbSpace
                @list << LUIT::Button.new(self, 1, 0, 0, "Test", 0, 50)
        when Gosu::KbReturn
                puts @scanner.field.text
                @scanner.field.text = ""
        end
end
draw() click to toggle source
# File lib/luit.rb, line 442
def draw
        @LUITElements.each {|e| e.draw}
        @font.draw(LUIT::to_roman(@vslider.value), 600, 250, 2)
end
needs_cursor?() click to toggle source
# File lib/luit.rb, line 474
def needs_cursor?
        return true
end
onClick(id) click to toggle source
# File lib/luit.rb, line 467
def onClick(id)
        puts id
        if id == "text"
                puts @texter.text
        end
end
onScan(text) click to toggle source
# File lib/luit.rb, line 462
def onScan(text)
        puts text
        @scanner.scan
end
update() click to toggle source
# File lib/luit.rb, line 447
def update
        @LUITElements.each {|e| e.update}
        @scanner.scan
end