Method: CRT#getch

Defined in:
lib/HDLRuby/hdr_samples/ruby_program/sw_cpu_terminal.rb

#getchObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/HDLRuby/hdr_samples/ruby_program/sw_cpu_terminal.rb', line 57

def getch
  sleep(0.02) while(@key == nil) 
  case(@key)
  when Gosu::KB_ESCAPE
    res = 27.chr
  when Gosu::KB_RETURN
    res = 10.chr
  when Gosu::KB_BACKSPACE
    res = 127.chr
  else
    res = Gosu.button_id_to_char(@key)
  end
  # puts "res=#{res}" if !res.empty?
  @key = nil
  return res
end