YAPOG  0.0.1
Yet Another Pokemon Online Game
yap::PhysicsCore Class Reference

Component on which forces can be applied that generates a resulting move. More...

#include <PhysicsCore.hpp>

Inheritance diagram for yap::PhysicsCore:
Collaboration diagram for yap::PhysicsCore:

List of all members.

Public Member Functions

virtual ~PhysicsCore ()
void ApplyForce (const Vector2 &force)
 Applies a force on the core.
void ResetForces ()
const Vector2GetMove () const
 Gets the resulting move of this PhysicsCore from the applied forces on it.
void SetVelocityBounds (const Vector2 &min, const Vector2 &max)
 Stores min and max bounds for the velocity of this PhysicsCore.
void RawSetVelocity (const Vector2 &velocity)
 Forces the value of velocity for this PhysicsCore. To use to synchronize velocity from server to client.
IUpdateable members.
virtual void Update (const Time &dt)
 Makes the object evolve for one frame of the game.
ICloneable members.
virtual PhysicsCoreClone () const
- Public Member Functions inherited from yap::IUpdateable
virtual ~IUpdateable ()
- Public Member Functions inherited from yap::ICloneable
virtual ~ICloneable ()

Public Attributes

Events.
Event< const PhysicsCore
&, const EmptyEventArgs & > 
OnStopped
Event< const PhysicsCore
&, const EmptyEventArgs & > 
OnMoved
Event< const PhysicsCore
&, const ChangeEventArgs
< const Vector2 & > & > 
OnVelocityChanged

Protected Member Functions

 PhysicsCore ()
 PhysicsCore (const PhysicsCore &copy)
const Vector2GetVelocity () const
void SetVelocity (const Vector2 &velocity)
void ResetVelocity (const Vector2 &velocity)
 Reset velocity value with velocity. To use in ResetVelocity (const Time&). Does not call OnVelocityChanged event.

Private Member Functions

 DISALLOW_ASSIGN (PhysicsCore)
void BoundVelocity (const Vector2 &velocity, Vector2 &result)
virtual void HandleApplyForce (const Vector2 &force)=0
virtual void ResetVelocity (const Time &dt)=0

Private Attributes

Vector2 velocity_
Vector2 lastVelocity_
Vector2 minVelocity_
Vector2 maxVelocity_
Vector2 move_

Static Private Attributes

static const Vector2 DEFAULT_MIN_VELOCITY_BOUNDS
static const Vector2 DEFAULT_MAX_VELOCITY_BOUNDS

Detailed Description

Component on which forces can be applied that generates a resulting move.

Definition at line 14 of file PhysicsCore.hpp.


Constructor & Destructor Documentation

yap::PhysicsCore::~PhysicsCore ( )
virtual

Definition at line 25 of file PhysicsCore.cpp.

yap::PhysicsCore::PhysicsCore ( )
protected

Definition at line 13 of file PhysicsCore.cpp.

yap::PhysicsCore::PhysicsCore ( const PhysicsCore copy)
protected

Definition at line 29 of file PhysicsCore.cpp.


Member Function Documentation

void yap::PhysicsCore::ApplyForce ( const Vector2 force)

Applies a force on the core.

Parameters:
forceForce to apply on the core.

Definition at line 41 of file PhysicsCore.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void yap::PhysicsCore::BoundVelocity ( const Vector2 velocity,
Vector2 result 
)
private

Definition at line 129 of file PhysicsCore.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual PhysicsCore* yap::PhysicsCore::Clone ( ) const
inlinevirtual

Implements yap::ICloneable.

Reimplemented in yap::BasicPhysicsCore, yap::ForceToVelocityPhysicsCore, and yap::PersistentPhysicsCore.

Definition at line 51 of file PhysicsCore.hpp.

Here is the caller graph for this function:

yap::PhysicsCore::DISALLOW_ASSIGN ( PhysicsCore  )
private
const Vector2 & yap::PhysicsCore::GetMove ( ) const

Gets the resulting move of this PhysicsCore from the applied forces on it.

Returns:
The resulting move of this PhysicsCore.

Definition at line 54 of file PhysicsCore.cpp.

Here is the caller graph for this function:

const Vector2 & yap::PhysicsCore::GetVelocity ( ) const
protected

Definition at line 91 of file PhysicsCore.cpp.

Here is the caller graph for this function:

virtual void yap::PhysicsCore::HandleApplyForce ( const Vector2 force)
privatepure virtual

Implemented in yap::BasicPhysicsCore, yap::ForceToVelocityPhysicsCore, and yap::PersistentPhysicsCore.

Here is the caller graph for this function:

void yap::PhysicsCore::RawSetVelocity ( const Vector2 velocity)

Forces the value of velocity for this PhysicsCore. To use to synchronize velocity from server to client.

Definition at line 86 of file PhysicsCore.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void yap::PhysicsCore::ResetForces ( )

Definition at line 46 of file PhysicsCore.cpp.

Here is the caller graph for this function:

void yap::PhysicsCore::ResetVelocity ( const Vector2 velocity)
protected

Reset velocity value with velocity. To use in ResetVelocity (const Time&). Does not call OnVelocityChanged event.

Parameters:
velocityValue to change current velocity with.

Definition at line 122 of file PhysicsCore.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void yap::PhysicsCore::ResetVelocity ( const Time dt)
privatepure virtual
void yap::PhysicsCore::SetVelocity ( const Vector2 velocity)
protected

Definition at line 96 of file PhysicsCore.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void yap::PhysicsCore::SetVelocityBounds ( const Vector2 min,
const Vector2 max 
)

Stores min and max bounds for the velocity of this PhysicsCore.

Parameters:
minMin velocity that this PhysicsCore must have.
maxMax velocity that this PhysicsCore must have.

Definition at line 76 of file PhysicsCore.cpp.

Here is the caller graph for this function:

void yap::PhysicsCore::Update ( const Time dt)
virtual

Makes the object evolve for one frame of the game.

Parameters:
dtDelta time since the last frame.

Implements yap::IUpdateable.

Definition at line 59 of file PhysicsCore.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

const Vector2 yap::PhysicsCore::DEFAULT_MAX_VELOCITY_BOUNDS
staticprivate
Initial value:
Vector2 (150.0f, 150.0f)

Definition at line 85 of file PhysicsCore.hpp.

const Vector2 yap::PhysicsCore::DEFAULT_MIN_VELOCITY_BOUNDS
staticprivate
Initial value:
Vector2 (0.0f, 0.0f)

Definition at line 84 of file PhysicsCore.hpp.

Vector2 yap::PhysicsCore::lastVelocity_
private

Definition at line 89 of file PhysicsCore.hpp.

Vector2 yap::PhysicsCore::maxVelocity_
private

Definition at line 91 of file PhysicsCore.hpp.

Vector2 yap::PhysicsCore::minVelocity_
private

Definition at line 90 of file PhysicsCore.hpp.

Vector2 yap::PhysicsCore::move_
private

Definition at line 93 of file PhysicsCore.hpp.

Event<const PhysicsCore&, const EmptyEventArgs&> yap::PhysicsCore::OnMoved

Definition at line 57 of file PhysicsCore.hpp.

Event<const PhysicsCore&, const EmptyEventArgs&> yap::PhysicsCore::OnStopped

Definition at line 56 of file PhysicsCore.hpp.

Event<const PhysicsCore&, const ChangeEventArgs<const Vector2&>&> yap::PhysicsCore::OnVelocityChanged

Definition at line 59 of file PhysicsCore.hpp.

Vector2 yap::PhysicsCore::velocity_
private

Definition at line 87 of file PhysicsCore.hpp.


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