YAPOG
0.0.1
Yet Another Pokemon Online Game
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
PhysicsCore.hpp
Go to the documentation of this file.
1
#ifndef YAPOG_PHYSICSCORE_HPP
2
# define YAPOG_PHYSICSCORE_HPP
3
4
# include "
YAPOG/Macros.hpp
"
5
# include "
YAPOG/Game/IUpdateable.hpp
"
6
# include "
YAPOG/Game/Factory/ICloneable.hpp
"
7
# include "
YAPOG/Graphics/Vector2.hpp
"
8
# include "
YAPOG/System/Event/Event.hpp
"
9
10
namespace
yap
11
{
14
class
YAPOG_LIB
PhysicsCore
:
public
IUpdateable
15
,
public
ICloneable
16
{
17
DISALLOW_ASSIGN
(
PhysicsCore
);
18
19
public
:
20
21
virtual
~
PhysicsCore
();
22
25
void
ApplyForce (
const
Vector2
& force);
26
27
void
ResetForces ();
28
32
const
Vector2
& GetMove ()
const
;
33
38
void
SetVelocityBounds (
const
Vector2
& min,
const
Vector2
& max);
39
42
void
RawSetVelocity (
const
Vector2
& velocity);
43
46
virtual
void
Update (
const
Time
& dt);
48
51
virtual
PhysicsCore
*
Clone
()
const
{
return
nullptr
; }
53
56
Event<const PhysicsCore&, const EmptyEventArgs&>
OnStopped
;
57
Event<const PhysicsCore&, const EmptyEventArgs&>
OnMoved
;
58
Event
<
const
PhysicsCore
&,
59
const
ChangeEventArgs<const Vector2&>
&>
OnVelocityChanged
;
61
62
protected
:
63
64
PhysicsCore
();
65
66
PhysicsCore
(
const
PhysicsCore
& copy);
67
68
const
Vector2
& GetVelocity ()
const
;
69
void
SetVelocity (
const
Vector2
& velocity);
70
75
void
ResetVelocity (
const
Vector2
& velocity);
76
77
private
:
78
79
void
BoundVelocity (
const
Vector2
& velocity,
Vector2
& result);
80
81
virtual
void
HandleApplyForce (
const
Vector2
& force) = 0;
82
virtual
void
ResetVelocity (
const
Time
& dt) = 0;
83
84
static
const
Vector2
DEFAULT_MIN_VELOCITY_BOUNDS
;
85
static
const
Vector2
DEFAULT_MAX_VELOCITY_BOUNDS
;
86
87
Vector2
velocity_
;
88
89
Vector2
lastVelocity_
;
90
Vector2
minVelocity_
;
91
Vector2
maxVelocity_
;
92
93
Vector2
move_
;
94
};
95
}
// namespace yap
96
97
#endif // YAPOG_PHYSICSCORE_HPP
YAPOG
include
YAPOG
Game
World
Map
Physics
PhysicsCore.hpp
Generated on Mon Sep 17 2012 22:24:23 for YAPOG by
1.8.1.1