======================================== std::tuple ========================================
| 1199 | // std::tuple |
| 1200 | // ======================================== |
| 1201 | static void tuple_test() { |
| 1202 | ImGui::SeparatorText("std::tuple Test"); |
| 1203 | ImGui::PushID("tuple_test"); |
| 1204 | ImGui::Indent(); |
| 1205 | static std::tuple<int, float, std::string> my_tuple = { 42, 3.14f, "Hello" }; |
| 1206 | ImGui::Text("Default"); |
| 1207 | HelpMarker("Default settings, no extra settings given"); |
| 1208 | { |
| 1209 | ImGui::PushID("default"); |
| 1210 | |
| 1211 | ImSettings config; |
| 1212 | config.push<std::tuple>() |
| 1213 | .as_dropdown(true) |
| 1214 | .pop(); |
| 1215 | |
| 1216 | ImReflect::Input("my_tuple", my_tuple, config); |
| 1217 | ImGui::PopID(); |
| 1218 | } |
| 1219 | ImGui::Text("Tuple inside of tuple"); |
| 1220 | HelpMarker("You can also nest tuples"); |
| 1221 | { |
| 1222 | ImGui::PushID("nested tuple"); |
| 1223 | static std::tuple<std::tuple<std::string, float>, int> nested_tuple = { {"Nested", 3.14f}, 7 }; |
| 1224 | ImSettings config; |
| 1225 | config.push<std::tuple>() |
| 1226 | ____.as_dropdown(false) |
| 1227 | ____.push<float>() |
| 1228 | ________.min(0.0f) |
| 1229 | ________.max(10.0f) |
| 1230 | ________.as_slider() |
| 1231 | ____.pop() |
| 1232 | ____.push<std::string>() |
| 1233 | ________.as_multiline() |
| 1234 | ________.auto_resize() |
| 1235 | ____.pop() |
| 1236 | .pop(); |
| 1237 | ImReflect::Input("nested_tuple", nested_tuple, config); |
| 1238 | ImGui::PopID(); |
| 1239 | } |
| 1240 | ImGui::Text("Tuple of tuples"); |
| 1241 | HelpMarker("You can also nest tuples"); |
| 1242 | { |
| 1243 | ImGui::PushID("tuple of tuples"); |
| 1244 | static std::tuple<std::tuple<int, int>, std::tuple<std::string, std::string>> tuple_of_tuples = { {1, 2}, {"Hello", "World"} }; |
| 1245 | ImReflect::Input("tuple_of_tuples", tuple_of_tuples); |
| 1246 | ImGui::PopID(); |
| 1247 | } |
| 1248 | ImGui::Text("5 levels of tuples"); |
| 1249 | HelpMarker("You can also nest tuples"); |
| 1250 | { |
| 1251 | ImGui::PushID("5 levels of tuples"); |
| 1252 | using tuple5 = std::tuple<int, std::tuple<int, std::tuple<int, std::tuple<std::string, std::tuple<int, int>>>>>; |
| 1253 | static tuple5 five_levels_of_tuples = { 1, { 2, { 3, { "Deep", { 4, 5 } } } } }; |
| 1254 | ImSettings config; |
| 1255 | config.push<std::string>() |
| 1256 | .as_multiline() |
| 1257 | .auto_resize() |
| 1258 | .pop() |
no test coverage detected