HUD verbose sample info with 'd', fixes #71
This commit is contained in:
parent
9971ea63b7
commit
b01b0e422a
@ -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
|
||||
|
@ -42,6 +42,7 @@ private:
|
||||
bool ctrlBehaviour;
|
||||
bool altBehaviour;
|
||||
bool showHud;
|
||||
bool showDebug;
|
||||
int introText;
|
||||
std::string introTextMessage;
|
||||
int toolIndex;
|
||||
|
@ -9,6 +9,8 @@ class SimulationSample
|
||||
{
|
||||
public:
|
||||
Particle particle;
|
||||
int ParticleID;
|
||||
int PositionX, PositionY;
|
||||
float AirPressure;
|
||||
float AirTemperature;
|
||||
float AirVelocityX;
|
||||
@ -19,7 +21,7 @@ public:
|
||||
float GravityVelocityX;
|
||||
float GravityVelocityY;
|
||||
|
||||
SimulationSample() : particle(), AirPressure(0), AirVelocityX(0), AirVelocityY(0), WallType(0), Gravity(0), GravityVelocityX(0), GravityVelocityY(0), AirTemperature(0) {}
|
||||
SimulationSample() : PositionX(0), PositionY(0), ParticleID(0), particle(), AirPressure(0), AirVelocityX(0), AirVelocityY(0), WallType(0), Gravity(0), GravityVelocityX(0), GravityVelocityY(0), AirTemperature(0) {}
|
||||
};
|
||||
|
||||
#endif
|
@ -351,10 +351,18 @@ int Simulation::flood_prop(int x, int y, size_t propoffset, void * propvalue, St
|
||||
SimulationSample Simulation::Get(int x, int y)
|
||||
{
|
||||
SimulationSample sample;
|
||||
sample.PositionX = x;
|
||||
sample.PositionY = y;
|
||||
if(pmap[y][x])
|
||||
{
|
||||
sample.particle = parts[pmap[y][x]>>8];
|
||||
if(photons[y][x])
|
||||
sample.ParticleID = pmap[y][x]>>8;
|
||||
}
|
||||
else if(photons[y][x])
|
||||
{
|
||||
sample.particle = parts[photons[y][x]>>8];
|
||||
sample.ParticleID = photons[y][x]>>8;
|
||||
}
|
||||
sample.AirPressure = pv[y/CELL][x/CELL];
|
||||
sample.AirTemperature = hv[y/CELL][x/CELL];
|
||||
sample.AirVelocityX = vx[y/CELL][x/CELL];
|
||||
|
Reference in New Issue
Block a user