MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / RenderEntryValue

Function RenderEntryValue

apps/tools/Studio/StudioApp.cpp:2626–2682  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2624 }
2625
2626 ImGui::EndChild();
2627}
2628
2629static void RenderEntryValue(const ParamEntry& e)
2630{
2631 if (e.IsArray())
2632 {
2633 std::string val = e.GetName().Data();
2634 val += "[] = {";
2635 int show = std::min(e.GetSize(), 5);
2636 for (int j = 0; j < show; j++)
2637 {
2638 if (j > 0)
2639 val += ", ";
2640 const IParamArrayValue& av = e[j];
2641 if (av.IsFloatValue())
2642 {
2643 char buf[32];
2644 snprintf(buf, sizeof(buf), "%g", av.GetFloat());
2645 val += buf;
2646 }
2647 else if (av.IsIntValue())
2648 val += std::to_string(av.GetInt());
2649 else
2650 {
2651 val += '"';
2652 val += av.GetValue().Data();
2653 val += '"';
2654 }
2655 }
2656 if (e.GetSize() > 5)
2657 val += ", ...";
2658 val += "}";
2659 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.7f, 0.9f, 0.7f, 1.0f));
2660 ImGui::TextUnformatted(val.c_str());
2661 ImGui::PopStyleColor();
2662 }
2663 else
2664 {
2665 std::string line = e.GetName().Data();
2666 line += " = ";
2667 if (e.IsFloatValue())
2668 {
2669 char buf[32];
2670 snprintf(buf, sizeof(buf), "%g", (float)e);
2671 line += buf;
2672 }
2673 else if (e.IsIntValue())
2674 line += std::to_string((int)e);
2675 else
2676 {
2677 line += '"';
2678 line += e.GetValue().Data();
2679 line += '"';
2680 }
2681 ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.8f, 0.8f, 1.0f, 1.0f));
2682 ImGui::TextUnformatted(line.c_str());
2683 ImGui::PopStyleColor();

Callers 1

renderConfigClassTreeMethod · 0.85

Calls 10

minFunction · 0.85
IsArrayMethod · 0.45
DataMethod · 0.45
GetNameMethod · 0.45
GetSizeMethod · 0.45
IsFloatValueMethod · 0.45
GetFloatMethod · 0.45
IsIntValueMethod · 0.45
GetIntMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected