示例#1
0
//-----------------------------------------------------------------------------------------------
void Game::UpdateConsoleInput( float, Keyboard& keyInput, const Mouse& )
{
	if( keyInput.KeyIsPressed( Keyboard::BACKSPACE ) )
		m_console->RemoveLetterLeftOfCursorPosition();

	if( keyInput.KeyIsPressed( Keyboard::DELETE_KEY ) )
		m_console->RemoveLetterRightOfCursorPosition();

	if( keyInput.KeyIsPressed( Keyboard::ESCAPE ) )
	{
		if( m_console->PromptIsEmpty() )
			m_consoleVisible = false;
		else
			m_console->ClearPrompt();
	}

	if( keyInput.KeyIsPressed( Keyboard::ENTER ) )
	{
		if( m_console->PromptIsEmpty() )
			m_consoleVisible = false;
		else
			m_console->ExecuteCommandInPrompt();
	}


	//Cursor Movement
	if( keyInput.KeyIsPressed( Keyboard::ARROW_LEFT ) )
		m_console->MovePromptCursorLeft();

	if( keyInput.KeyIsPressed( Keyboard::ARROW_RIGHT ) )
		m_console->MovePromptCursorRight();

	if( keyInput.KeyIsPressed( Keyboard::HOME ) )
		m_console->MovePromptCursorToStart();

	if( keyInput.KeyIsPressed( Keyboard::END ) )
		m_console->MovePromptCursorToEnd();

	//Character Input
	while( !keyInput.InputQueueIsEmpty() )
	{
		m_console->AddCharacterToPrompt( keyInput.GetCharacterFromInputQueue() );
	}
}