Package org.lwjgl

Class Sys


  • public final class Sys
    extends java.lang.Object

    System class (named Sys so as not to conflict with java.lang.System)

    Version:
    $Revision$ $Id$
    Author:
    cix_foo
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void alert​(java.lang.String title, java.lang.String message)
      Attempt to display a modal alert to the user.
      static java.lang.String getClipboard()
      Get the contents of the system clipboard.
      static long getTime()
      Gets the current value of the hires timer, in ticks.
      static long getTimerResolution()
      Obtains the number of ticks that the hires timer does in a second.
      static java.lang.String getVersion()
      Return the version of the core LWJGL libraries as a String.
      static void initialize()
      Initialization.
      static boolean is64Bit()
      Returns true if a 64bit implementation was loaded.
      static boolean openURL​(java.lang.String url)
      Open the system web browser and point it at the specified URL.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getVersion

        public static java.lang.String getVersion()
        Return the version of the core LWJGL libraries as a String.
      • initialize

        public static void initialize()
        Initialization. This is just a dummy method to trigger the static constructor.
      • is64Bit

        public static boolean is64Bit()
        Returns true if a 64bit implementation was loaded.
      • getTimerResolution

        public static long getTimerResolution()
        Obtains the number of ticks that the hires timer does in a second. This method is fast; it should be called as frequently as possible, as it recalibrates the timer.
        Returns:
        timer resolution in ticks per second or 0 if no timer is present.
      • getTime

        public static long getTime()
        Gets the current value of the hires timer, in ticks. When the Sys class is first loaded the hires timer is reset to 0. If no hires timer is present then this method will always return 0.

        NOTEZ BIEN that the hires timer WILL wrap around.

        Returns:
        the current hires time, in ticks (always >= 0)
      • alert

        public static void alert​(java.lang.String title,
                                 java.lang.String message)
        Attempt to display a modal alert to the user. This method should be used when a game fails to initialize properly or crashes out losing its display in the process. It is provided because AWT may not be available on the target platform, although on Mac and Linux and other platforms supporting AWT we delegate the task to AWT instead of doing it ourselves.

        The alert should display the title and the message and then the current thread should block until the user dismisses the alert - typically with an OK button click.

        It may be that the user's system has no windowing system installed for some reason, in which case this method may do nothing at all, or attempt to provide some console output.

        Parameters:
        title - The title of the alert. We suggest using the title of your game.
        message - The message text for the alert.
      • openURL

        public static boolean openURL​(java.lang.String url)
        Open the system web browser and point it at the specified URL. It is recommended that this not be called whilst your game is running, but on application exit in a shutdown hook, as the screen resolution will not be reset when the browser is brought into view.

        There is no guarantee that this will work, nor that we can detect if it has failed - hence we don't return success code or throw an Exception. This is just a best attempt at opening the URL given - don't rely on it to work!

        Parameters:
        url - The URL. Ensure that the URL is properly encoded.
        Returns:
        false if we are CERTAIN the call has failed
      • getClipboard

        public static java.lang.String getClipboard()
        Get the contents of the system clipboard. The system might not have a clipboard (particularly if it doesn't even have a keyboard) in which case we return null. Otherwise we return a String, which may be the empty string "".
        Returns:
        a String, or null if there is no system clipboard.