int TwDefine(const char *def) |
---|
This function defines optional parameters for tweak bars and variables. For instance, it allows you to change the color of a tweak bar, to set a min and a max value for a variable, to add an help message that inform users of the meaning of a variable, and so on...
A string containing one or more parameter assignments (separated by newlines).
To define bar parameters, the syntax is:
barName barParam1=xx barParam2=xx ...
where barName
is the name of the tweak bar (the same as the one provided to TwNewBar), and barParam
n follows the bar parameters syntax.
To define variable parameters, the syntax is:
barName/varName varParam1=xx varParam2=xx ...
where barName
is the name of the tweak bar (the same as the one provided to TwNewBar), varName
is the name of the variable (the same as the one provided to TwAddVar*), and varParam
n follows the variable parameters syntax.
If barName
or varName
contains special characters like spaces or quotation marks, you can surround it by quotes (‘), back-quotes (`) or double-quotes (“).
Using a text file to define parameters
One or more parameters can be defined by each TwDefine
call. If you want to assign more than one parameter through one TwDefine
call, separate them by new lines (\n
). This allows, for instance, the read of parameters definition from a file into a string buffer, and then send this string to TwDefine
. Doing so, you can modify the behavior of your tweak bars and variables without re-compiling your application.