template<typename T>
class tap::communication::referee::StateHUDIndicator< T >
Draws a graphic. Each graphic has an associated state (of type specified by the template parameter). Can be true/false, some enumeration type, or something else. When the state associated with this object is updated, a function is called in which the user can update the graphic based on the state. In this way, the user may select to update color or shape of a graphic based on the indicator's state.
To use this drawer, pass in a Graphic1Message object that you must configure via calls to configGraphicGenerics and config<circle|line|etc.>.
- Note
initialize should be called once at the start of a protothread being used to write graphic information to the referee system and draw should be called repeatedly, and will either resend the graphic if the color has changed or do nothing.
Usage:
To construct some StateHUDIndicator<bool> indicator you must pass it an UpdateHUDIndicatorState function. For example, the function can be something like this:
void updateColor(bool state, Tx::Graphic1Message *graphic) {
graphic->graphicData.color = indicatorStatus ? GREEN : YELLOW;
}
Assuming some Tx::Graphic1Message graphic has been declared, to use the indicator, calls to initialize and draw must be done in a prothread similar to the following. It is recommended you put PT_YIELD in protothread loops to avoid infinite looping since the indicator's draw function is not guaranteed to block:
PT_CALL(indicator.initialize());
while (true)
{
PT_CALL(indicator.draw());
PT_YIELD();
}
- Template Parameters
-
| T | Type of the state associated with the HUD indicator. |