CTagState

#include

Public Member Functions

CTagState (const CTagDefinition &defs, TagState state=TAG_STATE_EMPTY)
CTagState (const CTagState &other)
void Clear ()
void SetByCRC (uint32 CRC, bool enable)
void Set (TagID id, bool enable)
void SetGroup (TagGroupID groupID, TagID tagID)
void ClearGroup (TagGroupID groupID)
ILINE bool IsSet (TagID tagID) const
ILINE bool IsGroupSet (TagGroupID tagGroupID) const
ILINE bool Contains (const TagState &comp) const
ILINE bool Contains (const CTagState &comp) const
const TagState & GetMask () const
const CTagDefinition & GetDef () const
CTagState & operator= (const TagState &tagState)
CTagState & operator= (const CTagState &cTagState)

Detailed Description

Helper to store the boolean state of tags for an action controller

See also
IActionController::GetContext().state

Member Function Documentation

◆ Set()

void CTagState::Set ( TagID id,
bool enable
)
inline

Sets a tag to the specified state

#include 
#include 

// Sets the state of a specified tag for the action controller
void SetTag(IActionController& actionController)
{
    // Name of the tag that we want to set, for the sake of our example we named it "Rotate"
    const char* szTagName = "Rotate";
    // Whether or not the tag should be enabled
    const bool isTagEnabled = true;
    // Cache the tag state for the action controller
    CTagState& tagState = actionController.GetContext().state;

    // Find the tag, ideally this should be cached to avoid run-time lookups
    TagID tagId = tagState.GetDef().Find(szTagName);

    // Now set the specified tag to the desired state (isTagEnabled)
    tagState.Set(tagId, isTagEnabled);
}