Skip to content

Development Overview & Concepts

TheBigO edited this page Dec 11, 2020 · 66 revisions

General

  1. plugin einbinden
  2. was ist erlaubt / was nicht

Simulator Controller

Button Box

Plugins

Modes

Controller Functions

Instances of ControllerFunction represent the active elements of a hardware controller - buttons, dials, switches and so on. A function must be mapped to an Action () to be useful. This mapping is handled by Plugins () and Modes (), since both can take ownership of a function and define the corresponding Action. Whereas modes may own a function only as long they are the currently active mode of the Controller () (i.e. the currently active layer of a button box), plugins can define actions and bind them to functions, so that they are available all the time. Functions might be enabled or disabled according to the current state of their mode or plugin and they can give visual feedback, if a visual button box representation has been defined. For example, if you increase the force feedback of your steering wheel with a dial knob, the current feedback strength might be dislayed below the dial. Normally this is handled by the action, when the fireAction (*) method is called.

Several subclasses of ControllerFunction define specialized behaviour, for example 2WayToggleFunction can trigger to different action methods, since they have an On and an Off state. See the class reference for details on all subclasses of ControllerFunction.

To make things more complicated a seperate controller function inheritance tree exists for all functions handled by SimulatorController (), since AutoHotkey does not support multiple inheritence. The complete protocol of ControllerFunction is implemented by these classes () as well and they use the original classes by a delegation pattern. Since AutoHotey is weakly typed prototype-based language, this fact is invisible to the programmer, but in the end good to know and to understand.

Controller Actions

ControllerAction () objects are very simple. They define a label, which might be displayed by the button box visual and the define the method fireAction () which will be triggered by the function. Although actions might be created and registered to their mode or plugin anytime, normally they are created by the mode or plugin during initialization, for example based on configuration data.

Example

Clone this wiki locally