Esempio n. 1
0
        public unsafe GlfwInput(OpenToolkit.GraphicsLibraryFramework.Window *window)
        {
            _window = window;

            GLFW.GetCursorPos(_window, out double x, out double y);
            _mousePos = new Vector2((float)x, (float)y);

            GLFW.SetKeyCallback(window, KeyEvent);
            GLFW.SetCursorPosCallback(window, MouseEvent);
        }
Esempio n. 2
0
        // private readonly GLFWCallbacks.MouseButtonCallback _mouseButtonCallback;
        // private readonly GLFWCallbacks.CursorPosCallback _cursorPosCallback;

        internal Mouse(GlfwWindow *handle)
        {
            GLFW.GetCursorPos(handle, out var x, out var y);
            Position = new Vector2((float)x, (float)y);

            // Not sure if these are needed.
            // _mouseButtonCallback = MouseButtonCallback;
            GLFW.SetMouseButtonCallback(handle, MouseButtonCallback);
            // _cursorPosCallback = CursorPosCallback;
            GLFW.SetCursorPosCallback(handle, CursorPosCallback);
        }
Esempio n. 3
0
        public static void Update()
        {
            Point2d pos;

            GLFW.GetCursorPos(Game.Game.Window.Handle, out pos.X, out pos.Y);
            Position = pos;

            _currentButtons.Clear();
            foreach (MouseButton i in _allKeys)
            {
                if (GetButton(i))
                {
                    _currentButtons.Add(i);
                }
            }
        }