namespace Sandbox.UI;
///
/// WorldInput can be used to simulate standard mouse inputs on WorldPanels.
///
///
///
/// You need to set and to simulate inputs,
/// ideally this should be done in a BuildInput event.
///
///
public class WorldInput
{
internal WorldInputInternal WorldInputInternal { get; init; } = new();
///
/// This input won't tick when this is false.
/// Any hovered panels will be cleared.
///
public bool Enabled
{
get => WorldInputInternal.Enabled;
set => WorldInputInternal.Enabled = value;
}
///
/// The Ray used to intersect with your world panels, simulating mouse position.
///
///
/// This should ideally be set in BuildInput or FrameSimulate.
///
public Ray Ray
{
get => WorldInputInternal.Ray;
set => WorldInputInternal.Ray = value;
}
public bool MouseLeftPressed
{
get => WorldInputInternal.MouseLeftPressed;
set => WorldInputInternal.MouseLeftPressed = value;
}
public bool MouseRightPressed
{
get => WorldInputInternal.MouseRightPressed;
set => WorldInputInternal.MouseRightPressed = value;
}
///
/// Simulate the mouse scroll wheel.
/// You could use
/// Or you could simulate it with the camera view delta for example.
///
public Vector2 MouseWheel
{
get => WorldInputInternal.MouseWheel;
set => WorldInputInternal.MouseWheel = value;
}
///
/// Instead of simulating mouse input, this will simply use the mouse input.
///
public bool UseMouseInput
{
get => WorldInputInternal.UseMouseInput;
set => WorldInputInternal.UseMouseInput = value;
}
///
/// The that is currently hovered by this input.
///
public Panel Hovered => WorldInputInternal.Hovered;
///
/// The that is currently pressed by this input.
///
public Panel Active => WorldInputInternal.Active;
}