imgui_impl_osx.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // dear imgui: Platform Backend for OSX / Cocoa
  2. // This needs to be used along with a Renderer (e.g. OpenGL2, OpenGL3, Vulkan, Metal..)
  3. // [ALPHA] Early backend, not well tested. If you want a portable application, prefer using the GLFW or SDL platform Backends on Mac.
  4. // Implemented features:
  5. // [X] Platform: Mouse cursor shape and visibility. Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
  6. // [X] Platform: Keyboard support. Since 1.87 we are using the io.AddKeyEvent() function. Pass ImGuiKey values to all key functions e.g. ImGui::IsKeyPressed(ImGuiKey_Space). [Legacy kVK_* values will also be supported unless IMGUI_DISABLE_OBSOLETE_KEYIO is set]
  7. // [X] Platform: OSX clipboard is supported within core Dear ImGui (no specific code in this backend).
  8. // [X] Platform: Gamepad support. Enabled with 'io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad'.
  9. // [X] Platform: IME support.
  10. // [X] Platform: Multi-viewport / platform windows.
  11. // You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
  12. // Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
  13. // If you are new to Dear ImGui, read documentation from the docs/ folder + read the top of imgui.cpp.
  14. // Read online: https://github.com/ocornut/imgui/tree/master/docs
  15. #include "imgui.h" // IMGUI_IMPL_API
  16. #ifdef __OBJC__
  17. @class NSEvent;
  18. @class NSView;
  19. IMGUI_IMPL_API bool ImGui_ImplOSX_Init(NSView* _Nonnull view);
  20. IMGUI_IMPL_API void ImGui_ImplOSX_Shutdown();
  21. IMGUI_IMPL_API void ImGui_ImplOSX_NewFrame(NSView* _Nullable view);
  22. #endif
  23. //-----------------------------------------------------------------------------
  24. // C++ API
  25. //-----------------------------------------------------------------------------
  26. #ifdef IMGUI_IMPL_METAL_CPP_EXTENSIONS
  27. // #include <AppKit/AppKit.hpp>
  28. #ifndef __OBJC__
  29. IMGUI_IMPL_API bool ImGui_ImplOSX_Init(void* _Nonnull view);
  30. IMGUI_IMPL_API void ImGui_ImplOSX_Shutdown();
  31. IMGUI_IMPL_API void ImGui_ImplOSX_NewFrame(void* _Nullable view);
  32. #endif
  33. #endif