コード例 #1
0
        public bool Initialize(ImGuiIOPtr io)
        {
            io.SetBackendPlatformName("Unity Input Manager");                               // setup backend info and capabilities
            io.BackendFlags |= ImGuiBackendFlags.HasMouseCursors;                           // can honor GetMouseCursor() values
            io.BackendFlags &= ~ImGuiBackendFlags.HasSetMousePos;                           // can't honor io.WantSetMousePos requests
            // io.BackendFlags |= ImGuiBackendFlags.HasGamepad;
            // set by UpdateGamepad()
            unsafe
            {
#if IMGUI_FEATURE_CUSTOM_ASSERT
                PlatformCallbacks.SetClipboardFunctions(
                    GetClipboardTextCallback,
                    SetClipboardTextCallback,
                    LogAssertCallback,
                    DebugBreakCallback);
#else
                PlatformCallbacks.SetClipboardFunctions(
                    GetClipboardTextCallback,
                    SetClipboardTextCallback);
#endif
            }

            _callbacks.Assign(io);                                                          // assign platform callbacks
            io.ClipboardUserData = IntPtr.Zero;

            if (_iniSettings != null)                                                       // ini settings
            {
                io.SetIniFilename(null);                                                    // handle ini saving manually
                ImGui.LoadIniSettingsFromMemory(_iniSettings.Load());                       // call after CreateContext(), before first call to NewFrame()
            }

            SetupKeyboard(io);                                                              // sets key mapping, text input, and IME

            return(true);
        }