finalise interface & documentation
Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
parent
c5157bd849
commit
52580a4382
56 changed files with 2074 additions and 780 deletions
|
|
@ -1,63 +1,46 @@
|
|||
#pragma once
|
||||
|
||||
/// \file property_scope.h
|
||||
/// \author Folling <mail@folling.io>
|
||||
/// \author Folling <folling@ikarus.world>
|
||||
|
||||
#include <ikarus/id.h>
|
||||
#include <ikarus/macros.h>
|
||||
#include <ikarus/objects/blueprint.h>
|
||||
#include <ikarus/objects/entity.h>
|
||||
|
||||
/// \addtogroup object_scopes ObjectScopes
|
||||
/// @{
|
||||
|
||||
IKARUS_BEGIN_HEADER
|
||||
|
||||
/// \brief Data for a property scope. This can either be a blueprint or an entity.
|
||||
union IkarusPropertyScopeData {
|
||||
/// \private \brief The blueprint the property is scoped to.
|
||||
IkarusBlueprint _blueprint;
|
||||
/// \private \brief The entity the property is scoped to.
|
||||
IkarusEntity _entity;
|
||||
};
|
||||
|
||||
/// \brief The type of a property scope. This can either be a blueprint or an entity.
|
||||
enum IkarusPropertyScopeType {
|
||||
/// \brief The property is scoped to a blueprint.
|
||||
IkarusPropertyScopeType_Blueprint,
|
||||
/// \brief The property is scoped to an entity.
|
||||
IkarusPropertyScopeType_Entity
|
||||
};
|
||||
|
||||
/// \brief The scope of a property
|
||||
struct IkarusPropertyScope {
|
||||
/// \private \brief Represents the type of the scope.
|
||||
IkarusPropertyScopeType _type;
|
||||
/// \private \brief Represents the data of the scope.
|
||||
IkarusPropertyScopeData _data;
|
||||
};
|
||||
struct IkarusPropertyScope;
|
||||
|
||||
/// \brief Creates a property scope from a blueprint.
|
||||
/// \param blueprint The blueprint the property is scoped to.
|
||||
/// \return The created property scope.
|
||||
IKA_API IkarusPropertyScope ikarus_property_scope_create_blueprint(IkarusBlueprint blueprint);
|
||||
/// \brief Creates a property scope from a entity.
|
||||
/// \remark Must be freed with #ikarus_free.
|
||||
IKA_API IkarusPropertyScope * ikarus_property_scope_create_blueprint(struct IkarusBlueprint * blueprint);
|
||||
/// \brief Creates a property scope from an entity.
|
||||
/// \param entity The entity the property is scoped to.
|
||||
/// \return The created property scope.
|
||||
IKA_API IkarusPropertyScope ikarus_property_scope_create_entity(IkarusEntity entity);
|
||||
/// \remark Must be freed with #ikarus_free.
|
||||
IKA_API IkarusPropertyScope * ikarus_property_scope_create_entity(struct IkarusEntity * entity);
|
||||
|
||||
/// \brief Fetches the type of an property scope.
|
||||
/// \param scope The scope to fetch the type of.
|
||||
/// \return The type of the scope.
|
||||
IKA_API IkarusPropertyScopeType ikarus_property_scope_get_type(IkarusPropertyScope scope);
|
||||
/// \brief Converts a property scope to an object scope.
|
||||
/// \param scope The scope to convert.
|
||||
/// \return The converted scope.
|
||||
/// \remark Must be freed with #ikarus_free.
|
||||
IKA_API struct IkarusObjectScope * ikarus_property_scope_to_object_scope(IkarusPropertyScope const * scope);
|
||||
|
||||
/// \brief Visits a property scope, calling the appropriate function.
|
||||
/// \param scope The scope to to visit
|
||||
/// \param blueprint The function to call if the property is scoped to a blueprint.
|
||||
/// \param entity The function to call if the property is scoped to an entity.
|
||||
/// \param data Optional data to pass to the functions.
|
||||
void ikarus_property_scope_visit(
|
||||
IkarusPropertyScope scope, void (*blueprint)(IkarusBlueprint, void *), void (*entity)(IkarusEntity, void *), void * data
|
||||
/// \param blueprint_visitor The function to call if the property is scoped to a blueprint.
|
||||
/// \param entity_visitor The function to call if the property is scoped to an entity.
|
||||
/// \param data The data passed to the visitor functions.
|
||||
IKA_API void ikarus_property_scope_visit(
|
||||
IkarusPropertyScope * scope,
|
||||
void (*blueprint_visitor)(struct IkarusBlueprint *, void *),
|
||||
void (*entity_visitor)(struct IkarusEntity *, void *),
|
||||
void * data
|
||||
);
|
||||
|
||||
IKARUS_END_HEADER
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue