|
@@ -68,11 +68,25 @@ void application::update()
|
|
|
}
|
|
|
this->millisecsPreviousFrame = SDL_GetTicks();
|
|
|
|
|
|
- this->part->acceleration = vec2(0.0, 9.8 * PIXELS_PER_METER);
|
|
|
+ this->part->acceleration = vec2(2.0 * PIXELS_PER_METER, 9.8 * PIXELS_PER_METER);
|
|
|
|
|
|
// Integrate the change
|
|
|
this->part->velocity += (this->part->acceleration * deltaTime);
|
|
|
this->part->position += (this->part->velocity * deltaTime);
|
|
|
+
|
|
|
+ // check the particles position and keep the particule in the window.
|
|
|
+ if ( ((this->part->position.y - this->part->radius) <= 0) ||
|
|
|
+ ((this->part->position.y + this->part->radius) >= graphics::height()))
|
|
|
+ {
|
|
|
+ this->part->velocity.y = -this->part->velocity.y;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ( ((this->part->position.x - this->part->radius) <= 0) ||
|
|
|
+ ((this->part->position.x + this->part->radius) >= graphics::width()))
|
|
|
+ {
|
|
|
+ this->part->velocity.x = -this->part->velocity.x;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
void application::render()
|