Skip to content

Commit

Permalink
Keys Added multi byte dosen't work but getsc works too
Browse files Browse the repository at this point in the history
  • Loading branch information
metacritical committed Mar 23, 2012
1 parent 63af71f commit 8a9c21f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
66 changes: 33 additions & 33 deletions controller/keyb_handler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,43 @@ def initialize(io)
@io = io
end

# def read_data
# multi_bytes = @io.bytes.each do |i|
# i.to_s(16)
# end
# return multi_bytes
# end
#
def read_data
multi_bytes = @io.bytes.each do |i|
i.to_s(16)
end
end

def run
loop do
character = @io.getbyte.to_s(16)
# char_data = read_data

case character
when "1b" #<esc> Character
@io.print "\x8\x8"
@io.print "Shorel 'aran\n"
$monkserver.stop

when "41" #"A"
@io.print "\x8"
@io.print "B"
#io.print "\x1b\x238" #Repeat E on screen

when "8" #"C-h" combination keypress
@io.print "\x8\x8"
@io.puts "Help commands : blah..blah.."
@io.print "\n~> "
character = @io.getbytes.to_s(16)
#multi_bytes = @io.bytes.each {|i| i.to_s(16) }

when "7f"
@io.print "\x8\x8\x8"

when "\e"
@io.print "Da..Da..da.da..da"

case character
when "11" #C-q KeyCombo
@io.print "\x8\x8"
@io.print "\nShorel 'aran\n"
$monkserver.stop

when "41" #"A" Character
@io.print "\x8"
@io.print "B"
#@io.print "\x1b\x238" #Repeat E on screen

when "8" #"C-h" combination keypress
@io.print "\x8\x8"
@io.puts "Help commands : blah..blah.."
@io.print "\n~> "

when "7f" #Backspace
@io.print "\x8\x8\x8"

else
# multi_character = self.read_data
@io.print character
#character = @io.bytes.each {|i| i.to_s(16) }

#case multi_character
# when "1b5b337e"
#@io.print read_data
@io.print character + "-"
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion controller/mudserve.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def start_logger

#Draw Monk pic
def draw_monk
monk_pic = File.read('views/monk.pic').split(/\n/)
monk_pic = File.read('views/ascii_monk.pic').split(/\n/)
#FG Red (\e[31m) and BG Blue (\e[44m).
out ||= [] << "\e[44m\e[31mWelcome to #{MonkServerName} #{MudMonkVersion}\n\e[0m"
out << HELP
Expand Down

0 comments on commit 8a9c21f

Please sign in to comment.