using System; using System.Numerics; using System.Runtime.InteropServices; namespace ImGuiNET { [StructLayout(LayoutKind.Sequential)] public unsafe struct NativeIO { //------------------------------------------------------------------ // Settings (fill once) //------------------------------------------------------------------ /// /// Display size, in pixels. For clamping windows positions. /// Default value: [unset] /// public Vector2 DisplaySize; /// /// Time elapsed since last frame, in seconds. /// Default value: 1.0f / 10.0f. /// public float DeltaTime; /// /// Maximum time between saving positions/sizes to .ini file, in seconds. /// Default value: 5.0f. /// public float IniSavingRate; /// /// Path to .ini file. NULL to disable .ini saving. /// Default value: "imgui.ini" /// public IntPtr IniFilename; /// /// Path to .log file (default parameter to ImGui::LogToFile when no file is specified). /// Default value: "imgui_log.txt" /// public IntPtr LogFilename; /// /// Time for a double-click, in seconds. /// Default value: 0.30f. /// public float MouseDoubleClickTime; /// /// Distance threshold to stay in to validate a double-click, in pixels. /// Default Value: 6.0f. /// public float MouseDoubleClickMaxDist; /// /// Distance threshold before considering we are dragging. /// Default Value: 6.0f. /// public float MouseDragThreshold; /// /// Map of indices into the KeysDown[512] entries array. /// Default values: [unset] /// public fixed int KeyMap[(int)GuiKey.Count]; /// /// When holding a key/button, time before it starts repeating, in seconds. (for actions where 'repeat' is active). /// Default value: 0.250f. /// public float KeyRepeatDelay; /// /// When holding a key/button, rate at which it repeats, in seconds. /// Default value: 0.020f. /// public float KeyRepeatRate; /// /// Store your own data for retrieval by callbacks. /// Default value: IntPtr.Zero. /// public IntPtr UserData; /// /// Load and assemble one or more fonts into a single tightly packed texture. Output to Fonts array. /// Default value: [auto] /// public FontAtlas* FontAtlas; /// /// Global scale all fonts. /// Default value: 1.0f. /// public float FontGlobalScale; /// /// Allow user scaling text of individual window with CTRL+Wheel. /// Default value: false. /// public byte FontAllowUserScaling; /// /// For retina display or other situations where window coordinates are different from framebuffer coordinates. /// User storage only, presently not used by ImGui. /// Default value: (1.0f, 1.0f). /// public Vector2 DisplayFramebufferScale; /// /// If you use DisplaySize as a virtual space larger than your screen, set DisplayVisibleMin/Max to the visible area. /// Default value: (0.0f, 0.0f) /// public Vector2 DisplayVisibleMin; /// /// If the values are the same, we defaults to Min=0.0f) and Max=DisplaySize. /// Default value: (0.0f, 0.0f). /// public Vector2 DisplayVisibleMax; // (0.0f,0.0f) // If the values are the same, we defaults to Min=(0.0f) and Max=DisplaySize //------------------------------------------------------------------ // User Functions //------------------------------------------------------------------ /// /// Rendering function, will be called in Render(). /// Alternatively you can keep this to NULL and call GetDrawData() after Render() to get the same pointer. /// public IntPtr RenderDrawListsFn; /// /// Optional: access OS clipboard /// (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures) /// public IntPtr GetClipboardTextFn; /// /// Optional: access OS clipboard /// (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures) /// public IntPtr SetClipboardTextFn; /// /// Optional: override memory allocations. MemFreeFn() may be called with a NULL pointer. /// (default to posix malloc/free) /// public IntPtr MemAllocFn; /// /// Optional: override memory allocations. MemFreeFn() may be called with a NULL pointer. /// (default to posix malloc/free) /// public IntPtr MemFreeFn; /// /// Optional: notify OS Input Method Editor of the screen position of your cursor for text input position (e.g. when using Japanese/Chinese IME in Windows) /// (default to use native imm32 api on Windows) /// public IntPtr ImeSetInputScreenPosFn; /// /// (Windows) Set this to your HWND to get automatic IME cursor positioning. /// public IntPtr ImeWindowHandle; //------------------------------------------------------------------ // Input - Fill before calling NewFrame() //------------------------------------------------------------------ /// /// Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.). /// public Vector2 MousePos; /// /// Mouse buttons: left, right, middle + extras. /// ImGui itself mostly only uses left button (BeginPopupContext** are using right button). /// Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API. /// public fixed byte MouseDown[5]; /// /// Mouse wheel: 1 unit scrolls about 5 lines text. /// public float MouseWheel; /// /// Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor). /// public byte MouseDrawCursor; /// /// Keyboard modifier pressed: Control. /// public byte KeyCtrl; /// /// Keyboard modifier pressed: Shift /// public byte KeyShift; /// /// Keyboard modifier pressed: Alt /// public byte KeyAlt; /// /// Keyboard keys that are pressed (in whatever storage order you naturally have access to keyboard data) /// public fixed byte KeysDown[512]; /// /// List of characters input (translated by user from keypress+keyboard state). /// Fill using AddInputCharacter() helper. /// public fixed ushort InputCharacters[16 + 1]; //------------------------------------------------------------------ // Output - Retrieve after calling NewFrame(), you can use them to discard inputs or hide them from the rest of your application //------------------------------------------------------------------ /// /// Mouse is hovering a window or widget is active (= ImGui will use your mouse input). /// public byte WantCaptureMouse; /// /// Widget is active (= ImGui will use your keyboard input). /// public byte WantCaptureKeyboard; /// /// Some text input widget is active, which will read input characters from the InputCharacters array. /// public byte WantTextInput; /// /// Framerate estimation, in frame per second. Rolling average estimation based on IO.DeltaTime over 120 frames. /// public float Framerate; /// /// Number of active memory allocations. /// public int MetricsAllocs; /// /// Vertices output during last call to Render(). /// public int MetricsRenderVertices; /// /// Indices output during last call to Render() = number of triangles * 3 /// public int MetricsRenderIndices; /// /// Number of visible windows (exclude child windows) /// public int MetricsActiveWindows; //------------------------------------------------------------------ // [Internal] ImGui will maintain those fields for you //------------------------------------------------------------------ /// /// Previous mouse position /// public Vector2 MousePosPrev; /// /// Mouse delta. Note that this is zero if either current or previous position are negative to allow mouse enabling/disabling. /// public Vector2 MouseDelta; /// /// Mouse button went from !Down to Down /// public fixed byte MouseClicked[5]; /// /// Position at time of clicking /// public Vector2 MouseClickedPos0; /// /// Position at time of clicking /// public Vector2 MouseClickedPos1; /// /// Position at time of clicking /// public Vector2 MouseClickedPos2; /// /// Position at time of clicking /// public Vector2 MouseClickedPos3; /// /// Position at time of clicking /// public Vector2 MouseClickedPos4; /// /// Time of last click (used to figure out double-click) /// public fixed float MouseClickedTime[5]; /// /// Has mouse button been double-clicked? /// public fixed byte MouseDoubleClicked[5]; /// /// Mouse button went from Down to !Down /// public fixed byte MouseReleased[5]; /// /// Track if button was clicked inside a window. /// We don't request mouse capture from the application if click started outside ImGui bounds. /// public fixed byte MouseDownOwned[5]; /// /// Duration the mouse button has been down (0.0f == just clicked). /// public fixed float MouseDownDuration[5]; /// /// Previous time the mouse button has been down /// public fixed float MouseDownDurationPrev[5]; /// /// Squared maximum distance of how much mouse has traveled from the click point /// public fixed float MouseDragMaxDistanceSqr[5]; /// /// Duration the keyboard key has been down (0.0f == just pressed) /// public fixed float KeysDownDuration[512]; /// /// Previous duration the key has been down /// public fixed float KeysDownDurationPrev[512]; } }