Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Keys Added multi byte dosen't work but getsc works too

  • Loading branch information...
commit 8a9c21f18d1fb4e29a8b468de5ae5e46c498f11d 1 parent 63af71f
Pankaj Doharey authored
Showing with 34 additions and 34 deletions.
  1. +33 −33 controller/keyb_handler.rb
  2. +1 −1  controller/mudserve.rb
66 controller/keyb_handler.rb
View
@@ -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
2  controller/mudserve.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.