パラメータをまとめる

struct.png
typedef struct {
        int   X;
        float F;
        void *P;
        int   Y;
    } MyStruct;
    MyStruct elem;  // an element of type MyStruct that we want to add to a tweak bar
 
    // Description of the structure (note that you are not required to describe all members, and that members can be reordered)
    TwStructMember myStructMembers[] = {
        { "x", TW_TYPE_INT32, offsetof(MyStruct, X), "min=0 max=9" },
        { "y", TW_TYPE_INT32, offsetof(MyStruct, Y), "" },
        { "f", TW_TYPE_FLOAT, offsetof(MyStruct, F), "step=0.1" }
    };
    TwType myStructType;
 
    // ...
 
    // Define myStructType
    myStructType = TwDefineStruct("MyStructType", myStructMembers, 3, sizeof(MyStruct), NULL, NULL);
    // Add elem to bar
    TwAddVarRW(bar, "Elem", myStructType, &elem, NULL);
サポートサイト Wikidot.com