Package-level declarations

Functions

Link copied to clipboard
inline fun Preferences.flush(operations: Preferences.() -> Unit)

Calls Preferences.flush after executing the given operations.

Link copied to clipboard
inline operator fun <T> Preferences.get(key: String): T?

Retrieves a value of T type from the Preferences for the given key.

inline operator fun <T> Preferences.get(key: String, defaultValue: T): T

Retrieves a value of T type from the Preferences for the given key or returns the defaultValue if the key is absent.

Link copied to clipboard
fun Preferences.set(pair: Pair<String, Any>): Preferences

Stores any value under the given key in the Preferences. The first value of the pair is considered the key, while the second is treated as the value.

operator fun Preferences.set(key: String, value: Any): Preferences

Serializes any value as a JSON string and stores it under the given key in the Preferences. Note that value must be JSON-serializable - see the Json module for details.

operator fun Preferences.set(key: String, value: Boolean): Preferences

Stores a Boolean under the given key in the Preferences.

operator fun Preferences.set(key: String, value: Double): Preferences

Stores a Double as Float under the given key in the Preferences. Throws GdxRuntimeException if value is outside the Float range.

operator fun Preferences.set(key: String, value: Float): Preferences

Stores a Float under the given key in the Preferences.

operator fun Preferences.set(key: String, value: Int): Preferences

Stores an Int under the given key in the Preferences.

operator fun Preferences.set(key: String, value: Long): Preferences

Stores a Long under the given key in the Preferences.

operator fun Preferences.set(key: String, value: String): Preferences

Stores a String under the given key in the Preferences.