73 lines
2.6 KiB
C
73 lines
2.6 KiB
C
#pragma once
|
|
|
|
// IMPLEMENTATION_DETAIL_LAZY_VALUE_CREATION, IMPLEMENTATION_DETAIL_PROPERTY_TYPES
|
|
|
|
/// \file property.h
|
|
/// \author Folling <mail@folling.io>
|
|
|
|
#include <ikarus/id.h>
|
|
#include <ikarus/macros.h>
|
|
#include <ikarus/objects/blueprint.h>
|
|
#include <ikarus/objects/entity.h>
|
|
|
|
/// \defgroup properties Properties
|
|
/// \brief Properties define the structure and types of data.
|
|
|
|
IKARUS_BEGIN_HEADER
|
|
|
|
/// \brief Properties are the placeholders of values for entities.
|
|
/// \details Each entity can have any number of properties.
|
|
/// Every property has a type that identifies the kind of data that can be put in.
|
|
///
|
|
/// The following types currently exist:
|
|
/// - Toggle: A true/false boolean-like value
|
|
/// - Number: An arbitrary numeric value
|
|
/// - Text: An arbitrary textual value
|
|
///
|
|
/// Property Examples:
|
|
/// - Is Dead (Toggle)
|
|
/// - Age (Number)
|
|
/// - ISBN (Text)
|
|
///
|
|
/// Every property has settings which can be used to customise the property further.
|
|
/// Two settings that are shared among all properties are the following:
|
|
/// - Multiple
|
|
/// - Allow undefined
|
|
///
|
|
/// The former transforms a property into a list. Instead of one number, you could then specify a series of numbers.
|
|
/// The latter allows you to specify an "unknown" value for a property.
|
|
/// It might not be known if a character is dead or not for example.
|
|
///
|
|
/// Each entity associated with the property has a value for it.
|
|
///
|
|
/// Properties can also be added to blueprints in which case they are available for all entities associated with the
|
|
/// blueprint.
|
|
///
|
|
/// We call properties within entities "Entity Properties" and properties within blueprints "Blueprint Properties".
|
|
///
|
|
/// \remark Properties are scoped to the blueprint or entity they are associated with.
|
|
/// \remark Values for properties are lazily created as space saving measure.
|
|
/// Fetching the value for some property of some entity will return the property's default value if none is specified.
|
|
/// This default value is specified when the property is created and can be updated later.
|
|
/// \remark Properties' tree structures are scoped to the entity or blueprint they are associated with.
|
|
struct IkarusProperty {
|
|
/// \private \brief The id of the property.
|
|
IkarusId id;
|
|
};
|
|
|
|
/// \brief The type of a property.
|
|
/// \details Designates the type of data stored by the property as well as which settings are
|
|
/// available.
|
|
/// \see IkarusPropertySettings
|
|
enum IkarusPropertyType {
|
|
/// \brief A true/false boolean-like value.
|
|
IkarusPropertyType_Toggle,
|
|
/// \brief An arbitrary numeric value.
|
|
IkarusPropertyType_Number,
|
|
/// \brief An arbitrary textual value.
|
|
IkarusPropertyType_Text,
|
|
};
|
|
|
|
IKARUS_END_HEADER
|
|
|
|
// @}
|