Skip to content

Commit 1f2a1a4

Browse files
committed
fix treeNode label / id argument order and inline textColored logic with the way it's done in the rest of the class
1 parent df165b2 commit 1f2a1a4

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/main/kotlin/com/lambda/gui/dsl/ImGuiBuilder.kt

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -448,15 +448,11 @@ object ImGuiBuilder {
448448
* @param text The text to display
449449
*/
450450
@ImGuiDsl
451-
fun textColored(text: String, color: Color) = textColored(
452-
getColorU32(
453-
color.red / 255f,
454-
color.green / 255f,
455-
color.blue / 255f,
456-
color.alpha / 255f
457-
),
458-
text
459-
)
451+
fun textColored(text: String, color: Color) {
452+
val floats = floatArrayOf(0f, 0f, 0f, 0f)
453+
val (r, g, b, a) = color.getColorComponents(floats)
454+
textColored(r, g, b, a, text)
455+
}
460456

461457
/**
462458
* Text with disabled coloring.
@@ -1317,7 +1313,7 @@ object ImGuiBuilder {
13171313
*/
13181314
@ImGuiDsl
13191315
inline fun treeNode(label: String, id: String, block: ProcedureBlock) {
1320-
if (treeNode(label, id)) {
1316+
if (treeNode(id, label)) {
13211317
block()
13221318
treePop()
13231319
}

0 commit comments

Comments
 (0)