diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-24 13:58:39 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-07-24 13:58:39 (GMT) |
| commit | 603cf3149df2fc788303207162bf29e05bd29816 (patch) | |
| tree | 1e2f9c7ddf3c01a67bc50426806e598a595a1e40 /src/game/GameView.cpp | |
| parent | e65e222f2ccbf60a4c224bbe29884ebb1001cfd7 (diff) | |
| download | powder-603cf3149df2fc788303207162bf29e05bd29816.zip powder-603cf3149df2fc788303207162bf29e05bd29816.tar.gz | |
HUD improvements
Diffstat (limited to 'src/game/GameView.cpp')
| -rw-r--r-- | src/game/GameView.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp index ac718c3..6b50d31 100644 --- a/src/game/GameView.cpp +++ b/src/game/GameView.cpp @@ -375,7 +375,7 @@ void GameView::NotifyMenuListChanged(GameModel * sender) } } -void GameView::SetSample(Particle sample) +void GameView::SetSample(SimulationSample sample) { this->sample = sample; } @@ -1251,18 +1251,36 @@ void GameView::OnDraw() } } + //Draw info about simulation under cursor std::stringstream sampleInfo; sampleInfo.precision(2); - if(sample.type) - sampleInfo << c->ElementResolve(sample.type) << ", Temp: " << std::fixed << sample.temp -273.15f; + if(sample.particle.type) + sampleInfo << c->ElementResolve(sample.particle.type) << ", Temp: " << std::fixed << sample.particle.temp -273.15f; else sampleInfo << "Empty"; - if(sample.ctype && sample.ctype>0 && sample.ctype<PT_NUM) - sampleInfo << ", Ctype: " << c->ElementResolve(sample.ctype); + sampleInfo << ", Pressure: " << std::fixed << sample.AirPressure; - g->drawtext(XRES+BARSIZE-(10+Graphics::textwidth((char*)sampleInfo.str().c_str())), 10, (const char*)sampleInfo.str().c_str(), 255, 255, 255, 255); + 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); + + //FPS and some version info +#ifndef DEBUG //In debug mode, the Engine will draw FPS and other info instead + std::stringstream fpsInfo; + fpsInfo.precision(2); +#ifdef SNAPSHOT + fpsInfo << "Snapshot " << SNAPSHOT_ID << ". "; +#endif + fpsInfo << "FPS: " << std::fixed << ui::Engine::Ref().GetFps(); +#endif + + textWidth = Graphics::textwidth((char*)fpsInfo.str().c_str()); + g->fillrect(12, 12, textWidth+8, 15, 0, 0, 0, 255*0.5); + g->drawtext(16, 16, (const char*)fpsInfo.str().c_str(), 32, 216, 255, 255*0.75); + + //Tooltips if(infoTipPresence) { int infoTipAlpha = (infoTipPresence>50?50:infoTipPresence)*5; |
