iterate through entire hud item list to draw.
| 1407 | |
| 1408 | // iterate through entire hud item list to draw. |
| 1409 | void RenderHUDItems(tStatMask stat_mask) { |
| 1410 | static float framerate_timer = 0; |
| 1411 | static float last_fps; |
| 1412 | float font_aspect_x, font_aspect_y; |
| 1413 | int i; |
| 1414 | |
| 1415 | grtext_Reset(); |
| 1416 | grtext_SetFont(HUD_FONT); |
| 1417 | |
| 1418 | // for lores screens, we use different fonts, so DONT SCALE. |
| 1419 | font_aspect_x = (float)Game_window_w / Max_window_w; |
| 1420 | font_aspect_y = (float)Game_window_h / Max_window_h; |
| 1421 | |
| 1422 | if (font_aspect_x <= 0.60f) { |
| 1423 | grtext_SetFontScale(0.60f); |
| 1424 | } else if (font_aspect_x <= 0.80f) { |
| 1425 | grtext_SetFontScale(0.80f); |
| 1426 | } else { |
| 1427 | grtext_SetFontScale(1.0f); |
| 1428 | } |
| 1429 | |
| 1430 | // do framerate calculations |
| 1431 | framerate_timer -= Frametime; |
| 1432 | while (framerate_timer < 0) { |
| 1433 | framerate_timer += FRAMERATE_TIME_DELAY; |
| 1434 | last_fps = GetFPS(); |
| 1435 | } |
| 1436 | |
| 1437 | // show framerate text gauge |
| 1438 | if (stat_mask & STAT_FPS) { |
| 1439 | RenderHUDText(HUD_COLOR, HUD_ALPHA, 0, 10, 10, "FPS: %.1f", last_fps); |
| 1440 | } |
| 1441 | |
| 1442 | // show music spew |
| 1443 | |
| 1444 | #ifdef _DEBUG |
| 1445 | if (Music_debug_verbose) { |
| 1446 | int min, sec; |
| 1447 | RenderHUDText(HUD_COLOR, HUD_ALPHA, 0, 10, 60, "Music: %s", IsD3MusicOn() ? "ON" : "OFF"); |
| 1448 | RenderHUDText(HUD_COLOR, HUD_ALPHA, 0, 10, 72, "Region: %d", D3MusicGetRegion()); |
| 1449 | RenderHUDText(HUD_COLOR, HUD_ALPHA, 0, 10, 84, "Song: %s", Music_type_names[Game_music_info.cur_song]); |
| 1450 | min = (int)(Game_music_info.peace_timer / 60); |
| 1451 | sec = (int)((Game_music_info.peace_timer / 60.0f - (float)min) * 60.0f); |
| 1452 | RenderHUDText(HUD_COLOR, HUD_ALPHA, 0, 10, 96, "Peace time: %d:%.2d", min, sec); |
| 1453 | |
| 1454 | if (Game_music_info.cur_loop_name) { |
| 1455 | RenderHUDText(HUD_COLOR, HUD_ALPHA, 0, 10, 108, "Loop: %s", Game_music_info.cur_loop_name); |
| 1456 | } |
| 1457 | } |
| 1458 | |
| 1459 | // show timer |
| 1460 | if (1) { |
| 1461 | // timer always displayed in debug builds. |
| 1462 | int min, sec, y; |
| 1463 | |
| 1464 | min = (int)(Gametime / 60); |
| 1465 | sec = (int)((Gametime / 60.0f - (float)min) * 60.0f); |
| 1466 |
no test coverage detected