Class: Test
- Inherits:
-
Gosu::Window
- Object
- Gosu::Window
- Test
- Defined in:
- lib/luit.rb
Instance Method Summary collapse
- #button_down(id) ⇒ Object
- #draw ⇒ Object
-
#initialize ⇒ Test
constructor
A new instance of Test.
- #needs_cursor? ⇒ Boolean
- #onClick(id) ⇒ Object
- #onScan(text) ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize ⇒ Test
Returns a new instance of Test.
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 |
# 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 |
Instance Method Details
#button_down(id) ⇒ Object
452 453 454 455 456 457 458 459 460 |
# File 'lib/luit.rb', line 452 def (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 ⇒ Object
442 443 444 445 |
# 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? ⇒ Boolean
474 475 476 |
# File 'lib/luit.rb', line 474 def needs_cursor? return true end |
#onClick(id) ⇒ Object
467 468 469 470 471 472 |
# File 'lib/luit.rb', line 467 def onClick(id) puts id if id == "text" puts @texter.text end end |
#onScan(text) ⇒ Object
462 463 464 465 |
# File 'lib/luit.rb', line 462 def onScan(text) puts text @scanner.scan end |
#update ⇒ Object
447 448 449 450 |
# File 'lib/luit.rb', line 447 def update @LUITElements.each {|e| e.update} @scanner.scan end |