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); }
public bool Initialize(ImGuiIOPtr io) { InputSystem.onDeviceChange += OnDeviceChange; // listen to keyboard device and layout changes io.SetBackendPlatformName("Unity Input System"); // setup backend info and capabilities io.BackendFlags |= ImGuiBackendFlags.HasMouseCursors; // can honor GetMouseCursor() values io.BackendFlags |= ImGuiBackendFlags.HasSetMousePos; // can honor io.WantSetMousePos requests // io.BackendFlags |= ImGuiBackendFlags.HasGamepad; // set by UpdateGamepad() _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, Keyboard.current); // sets key mapping, text input, and IME return(true); }