diff options
author | Paramat <paramat@users.noreply.github.com> | 2017-07-16 11:33:09 +0100 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-07-16 12:33:09 +0200 |
commit | d4cc49e9a72cb5cce7dce80ccc0196aedd106acd (patch) | |
tree | 992fc84dc18df04a69c7176cd0381d0aec53b5e3 /src | |
parent | 7ddf67aa1478813e12a5fcdfb4986b9e5adfe62f (diff) | |
download | minetest-d4cc49e9a72cb5cce7dce80ccc0196aedd106acd.tar.gz minetest-d4cc49e9a72cb5cce7dce80ccc0196aedd106acd.tar.bz2 minetest-d4cc49e9a72cb5cce7dce80ccc0196aedd106acd.zip |
F5 debug display: Reformat and remove some information (#6125)
For consistency return to 'FPS =', add comma before FPS.
Remove 'R' from 'range_all' as may be re-keymapped.
Remove inconsistent brackets from 'range_all'.
Change 'v_range' to 'view_range'.
Add 'pos = ' before co-ordinates.
Add spaces around '=' in yaw display.
Remove brackets from around 'yaw' and 'seed'.
Move 'pointing_at' to 3rd line.
Remove 'param1' (0 for all solid nodes and unreadable for light sources due to
light bank encoding).
Remove file name of pointed node top tile (this also removes the need to get
ContentFeatures for the node, slightly improving performance).
Replace quotes around node data with brackets, looks better and more consistent.
Add 'guitext3' for third line.
Use 'setVisible' for all 3 lines to control the setting of each text rectangle.
Improve logic of 3rd line to only run code it needs to depending on whether
pointing data is avaialble and whether node is not 'ignore' and not 'unknown'.
Diffstat (limited to 'src')
-rw-r--r-- | src/game.cpp | 67 |
1 files changed, 43 insertions, 24 deletions
diff --git a/src/game.cpp b/src/game.cpp index 639cc29c3..f0c11cb98 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1428,6 +1428,7 @@ private: */ gui::IGUIStaticText *guitext; // First line of debug text gui::IGUIStaticText *guitext2; // Second line of debug text + gui::IGUIStaticText *guitext3; // Third line of debug text gui::IGUIStaticText *guitext_info; // At the middle of the screen gui::IGUIStaticText *guitext_status; gui::IGUIStaticText *guitext_chat; // Chat text @@ -2000,6 +2001,12 @@ bool Game::initGui() core::rect<s32>(0, 0, 0, 0), false, false, guiroot); + // Third line of debug text + guitext3 = addStaticText(guienv, + L"", + core::rect<s32>(0, 0, 0, 0), + false, false, guiroot); + // At the middle of the screen // Object infos are shown in this guitext_info = addStaticText(guienv, @@ -4307,21 +4314,20 @@ void Game::updateGui(const RunStats &stats, f32 dtime, const CameraOrientation & if (flags.show_debug) { static float drawtime_avg = 0; drawtime_avg = drawtime_avg * 0.95 + stats.drawtime * 0.05; - u16 fps = 1.0 / stats.dtime_jitter.avg; std::ostringstream os(std::ios_base::binary); os << std::fixed << PROJECT_NAME_C " " << g_version_hash - << "; " << fps << " FPS" - << ", (R: range_all=" << draw_control->range_all << ")" + << ", FPS = " << fps + << ", range_all = " << draw_control->range_all << std::setprecision(0) << ", drawtime = " << drawtime_avg << " ms" << std::setprecision(1) << ", dtime_jitter = " << (stats.dtime_jitter.max_fraction * 100.0) << " %" << std::setprecision(1) - << ", v_range = " << draw_control->wanted_range + << ", view_range = " << draw_control->wanted_range << std::setprecision(3) << ", RTT = " << client->getRTT() << " s"; setStaticText(guitext, utf8_to_wide(os.str()).c_str()); @@ -4341,38 +4347,51 @@ void Game::updateGui(const RunStats &stats, f32 dtime, const CameraOrientation & if (flags.show_debug) { std::ostringstream os(std::ios_base::binary); os << std::setprecision(1) << std::fixed - << "(" << (player_position.X / BS) + << "pos = (" << (player_position.X / BS) << ", " << (player_position.Y / BS) << ", " << (player_position.Z / BS) - << ") (yaw=" << (wrapDegrees_0_360(cam.camera_yaw)) << "°" + << "), yaw = " << (wrapDegrees_0_360(cam.camera_yaw)) << "°" << " " << yawToDirectionString(cam.camera_yaw) - << ") (seed = " << ((u64)client->getMapSeed()) - << ")"; - - if (runData.pointed_old.type == POINTEDTHING_NODE) { - ClientMap &map = client->getEnv().getClientMap(); - const INodeDefManager *nodedef = client->getNodeDefManager(); - MapNode n = map.getNodeNoEx(runData.pointed_old.node_undersurface); - if (n.getContent() != CONTENT_IGNORE && nodedef->get(n).name != "unknown") { - const ContentFeatures &features = nodedef->get(n); - os << " (pointing_at = \"" << nodedef->get(n).name - << "\", param1 = " << (u64) n.getParam1() - << ", param2 = " << (u64) n.getParam2() - << ", tiledef[0] = \"" << features.tiledef[0].name.c_str() - << "\")"; - } - } - + << ", seed = " << ((u64)client->getMapSeed()); setStaticText(guitext2, utf8_to_wide(os.str()).c_str()); guitext2->setVisible(true); + } else { + guitext2->setVisible(false); + } + if (guitext2->isVisible()) { core::rect<s32> rect( 5, 5 + g_fontengine->getTextHeight(), screensize.X, 5 + g_fontengine->getTextHeight() * 2 ); guitext2->setRelativePosition(rect); + } + + if (flags.show_debug && runData.pointed_old.type == POINTEDTHING_NODE) { + ClientMap &map = client->getEnv().getClientMap(); + const INodeDefManager *nodedef = client->getNodeDefManager(); + MapNode n = map.getNodeNoEx(runData.pointed_old.node_undersurface); + + if (n.getContent() != CONTENT_IGNORE && nodedef->get(n).name != "unknown") { + std::ostringstream os(std::ios_base::binary); + os << "pointing_at = (" << nodedef->get(n).name + << ", param2 = " << (u64) n.getParam2() + << ")"; + setStaticText(guitext3, utf8_to_wide(os.str()).c_str()); + guitext3->setVisible(true); + } else { + guitext3->setVisible(false); + } } else { - guitext2->setVisible(false); + guitext3->setVisible(false); + } + + if (guitext3->isVisible()) { + core::rect<s32> rect( + 5, 5 + g_fontengine->getTextHeight() * 2, + screensize.X, 5 + g_fontengine->getTextHeight() * 3 + ); + guitext3->setRelativePosition(rect); } setStaticText(guitext_info, infotext.c_str()); |