======================================== Pointer Test ========================================
| 373 | // Pointer Test |
| 374 | // ======================================== |
| 375 | static void pointer_test() { |
| 376 | const std::string name = "Pointer"; |
| 377 | |
| 378 | ImGui::SeparatorText((name + "*").c_str()); |
| 379 | ImGui::PushID((name + "*").c_str()); |
| 380 | ImGui::Indent(); |
| 381 | |
| 382 | static int my_value = 42; |
| 383 | static int* invalid_ptr = nullptr; |
| 384 | static int* my_ptr = invalid_ptr; |
| 385 | |
| 386 | ImGui::Text("Pointer - nullptr"); |
| 387 | HelpMarker("Pointer is nullptr, nothing to edit"); |
| 388 | { |
| 389 | ImReflect::Input("my_ptr", invalid_ptr); |
| 390 | } |
| 391 | |
| 392 | ImGui::NewLine(); |
| 393 | |
| 394 | ImGui::Text("Pointer - valid"); |
| 395 | HelpMarker("Pointer is valid, you can edit the value it points to"); |
| 396 | { |
| 397 | my_ptr = &my_value; |
| 398 | ImReflect::Input("my_ptr", my_ptr); |
| 399 | } |
| 400 | |
| 401 | ImGui::Unindent(); |
| 402 | ImGui::PopID(); |
| 403 | } |
| 404 | |
| 405 | // ======================================== |
| 406 | // Simple Test |
no test coverage detected