Class: LUIT::ScannerInput

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(holder, id) ⇒ ScannerInput

Returns a new instance of ScannerInput.



169
170
171
172
173
174
# File 'lib/luit.rb', line 169

def initialize(holder, id)
	@field = Gosu::TextInput.new
	@window = LUIT.window
	@holder = holder
	@id = id
end

Instance Attribute Details

#scnningObject (readonly)

Returns the value of attribute scnning.



168
169
170
# File 'lib/luit.rb', line 168

def scnning
  @scnning
end

Instance Method Details

#scanObject



189
190
191
192
# File 'lib/luit.rb', line 189

def scan
	@scaning = true
	@window.text_input = @field
end

#stopObject



184
185
186
187
# File 'lib/luit.rb', line 184

def stop
	@scaning = false
	@window.text_input = nil if @window.text_input == @field
end

#updateObject



176
177
178
179
180
181
182
# File 'lib/luit.rb', line 176

def update
	if Gosu::button_down?(Gosu::KbReturn) && @scaning
		stop
		@holder.onScan(@field.text)
		@field.text = ""
	end
end