Physics2D.hpp

Physics2D - handles movement and collissions in a simple 2D world.

template<typename BODY_TYPE>
class Physics2D
#include <Physics2D.hpp>

Public Functions

inline Physics2D(double width, double height, double max_org_diameter = 20, bool detach = true)
inline ~Physics2D()
inline const Surface_t &GetSurface() const
inline const Surface_t &GetBackground() const
inline bool GetDetach() const
inline Physics2D &SetDetach(bool _in)
inline Physics2D &AddBody(Ptr<BODY_TYPE> in_body)
inline Physics2D &AddBackground(Ptr<BODY_TYPE> in_body)
inline Physics2D &Clear()
inline Physics2D &KillOldest()
inline bool TestPairCollision(BODY_TYPE &body1, BODY_TYPE &body2)
inline void Update()
inline vector<Ptr<BODY_TYPE>> &GetBodySet()
inline vector<Ptr<BODY_TYPE>> &GetBackgroundSet()
inline const vector<Ptr<BODY_TYPE>> &GetConstBodySet() const
inline const vector<Ptr<BODY_TYPE>> &GetConstBackgroundSet() const

Private Types

using Surface_t = Surface2D<BODY_TYPE>

Private Members

Surface_t surface
Surface_t background
bool detach_on_birth