| 87 | } |
| 88 | |
| 89 | void drawProperties() |
| 90 | { |
| 91 | |
| 92 | if (selected_node == nullptr) |
| 93 | { |
| 94 | ImGui::Text("Select a node to edit its properties :-)"); |
| 95 | return; |
| 96 | } |
| 97 | |
| 98 | if (ImGui::Button("Copy JSON")) |
| 99 | { |
| 100 | NodeSerializer::copyNodeJsonToClipboard(selected_node); |
| 101 | } |
| 102 | ImGui::SameLine(); |
| 103 | |
| 104 | if (ImGui::Button("Delete")) |
| 105 | { |
| 106 | selected_node->removeFromParentAndCleanup(true); |
| 107 | ImGui::TreePop(); |
| 108 | ImGui::TreePop(); |
| 109 | return; |
| 110 | } |
| 111 | ImGui::SameLine(); |
| 112 | if (ImGui::Button("Add Child")) |
| 113 | { |
| 114 | ImGui::OpenPopup("Add Child"); |
| 115 | } |
| 116 | |
| 117 | if (ImGui::BeginPopupModal("Add Child")) |
| 118 | { |
| 119 | static int item = 0; |
| 120 | ImGui::Combo("Node", &item, "Node\0LabelBMFont\0LabelTTF\0Sprite\0MenuItemSpriteExtra\0"); |
| 121 | |
| 122 | static int tag = -1; |
| 123 | ImGui::InputInt("Tag", &tag); |
| 124 | |
| 125 | static char text[256]; |
| 126 | static char labelFont[256] = "bigFont.fnt"; |
| 127 | if (item == 1) |
| 128 | { |
| 129 | ImGui::InputText("Text", text, 256); |
| 130 | ImGui::InputText("Font", labelFont, 256); |
| 131 | } |
| 132 | static int fontSize = 20; |
| 133 | if (item == 2) |
| 134 | { |
| 135 | ImGui::InputText("Text", text, 256); |
| 136 | ImGui::InputInt("Font Size", &fontSize); |
| 137 | } |
| 138 | static bool frame = false; |
| 139 | if (item == 3 || item == 4) |
| 140 | { |
| 141 | ImGui::InputText("Texture", text, 256); |
| 142 | ImGui::Checkbox("Frame", &frame); |
| 143 | } |
| 144 | |
| 145 | ImGui::Separator(); |
| 146 | ImGui::SameLine(); |
no test coverage detected