You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

86 lines
2.6 KiB

using System;
using gaemstone.ECS;
using static gaemstone.Flecs.Core;
namespace gaemstone;
[Module]
public class Doc
{
[Tag]
public struct DisplayType { }
[Tag]
public struct Relation { }
// TODO: These need to actually be read at some point.
/// <summary>
/// A display name for this entity.
/// Names in the entity hierarchy must be unique within the parent entity,
/// This doesn't apply to display names - they are mostly informational.
/// Displayed in the Entity Inspector.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum)]
public class Name : Attribute
{
public string Value { get; }
public Name(string value) => Value = value;
}
/// <summary>
/// A brief description of this entity.
/// Displayed in the Entity Inspector.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum)]
public class Brief : Attribute
{
public string Value { get; }
public Brief(string value) => Value = value;
}
/// <summary>
/// A detailed description, or full documentation, of this entity's purpose and behaviors.
/// It's encouraged to use multiple paragraphs and markdown formatting if necessary.
/// Displayed in the Entity Inspector.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum)]
public class Detail : Attribute
{
public string Value { get; }
public Detail(string value) => Value = value;
}
/// <summary>
/// A link to a website relating to this entity, such as
/// a module's repository, or further documentation.
/// Displayed in the Entity Inspector.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum)]
public class Link : Attribute
{
public string Value { get; }
public Link(string value) => Value = value;
}
/// <summary>
/// A custom color to represent this entity.
/// Displayed in the Entity Inspector.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum)]
public class Color : Attribute
{
public float Red { get; }
public float Green { get; }
public float Blue { get; }
public Color(float red, float green, float blue)
{
if ((red < 0.0f) || (red > 1.0f)) throw new ArgumentOutOfRangeException(nameof(red ));
if ((green < 0.0f) || (green > 1.0f)) throw new ArgumentOutOfRangeException(nameof(green));
if ((blue < 0.0f) || (blue > 1.0f)) throw new ArgumentOutOfRangeException(nameof(blue ));
Red = red; Green = green; Blue = blue;
}
}
}