|
@@ -71,12 +71,12 @@ Console::~Console()
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
void
|
|
|
-Console::Input( const Event& event )
|
|
|
|
|
|
|
+Console::Input(const QGears::Event& event)
|
|
|
{
|
|
{
|
|
|
if( m_Visible != true )
|
|
if( m_Visible != true )
|
|
|
{
|
|
{
|
|
|
// add console
|
|
// add console
|
|
|
- if( event.type == ET_KEY_PRESS && event.param1 == OIS::KC_GRAVE )
|
|
|
|
|
|
|
+ if (event.type == QGears::ET_KEY_PRESS && event.param1 == OIS::KC_GRAVE)
|
|
|
{
|
|
{
|
|
|
SetToVisible();
|
|
SetToVisible();
|
|
|
}
|
|
}
|
|
@@ -85,7 +85,7 @@ Console::Input( const Event& event )
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// input command
|
|
// input command
|
|
|
- else if( event.type == ET_KEY_PRESS && event.param1 == OIS::KC_RETURN && m_InputLine.size() )
|
|
|
|
|
|
|
+ else if (event.type == QGears::ET_KEY_PRESS && event.param1 == OIS::KC_RETURN && m_InputLine.size())
|
|
|
{
|
|
{
|
|
|
if( m_AutoCompletition.size() > 0 )
|
|
if( m_AutoCompletition.size() > 0 )
|
|
|
{
|
|
{
|
|
@@ -115,17 +115,17 @@ Console::Input( const Event& event )
|
|
|
m_CursorPosition = 0;
|
|
m_CursorPosition = 0;
|
|
|
ResetAutoCompletion();
|
|
ResetAutoCompletion();
|
|
|
}
|
|
}
|
|
|
- else if( event.type == ET_KEY_PRESS && event.param1 == OIS::KC_TAB )
|
|
|
|
|
|
|
+ else if (event.type == QGears::ET_KEY_PRESS && event.param1 == OIS::KC_TAB)
|
|
|
{
|
|
{
|
|
|
CompleteInput();
|
|
CompleteInput();
|
|
|
}
|
|
}
|
|
|
// remove console
|
|
// remove console
|
|
|
- else if( event.type == ET_KEY_PRESS && event.param1 == OIS::KC_GRAVE )
|
|
|
|
|
|
|
+ else if (event.type == QGears::ET_KEY_PRESS && event.param1 == OIS::KC_GRAVE)
|
|
|
{
|
|
{
|
|
|
SetToHide();
|
|
SetToHide();
|
|
|
}
|
|
}
|
|
|
// history up
|
|
// history up
|
|
|
- else if( ( event.type == ET_KEY_PRESS || event.type == ET_KEY_REPEAT ) && event.param1 == OIS::KC_UP )
|
|
|
|
|
|
|
+ else if ((event.type == QGears::ET_KEY_PRESS || event.type == QGears::ET_KEY_REPEAT) && event.param1 == OIS::KC_UP)
|
|
|
{
|
|
{
|
|
|
if( m_HistoryLine < ( int )m_History.size() - 1 )
|
|
if( m_HistoryLine < ( int )m_History.size() - 1 )
|
|
|
{
|
|
{
|
|
@@ -134,7 +134,7 @@ Console::Input( const Event& event )
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// history down
|
|
// history down
|
|
|
- else if( ( event.type == ET_KEY_PRESS || event.type == ET_KEY_REPEAT ) && event.param1 == OIS::KC_DOWN )
|
|
|
|
|
|
|
+ else if ((event.type == QGears::ET_KEY_PRESS || event.type == QGears::ET_KEY_REPEAT) && event.param1 == OIS::KC_DOWN)
|
|
|
{
|
|
{
|
|
|
if( m_HistoryLine > 0 )
|
|
if( m_HistoryLine > 0 )
|
|
|
{
|
|
{
|
|
@@ -143,7 +143,7 @@ Console::Input( const Event& event )
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// scroll display to previous row
|
|
// scroll display to previous row
|
|
|
- else if( event.type == ET_MOUSE_SCROLL && event.param1 > 0 )
|
|
|
|
|
|
|
+ else if (event.type == QGears::ET_MOUSE_SCROLL && event.param1 > 0)
|
|
|
{
|
|
{
|
|
|
if( m_DisplayLine > 0 )
|
|
if( m_DisplayLine > 0 )
|
|
|
{
|
|
{
|
|
@@ -151,7 +151,7 @@ Console::Input( const Event& event )
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// scroll display to next row
|
|
// scroll display to next row
|
|
|
- else if( event.type == ET_MOUSE_SCROLL && event.param1 < 0 )
|
|
|
|
|
|
|
+ else if (event.type == QGears::ET_MOUSE_SCROLL && event.param1 < 0)
|
|
|
{
|
|
{
|
|
|
if( m_DisplayLine < m_OutputLine.size() )
|
|
if( m_DisplayLine < m_OutputLine.size() )
|
|
|
{
|
|
{
|
|
@@ -160,7 +160,7 @@ Console::Input( const Event& event )
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
// scroll display to previous row
|
|
// scroll display to previous row
|
|
|
- else if( ( event.type == ET_KEY_PRESS || event.type == ET_KEY_REPEAT ) && event.param1 == OIS::KC_PGUP )
|
|
|
|
|
|
|
+ else if ((event.type == QGears::ET_KEY_PRESS || event.type == QGears::ET_KEY_REPEAT) && event.param1 == OIS::KC_PGUP)
|
|
|
{
|
|
{
|
|
|
if( m_DisplayLine > 0 )
|
|
if( m_DisplayLine > 0 )
|
|
|
{
|
|
{
|
|
@@ -168,7 +168,7 @@ Console::Input( const Event& event )
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// scroll display to next row
|
|
// scroll display to next row
|
|
|
- else if( ( event.type == ET_KEY_PRESS || event.type == ET_KEY_REPEAT ) && event.param1 == OIS::KC_PGDOWN )
|
|
|
|
|
|
|
+ else if ((event.type == QGears::ET_KEY_PRESS || event.type == QGears::ET_KEY_REPEAT) && event.param1 == OIS::KC_PGDOWN)
|
|
|
{
|
|
{
|
|
|
if( m_DisplayLine < m_OutputLine.size() )
|
|
if( m_DisplayLine < m_OutputLine.size() )
|
|
|
{
|
|
{
|
|
@@ -176,7 +176,7 @@ Console::Input( const Event& event )
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// delete character after cursor
|
|
// delete character after cursor
|
|
|
- else if( ( event.type == ET_KEY_PRESS || event.type == ET_KEY_REPEAT ) && event.param1 == OIS::KC_DELETE )
|
|
|
|
|
|
|
+ else if ((event.type == QGears::ET_KEY_PRESS || event.type == QGears::ET_KEY_REPEAT) && event.param1 == OIS::KC_DELETE)
|
|
|
{
|
|
{
|
|
|
if( m_AutoCompletition.size() > 0 )
|
|
if( m_AutoCompletition.size() > 0 )
|
|
|
{
|
|
{
|
|
@@ -191,7 +191,7 @@ Console::Input( const Event& event )
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// delete character before cursor
|
|
// delete character before cursor
|
|
|
- else if( ( event.type == ET_KEY_PRESS || event.type == ET_KEY_REPEAT ) && event.param1 == OIS::KC_BACK )
|
|
|
|
|
|
|
+ else if ((event.type == QGears::ET_KEY_PRESS || event.type == QGears::ET_KEY_REPEAT) && event.param1 == OIS::KC_BACK)
|
|
|
{
|
|
{
|
|
|
if( m_AutoCompletition.size() > 0 )
|
|
if( m_AutoCompletition.size() > 0 )
|
|
|
{
|
|
{
|
|
@@ -207,7 +207,7 @@ Console::Input( const Event& event )
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// move cursor to left
|
|
// move cursor to left
|
|
|
- else if( ( event.type == ET_KEY_PRESS || event.type == ET_KEY_REPEAT ) && event.param1 == OIS::KC_LEFT )
|
|
|
|
|
|
|
+ else if ((event.type == QGears::ET_KEY_PRESS || event.type == QGears::ET_KEY_REPEAT) && event.param1 == OIS::KC_LEFT)
|
|
|
{
|
|
{
|
|
|
if( m_AutoCompletition.size() > 0 )
|
|
if( m_AutoCompletition.size() > 0 )
|
|
|
{
|
|
{
|
|
@@ -221,7 +221,7 @@ Console::Input( const Event& event )
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// move cursor to right
|
|
// move cursor to right
|
|
|
- else if( ( event.type == ET_KEY_PRESS || event.type == ET_KEY_REPEAT ) && event.param1 == OIS::KC_RIGHT )
|
|
|
|
|
|
|
+ else if ((event.type == QGears::ET_KEY_PRESS || event.type == QGears::ET_KEY_REPEAT) && event.param1 == OIS::KC_RIGHT)
|
|
|
{
|
|
{
|
|
|
if( m_AutoCompletition.size() > 0 )
|
|
if( m_AutoCompletition.size() > 0 )
|
|
|
{
|
|
{
|
|
@@ -234,14 +234,14 @@ Console::Input( const Event& event )
|
|
|
++m_CursorPosition;
|
|
++m_CursorPosition;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- else if ( event.type == ET_KEY_PRESS && event.param1 == OIS::KC_ESCAPE )
|
|
|
|
|
|
|
+ else if (event.type == QGears::ET_KEY_PRESS && event.param1 == OIS::KC_ESCAPE)
|
|
|
{
|
|
{
|
|
|
m_InputLine.clear();
|
|
m_InputLine.clear();
|
|
|
m_CursorPosition = 0;
|
|
m_CursorPosition = 0;
|
|
|
ResetAutoCompletion();
|
|
ResetAutoCompletion();
|
|
|
}
|
|
}
|
|
|
// move cursor to start of string
|
|
// move cursor to start of string
|
|
|
- else if( event.type == ET_KEY_PRESS && event.param1 == OIS::KC_HOME )
|
|
|
|
|
|
|
+ else if (event.type == QGears::ET_KEY_PRESS && event.param1 == OIS::KC_HOME)
|
|
|
{
|
|
{
|
|
|
m_CursorPosition = 0;
|
|
m_CursorPosition = 0;
|
|
|
|
|
|
|
@@ -252,7 +252,7 @@ Console::Input( const Event& event )
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// move cursor to end of string
|
|
// move cursor to end of string
|
|
|
- else if( event.type == ET_KEY_PRESS && event.param1 == OIS::KC_END )
|
|
|
|
|
|
|
+ else if (event.type == QGears::ET_KEY_PRESS && event.param1 == OIS::KC_END)
|
|
|
{
|
|
{
|
|
|
if( m_AutoCompletition.size() > 0 )
|
|
if( m_AutoCompletition.size() > 0 )
|
|
|
{
|
|
{
|
|
@@ -263,7 +263,7 @@ Console::Input( const Event& event )
|
|
|
m_CursorPosition = m_InputLine.size();
|
|
m_CursorPosition = m_InputLine.size();
|
|
|
}
|
|
}
|
|
|
// input ascii character
|
|
// input ascii character
|
|
|
- else if( ( event.type == ET_KEY_PRESS || event.type == ET_KEY_REPEAT ) && m_InputLine.size() < m_LineWidth )
|
|
|
|
|
|
|
+ else if ((event.type == QGears::ET_KEY_PRESS || event.type == QGears::ET_KEY_REPEAT) && m_InputLine.size() < m_LineWidth)
|
|
|
{
|
|
{
|
|
|
char legalchars[] = "ABCDEFGHIJKLMNOPQRSTUVWXUZabcdefghijklmnopqrstuvwxyz1234567890~!@#$%^&*()-_=+?{[]}|\\;:'\"<>,./? ";
|
|
char legalchars[] = "ABCDEFGHIJKLMNOPQRSTUVWXUZabcdefghijklmnopqrstuvwxyz1234567890~!@#$%^&*()-_=+?{[]}|\\;:'\"<>,./? ";
|
|
|
char txt = event.param2;
|
|
char txt = event.param2;
|