diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-09 20:28:43 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-09 20:28:43 (GMT) |
| commit | b01b0e422a7486a4d1063b54a3c9713e2c1456c4 (patch) | |
| tree | 25b30ca04673b1b7e54190c918388bce6d5e149b /src/game/GameView.cpp | |
| parent | 9971ea63b7aca6f23dfdee9ceb5d7cb3dcd1fa58 (diff) | |
| download | powder-b01b0e422a7486a4d1063b54a3c9713e2c1456c4.zip powder-b01b0e422a7486a4d1063b54a3c9713e2c1456c4.tar.gz | |
HUD verbose sample info with 'd', fixes #71
Diffstat (limited to 'src/game/GameView.cpp')
| -rw-r--r-- | src/game/GameView.cpp | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp index 65c0ddd..9b1010d 100644 --- a/src/game/GameView.cpp +++ b/src/game/GameView.cpp @@ -172,6 +172,7 @@ GameView::GameView(): shiftBehaviour(false), ctrlBehaviour(false), showHud(true), + showDebug(false), introText(2048), introTextMessage(introTextData) { @@ -1182,6 +1183,9 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool case 'f': c->FrameStep(); break; + case 'd': + showDebug = !showDebug; + break; case KEY_F1: if(!introText) introText = 8047; @@ -1705,16 +1709,49 @@ void GameView::OnDraw() std::stringstream sampleInfo; sampleInfo.precision(2); if(sample.particle.type) - sampleInfo << c->ElementResolve(sample.particle.type) << ", Temp: " << std::fixed << sample.particle.temp -273.15f; + { + if(showDebug) + { + sampleInfo << c->ElementResolve(sample.particle.type); + if(sample.particle.ctype > 0 && sample.particle.ctype < PT_NUM) + { + sampleInfo << " (" << c->ElementResolve(sample.particle.ctype) << ")"; + } + sampleInfo << ", Pressure: " << std::fixed << sample.AirPressure; + sampleInfo << ", Temp: " << std::fixed << sample.particle.temp -273.15f; + sampleInfo << ", Life: " << sample.particle.life; + sampleInfo << ", Temp: " << sample.particle.tmp; + } + else + { + sampleInfo << c->ElementResolve(sample.particle.type) << ", Pressure: " << std::fixed << sample.AirPressure; + sampleInfo << ", Temp: " << std::fixed << sample.particle.temp -273.15f; + } + } else - sampleInfo << "Empty"; - - sampleInfo << ", Pressure: " << std::fixed << sample.AirPressure; + { + sampleInfo << "Empty, Pressure: " << std::fixed << sample.AirPressure; + } int textWidth = Graphics::textwidth((char*)sampleInfo.str().c_str()); g->fillrect(XRES-20-textWidth, 12, textWidth+8, 15, 0, 0, 0, 255*0.5); g->drawtext(XRES-16-textWidth, 16, (const char*)sampleInfo.str().c_str(), 255, 255, 255, 255*0.75); + if(showDebug) + { + sampleInfo.str(std::string()); + + if(sample.particle.type) + { + sampleInfo << "#" << sample.ParticleID << ", "; + } + sampleInfo << "X:" << sample.PositionX << " Y:" << sample.PositionY; + + textWidth = Graphics::textwidth((char*)sampleInfo.str().c_str()); + g->fillrect(XRES-20-textWidth, 26, textWidth+8, 15, 0, 0, 0, 255*0.5); + g->drawtext(XRES-16-textWidth, 30, (const char*)sampleInfo.str().c_str(), 255, 255, 255, 255*0.75); + } + //FPS and some version info #ifndef DEBUG //In debug mode, the Engine will draw FPS and other info instead |
