Skip to content

Commit fdd28f4

Browse files
committed
remove redundant "ImGui." prefixes
1 parent b0aaaed commit fdd28f4

File tree

1 file changed

+49
-49
lines changed

1 file changed

+49
-49
lines changed

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

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ object ImGuiBuilder {
6262
/**
6363
* Access the IO structure (mouse/keyboard/gamepad inputs, time, various configuration options/flags).
6464
*/
65-
val io: ImGuiIO get() = ImGui.getIO()
65+
val io: ImGuiIO get() = getIO()
6666

6767
/**
6868
* Access the Style structure (colors, sizes). Always use PushStyleCol(), PushStyleVar() to modify style mid-frame!
@@ -72,50 +72,50 @@ object ImGuiBuilder {
7272
/**
7373
* Get the compiled version string e.g. "1.80 WIP" (essentially the value for IMGUI_VERSION from the compiled version of imgui.cpp)
7474
*/
75-
val version: String get() = ImGui.getVersion()
75+
val version: String get() = getVersion()
7676

77-
val isWindowAppearing: Boolean get() = ImGui.isWindowAppearing()
78-
val isWindowCollapsed: Boolean get() = ImGui.isWindowCollapsed()
77+
val isWindowAppearing: Boolean get() = isWindowAppearing()
78+
val isWindowCollapsed: Boolean get() = isWindowCollapsed()
7979

8080
/**
8181
* Returns the current window position in screen space
8282
*
8383
* It is unlikely you need to use this. Consider using current layout pos instead, GetScreenCursorPos().
8484
*/
85-
val windowPos: ImVec2 get() = ImGui.getWindowPos()
86-
val windowX: Float get() = ImGui.getWindowPosX()
87-
val windowY: Float get() = ImGui.getWindowPosY()
85+
val windowPos: ImVec2 get() = getWindowPos()
86+
val windowX: Float get() = getWindowPosX()
87+
val windowY: Float get() = getWindowPosY()
8888

8989
/**
9090
* Returns the current window size
9191
* It is unlikely you need to use this. Consider using GetScreenCursorPos() and GetContentRegionAvail() instead.
9292
*/
93-
val windowSize: ImVec2 get() = ImGui.getWindowSize()
94-
val windowWidth: Float get() = ImGui.getWindowWidth()
95-
val windowHeight: Float get() = ImGui.getWindowHeight()
93+
val windowSize: ImVec2 get() = getWindowSize()
94+
val windowWidth: Float get() = getWindowWidth()
95+
val windowHeight: Float get() = getWindowHeight()
9696

9797
/**
9898
* Returns the viewport associated to the current window.
9999
*/
100-
val windowViewport: ImGuiViewport get() = ImGui.getWindowViewport()
100+
val windowViewport: ImGuiViewport get() = getWindowViewport()
101101

102102
/**
103103
* Returns whether any item hovered and usable (not blocked by a popup, etc.).
104104
*/
105-
val isAnyItemHovered: Boolean get() = ImGui.isAnyItemHovered()
105+
val isAnyItemHovered: Boolean get() = isAnyItemHovered()
106106

107107
/**
108108
* Returns whether:
109109
* - Any button is being held
110110
* - Any text field is being edited
111111
* - Any item is being held and allows interaction
112112
*/
113-
val isAnyItemActive: Boolean get() = ImGui.isAnyItemActive()
113+
val isAnyItemActive: Boolean get() = isAnyItemActive()
114114

115115
/**
116116
* Returns whether any item is focused via keyboard/gamepad navigation
117117
*/
118-
val isAnyItemFocused: Boolean get() = ImGui.isAnyItemFocused()
118+
val isAnyItemFocused: Boolean get() = isAnyItemFocused()
119119

120120
/**
121121
* Executes the specified block if the current window is hovered, based on the provided flags.
@@ -125,7 +125,7 @@ object ImGuiBuilder {
125125
*/
126126
@ImGuiDsl
127127
fun onWindowFocus(flags: Int = ImGuiWindowFlags.None, block: ProcedureBlock) =
128-
if (ImGui.isWindowHovered(flags)) block() else Unit
128+
if (isWindowHovered(flags)) block() else Unit
129129

130130
/**
131131
* Executes a given block of code when the current ImGui window is being hovered.
@@ -136,7 +136,7 @@ object ImGuiBuilder {
136136
*/
137137
@ImGuiDsl
138138
fun onWindowHover(flags: Int = ImGuiWindowFlags.None, block: ProcedureBlock) =
139-
if (ImGui.isWindowHovered(flags)) block() else Unit
139+
if (isWindowHovered(flags)) block() else Unit
140140

141141
/**
142142
* Executes the given block of code if the current ImGui item is hovered.
@@ -146,7 +146,7 @@ object ImGuiBuilder {
146146
*/
147147
@ImGuiDsl
148148
fun onItemHover(flags: Int = ImGuiHoveredFlags.None, block: ProcedureBlock) =
149-
if (ImGui.isItemHovered(flags)) block() else Unit
149+
if (isItemHovered(flags)) block() else Unit
150150

151151
/**
152152
* Executes the provided block of code if the current item is active in the ImGui context.
@@ -155,7 +155,7 @@ object ImGuiBuilder {
155155
*/
156156
@ImGuiDsl
157157
fun onItemActive(block: ProcedureBlock) =
158-
if (ImGui.isItemActive()) block() else Unit
158+
if (isItemActive()) block() else Unit
159159

160160
/**
161161
* Executes the given [block] when the currently active item in the ImGui interface gains focus.
@@ -164,7 +164,7 @@ object ImGuiBuilder {
164164
*/
165165
@ImGuiDsl
166166
fun onItemFocus(block: ProcedureBlock) =
167-
if (ImGui.isItemFocused()) block() else Unit
167+
if (isItemFocused()) block() else Unit
168168

169169
/**
170170
* Returns whether the last hovered item is clicked on
@@ -175,51 +175,51 @@ object ImGuiBuilder {
175175
*/
176176
@ImGuiDsl
177177
fun onItemClick(button: Int = ImGuiMouseButton.Right, block: ProcedureBlock) =
178-
if (ImGui.isItemClicked(button)) block() else Unit
178+
if (isItemClicked(button)) block() else Unit
179179

180180
/**
181181
* Returns whether:
182182
* - The last item modified its value in this frame
183183
* - Was pressed
184184
*/
185-
val isItemEdited: Boolean get() = ImGui.isItemEdited()
185+
val isItemEdited: Boolean get() = isItemEdited()
186186

187187
/**
188188
* Returns whether the last item was made active.
189189
*/
190-
val isItemActivated: Boolean get() = ImGui.isItemActivated()
190+
val isItemActivated: Boolean get() = isItemActivated()
191191

192192
/**
193193
* Returns whether the last item was made inactive
194194
*
195195
* Useful for Undo/Redo patterns with widgets that require continuous editing.
196196
*/
197-
val isItemDeactivated: Boolean get() = ImGui.isItemDeactivated()
197+
val isItemDeactivated: Boolean get() = isItemDeactivated()
198198

199199
/**
200200
* Returns whether the last item was made inactive and its value was changed when active (e.g. Slider/Drag moved).
201201
*
202202
* Useful for Undo/Redo patterns with widgets that require continuous editing. Note that you may get false positives (some widgets such as Combo()/ListBox()/Selectable() will return true even when clicking an already selected item).
203203
*/
204-
val isItemDeactivatedAfterEdit: Boolean get() = ImGui.isItemDeactivatedAfterEdit()
204+
val isItemDeactivatedAfterEdit: Boolean get() = isItemDeactivatedAfterEdit()
205205

206206
/**
207207
* Returns whether the last item state toggled (set by TreeNode()).
208208
*/
209-
val isItemToggledOpen: Boolean get() = ImGui.isItemToggledOpen()
209+
val isItemToggledOpen: Boolean get() = isItemToggledOpen()
210210

211211
/**
212212
* Returns the ID of last item (~~ often same ImGui::GetID(label) beforehand)
213213
*/
214-
val itemID: Int get() = ImGui.getItemID()
214+
val itemID: Int get() = getItemID()
215215

216216

217-
val font: ImFont get() = ImGui.getFont()
217+
val font: ImFont get() = getFont()
218218

219219
/**
220220
* Returns the font size (= height in pixels) with the current scale applied.
221221
*/
222-
val fontSize: Int get() = ImGui.getFontSize()
222+
val fontSize: Int get() = getFontSize()
223223

224224

225225
/**
@@ -490,9 +490,9 @@ object ImGuiBuilder {
490490
flags: Int = ImGuiComboFlags.None,
491491
block: () -> Unit = {},
492492
) {
493-
if (ImGui.beginCombo(label, preview, flags)) {
493+
if (beginCombo(label, preview, flags)) {
494494
block()
495-
ImGui.endCombo()
495+
endCombo()
496496
}
497497
}
498498

@@ -579,7 +579,7 @@ object ImGuiBuilder {
579579
flags: Int = 0,
580580
block: (ImFloat) -> Unit = {},
581581
) {
582-
if (ImGui.dragFloat(label, value.data, vSpeed, vMin, vMax, format, flags))
582+
if (dragFloat(label, value.data, vSpeed, vMin, vMax, format, flags))
583583
block(value)
584584
}
585585

@@ -618,7 +618,7 @@ object ImGuiBuilder {
618618
flags: Int = 0,
619619
block: (ImInt) -> Unit = {},
620620
) {
621-
if (ImGui.dragInt(label, value.data, vSpeed, vMin, vMax, format, flags))
621+
if (dragInt(label, value.data, vSpeed, vMin, vMax, format, flags))
622622
block(value)
623623
}
624624

@@ -654,7 +654,7 @@ object ImGuiBuilder {
654654
flags: Int = 0,
655655
block: (ImFloat) -> Unit = {},
656656
) {
657-
if (ImGui.sliderFloat(label, value.data, vMin, vMax, format, flags))
657+
if (sliderFloat(label, value.data, vMin, vMax, format, flags))
658658
block(value)
659659
}
660660

@@ -690,7 +690,7 @@ object ImGuiBuilder {
690690
flags: Int = 0,
691691
block: (ImInt) -> Unit = {},
692692
) {
693-
if (ImGui.sliderInt(label, value.data, vMin, vMax, format, flags))
693+
if (sliderInt(label, value.data, vMin, vMax, format, flags))
694694
block(value)
695695
}
696696

@@ -831,7 +831,7 @@ object ImGuiBuilder {
831831
flags: Int = ImGuiInputTextFlags.None,
832832
block: (ImFloat) -> Unit = {}
833833
) {
834-
if (ImGui.inputFloat(label, value, step, stepFast, format, flags))
834+
if (inputFloat(label, value, step, stepFast, format, flags))
835835
block(value)
836836
}
837837

@@ -853,7 +853,7 @@ object ImGuiBuilder {
853853
flags: Int = ImGuiInputTextFlags.None,
854854
block: (FloatArray) -> Unit = {}
855855
) {
856-
if (ImGui.inputFloat2(label, values, format, flags))
856+
if (inputFloat2(label, values, format, flags))
857857
block(values)
858858
}
859859

@@ -868,7 +868,7 @@ object ImGuiBuilder {
868868
) {
869869
val floats = floatArrayOf(vec.x, vec.y)
870870

871-
if (ImGui.inputFloat2(label, floats, format, flags))
871+
if (inputFloat2(label, floats, format, flags))
872872
block(Vec2f(floats[0], floats[1]))
873873
}
874874

@@ -890,7 +890,7 @@ object ImGuiBuilder {
890890
flags: Int = ImGuiInputTextFlags.None,
891891
block: (FloatArray) -> Unit = {}
892892
) {
893-
if (ImGui.inputFloat3(label, values, format, flags))
893+
if (inputFloat3(label, values, format, flags))
894894
block(values)
895895
}
896896

@@ -912,7 +912,7 @@ object ImGuiBuilder {
912912
flags: Int = ImGuiInputTextFlags.None,
913913
block: (FloatArray) -> Unit = {}
914914
) {
915-
if (ImGui.inputFloat4(label, values, format, flags))
915+
if (inputFloat4(label, values, format, flags))
916916
block(values)
917917
}
918918

@@ -938,7 +938,7 @@ object ImGuiBuilder {
938938
flags: Int = ImGuiInputTextFlags.None,
939939
block: (Double) -> Unit = {},
940940
) = withDouble(value) {
941-
if (ImGui.inputDouble(label, it, step, stepFast, format, flags)) {
941+
if (inputDouble(label, it, step, stepFast, format, flags)) {
942942
value.set(it.get())
943943
block(it.get())
944944
}
@@ -964,7 +964,7 @@ object ImGuiBuilder {
964964
) {
965965
val doubles = floatArrayOf(vec.x.toFloat(), vec.y.toFloat())
966966

967-
if (ImGui.inputFloat3(label, doubles, format, flags))
967+
if (inputFloat3(label, doubles, format, flags))
968968
block(Vec2d(doubles[0], doubles[1]))
969969
}
970970

@@ -988,7 +988,7 @@ object ImGuiBuilder {
988988
) {
989989
val doubles = floatArrayOf(vec.x.toFloat(), vec.y.toFloat(), vec.z.toFloat())
990990

991-
if (ImGui.inputFloat3(label, doubles, format, flags))
991+
if (inputFloat3(label, doubles, format, flags))
992992
block(Vec3d(doubles[0].toDouble(), doubles[1].toDouble(), doubles[2].toDouble()))
993993
}
994994

@@ -1071,7 +1071,7 @@ object ImGuiBuilder {
10711071
val col = color.get()
10721072
val components = col.getComponents(default)
10731073

1074-
if (ImGui.colorEdit4(label, components)) {
1074+
if (colorEdit4(label, components)) {
10751075
val (r, g, b, a) = components
10761076

10771077
color.set(Color(r, g, b, a))
@@ -1143,7 +1143,7 @@ object ImGuiBuilder {
11431143
val floats = floatArrayOf(0f, 0f, 0f, 0f)
11441144
val (r, g, b, a) = color.getColorComponents(floats)
11451145

1146-
if (ImGui.colorButton(descId, r, g, b, a, flags))
1146+
if (colorButton(descId, r, g, b, a, flags))
11471147
block()
11481148
}
11491149

@@ -1155,7 +1155,7 @@ object ImGuiBuilder {
11551155
*/
11561156
@ImGuiDsl
11571157
inline fun treeNode(label: String, block: ProcedureBlock) {
1158-
if (ImGui.treeNode(label)) {
1158+
if (treeNode(label)) {
11591159
block()
11601160
treePop()
11611161
}
@@ -1170,7 +1170,7 @@ object ImGuiBuilder {
11701170
*/
11711171
@ImGuiDsl
11721172
inline fun treeNode(label: String, id: String, block: ProcedureBlock) {
1173-
if (ImGui.treeNode(label, id)) {
1173+
if (treeNode(label, id)) {
11741174
block()
11751175
treePop()
11761176
}
@@ -1890,19 +1890,19 @@ object ImGuiBuilder {
18901890
* Gets the current draw list for custom drawing.
18911891
*/
18921892
@ImGuiDsl
1893-
val windowDrawList: ImDrawList get() = ImGui.getWindowDrawList()
1893+
val windowDrawList: ImDrawList get() = getWindowDrawList()
18941894

18951895
/**
18961896
* Gets the background draw list for custom drawing.
18971897
*/
18981898
@ImGuiDsl
1899-
val getBackgroundDrawList: ImDrawList get() = ImGui.getBackgroundDrawList()
1899+
val getBackgroundDrawList: ImDrawList get() = getBackgroundDrawList()
19001900

19011901
/**
19021902
* Gets the foreground draw list for custom drawing.
19031903
*/
19041904
@ImGuiDsl
1905-
val getForegroundDrawList: ImDrawList get() = ImGui.getForegroundDrawList()
1905+
val getForegroundDrawList: ImDrawList get() = getForegroundDrawList()
19061906

19071907
/**
19081908
* Creates a frame with optional border.

0 commit comments

Comments
 (0)