aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-05-29 15:26:36 +0700
committerWyvest <45589059+Wyvest@users.noreply.github.com>2022-05-29 15:26:36 +0700
commit98eedb30ac2f4e6ab9b0b1b04127e4afdcba0315 (patch)
treea26d876b223229a35d05ef93c81a429ea1d877cd /src/main/kotlin
parentce370c8e2768383b57212fccd4018f92f88b8847 (diff)
downloadOneConfig-98eedb30ac2f4e6ab9b0b1b04127e4afdcba0315.tar.gz
OneConfig-98eedb30ac2f4e6ab9b0b1b04127e4afdcba0315.tar.bz2
OneConfig-98eedb30ac2f4e6ab9b0b1b04127e4afdcba0315.zip
kotlin dsl
RenderManager reorganization fix build error in CommandHelper
Diffstat (limited to 'src/main/kotlin')
-rw-r--r--src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/ColorUtilsDSL.kt67
-rw-r--r--src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/GuiUtilsDSL.kt11
-rw-r--r--src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/JsonUtilsDSL.kt11
-rw-r--r--src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/MathUtilsDSL.kt8
-rw-r--r--src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/MultithreadingDSL.kt18
-rw-r--r--src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/NetworkUtilsDSL.kt28
-rw-r--r--src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/RenderManagerDSL.kt265
-rw-r--r--src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/TextUtilsDSL.kt25
-rw-r--r--src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/TickDelayDSL.kt10
9 files changed, 443 insertions, 0 deletions
diff --git a/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/ColorUtilsDSL.kt b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/ColorUtilsDSL.kt
new file mode 100644
index 0000000..fbcf32a
--- /dev/null
+++ b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/ColorUtilsDSL.kt
@@ -0,0 +1,67 @@
+package cc.polyfrost.oneconfig.utils.dsl
+
+import cc.polyfrost.oneconfig.config.core.OneColor
+import cc.polyfrost.oneconfig.utils.ColorUtils
+
+/**
+ * Creates a new [OneColor] from the given RGBA integer.
+ *
+ * @see OneColor
+ */
+fun Int.toColor() = OneColor(this)
+
+/**
+ * Get the red component of the given RGBA value.
+ *
+ * @see ColorUtils.getRed
+ */
+fun Int.getRed() = ColorUtils.getRed(this)
+
+/**
+ * Get the green component of the given RGBA value.
+ *
+ * @see ColorUtils.getGreen
+ */
+fun Int.getGreen() = ColorUtils.getGreen(this)
+
+/**
+ * Get the blue component of the given RGBA value.
+ *
+ * @see ColorUtils.getBlue
+ */
+fun Int.getBlue() = ColorUtils.getBlue(this)
+
+/**
+ * Get the alpha component of the given RGBA value.
+ *
+ * @see ColorUtils.getAlpha
+ */
+fun Int.getAlpha() = ColorUtils.getAlpha(this)
+
+/**
+ * Return the color with the given red component.
+ *
+ * @see ColorUtils.setRed
+ */
+fun Int.setRed(red: Int) = ColorUtils.setRed(this, red)
+
+/**
+ * Return the color with the given green component.
+ *
+ * @see ColorUtils.setGreen
+ */
+fun Int.setGreen(green: Int) = ColorUtils.setGreen(this, green)
+
+/**
+ * Return the color with the given blue component.
+ *
+ * @see ColorUtils.setBlue
+ */
+fun Int.setBlue(blue: Int) = ColorUtils.setBlue(this, blue)
+
+/**
+ * Return the color with the given alpha component.
+ *
+ * @see ColorUtils.setAlpha
+ */
+fun Int.setAlpha(alpha: Int) = ColorUtils.setAlpha(this, alpha) \ No newline at end of file
diff --git a/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/GuiUtilsDSL.kt b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/GuiUtilsDSL.kt
new file mode 100644
index 0000000..704ad2b
--- /dev/null
+++ b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/GuiUtilsDSL.kt
@@ -0,0 +1,11 @@
+package cc.polyfrost.oneconfig.utils.dsl
+
+import cc.polyfrost.oneconfig.utils.GuiUtils
+import net.minecraft.client.gui.GuiScreen
+
+/**
+ * Displays the provided screen after a tick, preventing mouse sync issues.
+ *
+ * @see GuiUtils.displayScreen
+ */
+fun GuiScreen.openScreen() = GuiUtils.displayScreen(this) \ No newline at end of file
diff --git a/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/JsonUtilsDSL.kt b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/JsonUtilsDSL.kt
new file mode 100644
index 0000000..43e0927
--- /dev/null
+++ b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/JsonUtilsDSL.kt
@@ -0,0 +1,11 @@
+package cc.polyfrost.oneconfig.utils.dsl
+
+import cc.polyfrost.oneconfig.utils.JsonUtils
+import com.google.gson.JsonElement
+
+/**
+ * Returns the [JsonElement] of the given [String].
+ *
+ * @see JsonUtils.parseString
+ */
+fun String.asJsonElement(catchExceptions: Boolean = true): JsonElement? = JsonUtils.parseString(this, catchExceptions) \ No newline at end of file
diff --git a/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/MathUtilsDSL.kt b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/MathUtilsDSL.kt
new file mode 100644
index 0000000..79afee0
--- /dev/null
+++ b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/MathUtilsDSL.kt
@@ -0,0 +1,8 @@
+package cc.polyfrost.oneconfig.utils.dsl
+
+import cc.polyfrost.oneconfig.utils.MathUtils
+
+/**
+ * @see MathUtils.clamp
+ */
+fun Number.clamp(min: Number = 0F, max: Number = 1F) = MathUtils.clamp(this.toFloat(), min.toFloat(), max.toFloat()) \ No newline at end of file
diff --git a/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/MultithreadingDSL.kt b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/MultithreadingDSL.kt
new file mode 100644
index 0000000..101bb1f
--- /dev/null
+++ b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/MultithreadingDSL.kt
@@ -0,0 +1,18 @@
+package cc.polyfrost.oneconfig.utils.dsl
+
+import cc.polyfrost.oneconfig.utils.Multithreading
+import java.util.concurrent.TimeUnit
+
+/**
+ * Runs the given [block] asynchronously.
+ *
+ * @see Multithreading.runAsync
+ */
+fun runAsync(block: () -> Unit) = Multithreading.runAsync(block)
+
+/**
+ * Runs the given [block] asynchronously after the given [delay].
+ *
+ * @see Multithreading.schedule
+ */
+fun schedule(delay: Long, timeUnit: TimeUnit, block: () -> Unit) = Multithreading.schedule(block, delay, timeUnit) \ No newline at end of file
diff --git a/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/NetworkUtilsDSL.kt b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/NetworkUtilsDSL.kt
new file mode 100644
index 0000000..3265993
--- /dev/null
+++ b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/NetworkUtilsDSL.kt
@@ -0,0 +1,28 @@
+package cc.polyfrost.oneconfig.utils.dsl
+
+import cc.polyfrost.oneconfig.libs.universal.UDesktop
+import cc.polyfrost.oneconfig.utils.NetworkUtils
+import java.io.File
+
+/**
+ * Returns the SHA-256 hash of the given [File].
+ *
+ * @see NetworkUtils.getFileChecksum
+ */
+fun File.checksum() = NetworkUtils.getFileChecksum(this)
+
+/**
+ * Downloads the given [url] to the given [File].
+ *
+ * @see NetworkUtils.downloadFile
+ */
+fun File.download(url: String, userAgent: String = "OneConfig/1.0.0", timeout: Int = 5000, useCaches: Boolean = false) =
+ NetworkUtils.downloadFile(url, this, userAgent, timeout, useCaches)
+
+/**
+ * Launches a URL in the default browser.
+ *
+ * @see NetworkUtils.browseLink
+ */
+@Suppress("unused")
+fun UDesktop.browseLink(uri: String) = NetworkUtils.browseLink(uri) \ No newline at end of file
diff --git a/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/RenderManagerDSL.kt b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/RenderManagerDSL.kt
new file mode 100644
index 0000000..cbdf07e
--- /dev/null
+++ b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/RenderManagerDSL.kt
@@ -0,0 +1,265 @@
+package cc.polyfrost.oneconfig.utils.dsl
+
+import cc.polyfrost.oneconfig.config.data.InfoType
+import cc.polyfrost.oneconfig.lwjgl.RenderManager
+import cc.polyfrost.oneconfig.lwjgl.font.Font
+import cc.polyfrost.oneconfig.lwjgl.image.Images
+import cc.polyfrost.oneconfig.lwjgl.image.SVGs
+import cc.polyfrost.oneconfig.utils.ColorUtils
+import org.lwjgl.nanovg.NVGColor
+
+/**
+ * Wrapper for a NanoVG instance.
+ * @see nanoVG
+ * @see RenderManager
+ */
+data class VG(val instance: Long)
+
+/**
+ * Sets up rendering, calls the block with the NanoVG instance, and then cleans up.
+ *
+ * To start, call this method.
+ * ```kt
+ * nanoVG {
+ * // Do stuff with the NanoVG instance
+ * }
+ * ```
+ * From there, you can use the passed [VG] object to draw things. For example...
+ * ```kt
+ * nanoVG {
+ * drawRect(1, 1, 100, 100, Color.RED.rgb)
+ * drawText("Hello, world!", 10, 10, Color.BLACK.rgb, 9, Fonts.BOLD)
+ * }
+ * ```
+ * You can also set the [mcScaling] parameter to true to scale the NanoVG instance to match the Minecraft GUI scale.
+ *
+ * @param mcScaling Whether to scale the NanoVG instance to match the Minecraft GUI scale.
+ * @param block The block to run.
+ */
+fun nanoVG(mcScaling: Boolean = false, block: VG.() -> Unit) = RenderManager.setupAndDraw(mcScaling) {
+ block.invoke(
+ VG(it)
+ )
+}
+
+
+fun Long.drawRect(x: Number, y: Number, width: Number, height: Number, color: Int, bypassOneConfig: Boolean = false) =
+ if (bypassOneConfig) {
+ RenderManager.drawRect(this, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), color)
+ } else {
+ RenderManager.drawRect(this, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), color)
+ }
+
+fun VG.drawRect(x: Number, y: Number, width: Number, height: Number, color: Int, bypassOneConfig: Boolean = false) =
+ instance.drawRect(x, y, width, height, color, bypassOneConfig)
+
+fun Long.drawRoundedRect(x: Number, y: Number, width: Number, height: Number, radius: Number, color: Int) =
+ RenderManager.drawRoundedRect(
+ this, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), color, radius.toFloat()
+ )
+
+fun VG.drawRoundedRect(x: Number, y: Number, width: Number, height: Number, radius: Number, color: Int) =
+ instance.drawRoundedRect(x, y, width, height, radius, color)
+
+fun Long.drawHollowRoundedRect(
+ x: Number, y: Number, width: Number, height: Number, radius: Number, color: Int, thickness: Number
+) = RenderManager.drawHollowRoundRect(
+ this, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), color, radius.toFloat(), thickness.toFloat()
+)
+
+fun VG.drawHollowRoundedRect(
+ x: Number, y: Number, width: Number, height: Number, radius: Number, color: Int, thickness: Number
+) = instance.drawHollowRoundedRect(x, y, width, height, radius, color, thickness)
+
+fun Long.drawRoundedRectVaried(
+ x: Number,
+ y: Number,
+ width: Number,
+ height: Number,
+ color: Int,
+ radiusTL: Number,
+ radiusTR: Number,
+ radiusBR: Number,
+ radiusBL: Number
+) = RenderManager.drawRoundedRectVaried(
+ this,
+ x.toFloat(),
+ y.toFloat(),
+ width.toFloat(),
+ height.toFloat(),
+ color,
+ radiusTL.toFloat(),
+ radiusTR.toFloat(),
+ radiusBR.toFloat(),
+ radiusBL.toFloat()
+)
+
+fun VG.drawRoundedRectVaried(
+ x: Number,
+ y: Number,
+ width: Number,
+ height: Number,
+ color: Int,
+ radiusTL: Number,
+ radiusTR: Number,
+ radiusBR: Number,
+ radiusBL: Number
+) = instance.drawRoundedRectVaried(x, y, width, height, color, radiusTL, radiusTR, radiusBR, radiusBL)
+
+fun Long.drawGradientRect(x: Number, y: Number, width: Number, height: Number, color1: Int, color2: Int) =
+ RenderManager.drawGradientRect(this, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), color1, color2)
+
+fun VG.drawGradientRect(x: Number, y: Number, width: Number, height: Number, color1: Int, color2: Int) =
+ instance.drawGradientRect(x, y, width, height, color1, color2)
+
+fun Long.drawGradientRoundedRect(
+ x: Number, y: Number, width: Number, height: Number, color: Int, color2: Int, radius: Number
+) = RenderManager.drawGradientRoundedRect(
+ this, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), color, color2, radius.toFloat()
+)
+
+fun VG.drawGradientRoundedRect(
+ x: Number, y: Number, width: Number, height: Number, color: Int, color2: Int, radius: Number
+) = instance.drawGradientRoundedRect(x, y, width, height, color, color2, radius)
+
+
+fun Long.drawCircle(x: Number, y: Number, radius: Number, color: Int) =
+ RenderManager.drawCircle(this, x.toFloat(), y.toFloat(), radius.toFloat(), color)
+
+fun VG.drawCircle(x: Number, y: Number, radius: Number, color: Int) = instance.drawCircle(x, y, radius, color)
+
+
+fun Long.drawText(text: String, x: Number, y: Number, color: Int, size: Number, font: Font) =
+ RenderManager.drawText(this, text, x.toFloat(), y.toFloat(), color, size.toFloat(), font)
+
+fun VG.drawText(text: String, x: Number, y: Number, color: Int, size: Number, font: Font) =
+ instance.drawText(text, x, y, color, size, font)
+
+fun Long.drawWrappedString(text: String, x: Number, y: Number, width: Number, color: Int, size: Number, font: Font) =
+ RenderManager.drawWrappedString(this, text, x.toFloat(), y.toFloat(), width.toFloat(), color, size.toFloat(), font)
+
+fun VG.drawWrappedString(text: String, x: Number, y: Number, width: Number, color: Int, size: Number, font: Font) =
+ instance.drawWrappedString(text, x, y, width, color, size, font)
+
+fun Long.drawURL(url: String, x: Number, y: Number, size: Number, font: Font) =
+ RenderManager.drawURL(this, url, x.toFloat(), y.toFloat(), size.toFloat(), font)
+
+fun VG.drawURL(url: String, x: Number, y: Number, size: Number, font: Font) = instance.drawURL(url, x, y, size, font)
+
+
+fun Long.drawImage(filePath: String, x: Number, y: Number, width: Number, height: Number) =
+ RenderManager.drawImage(this, filePath, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat())
+
+fun VG.drawImage(filePath: String, x: Number, y: Number, width: Number, height: Number) =
+ instance.drawImage(filePath, x, y, width, height)
+
+fun Long.drawImage(filePath: String, x: Number, y: Number, width: Number, height: Number, color: Int) =
+ RenderManager.drawImage(this, filePath, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), color)
+
+fun VG.drawImage(filePath: String, x: Number, y: Number, width: Number, height: Number, color: Int) =
+ instance.drawImage(filePath, x, y, width, height, color)
+
+fun Long.drawImage(image: Images, x: Number, y: Number, width: Number, height: Number) =
+ RenderManager.drawImage(this, image, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat())
+
+fun VG.drawImage(image: Images, x: Number, y: Number, width: Number, height: Number) =
+ instance.drawImage(image, x, y, width, height)
+
+fun Long.drawImage(image: Images, x: Number, y: Number, width: Number, height: Number, color: Int) =
+ RenderManager.drawImage(this, image, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), color)
+
+fun VG.drawImage(image: Images, x: Number, y: Number, width: Number, height: Number, color: Int) =
+ instance.drawImage(image, x, y, width, height, color)
+
+
+fun Long.drawRoundedImage(filePath: String, x: Number, y: Number, width: Number, height: Number, radius: Number) =
+ RenderManager.drawRoundImage(
+ this, filePath, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), radius.toFloat()
+ )
+
+fun VG.drawRoundedImage(filePath: String, x: Number, y: Number, width: Number, height: Number, radius: Number) =
+ instance.drawRoundedImage(filePath, x, y, width, height, radius)
+
+fun Long.drawRoundedImage(image: Images, x: Number, y: Number, width: Number, height: Number, radius: Number) =
+ RenderManager.drawRoundImage(
+ this, image, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), radius.toFloat()
+ )
+
+fun VG.drawRoundedImage(image: Images, x: Number, y: Number, width: Number, height: Number, radius: Number) =
+ instance.drawRoundedImage(image, x, y, width, height, radius)
+
+
+fun Long.getTextWidth(text: String, size: Number, font: Font) =
+ RenderManager.getTextWidth(this, text, size.toFloat(), font)
+
+fun VG.getTextWidth(text: String, size: Number, font: Font) = instance.getTextWidth(text, size, font)
+
+
+fun Long.drawLine(x1: Number, y1: Number, x2: Number, y2: Number, width: Number, color: Int) =
+ RenderManager.drawLine(this, x1.toFloat(), y1.toFloat(), x2.toFloat(), y2.toFloat(), width.toFloat(), color)
+
+fun VG.drawLine(x1: Number, y1: Number, x2: Number, y2: Number, width: Number, color: Int) =
+ instance.drawLine(x1, y1, x2, y2, width, color)
+
+
+fun Long.drawDropShadow(
+ x: Number, y: Number, w: Number, h: Number, blur: Number, spread: Number, cornerRadius: Number
+) = RenderManager.drawDropShadow(
+ this, x.toFloat(), y.toFloat(), w.toFloat(), h.toFloat(), blur.toFloat(), spread.toFloat(), cornerRadius.toFloat()
+)
+
+fun VG.drawDropShadow(x: Number, y: Number, w: Number, h: Number, blur: Number, spread: Number, cornerRadius: Number) =
+ instance.drawDropShadow(x, y, w, h, blur, spread, cornerRadius)
+
+
+fun Long.newColor(r: Int, g: Int, b: Int, a: Int) = RenderManager.color(this, ColorUtils.getColor(r, g, b, a))
+fun VG.newColor(r: Int, g: Int, b: Int, a: Int) = instance.newColor(r, g, b, a)
+
+fun Long.newColor(color: Int) = RenderManager.color(this, color)
+fun VG.newColor(color: Int) = instance.newColor(color)
+
+fun NVGColor.fill(color: Int) = fill(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha())
+fun NVGColor.fill(r: Int, g: Int, b: Int, a: Int) = RenderManager.fillNVGColorWithRGBA(
+ r.toFloat() / 255f, g.toFloat() / 255f, b.toFloat() / 255f, a.toFloat() / 255f, this
+)
+
+fun NVGColor.fill(r: Float, g: Float, b: Float, a: Float) = RenderManager.fillNVGColorWithRGBA(r, g, b, a, this)
+
+
+fun Long.scale(x: Float, y: Float) = RenderManager.scale(this, x, y)
+fun VG.scale(x: Float, y: Float) = instance.scale(x, y)
+
+
+fun Long.setAlpha(alpha: Float) = RenderManager.setAlpha(this, alpha)
+fun VG.setAlpha(alpha: Float) = instance.setAlpha(alpha)
+
+
+fun Long.drawSVG(filePath: String, x: Number, y: Number, width: Number, height: Number) =
+ RenderManager.drawSvg(this, filePath, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat())
+
+fun VG.drawSVG(filePath: String, x: Number, y: Number, width: Number, height: Number) =
+ instance.drawSVG(filePath, x, y, width, height)
+
+fun Long.drawSVG(filePath: String, x: Number, y: Number, width: Number, height: Number, color: Int) =
+ RenderManager.drawSvg(this, filePath, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), color)
+
+fun VG.drawSVG(filePath: String, x: Number, y: Number, width: Number, height: Number, color: Int) =
+ instance.drawSVG(filePath, x, y, width, height, color)
+
+fun Long.drawSVG(svg: SVGs, x: Number, y: Number, width: Number, height: Number) =
+ RenderManager.drawSvg(this, svg, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat())
+
+fun VG.drawSVG(svg: SVGs, x: Number, y: Number, width: Number, height: Number) =
+ instance.drawSVG(svg, x, y, width, height)
+
+fun Long.drawSVG(svg: SVGs, x: Number, y: Number, width: Number, height: Number, color: Int) =
+ RenderManager.drawSvg(this, svg, x.toFloat(), y.toFloat(), width.toFloat(), height.toFloat(), color)
+
+fun VG.drawSVG(svg: SVGs, x: Number, y: Number, width: Number, height: Number, color: Int) =
+ instance.drawSVG(svg, x, y, width, height, color)
+
+
+fun Long.drawInfo(type: InfoType, x: Number, y: Number, size: Number) =
+ RenderManager.drawInfo(this, type, x.toFloat(), y.toFloat(), size.toFloat())
+
+fun VG.drawInfo(type: InfoType, x: Number, y: Number, size: Number) = instance.drawInfo(type, x, y, size) \ No newline at end of file
diff --git a/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/TextUtilsDSL.kt b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/TextUtilsDSL.kt
new file mode 100644
index 0000000..f764153
--- /dev/null
+++ b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/TextUtilsDSL.kt
@@ -0,0 +1,25 @@
+package cc.polyfrost.oneconfig.utils.dsl
+
+import cc.polyfrost.oneconfig.lwjgl.font.Font
+import cc.polyfrost.oneconfig.utils.TextUtils
+
+/**
+ * Wraps the given [String] to the given [maxWidth].
+ * @see TextUtils.wrapText
+ */
+fun String.wrap(vg: Long, maxWidth: Float, fontSize: Number, font: Font) =
+ TextUtils.wrapText(vg, this, maxWidth, fontSize.toFloat(), font)
+
+/**
+ * Wraps the given [String] to the given [maxWidth].
+ * @see wrap
+ */
+fun Long.wrap(text: String, maxWidth: Float, fontSize: Number, font: Font) =
+ TextUtils.wrapText(this, text, maxWidth, fontSize.toFloat(), font)
+
+/**
+ * Wraps the given [String] to the given [maxWidth].
+ * @see wrap
+ */
+fun VG.wrap(text: String, maxWidth: Float, fontSize: Number, font: Font) =
+ TextUtils.wrapText(instance, text, maxWidth, fontSize.toFloat(), font)
diff --git a/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/TickDelayDSL.kt b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/TickDelayDSL.kt
new file mode 100644
index 0000000..ed18fd5
--- /dev/null
+++ b/src/main/kotlin/cc/polyfrost/oneconfig/utils/dsl/TickDelayDSL.kt
@@ -0,0 +1,10 @@
+package cc.polyfrost.oneconfig.utils.dsl
+
+import cc.polyfrost.oneconfig.utils.TickDelay
+
+/**
+ * Schedules a Runnable to be called after a certain amount of ticks.
+ *
+ * @see TickDelay
+ */
+fun tick(ticks: Int, block: () -> Unit) = TickDelay(block, ticks) \ No newline at end of file