Skip to content
/ Ctrl Public

Input system wrapper built on Stride's native input system

License

Notifications You must be signed in to change notification settings

rsptim1/Ctrl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Ctrl

Ctrl is a programmer-oriented wrapper for Stride's native input system. The goal is to make grabbing player inputs at runtime more standardized and configurable, and to allow easy rebinding of controls.

Roadmap:

  • Basic binding controls for buttons and axes
  • Advanced mouse controls and utilities
  • Easy runtime rebinding
  • Savable and loadable controller binding layouts

Using Ctrl

The most configurable way to utilize Ctrl is by implementing the PlayerActionSet class and having PlayerAction fields to be read from.

public class InputController : PlayerActionSet
{
    private readonly TwoAxisPlayerAction exampleAxis;
    public TwoPlayerAxisAction => ExampleAxis;

    private readonly PlayerAction exampleButton;
    public PlayerAction => ExampleButton;

    public InputController() : base()
    {
        // Setup the axis action
        // Note: each PlayerAction must be assigned a unique name
        exampleAxis = CreateTwoAxisPlayerAction("Axis");
        exampleAxis.AddBinding(MouseAxis.X, MouseAxis.Y);

        // Setup the button action
        exampleAxis = CreatePlayerAction("Button");
        exampleAxis.AddBinding(Keys.Space);
    }
}

These player actions can now be read for input values.

var controller = new InputController();

bool isPressed = controller.ExampleButton.IsPressed;
Vector2 axisInput = controller.ExampleAxis.Vector;

Yes, the name is a pun.

About

Input system wrapper built on Stride's native input system

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages