Class OsUtils

java.lang.Object
gaiasky.util.scene2d.OsUtils

public class OsUtils extends Object
Operating system related utils.
  • Constructor Details

    • OsUtils

      public OsUtils()
  • Method Details

    • isWindows

      public static boolean isWindows()
      Returns:
      true if the current OS is Windows
    • isMac

      public static boolean isMac()
      Returns:
      true if the current OS is Mac
    • isUnix

      public static boolean isUnix()
      Returns:
      true if the current OS is Unix
    • isIos

      public static boolean isIos()
      Returns:
      true if the current OS is iOS
    • isAndroid

      public static boolean isAndroid()
      Returns:
      true if the current OS is Android
    • getAndroidApiLevel

      public static int getAndroidApiLevel()
      Returns the Android API level it's basically the same as android.os.Build.VERSION.SDK_INT
      Returns:
      the API level. Returns 0 if the current OS isn't Android
    • getShortcutFor

      public static String getShortcutFor(int... keycodes)
      Creates platform dependant shortcut text. Converts int keycodes to String text. Eg. Keys.CONTROL_LEFT, Keys.SHIFT_LEFT, Keys.F5 will be converted to Ctrl+Shift+F5 on Windows and Linux, and to ⌘⇧F5 on Mac.

      CONTROL_LEFT and CONTROL_RIGHT and SYM are mapped to Ctrl. The same goes for Alt (ALT_LEFT, ALT_RIGHT) and Shift (SHIFT_LEFT, SHIFT_RIGHT).

      Keycodes equal to Integer.MIN_VALUE will be ignored.

      Parameters:
      keycodes - keycodes from Input.Keys that are used to create shortcut text
      Returns:
      the platform dependent shortcut text