show # of parts, [GRID X], PIPE/PPIP with X, and molten X (with debug on) in HUD

This commit is contained in:
jacob1 2012-10-04 12:35:11 -04:00 committed by Simon Robertshaw
parent 433a80b099
commit d2af4470a5
3 changed files with 28 additions and 6 deletions

View File

@ -1881,12 +1881,23 @@ void GameView::OnDraw()
if(sample.particle.type)
{
if(showDebug)
{
int ctype = sample.particle.ctype;
if (sample.particle.type == PT_PIPE || sample.particle.type == PT_PPIP)
ctype = sample.particle.tmp;
if (sample.particle.type == PT_LAVA && ctype > 0 && ctype < PT_NUM)
sampleInfo << "Molten " << c->ElementResolve(ctype);
else if((sample.particle.type == PT_PIPE || sample.particle.type == PT_PPIP) && ctype > 0 && ctype < PT_NUM)
sampleInfo << c->ElementResolve(sample.particle.type) << " with " << c->ElementResolve(ctype);
else
{
sampleInfo << c->ElementResolve(sample.particle.type);
if(sample.particle.ctype > 0 && sample.particle.ctype < PT_NUM)
sampleInfo << " (" << c->ElementResolve(sample.particle.ctype) << ")";
if(ctype > 0 && ctype < PT_NUM)
sampleInfo << " (" << c->ElementResolve(ctype) << ")";
else
sampleInfo << " ()";
}
sampleInfo << ", Temp: " << std::fixed << sample.particle.temp -273.15f;
sampleInfo << ", Life: " << sample.particle.life;
sampleInfo << ", Tmp: " << sample.particle.tmp;
@ -1896,6 +1907,8 @@ void GameView::OnDraw()
{
if (sample.particle.type == PT_LAVA && sample.particle.ctype > 0 && sample.particle.ctype < PT_NUM)
sampleInfo << "Molten " << c->ElementResolve(sample.particle.ctype);
else if((sample.particle.type == PT_PIPE || sample.particle.type == PT_PPIP) && sample.particle.tmp > 0 && sample.particle.tmp < PT_NUM)
sampleInfo << c->ElementResolve(sample.particle.type) << " with " << c->ElementResolve(sample.particle.tmp);
else
sampleInfo << c->ElementResolve(sample.particle.type);
sampleInfo << ", Temp: " << std::fixed << sample.particle.temp -273.15f;
@ -1984,6 +1997,11 @@ void GameView::OnDraw()
#endif
fpsInfo << "FPS: " << std::fixed << ui::Engine::Ref().GetFps();
if (showDebug)
fpsInfo << " Parts: " << sample.NumParts;
if (ren->GetGridSize())
fpsInfo << " [GRID: " << ren->GetGridSize() << "]";
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);

View File

@ -21,7 +21,9 @@ public:
float GravityVelocityX;
float GravityVelocityY;
SimulationSample() : PositionX(0), PositionY(0), ParticleID(0), particle(), AirPressure(0), AirVelocityX(0), AirVelocityY(0), WallType(0), Gravity(0), GravityVelocityX(0), GravityVelocityY(0), AirTemperature(0) {}
int NumParts;
SimulationSample() : PositionX(0), PositionY(0), ParticleID(0), particle(), AirPressure(0), AirVelocityX(0), AirVelocityY(0), WallType(0), Gravity(0), GravityVelocityX(0), GravityVelocityY(0), AirTemperature(0), NumParts(0) {}
};
#endif

View File

@ -439,6 +439,8 @@ SimulationSample Simulation::Get(int x, int y)
sample.GravityVelocityX = gravx[(y/CELL)*(XRES/CELL)+(x/CELL)];
sample.GravityVelocityY = gravy[(y/CELL)*(XRES/CELL)+(x/CELL)];
}
sample.NumParts = NUM_PARTS;
return sample;
}