mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-04 13:42:55 +01:00
@@ -29,30 +29,30 @@ using namespace OpenRCT2::Ui;
|
||||
|
||||
static void input_handle_console(int32_t key)
|
||||
{
|
||||
CONSOLE_INPUT input = CONSOLE_INPUT_NONE;
|
||||
ConsoleInput input = ConsoleInput::None;
|
||||
switch (key)
|
||||
{
|
||||
case SDL_SCANCODE_ESCAPE:
|
||||
input = CONSOLE_INPUT_LINE_CLEAR;
|
||||
input = ConsoleInput::LineClear;
|
||||
break;
|
||||
case SDL_SCANCODE_RETURN:
|
||||
case SDL_SCANCODE_KP_ENTER:
|
||||
input = CONSOLE_INPUT_LINE_EXECUTE;
|
||||
input = ConsoleInput::LineExecute;
|
||||
break;
|
||||
case SDL_SCANCODE_UP:
|
||||
input = CONSOLE_INPUT_HISTORY_PREVIOUS;
|
||||
input = ConsoleInput::HistoryPrevious;
|
||||
break;
|
||||
case SDL_SCANCODE_DOWN:
|
||||
input = CONSOLE_INPUT_HISTORY_NEXT;
|
||||
input = ConsoleInput::HistoryNext;
|
||||
break;
|
||||
case SDL_SCANCODE_PAGEUP:
|
||||
input = CONSOLE_INPUT_SCROLL_PREVIOUS;
|
||||
input = ConsoleInput::ScrollPrevious;
|
||||
break;
|
||||
case SDL_SCANCODE_PAGEDOWN:
|
||||
input = CONSOLE_INPUT_SCROLL_NEXT;
|
||||
input = ConsoleInput::ScrollNext;
|
||||
break;
|
||||
}
|
||||
if (input != CONSOLE_INPUT_NONE)
|
||||
if (input != ConsoleInput::None)
|
||||
{
|
||||
auto& console = GetInGameConsole();
|
||||
console.Input(input);
|
||||
|
||||
@@ -39,15 +39,15 @@ void InGameConsole::WritePrompt()
|
||||
InteractiveConsole::WriteLine("> ");
|
||||
}
|
||||
|
||||
void InGameConsole::Input(CONSOLE_INPUT input)
|
||||
void InGameConsole::Input(ConsoleInput input)
|
||||
{
|
||||
switch (input)
|
||||
{
|
||||
case CONSOLE_INPUT_LINE_CLEAR:
|
||||
case ConsoleInput::LineClear:
|
||||
ClearInput();
|
||||
RefreshCaret();
|
||||
break;
|
||||
case CONSOLE_INPUT_LINE_EXECUTE:
|
||||
case ConsoleInput::LineExecute:
|
||||
if (_consoleCurrentLine[0] != '\0')
|
||||
{
|
||||
HistoryAdd(_consoleCurrentLine);
|
||||
@@ -62,7 +62,7 @@ void InGameConsole::Input(CONSOLE_INPUT input)
|
||||
}
|
||||
ScrollToEnd();
|
||||
break;
|
||||
case CONSOLE_INPUT_HISTORY_PREVIOUS:
|
||||
case ConsoleInput::HistoryPrevious:
|
||||
if (_consoleHistoryIndex > 0)
|
||||
{
|
||||
_consoleHistoryIndex--;
|
||||
@@ -72,7 +72,7 @@ void InGameConsole::Input(CONSOLE_INPUT input)
|
||||
_consoleTextInputSession->Length = utf8_length(_consoleTextInputSession->Buffer);
|
||||
_consoleTextInputSession->SelectionStart = strlen(_consoleCurrentLine);
|
||||
break;
|
||||
case CONSOLE_INPUT_HISTORY_NEXT:
|
||||
case ConsoleInput::HistoryNext:
|
||||
if (_consoleHistoryIndex < _consoleHistoryCount - 1)
|
||||
{
|
||||
_consoleHistoryIndex++;
|
||||
@@ -87,13 +87,13 @@ void InGameConsole::Input(CONSOLE_INPUT input)
|
||||
ClearInput();
|
||||
}
|
||||
break;
|
||||
case CONSOLE_INPUT_SCROLL_PREVIOUS:
|
||||
case ConsoleInput::ScrollPrevious:
|
||||
{
|
||||
int32_t scrollAmt = GetNumVisibleLines() - 1;
|
||||
Scroll(scrollAmt);
|
||||
break;
|
||||
}
|
||||
case CONSOLE_INPUT_SCROLL_NEXT:
|
||||
case ConsoleInput::ScrollNext:
|
||||
{
|
||||
int32_t scrollAmt = GetNumVisibleLines() - 1;
|
||||
Scroll(-scrollAmt);
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace OpenRCT2::Ui
|
||||
void Toggle();
|
||||
void WriteLine(const std::string& s, uint32_t colourFormat) override;
|
||||
|
||||
void Input(CONSOLE_INPUT input);
|
||||
void Input(ConsoleInput input);
|
||||
void RefreshCaret();
|
||||
void Scroll(int32_t linesToScroll);
|
||||
|
||||
|
||||
@@ -19,15 +19,15 @@
|
||||
struct rct_drawpixelinfo;
|
||||
struct TextInputSession;
|
||||
|
||||
enum CONSOLE_INPUT
|
||||
enum class ConsoleInput : uint8_t
|
||||
{
|
||||
CONSOLE_INPUT_NONE,
|
||||
CONSOLE_INPUT_LINE_CLEAR,
|
||||
CONSOLE_INPUT_LINE_EXECUTE,
|
||||
CONSOLE_INPUT_HISTORY_PREVIOUS,
|
||||
CONSOLE_INPUT_HISTORY_NEXT,
|
||||
CONSOLE_INPUT_SCROLL_PREVIOUS,
|
||||
CONSOLE_INPUT_SCROLL_NEXT,
|
||||
None,
|
||||
LineClear,
|
||||
LineExecute,
|
||||
HistoryPrevious,
|
||||
HistoryNext,
|
||||
ScrollPrevious,
|
||||
ScrollNext,
|
||||
};
|
||||
|
||||
class InteractiveConsole
|
||||
|
||||
Reference in New Issue
Block a user