|
LPCGame
A Simple 2d Game Engine
|
Provides physics functions for an object. More...
#include <physics.h>
Public Types | |
| enum | MOVE { STOP = -1 } |
| Move enum, at the moment just has one for Stop as Math enum is used for dir. More... | |
Public Member Functions | |
| void | Move (float deltaT) |
| Vector2f | Position () const |
| Getters. | |
| Vector2f | Velocity () const |
| Vector2f | Acceleration () const |
| Rectf | Box () const |
| int | State () const |
| void | SetPosition (Vector2f pos) |
| Setters. | |
| void | SetVelocity (Vector2f vel) |
| void | SetAcceleration (Vector2f accel) |
| void | SetHorizDir (int moveDir) |
| Set the horizontal move direction. | |
| void | SetVertDir (int moveDir) |
| Set the vertical move direction. | |
| void | SetDirection (Vector2f v) |
| void | SetPhysConstants (PhysicalConstants physConstants) |
| void | SetBox (Rectf box) |
| void | SetMap (CollisionMap map) |
| Json::Value | Save () const |
| void | Load (Json::Value val) |
Provides physics functions for an object.
Handles an objects physics, collision checking, friction motion, etc. Note: A lot of the physics done here should actually be done by the user?
| enum Physics::MOVE |
| void Physics::Load | ( | Json::Value | val | ) |
Load the object's physical properties from a Json::Value
| val | The Json::Value containing the properties to load |
| void Physics::Move | ( | float | deltaT | ) |
Update the state of the object
| deltaT | The elapsed time |
| Json::Value Physics::Save | ( | ) | const |
Save the physical properties of the object to a Json::Value
| void Physics::SetDirection | ( | Vector2f | v | ) |
Set the direction of motion
| v | The vector direction to move in, will be normalized |
| void Physics::SetHorizDir | ( | int | moveDir | ) |
Set the horizontal move direction.
| void Physics::SetVertDir | ( | int | moveDir | ) |
Set the vertical move direction.