2.9 KB、58行 生 Blame 履歴
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// - Not well tested. If you want a portable application, prefer using the GLFW or SDL platform Backends on Mac.
4// - Requires linking with the GameController framework ("-framework GameController").
5
6// Implemented features:
7// [X] Platform: Clipboard support is part of core Dear ImGui (no specific code in this backend).
8// [X] Platform: Mouse support. Can discriminate Mouse/Pen.
9// [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 are obsolete since 1.87 and not supported since 1.91.5]
10// [X] Platform: Gamepad support.
11// [X] Platform: Mouse cursor shape and visibility (ImGuiBackendFlags_HasMouseCursors). Disable with 'io.ConfigFlags |= ImGuiConfigFlags_NoMouseCursorChange'.
12// [X] Platform: IME support.
13// [x] Platform: Multi-viewport / platform windows.
14// Missing features or Issues:
15// [ ] Platform: Multi-viewport: Window size not correctly reported when enabling io.ConfigViewportsNoDecoration
16// [ ] Platform: Multi-viewport: Missing ImGuiBackendFlags_HasParentViewport support. The viewport->ParentViewportID field is ignored, and therefore io.ConfigViewportsNoDefaultParent has no effect either.
17
18// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
19// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
20// Learn about Dear ImGui:
21// - FAQ https://dearimgui.com/faq
22// - Getting Started https://dearimgui.com/getting-started
23// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
24// - Introduction, links and more at the top of imgui.cpp
25
26#pragma once
27#include "imgui.h" // IMGUI_IMPL_API
28#ifndef IMGUI_DISABLE
29
30#ifdef __OBJC__
31
32@class NSEvent;
33@class NSView;
34
35// Follow "Getting Started" link and check examples/ folder to learn about using backends!
36IMGUI_IMPL_API bool ImGui_ImplOSX_Init(NSView* _Nonnull view);
37IMGUI_IMPL_API void ImGui_ImplOSX_Shutdown();
38IMGUI_IMPL_API void ImGui_ImplOSX_NewFrame(NSView* _Nullable view);
39
40#endif
41
42//-----------------------------------------------------------------------------
43// C++ API
44//-----------------------------------------------------------------------------
45
46#ifdef IMGUI_IMPL_METAL_CPP_EXTENSIONS
47// #include <AppKit/AppKit.hpp>
48#ifndef __OBJC__
49
50// Follow "Getting Started" link and check examples/ folder to learn about using backends!
51IMGUI_IMPL_API bool ImGui_ImplOSX_Init(void* _Nonnull view);
52IMGUI_IMPL_API void ImGui_ImplOSX_Shutdown();
53IMGUI_IMPL_API void ImGui_ImplOSX_NewFrame(void* _Nullable view);
54
55#endif
56#endif
57
58#endif // #ifndef IMGUI_DISABLE