lib/cyberarm_engine/console.rb in cyberarm_engine-0.23.0 vs lib/cyberarm_engine/console.rb in cyberarm_engine-0.24.0

- old
+ new

@@ -101,35 +101,35 @@ @input.text = @text_input.text end def button_down(id) case id - when Gosu::KbEnter, Gosu::KbReturn + when Gosu::KB_ENTER, Gosu::KB_RETURN return unless @text_input.text.length.positive? @history.text += "\n<c=999999>> #{@text_input.text}</c>" @command_history << @text_input.text @command_history_index = @command_history.size update_history_y handle_command @text_input.text = "" - when Gosu::KbUp + when Gosu::KB_UP @command_history_index -= 1 @command_history_index = 0 if @command_history_index.negative? @text_input.text = @command_history[@command_history_index] - when Gosu::KbDown + when Gosu::KB_DOWN @command_history_index += 1 if @command_history_index > @command_history.size - 1 @text_input.text = "" unless @command_history_index > @command_history.size @command_history_index = @command_history.size else @text_input.text = @command_history[@command_history_index] end - when Gosu::KbTab + when Gosu::KB_TAB split = @text_input.text.split(" ") if !@text_input.text.end_with?(" ") && split.size == 1 list = abbrev_search(Console::Command.list_commands.map { |cmd| cmd.command.to_s }, @text_input.text) @@ -140,39 +140,39 @@ end elsif split.size.positive? && cmd = Console::Command.find(split.first) cmd.autocomplete(self) end - when Gosu::KbBacktick + when Gosu::KB_BACKTICK # Remove backtick character from input @text_input.text = if @text_input.text.size > 1 @text_input.text[0..@text_input.text.size - 2] else "" end # Copy - when Gosu::KbC + when Gosu::KB_C if control_down? && shift_down? @memory = @text_input.text[caret_start..caret_end - 1] if caret_start != caret_end p @memory elsif control_down? @text_input.text = "" end # Paste - when Gosu::KbV + when Gosu::KB_V if control_down? && shift_down? string = @text_input.text.chars.insert(caret_pos, @memory).join _caret_pos = caret_pos @text_input.text = string @text_input.caret_pos = _caret_pos + @memory.length @text_input.selection_start = _caret_pos + @memory.length end # Cut - when Gosu::KbX + when Gosu::KB_X if control_down? && shift_down? @memory = @text_input.text[caret_start..caret_end - 1] if caret_start != caret_end string = @text_input.text.chars Array(caret_start..caret_end - 1).each_with_index do |i, j| string.delete_at(i - j) @@ -180,18 +180,18 @@ @text_input.text = string.join end # Delete word to left of caret - when Gosu::KbW + when Gosu::KB_W if control_down? split = @text_input.text.split(" ") split.delete(split.last) @text_input.text = split.join(" ") end # Clear history - when Gosu::KbL + when Gosu::KB_L @history.text = "" if control_down? end end def button_up(id)