diff --git a/src/states_screens/race_result_gui.cpp b/src/states_screens/race_result_gui.cpp index def432fb6..7a2c4fb00 100644 --- a/src/states_screens/race_result_gui.cpp +++ b/src/states_screens/race_result_gui.cpp @@ -269,7 +269,7 @@ void RaceResultGUI::enableAllButtons() right->setVisible(true); operations->select("right", PLAYER_ID_GAME_MASTER); middle->setLabel(_("Save the test results")); - middle->setImage("gui/icons/blue_arrow.png"); + middle->setImage("gui/icons/save.png"); middle->setVisible(true); left->setLabel(_("Back to main menu")); left->setImage("gui/icons/back.png"); @@ -1267,6 +1267,10 @@ void RaceResultGUI::renderGlobal(float dt) { displayCTFResults(); } + else if (RaceManager::get()->isBenchmarking()) + { + displayBenchmarkSummary(); + } else { for (unsigned int i = 0; i < m_all_row_infos.size(); i++) @@ -2282,6 +2286,57 @@ void RaceResultGUI::displayScreenShots() } } // displayScreenShots +//----------------------------------------------------------------------------- +void RaceResultGUI::displayBenchmarkSummary() +{ +#ifndef SERVER_ONLY + assert(RaceManager::get()->isBenchmarking()); + + // Draw the title + static video::SColor white_color = video::SColor(255, 255, 255, 255); + gui::IGUIFont* font = GUIEngine::getTitleFont(); + int current_x = UserConfigParams::m_width / 2; + RowInfo *ri = &(m_all_row_infos[0]); + int current_y = (int)ri->m_y_pos; + + core::stringw title_text = _("Performance Test Results"); + + core::rect pos(current_x, current_y, current_x, current_y); + font->draw(title_text.c_str(), pos, white_color, true, true); + + // Draw the results + core::dimension2du rect = font->getDimension(title_text.c_str()); + current_y += rect.Height; + current_x /= 2; + font = GUIEngine::getFont(); + rect = font->getDimension(title_text.c_str()); + + core::stringw info_text[5]; + core::stringw value = StringUtils::toWString( + StringUtils::timeToString(float(profiler.getTotalFrametime())/1000000.0f, 2, true)); + info_text[0] = _("Test duration: %s", value); + value = StringUtils::toWString(profiler.getTotalFrames()); + info_text[1] = _("Number of frames: %s", value); + value = StringUtils::toWString(profiler.getFPSMetricsLow()); + info_text[2] = _("Steady FPS: %s", value); + value = StringUtils::toWString(profiler.getFPSMetricsMid()); + info_text[3] = _("Mostly Stable FPS: %s", value); // TODO - better name + value = StringUtils::toWString(profiler.getFPSMetricsHigh()); + info_text[4] = _("Typical FPS: %s", value); + + for (int i=0; i<5; i++) + { + pos = core::rect(current_x, current_y, current_x, current_y); + font->draw(info_text[i].c_str(), pos, white_color, true, false); + current_y += (5 * rect.Height) / 4; + } + // TODO : Draw info on the settings + // * resolution + // * Render scale + // * graphics settings +#endif +} // displayBenchmarkSummary + // ---------------------------------------------------------------------------- int RaceResultGUI::getFontHeight() const { diff --git a/src/states_screens/race_result_gui.hpp b/src/states_screens/race_result_gui.hpp index e6e0f5642..54c6248da 100644 --- a/src/states_screens/race_result_gui.hpp +++ b/src/states_screens/race_result_gui.hpp @@ -212,6 +212,7 @@ private: void displayCTFResults(); void displaySoccerResults(); void drawTeamScorers(KartTeam team, int x, int y, int height); + void displayBenchmarkSummary(); void displayScreenShots(); int getFontHeight () const; diff --git a/src/utils/profiler.hpp b/src/utils/profiler.hpp index 5f4ad626a..e5a774673 100644 --- a/src/utils/profiler.hpp +++ b/src/utils/profiler.hpp @@ -329,6 +329,10 @@ public: // ------------------------------------------------------------------------ void setDrawing(bool drawing) { m_drawing = drawing; } - + int getTotalFrametime() { return m_total_frametime; } + int getTotalFrames() { return m_total_frames; } + int getFPSMetricsHigh() { return m_fps_metrics_high; } + int getFPSMetricsMid() { return m_fps_metrics_mid; } + int getFPSMetricsLow() { return m_fps_metrics_low; } }; #endif // PROFILER_HPP