|
@@ -48,6 +48,19 @@ void application::input()
|
|
|
break;
|
|
|
|
|
|
case SDL_KEYDOWN:
|
|
|
+ if (event.key.keysym.sym == SDLK_1)
|
|
|
+ {
|
|
|
+ this->showVelocity ^= true;
|
|
|
+ }
|
|
|
+ if (event.key.keysym.sym == SDLK_2)
|
|
|
+ {
|
|
|
+ this->showForceSum ^= true;
|
|
|
+ }
|
|
|
+ if (event.key.keysym.sym == SDLK_3)
|
|
|
+ {
|
|
|
+ this->showAllForces ^= true;
|
|
|
+ }
|
|
|
+
|
|
|
if (event.key.keysym.sym == SDLK_ESCAPE)
|
|
|
{
|
|
|
this->running = false;
|
|
@@ -195,10 +208,21 @@ void application::render()
|
|
|
graphics::draw::fillCircle(this->particles[1]->position.x, this->particles[1]->position.y,
|
|
|
this->particles[1]->radius, 0xFF00FFFF);
|
|
|
|
|
|
+ if (this->showForceSum || this->showVelocity || this->showAllForces)
|
|
|
+ {
|
|
|
+ for(auto part: this->particles)
|
|
|
+ {
|
|
|
+ part->forceDebug(this->showVelocity, this->showForceSum, this->showAllForces);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
graphics::draw::text(5, 5, 0x11FF22, "Wait time: %02.2f ms", waitTime.get());
|
|
|
graphics::draw::text(5, 17, 0x11FF22, "Update time: %02.2f ms", updateTime.get());
|
|
|
graphics::draw::text(5, 29, 0x11FF22, "Render time: %02.2f ms", renderTime.get());
|
|
|
- graphics::draw::text(5, 41, 0x11FF22, "FPS: %.1f | dT: %.3f", 1000 / (waitTime.get() + updateTime.get() + renderTime.get()), deltaTime);
|
|
|
+ graphics::draw::text(5, 41, 0x11FF22, "FPS: %.1f | dT: %.3f",
|
|
|
+ 1000 / (waitTime.get() + updateTime.get() + renderTime.get()), deltaTime);
|
|
|
+ graphics::draw::text(5, 53, 0x11FF22, "DBG: V:%c S:%c A:%c", this->showVelocity ? 'Y':'N',
|
|
|
+ this->showForceSum ? 'Y':'N', this->showAllForces ? 'Y':'N');
|
|
|
|
|
|
graphics::renderFrame();
|
|
|
|