pikaImgui.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #pragma once
  2. #include <pikaConfig.h>
  3. #include "imgui.h"
  4. #include "backends/imgui_impl_glfw.h"
  5. #include "backends/imgui_impl_opengl3.h"
  6. #include "imguiThemes.h"
  7. #include <IconsForkAwesome.h>
  8. #include <pikaAllocator/freeListAllocator.h>
  9. #include <pikaContext.h>
  10. #ifdef PIKA_WINDOWS
  11. #define IM_PRId64 "I64d"
  12. #define IM_PRIu64 "I64u"
  13. #define IM_PRIx64 "I64X"
  14. #else
  15. #define IM_PRId64 "lld"
  16. #define IM_PRIu64 "llu"
  17. #define IM_PRIx64 "llX"
  18. #endif
  19. namespace pika
  20. {
  21. namespace pikaImgui
  22. {
  23. void *imguiCustomAlloc(size_t sz, void *user_data);
  24. void imguiCustomFree(void *ptr, void *user_data);
  25. void setImguiAllocator(pika::memory::FreeListAllocator &allocator);
  26. void initImgui(PikaContext &pikaContext);
  27. void setImguiContext(PikaContext pikaContext);
  28. void imguiStartFrame(PikaContext pikaContext);
  29. void imguiEndFrame(PikaContext pikaContext);
  30. namespace EditorImguiIds
  31. {
  32. enum
  33. {
  34. idsCount = 4000
  35. };
  36. }
  37. struct ImGuiIdsManager
  38. {
  39. int counter = EditorImguiIds::idsCount + 1;
  40. //returns the first id. (count) ids will be reserved.
  41. //if you want 5 ids and the function returns 10, then ids 10 11 12 13 14 will be reserved.
  42. int getImguiIds(unsigned int count = 1)
  43. {
  44. if (count == 0) { return 0; }
  45. return counter + count;
  46. }
  47. };
  48. void addErrorSymbol();
  49. void addWarningSymbol();
  50. void helpMarker(const char *desc);
  51. //todo another namespace for pika imgui adons
  52. void alignForWidth(float width, float alignment = 0.5f);
  53. void displayMemorySizeValue(size_t value);
  54. //todo move to internal
  55. void displayMemorySizeToggle();
  56. };
  57. };