Input::Mouse

Mouse Input Handling in Unified Engine

The Unified Engine facilitates detailed mouse input tracking and management via classes dedicated to cursor control, button presses, scroll actions, and mouse movement.

Mouse Button Enumeration

An enumeration to capture mouse button inputs, covering both main and additional buttons.

enum MouseButtonEnums{
    //Main
    Mouse_LEFT = GLFW_MOUSE_BUTTON_LEFT,
    Mouse_RIGHT = GLFW_MOUSE_BUTTON_RIGHT,
    Mouse_MIDDLE = GLFW_MOUSE_BUTTON_MIDDLE,
    
    //Extra
    Mouse_1 = GLFW_MOUSE_BUTTON_1,
    Mouse_2 = GLFW_MOUSE_BUTTON_2,
    Mouse_3 = GLFW_MOUSE_BUTTON_3,
    Mouse_4 = GLFW_MOUSE_BUTTON_4,
    Mouse_5 = GLFW_MOUSE_BUTTON_5,
    Mouse_6 = GLFW_MOUSE_BUTTON_6,
    Mouse_7 = GLFW_MOUSE_BUTTON_7,
    Mouse_8 = GLFW_MOUSE_BUTTON_8,
};

Cursor Controller

Manages the cursor's lock state in the game window. Useful for scenarios where the cursor needs to be confined to the center or freed.

class CursorController{
    private:
        GLFWwindow* window;
    public:
        bool isLocked;
        CursorController(GLFWwindow* window);
        void Locked();
        void Free();
};

Mouse Controller

A comprehensive class that integrates cursor control with mouse button presses, position tracking, and scroll actions.

class MouseController{
    private:
        ...
    public:
        CursorController Cursor;
        MouseController(GLFWwindow* window, glm::ivec2 FB);
        bool MousePressed(MouseButtonEnums key);
        glm::vec2 GetPosition();
        int Scroll();
        void setScroll(double x, double y);
};

Last updated