Documentation for module 'NDK'

Former-commit-id: 7d8a51d8ad14bfb16a76b8d77c92c776bfb694ab [formerly 1dac8450f2eddf175b3eb2b6675621ea0b2a0df7] [formerly bb4300770d267df0eed5c509ec748c6866f36376 [formerly d15a100319ffc8805c7f93c9bcd936e204dad40b]]
Former-commit-id: 83a4715ed2a3220b7ef4718401d50ce584d275fc [formerly a941a150d510a51daed4322723795d90b6d56724]
Former-commit-id: f46308abb0bc577d73447f6a574ec091a50a9cca
This commit is contained in:
Gawaboumga
2016-08-21 13:48:52 +02:00
parent 2e29e1995f
commit c8c19f5845
75 changed files with 3374 additions and 112 deletions

View File

@@ -7,34 +7,60 @@
namespace Ndk
{
/*!
* \brief Constructs a BaseComponent object with an index
*
* \param index Index of the component
*/
inline BaseComponent::BaseComponent(ComponentIndex index) :
m_componentIndex(index),
m_entity(nullptr)
{
}
/*!
* \brief Gets the index of the component
* \return Index of the component
*/
inline ComponentIndex BaseComponent::GetIndex() const
{
return m_componentIndex;
}
/*!
* \brief Gets the maximal index of the components
* \return Index of the maximal component
*/
inline ComponentIndex BaseComponent::GetMaxComponentIndex()
{
return static_cast<ComponentIndex>(s_entries.size());
}
/*!
* \brief Registers a component
* \return Index of the registered component
*
* \param id Index of the component
* \param factory Factory to create the component
*
* \remark Produces a NazaraAssert if the identifier is already in use
*/
inline ComponentIndex BaseComponent::RegisterComponent(ComponentId id, Factory factoryFunc)
{
// Nous allons rajouter notre composant à la fin
// We add our component to the end
ComponentIndex index = static_cast<ComponentIndex>(s_entries.size());
s_entries.resize(index + 1);
// On récupère et on affecte
// We retrieve it and affect it
ComponentEntry& entry = s_entries.back();
entry.factory = factoryFunc;
entry.id = id;
// Une petite assertion pour s'assurer que l'identifiant n'est pas déjà utilisé
// We ensure that id is not already in use
NazaraAssert(s_idToIndex.find(id) == s_idToIndex.end(), "This id is already in use");
s_idToIndex[id] = index;
@@ -42,6 +68,10 @@ namespace Ndk
return index;
}
/*!
* \brief Sets the entity on which the component operates
*/
inline void BaseComponent::SetEntity(Entity* entity)
{
if (m_entity != entity)
@@ -55,12 +85,21 @@ namespace Ndk
}
}
/*!
* \brief Initializes the BaseComponent
* \return true
*/
inline bool BaseComponent::Initialize()
{
// Rien à faire
// Nothing to do
return true;
}
/*!
* \brief Uninitializes the BaseComponent
*/
inline void BaseComponent::Uninitialize()
{
s_entries.clear();