Package org.xjge.core

Class Hardware

java.lang.Object
org.xjge.core.Hardware

public final class Hardware
extends java.lang.Object
Provides utilities to manage the state of various connected peripheral devices not directly related to user input.
Since:
2.0.0
  • Constructor Summary

    Constructors
    Constructor Description
    Hardware()  
  • Method Summary

    Modifier and Type Method Description
    static java.util.NavigableMap<java.lang.Integer,​Monitor> findMonitors()
    Finds every available display device currently connected to the system and returns them in a collection.
    static java.util.NavigableMap<java.lang.Integer,​Speaker> findSpeakers()
    Finds every available audio device currently connected to the system and returns them in a collection.
    static Monitor getCurrentMonitor()
    Obtains an object which represents the current monitor the window is using.
    static Speaker getCurrentSpeaker()
    Obtains the current Speaker the engine is using for audio output.
    static int getNumMonitors()
    Provides the amount of currently connected display devices.
    static int getNumSpeakers()
    Provides the amount of currently connected audio devices.
    static boolean getVSyncEnabled()
    Obtains a value indicating whether or not vertical sync is enabled.
    static void setSpeaker​(java.lang.String operation)
    Sets the current audio device the engine will use.
    static void setVSyncEnabled​(boolean vSyncEnabled)
    Determines whether the application will take advantage of vertical sync (or VSync) while rendering frames.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Hardware

      public Hardware()
  • Method Details

    • findSpeakers

      public static final java.util.NavigableMap<java.lang.Integer,​Speaker> findSpeakers()
      Finds every available audio device currently connected to the system and returns them in a collection.
      Returns:
      an immutable collection of available audio devices
    • findMonitors

      public static final java.util.NavigableMap<java.lang.Integer,​Monitor> findMonitors()
      Finds every available display device currently connected to the system and returns them in a collection.
      Returns:
      an immutable collection of available display devices
    • getNumMonitors

      public static int getNumMonitors()
      Provides the amount of currently connected display devices.
      Returns:
      the number of available display devices
    • getNumSpeakers

      public static int getNumSpeakers()
      Provides the amount of currently connected audio devices.
      Returns:
      the number of available audio devices
    • getVSyncEnabled

      public static boolean getVSyncEnabled()
      Obtains a value indicating whether or not vertical sync is enabled.
      Returns:
      true if vertical sync is currently enabled
    • getCurrentMonitor

      public static Monitor getCurrentMonitor()
      Obtains an object which represents the current monitor the window is using. This method is identical in function to Window.getMonitor().
      Returns:
      the current monitor object of the window
    • getCurrentSpeaker

      public static Speaker getCurrentSpeaker()
      Obtains the current Speaker the engine is using for audio output.
      Returns:
      an object that represents a peripheral audio device
    • setVSyncEnabled

      public static void setVSyncEnabled​(boolean vSyncEnabled)
      Determines whether the application will take advantage of vertical sync (or VSync) while rendering frames. VSync is enabled by default on startup.
      Parameters:
      vSyncEnabled - if true, vertical sync will be enabled
    • setSpeaker

      public static void setSpeaker​(java.lang.String operation)
      Sets the current audio device the engine will use.

      NOTE: Using this method will update the collection of audio devices available to the engine and change the current OpenAL context. This action will require all sounds and music previously loaded into memory to be reloaded which may cause brief but noticeable stutter while the audio data is being transferred.

      Parameters:
      operation - the method of traversal to use. Either explicitly as the ID number of the device or "prev/next" to move between the previous and next devices in the collection respectively.