Permalink
Browse files

Let There be KeyBoard and Screen ...

  • Loading branch information...
1 parent 1b43f1a commit 48451234d4ccc9b9d26bb90ed246312c9de465f2 @metacritical committed Mar 21, 2012
Showing with 30 additions and 15 deletions.
  1. +3 −3 controller/mudserve.rb
  2. +7 −3 controller/scrn_handler.rb
  3. +20 −9 mudmonk.rb
View
@@ -2,11 +2,11 @@
require 'logger'
require 'gserver'
-SERVER_NAME = 'Genesis'
-PORT_NO = 8081
+SERVER_NAME = 'Genesis'
+PORT_NO = 8081
MonkServerName = "MUDMonk Server '#{SERVER_NAME}'"
MudMonkVersion = "v0.0.1"
-HELP = "Type: <esc> to quit and 'help?' for a list of commands"
+HELP = "Type: <esc> to quit and '<C-h>' for a list of commands"
class MUDServe < GServer
#Start Logger
View
@@ -1,15 +1,19 @@
require 'observer'
require './controller/keyb_handler'
+ROWS = 80
+COLUMNS = 120
+
class InitScreen
include Observable
+ attr_accessor :cursor
def initialize
- KeboardHandler.new
- #SyntaxParser.new
+ KeyboardHandler.new
+ #SyntaxParser.new
end
def run
-
+ @screen_area = [[],[]]
end
end
View
@@ -1,4 +1,5 @@
require './controller/mudserve'
+require './controller/scrn_handler'
#require './controller/scrn_handler'
class MonkServer < MUDServe
@@ -12,28 +13,36 @@ def serve(io)
puts "-- #{io.peeraddr} connected to the Mudmonk server!"
for eachline in draw_monk do
io.puts eachline
- sleep 0.05
+ sleep 0.05 #just a little delay for animation like effect
end
print io.methods.sort #methods to use
io.puts "Bal'a dash, Malanore" #msg send to telnet client
io.print "\377\373\3" # send IAC WILL SUPPRESS-GOAHEAD
+ #io.print "\e[?3" # Set number of columns to 132
#io.print "\377\375\3" # send IAC DO SUPPRESS-GO-AHEAD
#io.puts "\e[32;36r" #cursor scroll at 32;36
io.print "\n~> "
loop do
character = io.getbyte.to_s(16)
- if character == "1b" #mode switch Alt + `
+ case character
+ when "1b" #<esc> Character
io.print "\x8\x8"
- io.print "Shorel 'aran\n"
+ io.print "Shorel 'aran\n'"
self.stop
- else
- if character == '41'
- io.print "\x8"
- io.print 'B'
- #io.print "\x1b\x238" #Repeate E on screen
- end
+
+ when "41" #"A"
+ io.print "\x8"
+ io.print "A"
+ #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~> "
+ else
+ io.print character
end
end
end
@@ -43,6 +52,8 @@ def serve(io)
monkserver.audit = true
monkserver.start
monkserver.join
+initscreen = InitScreen.new
+#keyb_handler = KeyboardHandler.new
#monkserver.shutdown
#MonkServer.stop 8081
#self.stop

0 comments on commit 4845123

Please sign in to comment.