Class Prefs.Save

  • Enclosing class:
    Prefs

    public static class Prefs.Save
    extends java.lang.Object
    Static class used to save data
    • Constructor Summary

      Constructors 
      Constructor Description
      Save()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void close()
      Setting the flag to say that the data has been writen.
      static void open()
      This method does nothing, but each transaction should start with open and end with close()
      static void putArray​(java.lang.String key, java.lang.Float[] f)
      Store an array of Float.
      static void putBoatType​(java.lang.String key, BoatType b)
      Store BoatType.
      static void putFloat​(java.lang.String key, float f)
      Store a float
      static void putInteger​(java.lang.String key, int i)
      Store an int
      static void putVector2​(java.lang.String key, com.badlogic.gdx.math.Vector2 v)
      Store a Vector2.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Save

        public Save()
    • Method Detail

      • open

        public static void open()
        This method does nothing, but each transaction should start with open and end with close()
      • close

        public static void close()
        Setting the flag to say that the data has been writen. Also flushes the data to a file.
      • putInteger

        public static void putInteger​(java.lang.String key,
                                      int i)
        Store an int
        Parameters:
        key - key the int should be stored under
        i - int to be stored
      • putFloat

        public static void putFloat​(java.lang.String key,
                                    float f)
        Store a float
        Parameters:
        key - key the float should be stored under
        f - int to be stored
      • putArray

        public static void putArray​(java.lang.String key,
                                    java.lang.Float[] f)
        Store an array of Float. Array is first serialized to JSON then stored as a string.
        Parameters:
        key - key the array should be stored under
        f - array to be stored
      • putVector2

        public static void putVector2​(java.lang.String key,
                                      com.badlogic.gdx.math.Vector2 v)
        Store a Vector2. Stored as 2 fields with x and y added for differentiation.
        Parameters:
        key - key the vector should be stored under
        v - vector to be stored
      • putBoatType

        public static void putBoatType​(java.lang.String key,
                                       BoatType b)
        Store BoatType. Stored as an integer.
        Parameters:
        key - key the BoatType should be stored under.
        b - BoatType to be stored.