Moved menu files to be under /ui directory, added support for commands to Console!

This commit is contained in:
2019-08-07 15:36:45 -05:00
parent ffae3ae14e
commit 80576a211a
7 changed files with 101 additions and 6 deletions

View File

@@ -62,8 +62,9 @@ class IMICFPS
case id
when Gosu::KbEnter, Gosu::KbReturn
return unless @text_input.text.length > 0
@history.text += "\n> #{@text_input.text}"
@history.text += "\n<c=999999>> #{@text_input.text}</c>"
update_history
handle_command
@text_input.text = ""
when Gosu::KbBacktick
# Removed backtick character from input
@@ -82,6 +83,20 @@ class IMICFPS
@history.y = @history_height - (@history.text.lines.count * (@history.textobject.height))
end
def handle_command
string = @text_input.text
split = string.split(" ")
command = split.first
arguments = split.length > 0 ? split[1..split.length - 1] : []
IMICFPS::Commands::Command.use(command, arguments, self)
end
def stdin(string)
@history.text += "\n#{string}"
update_history
end
def focus
@active_text_input = window.text_input
window.text_input = @text_input