2D_Game_Engine
Loading...
Searching...
No Matches
Classes | Typedefs | Functions | Variables
entity.hpp File Reference
#include <structs.hpp>
#include <texture.hpp>
#include <window.hpp>
#include <textrenderer.hpp>

Go to the source code of this file.

Classes

class  TagComponent
 
class  TextureComponent
 
class  AnimatedTextureComponent
 
class  RigidbodyComponent
 
class  BoxColliderComponent
 
class  CircleColliderComponent
 
class  LightComponent
 
class  NativeScriptComponent
 
class  TextComponent
 
class  Entity
 
class  ComponentManager< T, >
 

Typedefs

template<typename T >
using ComponentType
 

Functions

template<typename T , ComponentType< T > = 0>
int BinarySearch (std::vector< T > &v, uint32_t uid)
 
template<typename T , ComponentType< T > = 0>
int FirstGreaterThan (std::vector< T > &v, uint32_t uid)
 
template<typename T , ComponentType< T > = 0>
void RightShift (std::vector< T > &v, size_t idx)
 
float Interpolate (float current, float previous)
 
std::ostream & operator<< (std::ostream &os, const RigidbodyComponent::BodyType &type)
 
EntityBinarySearch (std::vector< Entity > &v, uint32_t uid)
 
b2BodyType RigidbodyTypeToBox2DBody (RigidbodyComponent::BodyType bodyType)
 
RigidbodyComponent::BodyType RigidbodyTypeFromBox2DBody (b2BodyType bodyType)
 

Variables

uint32_t NEXT_UID
 

Typedef Documentation

◆ ComponentType

template<typename T >
using ComponentType
Initial value:
typename std::enable_if<
std::is_same<T,TagComponent>::value ||
std::is_same<T,TextureComponent>::value ||
std::is_same<T,AnimatedTextureComponent>::value ||
std::is_same<T,RigidbodyComponent>::value ||
std::is_same<T,BoxColliderComponent>::value ||
std::is_same<T,CircleColliderComponent>::value ||
std::is_same<T,LightComponent>::value ||
std::is_same<T,NativeScriptComponent>::value ||
std::is_same<T,TextComponent>::value,
int>::type

Definition at line 23 of file entity.hpp.

Function Documentation

◆ BinarySearch() [1/2]

Entity * BinarySearch ( std::vector< Entity > & v,
uint32_t uid )
inline

Search for the entity with the given uid.

Returns
a pointer to the entity with the given uid, or nullptr if not found

Definition at line 341 of file entity.hpp.

◆ BinarySearch() [2/2]

template<typename T , ComponentType< T > = 0>
int BinarySearch ( std::vector< T > & v,
uint32_t uid )
inline

Search for the component with the given uid.

Returns
the index of the component with the given uid, or -1 if not found

Definition at line 40 of file entity.hpp.

◆ FirstGreaterThan()

template<typename T , ComponentType< T > = 0>
int FirstGreaterThan ( std::vector< T > & v,
uint32_t uid )
inline

Search for the first component with uid greater than the given uid.

Definition at line 58 of file entity.hpp.

◆ Interpolate()

float Interpolate ( float current,
float previous )
inline

Interpolate between the current and previous value using Window::Alpha

Definition at line 83 of file entity.hpp.

◆ operator<<()

std::ostream & operator<< ( std::ostream & os,
const RigidbodyComponent::BodyType & type )

Definition at line 198 of file entity.cpp.

◆ RightShift()

template<typename T , ComponentType< T > = 0>
void RightShift ( std::vector< T > & v,
size_t idx )
inline

Shift the elements of the vector to the right starting from the given index.

Parameters
idxthe index from which to start shifting

Definition at line 75 of file entity.hpp.

◆ RigidbodyTypeFromBox2DBody()

RigidbodyComponent::BodyType RigidbodyTypeFromBox2DBody ( b2BodyType bodyType)
inline
Returns
the b2BodyType converted to a BodyType

Definition at line 446 of file entity.hpp.

◆ RigidbodyTypeToBox2DBody()

b2BodyType RigidbodyTypeToBox2DBody ( RigidbodyComponent::BodyType bodyType)
inline
Returns
the body type converted to a b2BodyType

Definition at line 431 of file entity.hpp.

Variable Documentation

◆ NEXT_UID

uint32_t NEXT_UID
extern

Definition at line 485 of file sceneserializer.cpp.