Improve console interface
This commit is contained in:
parent
9c8c257c43
commit
6fde122401
2 changed files with 13 additions and 2 deletions
|
@ -250,9 +250,17 @@ void draw_console() {
|
|||
ImGui::Text("%s", prism::log_output.c_str());
|
||||
|
||||
static std::string console_input;
|
||||
ImGui::InputText("##console_input", &console_input);
|
||||
|
||||
if(ImGui::Button("Input")) {
|
||||
ImGui::SetNextItemWidth(-1.0f);
|
||||
|
||||
const bool input_return = ImGui::InputText("##console_input", &console_input, ImGuiInputTextFlags_EnterReturnsTrue);
|
||||
|
||||
if(input_return)
|
||||
ImGui::SetKeyboardFocusHere(-1);
|
||||
|
||||
const bool button_return = ImGui::Button("Input");
|
||||
|
||||
if(input_return || button_return) {
|
||||
prism::console::parse_and_invoke_command(console_input);
|
||||
console_input.clear();
|
||||
}
|
||||
|
|
|
@ -174,5 +174,8 @@ bool input_system::get_allowable_text_button(unsigned int keycode) const {
|
|||
if(platform::get_keycode(InputButton::Backspace) == keycode)
|
||||
return true;
|
||||
|
||||
if(platform::get_keycode(InputButton::Enter) == keycode)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
Reference in a new issue