TwType TwDefineEnumFromString(const char *name, const char *enumString) |
---|
This function is an alternative to TwDefineEnum. It creates a new TwType corresponding to a C/C++ enum. Thus the type could be used with TwAddVar* functions to control variables of type enum.
Here the enum values are defined by a string containing a comma-separated list of labels. The first label is associated to 0, the second to 1, etc.
Specify a name for the enum type (must be unique).
Comma-separated list of labels.
int density; TwType densityType; // Defining new enum type densityType = TwDefineEnumFromString("DensityType", "Low,Medium,High"); // Adding density to bar TwAddVarRW(bar, "Density", densityType, &density, NULL);