Instanceclass

Holds the backend state for a Gizmo scope. This allows us to have multiple different gizmo states (for multiple views, multiple windows, game and editor) and push them as the current active state whenever needed.

object→Instance
Namespace
global
Assembly
Sandbox.Engine
Declaration
public class Sandbox.Gizmo.Instance

Constructors1

Showing 1 constructors

public Instance()PUBLICCONSTRUCTOR

Methods6

Showing 6 methods

public void Clear()PUBLIC

Called when the scene changes and we don't want to inherit a bunch of values. We might want to just target some specific values here instead of clearing the log.

Returns:void—

public virtual sealed void Dispose()PUBLICVIRTUAL

Destroy this instance, clean up any created resources/scene objects, destroy the world.

Returns:void—

public T GetValue(string name)PUBLIC

Generic storage for whatever you want to do. You're responsible for not spamming into this and cleaning up after yourself.

ParameterTypeDescription
namestring—
Returns:T—

public System.IDisposable Push()PUBLIC

Push this instance as the global Gizmo state. All Gizmo calls during this scope will use this instance.

Returns:IDisposable—

public void SetValue(string name, T value)PUBLIC

Generic storage for whatever you want to do. You're responsible for not spamming into this and cleaning up after yourself.

ParameterTypeDescription
namestring—
valueT—
Returns:void—

public void StompCursorPosition(Vector2 position)PUBLIC

Set all of the state's cursor positions to this value. This stomps previous values which will effectively clear any deltas. This should be used prior to starting a loop.

ParameterTypeDescription
positionVector2—
Returns:void—

Properties7

Showing 7 properties

public string Sandbox.Gizmo.Instance.ControlMode { get; set; }PUBLICGETSET

The current control mode. This is generally implementation specific. We tend to use "mouse" and "firstperson".

Returns:string—

public bool Sandbox.Gizmo.Instance.Debug { get; set; }PUBLICGETSET

If true, we'll draw some debug information

Returns:bool—

public bool Sandbox.Gizmo.Instance.DebugHitboxes { get; set; }PUBLICGETSET

If true we'll enable hitbox debugging

Returns:bool—

public Sandbox.Gizmo.Inputs Sandbox.Gizmo.Instance.PreviousInput { get; set; }PUBLICGETSETINGEST

The previous input state

Returns:Inputs—

public Sandbox.Gizmo.SceneSettings Sandbox.Gizmo.Instance.Settings { get; set; }PUBLICGETSET

Some global settings accessible to the gizmos. Your implementation generally lets your users set up these things to their preference, and the gizmos should try to obey them.

Returns:SceneSettings—

public Sandbox.SceneWorld Sandbox.Gizmo.Instance.World { get; set; }PUBLICGETSET

The world the gizmos are drawn into. Created on first use - every scene owns a gizmo instance, but most never draw a gizmo, so don't pay for a native world up front.

Returns:SceneWorld—

On this page