diff --git a/README.md b/README.md index b18d2e8..5ec4cd2 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ # Mindustry Kotlin Ui Lib -An utility library for mindustry mods. +An ui library for mindustry mods. -Provides a set of inline extension functions that allow you to build mindustry ui in an idiomatic & optimized way. -Also provides some utility extension functions that arc lacks. +Provides some useful stuff, such as inline ui construction functions, utility functions, new ui classes, etc. May not be compatible with other (non-mindustry) arc projects. @@ -14,6 +13,8 @@ In your `build.gradle` file: (it should already be here if you're using the official mod template) * add `implementation "com.github.mnemotechnician:MKUI:TAG"` (replace `TAG` with the the latest tag in this repo) to the `dependencies {}` block +Note: you can go to the releases tab and use the name of the latest release as the tag. These names usually start with `snapshot-`. + example of a `build.gradle` file: ```groovy //... some other code diff --git a/lib/src/main/kotlin/com/github/mnemotechnician/mkui/ElementUtil.kt b/lib/src/main/kotlin/com/github/mnemotechnician/mkui/ElementUtil.kt index e05af3d..a2e1198 100644 --- a/lib/src/main/kotlin/com/github/mnemotechnician/mkui/ElementUtil.kt +++ b/lib/src/main/kotlin/com/github/mnemotechnician/mkui/ElementUtil.kt @@ -4,8 +4,5 @@ import arc.scene.* import arc.scene.ui.* import arc.scene.ui.layout.* -/** casts the element to the specified class */ -inline fun Element.to() = this as T; - /** casts the element to the specified class or returns null if it's not an instance of this class */ -inline fun Element.toOrNull() = if (this is T) this else null; \ No newline at end of file +inline fun Element.asOrNull() = if (this is T) this else null; \ No newline at end of file diff --git a/lib/src/main/kotlin/com/github/mnemotechnician/mkui/Layout.kt b/lib/src/main/kotlin/com/github/mnemotechnician/mkui/Layout.kt index cf88d80..e3d8784 100644 --- a/lib/src/main/kotlin/com/github/mnemotechnician/mkui/Layout.kt +++ b/lib/src/main/kotlin/com/github/mnemotechnician/mkui/Layout.kt @@ -34,16 +34,18 @@ inline fun Table.addTable(background: Drawable = Styles.none, constructor: Table } /** Adds a constant label to the table and returns the created cell */ -inline fun Table.addLabel(text: String, style: Label.LabelStyle = Styles.defaultLabel, wrap: Boolean = false): Cell