Record Class KeyMods

java.lang.Object
java.lang.Record
io.github.ocelot.window.input.KeyMods
Record Components:
mods - The raw modifiers bitfield
shift - Whether Left or Right shift is held
control - Whether Left or Right control is held
alt - Whether Left or Right alt is held
superKey - Whether the platform super key is held. This is the Windows key on Windows and the super key on Mac.
caps - Whether caps lock is active
numLock - Whether num lock is active

public record KeyMods(int mods, boolean shift, boolean control, boolean alt, boolean superKey, boolean caps, boolean numLock) extends Record
Boolean representations of each key modifier passed from GLFW.
  • Constructor Summary

    Constructors
    Constructor
    Description
    KeyMods(int mods)
     
    KeyMods(int mods, boolean shift, boolean control, boolean alt, boolean superKey, boolean caps, boolean numLock)
    Creates an instance of a KeyMods record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    alt()
    Returns the value of the alt record component.
    boolean
    Returns the value of the caps record component.
    boolean
    Returns the value of the control record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the mods record component.
    boolean
    Returns the value of the numLock record component.
    boolean
    Returns the value of the shift record component.
    boolean
    Returns the value of the superKey record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • KeyMods

      public KeyMods(int mods)
    • KeyMods

      public KeyMods(int mods, boolean shift, boolean control, boolean alt, boolean superKey, boolean caps, boolean numLock)
      Creates an instance of a KeyMods record class.
      Parameters:
      mods - the value for the mods record component
      shift - the value for the shift record component
      control - the value for the control record component
      alt - the value for the alt record component
      superKey - the value for the superKey record component
      caps - the value for the caps record component
      numLock - the value for the numLock record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • mods

      public int mods()
      Returns the value of the mods record component.
      Returns:
      the value of the mods record component
    • shift

      public boolean shift()
      Returns the value of the shift record component.
      Returns:
      the value of the shift record component
    • control

      public boolean control()
      Returns the value of the control record component.
      Returns:
      the value of the control record component
    • alt

      public boolean alt()
      Returns the value of the alt record component.
      Returns:
      the value of the alt record component
    • superKey

      public boolean superKey()
      Returns the value of the superKey record component.
      Returns:
      the value of the superKey record component
    • caps

      public boolean caps()
      Returns the value of the caps record component.
      Returns:
      the value of the caps record component
    • numLock

      public boolean numLock()
      Returns the value of the numLock record component.
      Returns:
      the value of the numLock record component