18 #ifndef HEADER_SUPERTUX_SUPERTUX_PHYSIC_HPP 19 #define HEADER_SUPERTUX_SUPERTUX_PHYSIC_HPP 21 #include "math/vector.hpp" 39 void set_velocity_x(
float nvx) { vx = nvx; }
40 void set_velocity_y(
float nvy) { vy = nvy; }
44 void inverse_velocity_y() { vy = -vy; }
46 Vector get_velocity()
const {
return Vector(vx, vy); }
47 float get_velocity_x()
const {
return vx; }
48 float get_velocity_y()
const {
return vy; }
57 void set_acceleration_x(
float nax) { ax = nax; }
58 void set_acceleration_y(
float nay) { ay = nay; }
60 Vector get_acceleration()
const {
return Vector(ax, ay); }
61 float get_acceleration_x()
const {
return ax; }
62 float get_acceleration_y()
const {
return ay; }
66 bool gravity_enabled()
const {
return gravity_enabled_flag; }
71 float get_gravity_modifier()
const {
return gravity_modifier; }
73 Vector get_movement(
float dt_sec);
83 bool gravity_enabled_flag;
86 float gravity_modifier;
Physics engine.
Definition: physic.hpp:27
void set_velocity(float nvx, float nvy)
Sets velocity to a fixed value.
Definition: physic.cpp:38
void enable_gravity(bool enable)
Enables or disables handling of gravity.
Definition: physic.hpp:65
void set_acceleration(float nax, float nay)
Set acceleration.
Definition: physic.cpp:52
void reset()
Resets all velocities and accelerations to 0.
Definition: physic.cpp:31
void set_gravity_modifier(float modifier)
Set gravity modifier factor to apply to object when enabled.
Definition: physic.hpp:69
void inverse_velocity_x()
Velocity inversion.
Definition: physic.hpp:43