using System; using System.Numerics; using gaemstone.ECS; namespace gaemstone.Client.Components; [Module] public class InputComponents { [Symbol, Path("/Input")] [Add] public struct Input { } [Symbol, Path("/Input/Mouse")] [Add] public struct Mouse { } [Symbol, Path("/Input/Keyboard")] [Add] public struct Keyboard { } [Symbol, Tag] public struct Gamepad { } /// Present on inputs / actions that are currently active. [Symbol, Component] public struct Active { public TimeSpan Duration; } /// Present on inputs / actions were activated this frame. [Symbol, Tag] public struct Activated { } /// Present on inputs / actions were deactivated this frame. [Symbol, Tag] public struct Deactivated { } /// /// Relationship on which indicates keyboard /// and gamepad input is currently captured by the target. /// /// /// This is set if a UI element is focused that captures /// navigational or text input. /// [Symbol, Relation, Tag, Exclusive] public struct InputCapturedBy { } /// /// Relationship on which indicates that mouse /// input (buttons and wheel) is currently captured by the target. /// /// /// This could for example include the mouse currently being over /// a UI element, preventing the game from handling mouse input. /// [Symbol, Relation, Tag, Exclusive] public struct MouseInputCapturedBy { } /// /// Relationship on which indicates that the /// cursor is currently captured by the target, and thus hidden. /// /// /// This is set when a camera controller assumes control of the mouse. /// [Symbol, Relation, Tag, Exclusive] [With] [With] public struct CursorCapturedBy { } [Component] internal readonly struct RawValue1D { private readonly float _value; private RawValue1D(float value) => _value = value; public static implicit operator float(RawValue1D value) => value._value; public static implicit operator RawValue1D(float value) => new(value); } [Component] internal readonly struct RawValue2D { private readonly Vector2 _value; private RawValue2D(Vector2 value) => _value = value; public static implicit operator Vector2(RawValue2D value) => value._value; public static implicit operator RawValue2D(Vector2 value) => new(value); } }