MCPcopy Create free account
hub / github.com/dhewm/dhewm3 / Draw

Method Draw

neo/framework/Dhewm3SettingsMenu.cpp:1480–1529  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1478 }
1479
1480 void Draw()
1481 {
1482 if (type == OT_HEADING) {
1483 if (label != NULL) {
1484 ImGui::SeparatorText( label );
1485 }
1486 } else if (cvar != nullptr) {
1487 switch(type) {
1488 case OT_BOOL:
1489 {
1490 bool b = cvar->GetBool();
1491 bool bOrig = b;
1492 ImGui::Checkbox( label, &b );
1493 AddCVarOptionTooltips( *cvar );
1494 if (b != bOrig) {
1495 cvar->SetBool(b);
1496 }
1497 break;
1498 }
1499 case OT_FLOAT:
1500 {
1501 float f = cvar->GetFloat();
1502 float fOrig = f;
1503 // TODO: make format configurable?
1504 ImGui::SliderFloat(label, &f, minVal, maxVal, "%.2f", 0);
1505 AddCVarOptionTooltips( *cvar );
1506 if(f != fOrig) {
1507 cvar->SetFloat(f);
1508 }
1509 break;
1510 }
1511 case OT_INT:
1512 {
1513 int i = cvar->GetInteger();
1514 int iOrig = i;
1515 ImGui::SliderInt(label, &i, minVal, maxVal);
1516 AddCVarOptionTooltips( *cvar );
1517 if (i != iOrig) {
1518 cvar->SetInteger(i);
1519 }
1520 break;
1521 }
1522 case OT_CUSTOM:
1523 if (drawCallback != nullptr) {
1524 drawCallback(*cvar);
1525 }
1526 break;
1527 }
1528 }
1529 }
1530};
1531
1532static void InitOptions(CVarOption options[], int numOptions)

Callers 2

DrawBindingsMenuFunction · 0.45
DrawOptionsFunction · 0.45

Calls 7

AddCVarOptionTooltipsFunction · 0.85
GetIntegerMethod · 0.80
SetIntegerMethod · 0.80
GetBoolMethod · 0.45
SetBoolMethod · 0.45
GetFloatMethod · 0.45
SetFloatMethod · 0.45

Tested by

no test coverage detected