HUD toggle, addresses "h should toggle the HUD" in issue #23
This commit is contained in:
parent
f8a6d2ea1f
commit
418373a3cd
@ -39,7 +39,8 @@ GameView::GameView():
|
|||||||
infoTipPresence(0),
|
infoTipPresence(0),
|
||||||
toolTipPosition(-1, -1),
|
toolTipPosition(-1, -1),
|
||||||
shiftBehaviour(false),
|
shiftBehaviour(false),
|
||||||
ctrlBehaviour(false)
|
ctrlBehaviour(false),
|
||||||
|
showHud(true)
|
||||||
{
|
{
|
||||||
|
|
||||||
int currentX = 1;
|
int currentX = 1;
|
||||||
@ -943,6 +944,9 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
case 'f':
|
case 'f':
|
||||||
c->FrameStep();
|
c->FrameStep();
|
||||||
break;
|
break;
|
||||||
|
case 'h':
|
||||||
|
showHud = !showHud;
|
||||||
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
if(ctrl)
|
if(ctrl)
|
||||||
c->SetDecoration();
|
c->SetDecoration();
|
||||||
@ -1390,34 +1394,37 @@ void GameView::OnDraw()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Draw info about simulation under cursor
|
if(showHud)
|
||||||
std::stringstream sampleInfo;
|
{
|
||||||
sampleInfo.precision(2);
|
//Draw info about simulation under cursor
|
||||||
if(sample.particle.type)
|
std::stringstream sampleInfo;
|
||||||
sampleInfo << c->ElementResolve(sample.particle.type) << ", Temp: " << std::fixed << sample.particle.temp -273.15f;
|
sampleInfo.precision(2);
|
||||||
else
|
if(sample.particle.type)
|
||||||
sampleInfo << "Empty";
|
sampleInfo << c->ElementResolve(sample.particle.type) << ", Temp: " << std::fixed << sample.particle.temp -273.15f;
|
||||||
|
else
|
||||||
|
sampleInfo << "Empty";
|
||||||
|
|
||||||
sampleInfo << ", Pressure: " << std::fixed << sample.AirPressure;
|
sampleInfo << ", Pressure: " << std::fixed << sample.AirPressure;
|
||||||
|
|
||||||
int textWidth = Graphics::textwidth((char*)sampleInfo.str().c_str());
|
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->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);
|
g->drawtext(XRES-16-textWidth, 16, (const char*)sampleInfo.str().c_str(), 255, 255, 255, 255*0.75);
|
||||||
|
|
||||||
|
|
||||||
//FPS and some version info
|
//FPS and some version info
|
||||||
#ifndef DEBUG //In debug mode, the Engine will draw FPS and other info instead
|
#ifndef DEBUG //In debug mode, the Engine will draw FPS and other info instead
|
||||||
std::stringstream fpsInfo;
|
std::stringstream fpsInfo;
|
||||||
fpsInfo.precision(2);
|
fpsInfo.precision(2);
|
||||||
#ifdef SNAPSHOT
|
#ifdef SNAPSHOT
|
||||||
fpsInfo << "Snapshot " << SNAPSHOT_ID << ". ";
|
fpsInfo << "Snapshot " << SNAPSHOT_ID << ". ";
|
||||||
#endif
|
#endif
|
||||||
fpsInfo << "FPS: " << std::fixed << ui::Engine::Ref().GetFps();
|
fpsInfo << "FPS: " << std::fixed << ui::Engine::Ref().GetFps();
|
||||||
|
|
||||||
textWidth = Graphics::textwidth((char*)fpsInfo.str().c_str());
|
textWidth = Graphics::textwidth((char*)fpsInfo.str().c_str());
|
||||||
g->fillrect(12, 12, textWidth+8, 15, 0, 0, 0, 255*0.5);
|
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);
|
g->drawtext(16, 16, (const char*)fpsInfo.str().c_str(), 32, 216, 255, 255*0.75);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//Tooltips
|
//Tooltips
|
||||||
if(infoTipPresence)
|
if(infoTipPresence)
|
||||||
|
@ -40,6 +40,7 @@ private:
|
|||||||
bool drawSnap;
|
bool drawSnap;
|
||||||
bool shiftBehaviour;
|
bool shiftBehaviour;
|
||||||
bool ctrlBehaviour;
|
bool ctrlBehaviour;
|
||||||
|
bool showHud;
|
||||||
int toolIndex;
|
int toolIndex;
|
||||||
|
|
||||||
int infoTipPresence;
|
int infoTipPresence;
|
||||||
|
Loading…
Reference in New Issue
Block a user