-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added compatibility for Linux platform #5
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd really would like to avoid adding a third-party lib just for managing console output, but I'm open to get educated as I didn't find the time to look into the matter on linux yet (I only know about the ANSI control codes which should work on both linux and mac)
Warning: I only skimmed over it quickly, so I might have missed quite a few spots, hopefully once you address my comments there'll be a more thorough review.
@Scienziatogm needs a rebase, and there's still 2 unresolved conversations |
@@ -284,7 +284,7 @@ void DumpConsoleHelp(); | |||
|
|||
COORD FServerConsole::GetCursorPosition() | |||
{ | |||
COORD hCursorPosition = 0; | |||
COORD hCursorPosition = { 0, 0 }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COORD hCursorPosition = { 0, 0 }; | |
COORD hCursorPosition = {}; |
} | ||
if ( hInputEvents == '\n' ) | ||
{ | ||
auto& sInput = m_sInput; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto& sInput = m_sInput; | |
auto sInput = m_sInput; |
Not sure if we need a reference here
COORD retval; | ||
getyx( stdscr, retval.Y, retval.X ); | ||
return retval; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COORD retval; | |
getyx( stdscr, retval.Y, retval.X ); | |
return retval; | |
COORD hPos; | |
getyx( stdscr, hPos.Y, hPos.X ); | |
return hPos; |
int retval = move( hCursorPosition.Y, hCursorPosition.X ); | ||
refresh(); | ||
return retval == OK ? true : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int retval = move( hCursorPosition.Y, hCursorPosition.X ); | |
refresh(); | |
return retval == OK ? true : false; | |
int iStatus = move( hCursorPosition.Y, hCursorPosition.X ); | |
refresh(); | |
return iStatus == OK; |
COORD() | ||
{ | ||
this->Y = 0; | ||
this->X = 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this even needed?
COORD( int Y, int X ) | ||
{ | ||
this->Y = Y; | ||
this->X = X; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COORD( int Y, int X ) | |
{ | |
this->Y = Y; | |
this->X = X; | |
} | |
COORD( int iX, int iY ) | |
{ | |
X = iX; | |
Y = iY; | |
} |
Make sure you validate the order of the parameters on the rest of the code (with or without accepting this suggestion)
Added compatibility for Linux Platform. Tested on x86_64 ubuntu dedicated server.