Rune Engine  Version 0.2.7-alpha
Documentation for how to make games using the Rune Engine.
world.h
1 
9 #pragma once
10 
11 #include <core.h>
12 #include <cmath>
13 #include <vector>
14 #include <Physics\rigidBody.h>
15 #include <Math\vec2.h>
16 #include <math.h>
17 #include <algorithm>
18 #include <DataStructures/list.h>
19 #include <Events/clock.h>
20 
21 namespace physics{
22 
23 class RUNE_ENGINE World
24 {
25 private:
26 
27  rune::List<RigidBody*> physicsBodies;
28 
29  double dT, accumulator, frameStart;
30 
31  rune::Clock variableClock;
32 
33 public:
35  World();
37  void step(void);
39  void updatePhysics(rune::List<physics::RigidBody*>& objects, double dT);
48  void resolveCollisions(rune::List<physics::collision>& currentCollision);
50  void positionalCorrection(physics::RigidBody* object1, physics::RigidBody* object2, double penetration, rune::Vec2 normal);
52  double pythagoreanSolve(double a, double b);
53 
54 
55 };
56 
57 }//namespace physics
58 
rune::List
A list that can be used to store data.
Definition: list.h:45
physics::positionalCorrection
void positionalCorrection(physics::RigidBody *object1, physics::RigidBody *object2, double penetration, rune::Vec2 normal)
Correct the position of the object each frame so that it doesn't look like two objects are overlappin...
Definition: physicsEngine.cpp:376
physics
The physics module responsible for handling and resolving collisions between physics::Collider2D.
Definition: AABB.h:7
physics::RigidBody
Game object component that allows a game object to have collisions with other objects.
Definition: rigidBody.h:95
physics::pythagoreanSolve
double pythagoreanSolve(double a, double b)
Solve for the hypotenuse given the two sides of a triangle.
Definition: physicsEngine.cpp:395
physics::narrowPhaseCollisions
std::vector< physics::collision > narrowPhaseCollisions(std::vector< physics::collision > possibleCollisions)
Narrow phase collision responsible for determining if a possible collision is actually a collision af...
physics::broadPhaseCollisions
std::vector< physics::collision > broadPhaseCollisions(std::vector< physics::RigidBody * > boundingBoxes)
Broad phase collision responsible for determining collisions based off of AABB's only.
physics::World
A physics world that contains all the information needed to run physics.
Definition: world.h:24
physics::resolveCollisions
void resolveCollisions(std::vector< physics::collision > currentCollision)
Resolve the definite collisions in a physically realistic way.
Definition: physicsEngine.cpp:303
physics::updatePhysics
void updatePhysics(std::vector< physics::RigidBody * > objects, double dT)
Function call made by the game scene to have objects get updated.
Definition: physicsEngine.cpp:7
rune::Vec2
1 x 2 vector to be used for math.
Definition: vec2.h:20
rune::Clock
A clock that can be used to tell how much time has passed.
Definition: clock.h:19