| 236 | } |
| 237 | |
| 238 | void CConsole::OutFont(LPCSTR text, float& pos_y) |
| 239 | { |
| 240 | float str_length = pFont->SizeOf_(text); |
| 241 | float scr_width = 1.98f * Device.fWidth_2; |
| 242 | if (str_length > scr_width) //1024.0f |
| 243 | { |
| 244 | int sz = 0; |
| 245 | int ln = 0; |
| 246 | LPSTR one_line = (LPSTR)_alloca((CONSOLE_BUF_SIZE + 1) * sizeof(char)); |
| 247 | |
| 248 | while (text[sz] && (ln + sz < CONSOLE_BUF_SIZE - 5)) // перенос строк |
| 249 | { |
| 250 | one_line[ln + sz] = text[sz]; |
| 251 | one_line[ln + sz + 1] = 0; |
| 252 | |
| 253 | float t = pFont->SizeOf_(one_line + ln); |
| 254 | if (t > scr_width) |
| 255 | { |
| 256 | OutFont(text + sz + 1, pos_y); |
| 257 | pos_y -= lineDistance; |
| 258 | pFont->OutI(-1.0f, pos_y, "%s", one_line + ln); |
| 259 | ln = sz + 1; |
| 260 | } |
| 261 | |
| 262 | ++sz; |
| 263 | } |
| 264 | } |
| 265 | else |
| 266 | { |
| 267 | pFont->OutI(-1.0f, pos_y, "%s", text); |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | void CConsole::OnScreenResolutionChanged() |
| 272 | { |