| 24 | } |
| 25 | |
| 26 | void Setting::Initialize(TwBar* tweakBar_, SettingType type_, void* data_, const char* name_, |
| 27 | const char* group_, const char* label_, const char* helpText_, |
| 28 | ETwType twType_) |
| 29 | { |
| 30 | tweakBar = tweakBar_; |
| 31 | type = type_; |
| 32 | data = data_; |
| 33 | name = name_; |
| 34 | group = group_; |
| 35 | label = label_; |
| 36 | helpText = helpText_; |
| 37 | changed = false; |
| 38 | |
| 39 | static const ETwType twTypes[] = |
| 40 | { |
| 41 | TW_TYPE_FLOAT, |
| 42 | TW_TYPE_INT32, |
| 43 | TW_TYPE_BOOL32, |
| 44 | TW_TYPE_UINT32, // not used |
| 45 | TW_TYPE_DIR3F, |
| 46 | TW_TYPE_QUAT4F, |
| 47 | TW_TYPE_COLOR3F, |
| 48 | TW_TYPE_UNDEF, |
| 49 | }; |
| 50 | |
| 51 | StaticAssert_(_countof(twTypes) == uint64(SettingType::NumTypes)); |
| 52 | |
| 53 | const ETwType twType = twType_ == TW_TYPE_UNDEF ? twTypes[uint64(type)] : twType_; |
| 54 | TwCall(TwAddVarRW(tweakBar, name.c_str(), twType, data, nullptr)); |
| 55 | if(label.length() > 0) |
| 56 | TwHelper::SetLabel(tweakBar, name.c_str(), label.c_str()); |
| 57 | if(helpText.length() > 0) |
| 58 | TwHelper::SetHelpText(tweakBar, name.c_str(), helpText.c_str()); |
| 59 | if(group.length() > 0) |
| 60 | TwHelper::SetGroup(tweakBar, name.c_str(), group.c_str()); |
| 61 | } |
| 62 | |
| 63 | void Setting::SetReadOnly(bool readOnly) |
| 64 | { |
no test coverage detected