// // GLFWCallbacks.cs // // Copyright (C) 2019 OpenTK // // This software may be modified and distributed under the terms // of the MIT license. See the LICENSE file for details. // using System; namespace OpenToolkit.GraphicsLibraryFramework { /// /// Class containing GLFW related callbacks. /// public static unsafe class GLFWCallbacks { /// /// The function signature for Unicode character callback functions. /// /// The window that received the event. /// The Unicode code point of the character. /// public delegate void CharCallback(Window* window, uint codepoint); /// /// The function signature for Unicode character with modifiers callback functions. /// It is called for each input character, regardless of what modifier keys are held down. /// /// The window that received the event. /// The Unicode code point of the character. /// Bit field describing which modifier keys were held down. /// public delegate void CharModsCallback(Window* window, uint codepoint, KeyModifiers modifiers); /// /// The function signature for cursor enter/leave callback functions. /// /// The window that received the event. /// true if the cursor entered the window's client area, or false if it left it. /// public delegate void CursorEnterCallback(Window* window, bool entered); /// /// The function signature for cursor position callback functions. /// /// The window that received the event. /// The new cursor x-coordinate, relative to the left edge of the client area. /// The new cursor y-coordinate, relative to the top edge of the client area. /// public delegate void CursorPosCallback(Window* window, double x, double y); /// /// The function signature for file drop callbacks. /// /// The window that received the event. /// The number of dropped files. /// The UTF-8 encoded file and/or directory path names. /// public delegate void DropCallback(Window* window, int count, byte** paths); /// /// The function signature for joystick configuration callback functions. /// /// The joystick that was connected or disconnected. /// /// One of or . /// /// public delegate void JoystickCallback(int joystick, ConnectedState state); /// /// The function signature for keyboard key callback functions. /// /// The window that received the event. /// The keyboard key that was pressed or released. /// The system-specific scancode of the key. /// The for that . /// Bit field describing which modifier keys were held down. /// public delegate void KeyCallback(Window* window, Keys key, int scanCode, InputAction action, KeyModifiers mods); /// /// The function signature for mouse button callback functions. /// /// The window that received the event. /// The mouse button that was pressed or released. /// One of or . /// Bit field describing which modifier keys were held down. /// public delegate void MouseButtonCallback(Window* window, MouseButton button, InputAction action, KeyModifiers mods); // TODO: Make enums for int params in callback /// /// The function signature for scroll callback functions. /// /// The window that received the event. /// The scroll offset along the x-axis. /// The scroll offset along the y-axis. /// public delegate void ScrollCallback(Window* window, double offsetX, double offsetY); /// /// The function signature for monitor configuration callback functions. /// /// The monitor that was connected or disconnected. /// /// One of or . /// /// public delegate void MonitorCallback(Monitor* monitor, ConnectedState state); /// /// The function signature for window close callback functions. /// /// The window that the user attempted to close. /// public delegate void WindowCloseCallback(Window* window); /// /// The function signature for window focus callback functions. /// /// The window that gained or lost input focus. /// true if the window was given input focus, or false if it lost it. /// public delegate void WindowFocusCallback(Window* window, bool focused); /// /// The function signature for window iconify/restore callback functions. /// /// The window that was iconified or restored. /// true if the window was iconified(minimized), or false if it was restored. /// public delegate void WindowIconifyCallback(Window* window, bool iconified); /// /// The function signature for window position callback functions. /// /// The window that was moved. /// /// The new x-coordinate, in screen coordinates, of the upper-left corner of the client area of the window. /// /// /// The new y-coordinate, in screen coordinates, of the upper-left corner of the client area of the window. /// /// public delegate void WindowPosCallback(Window* window, int x, int y); /// /// The function signature for window size callback functions. /// /// The window that was resized. /// The new width, in screen coordinates, of the window. /// The new height, in screen coordinates, of the window. /// public delegate void WindowSizeCallback(Window* window, int width, int height); /// /// The function signature for error callback functions. /// /// An error code. /// A UTF-8 encoded string describing the error. public delegate void ErrorCallback(ErrorCode error, string description); /// /// The function signature for window refresh functions. /// /// The window that needs to be refreshed. public delegate void WindowRefreshCallback(Window* window); /// /// This is the function pointer type for window content scale callbacks. /// /// The window whose content scale changed. /// The new x-axis content scale of the window. /// The new y-axis content scale of the window. /// public delegate void WindowContentScaleCallback(Window* window, float xscale, float yscale); } }