LPCGame
A Simple 2d Game Engine
 All Classes Namespaces Functions Variables Enumerations Enumerator Pages
Physics Class Reference

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)
 

Detailed Description

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?

Member Enumeration Documentation

Move enum, at the moment just has one for Stop as Math enum is used for dir.

See Also
Math

Member Function Documentation

void Physics::Load ( Json::Value  val)

Load the object's physical properties from a Json::Value

Parameters
valThe Json::Value containing the properties to load
void Physics::Move ( float  deltaT)

Update the state of the object

Parameters
deltaTThe elapsed time
Json::Value Physics::Save ( ) const

Save the physical properties of the object to a Json::Value

Returns
Json::Value containing the object's physical properties
void Physics::SetDirection ( Vector2f  v)

Set the direction of motion

Parameters
vThe vector direction to move in, will be normalized
void Physics::SetHorizDir ( int  moveDir)

Set the horizontal move direction.

See Also
Math enum
void Physics::SetVertDir ( int  moveDir)

Set the vertical move direction.

See Also
Math enum

The documentation for this class was generated from the following files: