puts a centered string in the text buffer.
| 420 | |
| 421 | // puts a centered string in the text buffer. |
| 422 | void grtext_CenteredPrintf(int xoff, int y, const char *fmt, ...) { |
| 423 | int new_x; |
| 424 | std::va_list arglist; |
| 425 | int len; |
| 426 | char buf[512]; |
| 427 | |
| 428 | va_start(arglist, fmt); |
| 429 | len = std::vsnprintf(buf, 512, fmt, arglist); |
| 430 | va_end(arglist); |
| 431 | if (len < 0) |
| 432 | return; |
| 433 | |
| 434 | new_x = Grtext_left + (Grtext_right - Grtext_left) / 2 - grtext_GetTextLineWidth(buf) / 2; |
| 435 | |
| 436 | grtext_Puts(new_x + xoff, y, buf); |
| 437 | } |
| 438 | |
| 439 | #define GR_STR_LEN 128 |
| 440 | // draws a string |
no test coverage detected