Class: Test

Inherits:
Gosu::Window
  • Object
show all
Defined in:
lib/luit.rb

Instance Method Summary collapse

Constructor Details

#initializeTest

Returns a new instance of Test.



424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
# File 'lib/luit.rb', line 424

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)
end

Instance Method Details

#button_down(id) ⇒ Object



457
458
459
460
461
# File 'lib/luit.rb', line 457

def button_down(id)
	if id == Gosu::KbSpace
		@list << LUIT::Button.new(self, 1, 0, 0, "Test", 0, 50)
	end
end

#drawObject



448
449
450
451
# File 'lib/luit.rb', line 448

def draw
	@LUITElements.each {|e| e.draw}
	@font.draw(LUIT::to_roman(@vslider.value), 600, 250, 2)
end

#needs_cursor?Boolean

Returns:

  • (Boolean)


470
471
472
# File 'lib/luit.rb', line 470

def needs_cursor?
	return true
end

#onClick(id) ⇒ Object



463
464
465
466
467
468
# File 'lib/luit.rb', line 463

def onClick(id)
	puts id
	if id == "text"
		puts @texter.text
	end
end

#updateObject



453
454
455
# File 'lib/luit.rb', line 453

def update
	@LUITElements.each {|e| e.update}
end