MCPcopy Create free account
hub / github.com/TheRealMJP/BakingLab / Initialize

Method Initialize

SampleFramework11/v1.02/Settings.cpp:26–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26void 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
63void Setting::SetReadOnly(bool readOnly)
64{

Callers 7

AddFloatSettingMethod · 0.45
AddIntSettingMethod · 0.45
AddBoolSettingMethod · 0.45
AddEnumSettingMethod · 0.45
AddDirectionSettingMethod · 0.45
AddOrientationSettingMethod · 0.45
AddColorSettingMethod · 0.45

Calls 12

TwCallFunction · 0.85
SetLabelFunction · 0.85
SetHelpTextFunction · 0.85
SetGroupFunction · 0.85
InitializeFunction · 0.85
SetMinMaxFunction · 0.85
SetStepFunction · 0.85
SetAxisMappingFunction · 0.85
ClampFunction · 0.85
GetIntensityLabelFunction · 0.85
lengthMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected