/*
CenterText.Lib.nxc
*/
int CenterText( const string text ) {
int len = StrLen(text);
len = (len * 5);
len = (100 - len);
len = (len / 2);
len = (len - 5);
return len;
}
char CenterTextOut( int y, string text, unsigned long options = DRAW_OPT_NORMAL ) {
int len = CenterText(text);
return TextOut( len, y, text, options );
}
int CenterTextOut( int y, string text , unsigned long options = DRAW_OPT_NORMAL ){
int len = StrLen(text);
len = (len * 5);
len = (100 - len);
len = (len / 2);
len = (len - 5);
TextOut( len, text, options );
}
I did think of doing something like that. Instead of replacing the CenterText function, how about adding to it by creating a CenterTextOut function that does exactly what your function does but insted uses the CenterText function to calculate length. (See first post for updated code.)