fake

package
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2022 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package fake implements a fake input controller.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInputController

func NewInputController(ctx context.Context, _ registry.Dependencies, config config.Component, logger golog.Logger) (interface{}, error)

NewInputController returns a fake input.Controller.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config can list input structs (with their states).

type InputController

type InputController struct {
	Name string

	generic.Echo
	// contains filtered or unexported fields
}

An InputController fakes an input.Controller.

func (*InputController) Controls

func (c *InputController) Controls(ctx context.Context) ([]input.Control, error)

Controls lists the inputs of the gamepad.

func (*InputController) Events

func (c *InputController) Events(ctx context.Context) (map[input.Control]input.Event, error)

Events returns the last input.Event (the current state) of each control.

func (*InputController) RegisterControlCallback

func (c *InputController) RegisterControlCallback(
	ctx context.Context,
	control input.Control,
	triggers []input.EventType,
	ctrlFunc input.ControlFunction,
) error

RegisterControlCallback registers a callback function to be executed on the specified trigger Event.

func (*InputController) TriggerEvent

func (c *InputController) TriggerEvent(ctx context.Context, event input.Event) error

TriggerEvent allows directly sending an Event (such as a button press) from external code.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL