diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2013-01-28 05:26:36 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2013-01-28 05:26:36 +0400 |
commit | 3a1ee13278b21176482b98d86709a3bdd489d531 (patch) | |
tree | cc2eedec28b5e8bba5062db0fedf5d07930e5efc /source/gameengine/Ketsji/KX_KetsjiEngine.cpp | |
parent | f64124cb781fee2366f1c5db4f0068420f874556 (diff) |
BGE Profile : visual feedback bars and improvements
You can see a screenshot of the funcionality here:
http://wiki.blender.org/index.php/Doc:2.6/manual/Game_Engine/Performance/Display/Framerate_and_Profile
This patch creates a bar-like graph to quickly allow the game dev to see the performance changes.
Also it changes the font to monospace (too allow ' ' padding) and reduced shadow border to
match the blenderplayer one.
Patch finalized and commited at Global Game Jam Vancouver (last one, time to sleep forever now)
Diffstat (limited to 'source/gameengine/Ketsji/KX_KetsjiEngine.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_KetsjiEngine.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp index 0ddac9c897a..23419f11cd5 100644 --- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp +++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp @@ -1446,7 +1446,7 @@ void KX_KetsjiEngine::RenderDebugProperties() int xcoord = 12; // mmmm, these constants were taken from blender source int ycoord = 17; // to 'mimic' behavior - int profile_indent = 64; + int profile_indent = 72; float tottime = m_logger->GetAverage(); if (tottime < 1e-6f) { @@ -1481,7 +1481,7 @@ void KX_KetsjiEngine::RenderDebugProperties() m_canvas->GetWidth() /* RdV, TODO ?? */, m_canvas->GetHeight() /* RdV, TODO ?? */); - debugtxt.Format("%5.1fms (%5.1f fps)", tottime * 1000.f, 1.0/tottime); + debugtxt.Format("%5.1fms (%.1ffps)", tottime * 1000.f, 1.0/tottime); m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED, debugtxt.ReadPtr(), xcoord + const_xindent + profile_indent, @@ -1504,12 +1504,14 @@ void KX_KetsjiEngine::RenderDebugProperties() double time = m_logger->GetAverage((KX_TimeCategory)j); - debugtxt.Format("%5.2fms (%2d%%)", time*1000.f, (int)(time/tottime * 100.f)); + debugtxt.Format("%5.2fms | %d%%", time*1000.f, (int)(time/tottime * 100.f)); m_rendertools->RenderText2D(RAS_IRenderTools::RAS_TEXT_PADDED, debugtxt.ReadPtr(), xcoord + const_xindent + profile_indent, ycoord, m_canvas->GetWidth(), m_canvas->GetHeight()); + + m_rendertools->RenderBox2D(xcoord + (int)(2.2 * profile_indent), ycoord, m_canvas->GetWidth(), m_canvas->GetHeight(), time/tottime); ycoord += const_ysize; } } |