Class Mouse


  • public class Mouse
    extends Object
    Class to manage the cursor and get mouse inputs
    Author:
    Darius Dinger
    • Constructor Detail

      • Mouse

        public Mouse()
    • Method Detail

      • update

        public static void update()
        Update the mouse and go to thenext frame. Should be called once per frame
      • isVisible

        public static boolean isVisible()
        Returns:
        Is mouse cursor visible at the moment
      • setVisible

        public static void setVisible​(boolean visible)
        Setting mouse cursor visibility.
        true = visible
        false = invisible
        Parameters:
        visible - New visibility
      • setGrabbed

        public static void setGrabbed​(boolean grabbed)
        Parameters:
        grabbed - Grab mouse at the center of the screen (true), or not(false)
      • isGrabbed

        public static boolean isGrabbed()
        Returns:
        Is mouse currently grabbed at the center of the screen
      • isButtonPressed

        public static boolean isButtonPressed​(int buttonCode)
        Check if the button is pressed at the moment.
        Returns false, if button code is out of range!
        Parameters:
        buttonCode - Code of the button to check
        Returns:
        True if the button is pressed, else false
      • getDWheel

        public static double getDWheel()
        Returns:
        Vertical delta mouse wheel scroll offset since last frame
      • getDx

        public static float getDx()
        Returns:
        Delta mouse position offset since last frame x
      • getDy

        public static float getDy()
        Returns:
        Delta mouse position offset since last frame y
      • getPosx

        public static float getPosx()
        Returns:
        Current mouse position x
      • getPosy

        public static float getPosy()
        Returns:
        Current mouse position y