ege::Element Class Referenceabstract
Inheritance diagram for ege::Element:
ememory::EnableSharedFromThis< Element > ememory::EnableSharedFromThisBase ege::ElementBase ege::ElementPhysic

Public Member Functions

 Element (const ememory::SharedPtr< ege::Environement > &_env)
 
virtual ~Element ()
 
virtual const std::string & getType () const
 
virtual bool init ()
 
virtual bool initString (const std::string &_description)
 
virtual bool initXML (const exml::Node &_node)
 
virtual bool initJSON (const ejson::Value &_value)
 
virtual bool initVoid (void *_value)
 
virtual bool unInit ()
 
uint32_t getUID () const
 
virtual bool loadMesh (const std::string &_meshFileName)
 
virtual bool setMesh (ememory::SharedPtr< ege::resource::Mesh > _mesh)
 
ememory::SharedPtr< ege::resource::MeshgetMesh ()
 
float getLifeRatio ()
 
bool isDead ()
 
virtual bool needToRemove ()
 
virtual void setFireOn (int32_t _groupIdSource, int32_t _type, float _power, const vec3 &_center=vec3(0, 0, 0))
 
virtual void onLifeChange ()
 
int32_t getGroup () const
 
void setGroup (int32_t _newGroup)
 
virtual void preCalculationDraw (const ege::Camera &_camera)
 
virtual void draw (int32_t _pass=0)=0
 
virtual void drawLife (ememory::SharedPtr< ewol::resource::Colored3DObject > _draw, ememory::SharedPtr< ege::Camera > _camera)
 
virtual void drawDebug (ememory::SharedPtr< ewol::resource::Colored3DObject > _draw, ememory::SharedPtr< ege::Camera > _camera)
 
virtual vec3 getPositionTheoric ()
 
virtual const vec3getPosition ()
 
virtual void setPosition (const vec3 &_pos)
 
virtual void elementIsRemoved (ememory::SharedPtr< ege::Element > _removedElement)
 
bool isFixed ()
 
float getRadius ()
 
virtual void onDestroy ()
 
virtual void dynamicEnable ()
 
virtual void dynamicDisable ()
 
- Public Member Functions inherited from ememory::EnableSharedFromThis< Element >
ememory::SharedPtr< EMEMORY_TYPE > sharedFromThis ()
 
const ememory::SharedPtr< EMEMORY_TYPE > sharedFromThis () const
 
ememory::WeakPtr< EMEMORY_TYPE > weakFromThis ()
 
const ememory::WeakPtr< EMEMORY_TYPE > weakFromThis () const
 

Protected Attributes

ememory::SharedPtr< ege::Environementm_env
 
ememory::SharedPtr< ege::resource::Meshm_mesh
 
float m_life
 
float m_lifeMax
 
int32_t m_group
 
ewol::compositing::Text m_debugText
 
bool m_fixe
 
float m_radius
 

Constructor & Destructor Documentation

§ Element()

ege::Element::Element ( const ememory::SharedPtr< ege::Environement > &  _env)

Constructor (when constructer is called just add element that did not change. The objest will be stored in a pool of element and keep a second time if needed == > redure memory allocation, when needed, the system will call the init and un-init function...

§ ~Element()

virtual ege::Element::~Element ( )
virtual

Destructor.

Member Function Documentation

§ draw()

virtual void ege::Element::draw ( int32_t  _pass = 0)
pure virtual

draw the curent element (can have multiple display)

Parameters
[in]passId of the current pass : [0..?]

Implemented in ege::ElementPhysic, and ege::ElementBase.

§ drawDebug()

virtual void ege::Element::drawDebug ( ememory::SharedPtr< ewol::resource::Colored3DObject >  _draw,
ememory::SharedPtr< ege::Camera _camera 
)
virtual

Debug display of the current element.

Parameters
[in,out]drawBasic system to draw the debug shape and informations

Reimplemented in ege::ElementPhysic.

§ drawLife()

virtual void ege::Element::drawLife ( ememory::SharedPtr< ewol::resource::Colored3DObject >  _draw,
ememory::SharedPtr< ege::Camera _camera 
)
virtual

draw the current life of the element

§ dynamicDisable()

virtual void ege::Element::dynamicDisable ( )
inlinevirtual

remove this element from the physique engine

Reimplemented in ege::ElementPhysic.

§ dynamicEnable()

virtual void ege::Element::dynamicEnable ( )
inlinevirtual

set the elment in the physique engine

Reimplemented in ege::ElementPhysic.

§ elementIsRemoved()

virtual void ege::Element::elementIsRemoved ( ememory::SharedPtr< ege::Element _removedElement)
inlinevirtual

Event arrive when an element has been remove from the system == > this permit to keep pointer of ennemy, and not search them every cycle ...

Parameters
[in]_removedElementPointer on the element removed.

§ getGroup()

int32_t ege::Element::getGroup ( ) const
inline

get the Group of the element.

Returns
The group ID

§ getLifeRatio()

float ege::Element::getLifeRatio ( )

get the curent life ratio [0..1]

Returns
The proportionnal life

§ getMesh()

ememory::SharedPtr<ege::resource::Mesh> ege::Element::getMesh ( )
inline

get a pointer on the Mesh file.

Returns
the mesh pointer.

§ getPosition()

virtual const vec3& ege::Element::getPosition ( )
virtual

get the current position of the element

Returns
the 3D position.

Reimplemented in ege::ElementPhysic, and ege::ElementBase.

§ getPositionTheoric()

virtual vec3 ege::Element::getPositionTheoric ( )
inlinevirtual

get the theoric position. Sometimes, the element has move due to an explosion or something else, then its real position in not the one that woult it be at the end ...

Returns
the theoric position

Reimplemented in ege::ElementPhysic.

§ getRadius()

float ege::Element::getRadius ( )
inline

get the current space needed by the element in the workspace

Returns
The dimention needed.

§ getType()

virtual const std::string& ege::Element::getType ( ) const
virtual

get the element Type description string.

Returns
A reference on the descriptive string.

Reimplemented in ege::ElementPhysic, and ege::ElementBase.

§ getUID()

uint32_t ege::Element::getUID ( ) const
inline

get the curent Element Unique ID in the all Game.

Returns
The requested Unique ID.

§ init()

virtual bool ege::Element::init ( )
virtual

init the element with the defined properties

Parameters
[in]_propertyType of the next element
[in]_valuepointer on the value type
Returns
true, the element is corectly initialized.

§ isDead()

bool ege::Element::isDead ( )
inline

Check if the element is dead.

Returns
true if the element does not exist anymore, false otherwise.

§ isFixed()

bool ege::Element::isFixed ( )
inline

get the element if it is fixed or not. if the element is fixed this is for tower, and all thing does not really move

Returns
true : The element is fixed.

§ loadMesh()

virtual bool ege::Element::loadMesh ( const std::string &  _meshFileName)
virtual

Select a mesh with a specific name.

Parameters
[in]_meshFileNamefilename of the Mesh.
Note
Automaticly load the shape if it is specify in the mesh file
Returns
true if no error occured

§ needToRemove()

virtual bool ege::Element::needToRemove ( )
inlinevirtual

Request if the element might be removed from the system.

Returns
true == > the object is removed

§ onDestroy()

virtual void ege::Element::onDestroy ( )
inlinevirtual

, call when the element is removed (call only one time)

Reimplemented in ege::ElementPhysic.

§ onLifeChange()

virtual void ege::Element::onLifeChange ( )
inlinevirtual

Call when the element life change.

§ preCalculationDraw()

virtual void ege::Element::preCalculationDraw ( const ege::Camera _camera)
inlinevirtual

Can be call tu opdate the list of the element displayed on the scren (example : no display of the hiden triangle)

Parameters
[in]thecamera properties @ note by default nothing to do ...

§ setFireOn()

virtual void ege::Element::setFireOn ( int32_t  _groupIdSource,
int32_t  _type,
float  _power,
const vec3 _center = vec3(0, 0, 0) 
)
virtual

apply a fire on the element at a current power and a specific power.

Parameters
[in]_groupIdSourceSource Id of the group, by default all event arrive at all group, buf some event can not be obviously apply at the ennemy like reparing ....
[in]_typeType of event on the life propertied
[in]_powerPower of the event (can be >0 for adding life).
[in]_centerSome fire decrease in function of space distance...

§ setGroup()

void ege::Element::setGroup ( int32_t  _newGroup)
inline

set the group of the curent element

Parameters
[in]newGroupThe new Group ID of the element.

§ setMesh()

virtual bool ege::Element::setMesh ( ememory::SharedPtr< ege::resource::Mesh _mesh)
virtual

set the the Mesh properties.

Parameters
[in]_meshThe mesh pointer. (nullptr to force the mesh remove ...)
Note
: this remove the shape and the mesh properties.
Returns
true if no error occured

Reimplemented in ege::ElementPhysic.

§ setPosition()

virtual void ege::Element::setPosition ( const vec3 _pos)
inlinevirtual

set the current position of the element

Parameters
[in]_posset the 3D position.

Reimplemented in ege::ElementPhysic, and ege::ElementBase.

Member Data Documentation

§ m_fixe

bool ege::Element::m_fixe
protected

is a fixed element == > used for placement of every elements

§ m_group

int32_t ege::Element::m_group
protected

Every element has a generic group.

§ m_life

float ege::Element::m_life
protected

Current life of the object.

§ m_lifeMax

float ege::Element::m_lifeMax
protected

Maximum possible life of the element.

§ m_mesh

ememory::SharedPtr<ege::resource::Mesh> ege::Element::m_mesh
protected

Mesh of the Element (can be nullptr)

§ m_radius

float ege::Element::m_radius
protected

Radius of the element (all element have a radius, if == 0 ==> then ghost ...


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