sfml.js-imgui 0.0.0-stage → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (270) hide show
  1. package/README.ja.md +113 -0
  2. package/README.ko.md +113 -0
  3. package/README.md +112 -2
  4. package/README.zh-CN.md +113 -0
  5. package/binding.gyp +125 -0
  6. package/dist/callbacks.d.ts +368 -0
  7. package/dist/callbacks.js +310 -0
  8. package/dist/enums/colors.d.ts +779 -0
  9. package/dist/enums/colors.js +766 -0
  10. package/dist/enums/drawing.d.ts +286 -0
  11. package/dist/enums/drawing.js +257 -0
  12. package/dist/enums/input.d.ts +792 -0
  13. package/dist/enums/input.js +731 -0
  14. package/dist/enums/keys.d.ts +1389 -0
  15. package/dist/enums/keys.js +1384 -0
  16. package/dist/enums/selection.d.ts +195 -0
  17. package/dist/enums/selection.js +182 -0
  18. package/dist/enums/style.d.ts +362 -0
  19. package/dist/enums/style.js +349 -0
  20. package/dist/enums/tables.d.ts +681 -0
  21. package/dist/enums/tables.js +644 -0
  22. package/dist/enums/text.d.ts +411 -0
  23. package/dist/enums/text.js +390 -0
  24. package/dist/enums/widgets.d.ts +861 -0
  25. package/dist/enums/widgets.js +800 -0
  26. package/dist/enums/windows.d.ts +487 -0
  27. package/dist/enums/windows.js +458 -0
  28. package/dist/enums.d.ts +10 -0
  29. package/dist/enums.js +26 -0
  30. package/dist/font.d.ts +249 -0
  31. package/dist/font.js +285 -0
  32. package/dist/formatted.d.ts +301 -0
  33. package/dist/formatted.js +342 -0
  34. package/dist/imgui/color.d.ts +493 -0
  35. package/dist/imgui/color.js +532 -0
  36. package/dist/imgui/columns.d.ts +242 -0
  37. package/dist/imgui/columns.js +273 -0
  38. package/dist/imgui/combo.d.ts +322 -0
  39. package/dist/imgui/combo.js +344 -0
  40. package/dist/imgui/context.d.ts +240 -0
  41. package/dist/imgui/context.js +270 -0
  42. package/dist/imgui/debug.d.ts +478 -0
  43. package/dist/imgui/debug.js +526 -0
  44. package/dist/imgui/drag-drop.d.ts +378 -0
  45. package/dist/imgui/drag-drop.js +414 -0
  46. package/dist/imgui/drag.d.ts +1371 -0
  47. package/dist/imgui/drag.js +1447 -0
  48. package/dist/imgui/draw-data.d.ts +139 -0
  49. package/dist/imgui/draw-data.js +154 -0
  50. package/dist/imgui/draw-list-images.d.ts +306 -0
  51. package/dist/imgui/draw-list-images.js +324 -0
  52. package/dist/imgui/draw-list-internals.d.ts +223 -0
  53. package/dist/imgui/draw-list-internals.js +259 -0
  54. package/dist/imgui/draw-list-path.d.ts +451 -0
  55. package/dist/imgui/draw-list-path.js +493 -0
  56. package/dist/imgui/draw-list-primitives.d.ts +297 -0
  57. package/dist/imgui/draw-list-primitives.js +324 -0
  58. package/dist/imgui/draw-list-shapes.d.ts +1258 -0
  59. package/dist/imgui/draw-list-shapes.js +1345 -0
  60. package/dist/imgui/draw-list-state.d.ts +458 -0
  61. package/dist/imgui/draw-list-state.js +515 -0
  62. package/dist/imgui/draw-list-text.d.ts +367 -0
  63. package/dist/imgui/draw-list-text.js +247 -0
  64. package/dist/imgui/drawing.d.ts +151 -0
  65. package/dist/imgui/drawing.js +169 -0
  66. package/dist/imgui/font-atlas.d.ts +726 -0
  67. package/dist/imgui/font-atlas.js +777 -0
  68. package/dist/imgui/font-glyph-ranges.d.ts +260 -0
  69. package/dist/imgui/font-glyph-ranges.js +230 -0
  70. package/dist/imgui/fonts.d.ts +114 -0
  71. package/dist/imgui/fonts.js +132 -0
  72. package/dist/imgui/id-stack.d.ts +363 -0
  73. package/dist/imgui/id-stack.js +309 -0
  74. package/dist/imgui/images.d.ts +310 -0
  75. package/dist/imgui/images.js +331 -0
  76. package/dist/imgui/index.d.ts +57 -0
  77. package/dist/imgui/index.js +73 -0
  78. package/dist/imgui/input-text-callback.d.ts +176 -0
  79. package/dist/imgui/input-text-callback.js +144 -0
  80. package/dist/imgui/inputs.d.ts +1086 -0
  81. package/dist/imgui/inputs.js +1159 -0
  82. package/dist/imgui/io.d.ts +546 -0
  83. package/dist/imgui/io.js +600 -0
  84. package/dist/imgui/item-state.d.ts +766 -0
  85. package/dist/imgui/item-state.js +850 -0
  86. package/dist/imgui/keyboard.d.ts +547 -0
  87. package/dist/imgui/keyboard.js +584 -0
  88. package/dist/imgui/layout.d.ts +927 -0
  89. package/dist/imgui/layout.js +1029 -0
  90. package/dist/imgui/legacy.d.ts +413 -0
  91. package/dist/imgui/legacy.js +461 -0
  92. package/dist/imgui/list-clipper.d.ts +282 -0
  93. package/dist/imgui/list-clipper.js +309 -0
  94. package/dist/imgui/logging.d.ts +113 -0
  95. package/dist/imgui/logging.js +135 -0
  96. package/dist/imgui/memory.d.ts +35 -0
  97. package/dist/imgui/memory.js +45 -0
  98. package/dist/imgui/menus.d.ts +373 -0
  99. package/dist/imgui/menus.js +407 -0
  100. package/dist/imgui/mouse.d.ts +740 -0
  101. package/dist/imgui/mouse.js +803 -0
  102. package/dist/imgui/plots.d.ts +252 -0
  103. package/dist/imgui/plots.js +267 -0
  104. package/dist/imgui/popups.d.ts +711 -0
  105. package/dist/imgui/popups.js +757 -0
  106. package/dist/imgui/scrolling.d.ts +341 -0
  107. package/dist/imgui/scrolling.js +375 -0
  108. package/dist/imgui/selection.d.ts +785 -0
  109. package/dist/imgui/selection.js +845 -0
  110. package/dist/imgui/settings.d.ts +194 -0
  111. package/dist/imgui/settings.js +216 -0
  112. package/dist/imgui/sliders.d.ts +1664 -0
  113. package/dist/imgui/sliders.js +1751 -0
  114. package/dist/imgui/storage.d.ts +344 -0
  115. package/dist/imgui/storage.js +386 -0
  116. package/dist/imgui/style.d.ts +680 -0
  117. package/dist/imgui/style.js +770 -0
  118. package/dist/imgui/tables.d.ts +762 -0
  119. package/dist/imgui/tables.js +831 -0
  120. package/dist/imgui/tabs.d.ts +228 -0
  121. package/dist/imgui/tabs.js +250 -0
  122. package/dist/imgui/text-buffer.d.ts +251 -0
  123. package/dist/imgui/text-buffer.js +239 -0
  124. package/dist/imgui/text-filter.d.ts +181 -0
  125. package/dist/imgui/text-filter.js +151 -0
  126. package/dist/imgui/text.d.ts +506 -0
  127. package/dist/imgui/text.js +425 -0
  128. package/dist/imgui/tooltips.d.ts +202 -0
  129. package/dist/imgui/tooltips.js +221 -0
  130. package/dist/imgui/trees.d.ts +516 -0
  131. package/dist/imgui/trees.js +562 -0
  132. package/dist/imgui/viewport.d.ts +93 -0
  133. package/dist/imgui/viewport.js +105 -0
  134. package/dist/imgui/widgets.d.ts +524 -0
  135. package/dist/imgui/widgets.js +572 -0
  136. package/dist/imgui/windows.d.ts +1210 -0
  137. package/dist/imgui/windows.js +1309 -0
  138. package/dist/index.d.ts +4 -0
  139. package/dist/index.js +19 -0
  140. package/dist/internal/imgui-binding.d.ts +40 -0
  141. package/dist/internal/imgui-binding.js +2 -0
  142. package/dist/internal/native.d.ts +67 -0
  143. package/dist/internal/native.js +7 -0
  144. package/dist/internal/sfml-interop.d.ts +45 -0
  145. package/dist/internal/sfml-interop.js +102 -0
  146. package/dist/references.d.ts +393 -0
  147. package/dist/references.js +372 -0
  148. package/dist/sfml.d.ts +223 -0
  149. package/dist/sfml.js +320 -0
  150. package/dist/struct-views.d.ts +3056 -0
  151. package/dist/struct-views.js +418 -0
  152. package/dist/types.d.ts +508 -0
  153. package/dist/types.js +2 -0
  154. package/native/addon.cc +68 -0
  155. package/native/cimgui.h +12 -0
  156. package/native/imgui-args.h +492 -0
  157. package/native/imgui-bindings.h +35 -0
  158. package/native/imgui-callbacks.cc +376 -0
  159. package/native/imgui-context.cc +117 -0
  160. package/native/imgui-debug.cc +171 -0
  161. package/native/imgui-drag-drop.cc +120 -0
  162. package/native/imgui-drag-widgets.cc +473 -0
  163. package/native/imgui-draw-callbacks.cc +210 -0
  164. package/native/imgui-draw-callbacks.h +25 -0
  165. package/native/imgui-draw-paths.cc +413 -0
  166. package/native/imgui-draw-primitives.cc +317 -0
  167. package/native/imgui-drawing.cc +963 -0
  168. package/native/imgui-font-ranges.cc +73 -0
  169. package/native/imgui-font.cc +488 -0
  170. package/native/imgui-formatted.cc +388 -0
  171. package/native/imgui-frame.cc +56 -0
  172. package/native/imgui-glyph-fields.cc +87 -0
  173. package/native/imgui-glyph-fields.h +12 -0
  174. package/native/imgui-input-widgets.cc +447 -0
  175. package/native/imgui-input.cc +277 -0
  176. package/native/imgui-integration.cc +442 -0
  177. package/native/imgui-io.cc +255 -0
  178. package/native/imgui-items.cc +290 -0
  179. package/native/imgui-layout.cc +349 -0
  180. package/native/imgui-popups.cc +331 -0
  181. package/native/imgui-references.cc +230 -0
  182. package/native/imgui-selection.cc +394 -0
  183. package/native/imgui-slider-widgets.cc +550 -0
  184. package/native/imgui-storage.cc +177 -0
  185. package/native/imgui-struct-views.cc +626 -0
  186. package/native/imgui-style.cc +283 -0
  187. package/native/imgui-tables.cc +267 -0
  188. package/native/imgui-text.cc +291 -0
  189. package/native/imgui-utilities.cc +127 -0
  190. package/native/imgui-values.cc +66 -0
  191. package/native/imgui-widgets.cc +570 -0
  192. package/native/imgui-windows.cc +436 -0
  193. package/native/interop.h +19 -0
  194. package/package.json +72 -3
  195. package/src/callbacks.ts +447 -0
  196. package/src/enums/colors.ts +782 -0
  197. package/src/enums/drawing.ts +293 -0
  198. package/src/enums/input.ts +807 -0
  199. package/src/enums/keys.ts +1390 -0
  200. package/src/enums/selection.ts +198 -0
  201. package/src/enums/style.ts +365 -0
  202. package/src/enums/tables.ts +690 -0
  203. package/src/enums/text.ts +416 -0
  204. package/src/enums/widgets.ts +876 -0
  205. package/src/enums/windows.ts +494 -0
  206. package/src/enums.ts +10 -0
  207. package/src/font.ts +287 -0
  208. package/src/formatted.ts +386 -0
  209. package/src/imgui/color.ts +575 -0
  210. package/src/imgui/columns.ts +274 -0
  211. package/src/imgui/combo.ts +376 -0
  212. package/src/imgui/context.ts +268 -0
  213. package/src/imgui/debug.ts +542 -0
  214. package/src/imgui/drag-drop.ts +423 -0
  215. package/src/imgui/drag.ts +1615 -0
  216. package/src/imgui/draw-data.ts +158 -0
  217. package/src/imgui/draw-list-images.ts +394 -0
  218. package/src/imgui/draw-list-internals.ts +291 -0
  219. package/src/imgui/draw-list-path.ts +568 -0
  220. package/src/imgui/draw-list-primitives.ts +363 -0
  221. package/src/imgui/draw-list-shapes.ts +1593 -0
  222. package/src/imgui/draw-list-state.ts +551 -0
  223. package/src/imgui/draw-list-text.ts +594 -0
  224. package/src/imgui/drawing.ts +170 -0
  225. package/src/imgui/font-atlas.ts +862 -0
  226. package/src/imgui/font-glyph-ranges.ts +357 -0
  227. package/src/imgui/fonts.ts +133 -0
  228. package/src/imgui/id-stack.ts +496 -0
  229. package/src/imgui/images.ts +364 -0
  230. package/src/imgui/index.ts +57 -0
  231. package/src/imgui/input-text-callback.ts +268 -0
  232. package/src/imgui/inputs.ts +1292 -0
  233. package/src/imgui/io.ts +638 -0
  234. package/src/imgui/item-state.ts +856 -0
  235. package/src/imgui/keyboard.ts +590 -0
  236. package/src/imgui/layout.ts +1030 -0
  237. package/src/imgui/legacy.ts +477 -0
  238. package/src/imgui/list-clipper.ts +329 -0
  239. package/src/imgui/logging.ts +135 -0
  240. package/src/imgui/memory.ts +42 -0
  241. package/src/imgui/menus.ts +417 -0
  242. package/src/imgui/mouse.ts +824 -0
  243. package/src/imgui/plots.ts +313 -0
  244. package/src/imgui/popups.ts +779 -0
  245. package/src/imgui/scrolling.ts +378 -0
  246. package/src/imgui/selection.ts +904 -0
  247. package/src/imgui/settings.ts +220 -0
  248. package/src/imgui/sliders.ts +1969 -0
  249. package/src/imgui/storage.ts +415 -0
  250. package/src/imgui/style.ts +781 -0
  251. package/src/imgui/tables.ts +854 -0
  252. package/src/imgui/tabs.ts +259 -0
  253. package/src/imgui/text-buffer.ts +337 -0
  254. package/src/imgui/text-filter.ts +262 -0
  255. package/src/imgui/text.ts +688 -0
  256. package/src/imgui/tooltips.ts +218 -0
  257. package/src/imgui/trees.ts +583 -0
  258. package/src/imgui/viewport.ts +103 -0
  259. package/src/imgui/widgets.ts +599 -0
  260. package/src/imgui/windows.ts +1350 -0
  261. package/src/index.ts +21 -0
  262. package/src/internal/imgui-binding.ts +142 -0
  263. package/src/internal/native.ts +163 -0
  264. package/src/internal/sfml-interop.ts +171 -0
  265. package/src/references.ts +464 -0
  266. package/src/sfml.ts +412 -0
  267. package/src/struct-views.ts +3194 -0
  268. package/src/types.ts +539 -0
  269. package/tools/deps_downloader.cjs +213 -0
  270. package/tsconfig.json +15 -0
@@ -0,0 +1,570 @@
1
+ // Copyright (c) 2026 XadillaX
2
+ // SPDX-License-Identifier: MIT
3
+
4
+ #include <string>
5
+ #include <vector>
6
+
7
+ #include "native/imgui-args.h"
8
+ #include "native/imgui-bindings.h"
9
+
10
+ namespace sfmlimgui {
11
+ namespace {
12
+
13
+ NAN_METHOD(Button) {
14
+ std::string label_utf8;
15
+ const char* label = nullptr;
16
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
17
+ auto result = ::cimgui::ImGui_Button(label);
18
+ info.GetReturnValue().Set(Nan::New(result));
19
+ }
20
+
21
+ NAN_METHOD(ButtonEx) {
22
+ std::string label_utf8;
23
+ const char* label = nullptr;
24
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
25
+ cimgui::ImVec2 size;
26
+ if (!ReadImVec2(info, 1, &size)) return;
27
+ auto result = ::cimgui::ImGui_ButtonEx(label, size);
28
+ info.GetReturnValue().Set(Nan::New(result));
29
+ }
30
+
31
+ NAN_METHOD(SmallButton) {
32
+ std::string label_utf8;
33
+ const char* label = nullptr;
34
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
35
+ auto result = ::cimgui::ImGui_SmallButton(label);
36
+ info.GetReturnValue().Set(Nan::New(result));
37
+ }
38
+
39
+ NAN_METHOD(InvisibleButton) {
40
+ std::string string_id_utf8;
41
+ const char* string_id = nullptr;
42
+ if (!ReadUtf8(info, 0, &string_id_utf8, &string_id, true)) return;
43
+ cimgui::ImVec2 size;
44
+ if (!ReadImVec2(info, 1, &size)) return;
45
+ ImGuiButtonFlags flags = {};
46
+ if (!ReadScalar(info, 2, &flags)) return;
47
+ auto result = ::cimgui::ImGui_InvisibleButton(string_id, size, flags);
48
+ info.GetReturnValue().Set(Nan::New(result));
49
+ }
50
+
51
+ NAN_METHOD(ArrowButton) {
52
+ std::string string_id_utf8;
53
+ const char* string_id = nullptr;
54
+ if (!ReadUtf8(info, 0, &string_id_utf8, &string_id, true)) return;
55
+ ImGuiDir direction = {};
56
+ if (!ReadScalar(info, 1, &direction)) return;
57
+ auto result = ::cimgui::ImGui_ArrowButton(string_id, direction);
58
+ info.GetReturnValue().Set(Nan::New(result));
59
+ }
60
+
61
+ NAN_METHOD(Checkbox) {
62
+ std::string label_utf8;
63
+ const char* label = nullptr;
64
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
65
+ bool* value = ReadBoolArray(info, 1, 1);
66
+ if (!value) return;
67
+ auto result = ::cimgui::ImGui_Checkbox(label, value);
68
+ info.GetReturnValue().Set(Nan::New(result));
69
+ }
70
+
71
+ NAN_METHOD(CheckboxFlagsIntPtr) {
72
+ std::string label_utf8;
73
+ const char* label = nullptr;
74
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
75
+ int* flags = ReadInt32Array(info, 1, 1);
76
+ if (!flags) return;
77
+ int flags_value = {};
78
+ if (!ReadScalar(info, 2, &flags_value)) return;
79
+ auto result = ::cimgui::ImGui_CheckboxFlagsIntPtr(label, flags, flags_value);
80
+ info.GetReturnValue().Set(Nan::New(result));
81
+ }
82
+
83
+ NAN_METHOD(CheckboxFlagsUintPtr) {
84
+ std::string label_utf8;
85
+ const char* label = nullptr;
86
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
87
+ unsigned int* flags = ReadUint32Array(info, 1, 1);
88
+ if (!flags) return;
89
+ unsigned int flags_value = {};
90
+ if (!ReadScalar(info, 2, &flags_value)) return;
91
+ auto result = ::cimgui::ImGui_CheckboxFlagsUintPtr(label, flags, flags_value);
92
+ info.GetReturnValue().Set(Nan::New(result));
93
+ }
94
+
95
+ NAN_METHOD(RadioButton) {
96
+ std::string label_utf8;
97
+ const char* label = nullptr;
98
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
99
+ bool active = false;
100
+ if (!ReadBool(info, 1, &active)) return;
101
+ auto result = ::cimgui::ImGui_RadioButton(label, active);
102
+ info.GetReturnValue().Set(Nan::New(result));
103
+ }
104
+
105
+ NAN_METHOD(RadioButtonIntPtr) {
106
+ std::string label_utf8;
107
+ const char* label = nullptr;
108
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
109
+ int* value = ReadInt32Array(info, 1, 1);
110
+ if (!value) return;
111
+ int button_value = {};
112
+ if (!ReadScalar(info, 2, &button_value)) return;
113
+ auto result = ::cimgui::ImGui_RadioButtonIntPtr(label, value, button_value);
114
+ info.GetReturnValue().Set(Nan::New(result));
115
+ }
116
+
117
+ NAN_METHOD(ProgressBar) {
118
+ float fraction = {};
119
+ if (!ReadScalar(info, 0, &fraction)) return;
120
+ cimgui::ImVec2 size_arg;
121
+ if (!ReadImVec2(info, 1, &size_arg)) return;
122
+ std::string overlay_utf8;
123
+ const char* overlay = nullptr;
124
+ if (!ReadUtf8(info, 2, &overlay_utf8, &overlay, true)) return;
125
+ ::cimgui::ImGui_ProgressBar(fraction, size_arg, overlay);
126
+ }
127
+
128
+ NAN_METHOD(Bullet) {
129
+ ::cimgui::ImGui_Bullet();
130
+ }
131
+
132
+ NAN_METHOD(TextLink) {
133
+ std::string label_utf8;
134
+ const char* label = nullptr;
135
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
136
+ auto result = ::cimgui::ImGui_TextLink(label);
137
+ info.GetReturnValue().Set(Nan::New(result));
138
+ }
139
+
140
+ NAN_METHOD(TextLinkOpenURL) {
141
+ std::string label_utf8;
142
+ const char* label = nullptr;
143
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
144
+ ::cimgui::ImGui_TextLinkOpenURL(label);
145
+ }
146
+
147
+ NAN_METHOD(TextLinkOpenURLEx) {
148
+ std::string label_utf8;
149
+ const char* label = nullptr;
150
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
151
+ std::string url_utf8;
152
+ const char* url = nullptr;
153
+ if (!ReadUtf8(info, 1, &url_utf8, &url, true)) return;
154
+ ::cimgui::ImGui_TextLinkOpenURLEx(label, url);
155
+ }
156
+
157
+ NAN_METHOD(Image) {
158
+ ImTextureID user_texture_id = 0;
159
+ if (!ReadTextureId(info, 0, &user_texture_id)) return;
160
+ cimgui::ImVec2 image_size;
161
+ if (!ReadImVec2(info, 1, &image_size)) return;
162
+ ::cimgui::ImGui_Image(user_texture_id, image_size);
163
+ }
164
+
165
+ NAN_METHOD(ImageEx) {
166
+ ImTextureID user_texture_id = 0;
167
+ if (!ReadTextureId(info, 0, &user_texture_id)) return;
168
+ cimgui::ImVec2 image_size;
169
+ if (!ReadImVec2(info, 1, &image_size)) return;
170
+ cimgui::ImVec2 uv0;
171
+ if (!ReadImVec2(info, 2, &uv0)) return;
172
+ cimgui::ImVec2 uv1;
173
+ if (!ReadImVec2(info, 3, &uv1)) return;
174
+ ::cimgui::ImGui_ImageEx(user_texture_id, image_size, uv0, uv1);
175
+ }
176
+
177
+ NAN_METHOD(ImageWithBg) {
178
+ ImTextureID user_texture_id = 0;
179
+ if (!ReadTextureId(info, 0, &user_texture_id)) return;
180
+ cimgui::ImVec2 image_size;
181
+ if (!ReadImVec2(info, 1, &image_size)) return;
182
+ ::cimgui::ImGui_ImageWithBg(user_texture_id, image_size);
183
+ }
184
+
185
+ NAN_METHOD(ImageWithBgEx) {
186
+ ImTextureID user_texture_id = 0;
187
+ if (!ReadTextureId(info, 0, &user_texture_id)) return;
188
+ cimgui::ImVec2 image_size;
189
+ if (!ReadImVec2(info, 1, &image_size)) return;
190
+ cimgui::ImVec2 uv0;
191
+ if (!ReadImVec2(info, 2, &uv0)) return;
192
+ cimgui::ImVec2 uv1;
193
+ if (!ReadImVec2(info, 3, &uv1)) return;
194
+ cimgui::ImVec4 background_color;
195
+ if (!ReadImVec4(info, 4, &background_color)) return;
196
+ cimgui::ImVec4 tint_color;
197
+ if (!ReadImVec4(info, 5, &tint_color)) return;
198
+ ::cimgui::ImGui_ImageWithBgEx(
199
+ user_texture_id, image_size, uv0, uv1, background_color, tint_color);
200
+ }
201
+
202
+ NAN_METHOD(ImageButton) {
203
+ std::string string_id_utf8;
204
+ const char* string_id = nullptr;
205
+ if (!ReadUtf8(info, 0, &string_id_utf8, &string_id, true)) return;
206
+ ImTextureID user_texture_id = 0;
207
+ if (!ReadTextureId(info, 1, &user_texture_id)) return;
208
+ cimgui::ImVec2 image_size;
209
+ if (!ReadImVec2(info, 2, &image_size)) return;
210
+ auto result =
211
+ ::cimgui::ImGui_ImageButton(string_id, user_texture_id, image_size);
212
+ info.GetReturnValue().Set(Nan::New(result));
213
+ }
214
+
215
+ NAN_METHOD(ImageButtonEx) {
216
+ std::string string_id_utf8;
217
+ const char* string_id = nullptr;
218
+ if (!ReadUtf8(info, 0, &string_id_utf8, &string_id, true)) return;
219
+ ImTextureID user_texture_id = 0;
220
+ if (!ReadTextureId(info, 1, &user_texture_id)) return;
221
+ cimgui::ImVec2 image_size;
222
+ if (!ReadImVec2(info, 2, &image_size)) return;
223
+ cimgui::ImVec2 uv0;
224
+ if (!ReadImVec2(info, 3, &uv0)) return;
225
+ cimgui::ImVec2 uv1;
226
+ if (!ReadImVec2(info, 4, &uv1)) return;
227
+ cimgui::ImVec4 background_color;
228
+ if (!ReadImVec4(info, 5, &background_color)) return;
229
+ cimgui::ImVec4 tint_color;
230
+ if (!ReadImVec4(info, 6, &tint_color)) return;
231
+ auto result = ::cimgui::ImGui_ImageButtonEx(string_id,
232
+ user_texture_id,
233
+ image_size,
234
+ uv0,
235
+ uv1,
236
+ background_color,
237
+ tint_color);
238
+ info.GetReturnValue().Set(Nan::New(result));
239
+ }
240
+
241
+ NAN_METHOD(BeginCombo) {
242
+ std::string label_utf8;
243
+ const char* label = nullptr;
244
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
245
+ std::string preview_value_utf8;
246
+ const char* preview_value = nullptr;
247
+ if (!ReadUtf8(info, 1, &preview_value_utf8, &preview_value, true)) return;
248
+ ImGuiComboFlags flags = {};
249
+ if (!ReadScalar(info, 2, &flags)) return;
250
+ auto result = ::cimgui::ImGui_BeginCombo(label, preview_value, flags);
251
+ info.GetReturnValue().Set(Nan::New(result));
252
+ }
253
+
254
+ NAN_METHOD(EndCombo) {
255
+ ::cimgui::ImGui_EndCombo();
256
+ }
257
+
258
+ NAN_METHOD(ComboChar) {
259
+ std::string label_utf8;
260
+ const char* label = nullptr;
261
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
262
+ int* current_item = ReadInt32Array(info, 1, 1);
263
+ if (!current_item) return;
264
+ std::vector<std::string> items_storage;
265
+ std::vector<const char*> items_pointers;
266
+ if (!ReadStringArray(info, 2, &items_storage, &items_pointers)) return;
267
+ const char* const* items = items_pointers.data();
268
+ int items_count = {};
269
+ if (!ReadScalar(info, 3, &items_count)) return;
270
+ auto result =
271
+ ::cimgui::ImGui_ComboChar(label, current_item, items, items_count);
272
+ info.GetReturnValue().Set(Nan::New(result));
273
+ }
274
+
275
+ NAN_METHOD(ComboCharEx) {
276
+ std::string label_utf8;
277
+ const char* label = nullptr;
278
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
279
+ int* current_item = ReadInt32Array(info, 1, 1);
280
+ if (!current_item) return;
281
+ std::vector<std::string> items_storage;
282
+ std::vector<const char*> items_pointers;
283
+ if (!ReadStringArray(info, 2, &items_storage, &items_pointers)) return;
284
+ const char* const* items = items_pointers.data();
285
+ int items_count = {};
286
+ if (!ReadScalar(info, 3, &items_count)) return;
287
+ int popup_max_height_in_items = {};
288
+ if (!ReadScalar(info, 4, &popup_max_height_in_items)) return;
289
+ auto result = ::cimgui::ImGui_ComboCharEx(
290
+ label, current_item, items, items_count, popup_max_height_in_items);
291
+ info.GetReturnValue().Set(Nan::New(result));
292
+ }
293
+
294
+ NAN_METHOD(Combo) {
295
+ std::string label_utf8;
296
+ const char* label = nullptr;
297
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
298
+ int* current_item = ReadInt32Array(info, 1, 1);
299
+ if (!current_item) return;
300
+ std::string items_separated_by_zeros_utf8;
301
+ const char* items_separated_by_zeros = nullptr;
302
+ if (!ReadUtf8(info,
303
+ 2,
304
+ &items_separated_by_zeros_utf8,
305
+ &items_separated_by_zeros,
306
+ true))
307
+ return;
308
+ auto result =
309
+ ::cimgui::ImGui_Combo(label, current_item, items_separated_by_zeros);
310
+ info.GetReturnValue().Set(Nan::New(result));
311
+ }
312
+
313
+ NAN_METHOD(ComboEx) {
314
+ std::string label_utf8;
315
+ const char* label = nullptr;
316
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
317
+ int* current_item = ReadInt32Array(info, 1, 1);
318
+ if (!current_item) return;
319
+ std::string items_separated_by_zeros_utf8;
320
+ const char* items_separated_by_zeros = nullptr;
321
+ if (!ReadUtf8(info,
322
+ 2,
323
+ &items_separated_by_zeros_utf8,
324
+ &items_separated_by_zeros,
325
+ true))
326
+ return;
327
+ int popup_max_height_in_items = {};
328
+ if (!ReadScalar(info, 3, &popup_max_height_in_items)) return;
329
+ auto result = ::cimgui::ImGui_ComboEx(
330
+ label, current_item, items_separated_by_zeros, popup_max_height_in_items);
331
+ info.GetReturnValue().Set(Nan::New(result));
332
+ }
333
+
334
+ NAN_METHOD(ColorEdit3) {
335
+ std::string label_utf8;
336
+ const char* label = nullptr;
337
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
338
+ float* color = ReadFloat32Array(info, 1, 3);
339
+ if (!color) return;
340
+ ImGuiColorEditFlags flags = {};
341
+ if (!ReadScalar(info, 2, &flags)) return;
342
+ auto result = ::cimgui::ImGui_ColorEdit3(label, color, flags);
343
+ info.GetReturnValue().Set(Nan::New(result));
344
+ }
345
+
346
+ NAN_METHOD(ColorEdit4) {
347
+ std::string label_utf8;
348
+ const char* label = nullptr;
349
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
350
+ float* color = ReadFloat32Array(info, 1, 4);
351
+ if (!color) return;
352
+ ImGuiColorEditFlags flags = {};
353
+ if (!ReadScalar(info, 2, &flags)) return;
354
+ auto result = ::cimgui::ImGui_ColorEdit4(label, color, flags);
355
+ info.GetReturnValue().Set(Nan::New(result));
356
+ }
357
+
358
+ NAN_METHOD(ColorPicker3) {
359
+ std::string label_utf8;
360
+ const char* label = nullptr;
361
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
362
+ float* color = ReadFloat32Array(info, 1, 3);
363
+ if (!color) return;
364
+ ImGuiColorEditFlags flags = {};
365
+ if (!ReadScalar(info, 2, &flags)) return;
366
+ auto result = ::cimgui::ImGui_ColorPicker3(label, color, flags);
367
+ info.GetReturnValue().Set(Nan::New(result));
368
+ }
369
+
370
+ NAN_METHOD(ColorPicker4) {
371
+ std::string label_utf8;
372
+ const char* label = nullptr;
373
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
374
+ float* color = ReadFloat32Array(info, 1, 4);
375
+ if (!color) return;
376
+ ImGuiColorEditFlags flags = {};
377
+ if (!ReadScalar(info, 2, &flags)) return;
378
+ float* reference_color = nullptr;
379
+ if (!info[3]->IsUndefined() && !info[3]->IsNull()) {
380
+ const size_t reference_components =
381
+ (flags & ImGuiColorEditFlags_NoAlpha) ? 3 : 4;
382
+ reference_color = ReadFloat32Array(info, 3, reference_components);
383
+ if (!reference_color) return;
384
+ }
385
+ auto result =
386
+ ::cimgui::ImGui_ColorPicker4(label, color, flags, reference_color);
387
+ info.GetReturnValue().Set(Nan::New(result));
388
+ }
389
+
390
+ NAN_METHOD(ColorButton) {
391
+ std::string description_id_utf8;
392
+ const char* description_id = nullptr;
393
+ if (!ReadUtf8(info, 0, &description_id_utf8, &description_id, true)) return;
394
+ cimgui::ImVec4 color;
395
+ if (!ReadImVec4(info, 1, &color)) return;
396
+ ImGuiColorEditFlags flags = {};
397
+ if (!ReadScalar(info, 2, &flags)) return;
398
+ auto result = ::cimgui::ImGui_ColorButton(description_id, color, flags);
399
+ info.GetReturnValue().Set(Nan::New(result));
400
+ }
401
+
402
+ NAN_METHOD(ColorButtonEx) {
403
+ std::string description_id_utf8;
404
+ const char* description_id = nullptr;
405
+ if (!ReadUtf8(info, 0, &description_id_utf8, &description_id, true)) return;
406
+ cimgui::ImVec4 color;
407
+ if (!ReadImVec4(info, 1, &color)) return;
408
+ ImGuiColorEditFlags flags = {};
409
+ if (!ReadScalar(info, 2, &flags)) return;
410
+ cimgui::ImVec2 size;
411
+ if (!ReadImVec2(info, 3, &size)) return;
412
+ auto result =
413
+ ::cimgui::ImGui_ColorButtonEx(description_id, color, flags, size);
414
+ info.GetReturnValue().Set(Nan::New(result));
415
+ }
416
+
417
+ NAN_METHOD(SetColorEditOptions) {
418
+ ImGuiColorEditFlags flags = {};
419
+ if (!ReadScalar(info, 0, &flags)) return;
420
+ ::cimgui::ImGui_SetColorEditOptions(flags);
421
+ }
422
+
423
+ NAN_METHOD(PlotLines) {
424
+ std::string label_utf8;
425
+ const char* label = nullptr;
426
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
427
+ float* values = ReadFloat32Array(info, 1, 1);
428
+ if (!values) return;
429
+ int values_count = {};
430
+ if (!ReadScalar(info, 2, &values_count)) return;
431
+ ::cimgui::ImGui_PlotLines(label, values, values_count);
432
+ }
433
+
434
+ NAN_METHOD(PlotLinesEx) {
435
+ std::string label_utf8;
436
+ const char* label = nullptr;
437
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
438
+ float* values = ReadFloat32Array(info, 1, 1);
439
+ if (!values) return;
440
+ int values_count = {};
441
+ if (!ReadScalar(info, 2, &values_count)) return;
442
+ int values_offset = {};
443
+ if (!ReadScalar(info, 3, &values_offset)) return;
444
+ std::string overlay_text_utf8;
445
+ const char* overlay_text = nullptr;
446
+ if (!ReadUtf8(info, 4, &overlay_text_utf8, &overlay_text, true)) return;
447
+ float scale_min = {};
448
+ if (!ReadScalar(info, 5, &scale_min)) return;
449
+ float scale_max = {};
450
+ if (!ReadScalar(info, 6, &scale_max)) return;
451
+ cimgui::ImVec2 graph_size;
452
+ if (!ReadImVec2(info, 7, &graph_size)) return;
453
+ int stride = {};
454
+ if (!ReadScalar(info, 8, &stride)) return;
455
+ ::cimgui::ImGui_PlotLinesEx(label,
456
+ values,
457
+ values_count,
458
+ values_offset,
459
+ overlay_text,
460
+ scale_min,
461
+ scale_max,
462
+ graph_size,
463
+ stride);
464
+ }
465
+
466
+ NAN_METHOD(PlotHistogram) {
467
+ std::string label_utf8;
468
+ const char* label = nullptr;
469
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
470
+ float* values = ReadFloat32Array(info, 1, 1);
471
+ if (!values) return;
472
+ int values_count = {};
473
+ if (!ReadScalar(info, 2, &values_count)) return;
474
+ ::cimgui::ImGui_PlotHistogram(label, values, values_count);
475
+ }
476
+
477
+ NAN_METHOD(PlotHistogramEx) {
478
+ std::string label_utf8;
479
+ const char* label = nullptr;
480
+ if (!ReadUtf8(info, 0, &label_utf8, &label, true)) return;
481
+ float* values = ReadFloat32Array(info, 1, 1);
482
+ if (!values) return;
483
+ int values_count = {};
484
+ if (!ReadScalar(info, 2, &values_count)) return;
485
+ int values_offset = {};
486
+ if (!ReadScalar(info, 3, &values_offset)) return;
487
+ std::string overlay_text_utf8;
488
+ const char* overlay_text = nullptr;
489
+ if (!ReadUtf8(info, 4, &overlay_text_utf8, &overlay_text, true)) return;
490
+ float scale_min = {};
491
+ if (!ReadScalar(info, 5, &scale_min)) return;
492
+ float scale_max = {};
493
+ if (!ReadScalar(info, 6, &scale_max)) return;
494
+ cimgui::ImVec2 graph_size;
495
+ if (!ReadImVec2(info, 7, &graph_size)) return;
496
+ int stride = {};
497
+ if (!ReadScalar(info, 8, &stride)) return;
498
+ ::cimgui::ImGui_PlotHistogramEx(label,
499
+ values,
500
+ values_count,
501
+ values_offset,
502
+ overlay_text,
503
+ scale_min,
504
+ scale_max,
505
+ graph_size,
506
+ stride);
507
+ }
508
+
509
+ NAN_METHOD(ImageImVec4) {
510
+ ImTextureID user_texture_id = 0;
511
+ if (!ReadTextureId(info, 0, &user_texture_id)) return;
512
+ cimgui::ImVec2 image_size;
513
+ if (!ReadImVec2(info, 1, &image_size)) return;
514
+ cimgui::ImVec2 uv0;
515
+ if (!ReadImVec2(info, 2, &uv0)) return;
516
+ cimgui::ImVec2 uv1;
517
+ if (!ReadImVec2(info, 3, &uv1)) return;
518
+ cimgui::ImVec4 tint_color;
519
+ if (!ReadImVec4(info, 4, &tint_color)) return;
520
+ cimgui::ImVec4 border_color;
521
+ if (!ReadImVec4(info, 5, &border_color)) return;
522
+ ::cimgui::ImGui_ImageImVec4(
523
+ user_texture_id, image_size, uv0, uv1, tint_color, border_color);
524
+ }
525
+
526
+ } // namespace
527
+
528
+ NAN_MODULE_INIT(InitializeImGuiWidgets) {
529
+ sfmljs::SetMethod<Button>(target, "Button");
530
+ sfmljs::SetMethod<ButtonEx>(target, "ButtonEx");
531
+ sfmljs::SetMethod<SmallButton>(target, "SmallButton");
532
+ sfmljs::SetMethod<InvisibleButton>(target, "InvisibleButton");
533
+ sfmljs::SetMethod<ArrowButton>(target, "ArrowButton");
534
+ sfmljs::SetMethod<Checkbox>(target, "Checkbox");
535
+ sfmljs::SetMethod<CheckboxFlagsIntPtr>(target, "CheckboxFlagsIntPtr");
536
+ sfmljs::SetMethod<CheckboxFlagsUintPtr>(target, "CheckboxFlagsUintPtr");
537
+ sfmljs::SetMethod<RadioButton>(target, "RadioButton");
538
+ sfmljs::SetMethod<RadioButtonIntPtr>(target, "RadioButtonIntPtr");
539
+ sfmljs::SetMethod<ProgressBar>(target, "ProgressBar");
540
+ sfmljs::SetMethod<Bullet>(target, "Bullet");
541
+ sfmljs::SetMethod<TextLink>(target, "TextLink");
542
+ sfmljs::SetMethod<TextLinkOpenURL>(target, "TextLinkOpenURL");
543
+ sfmljs::SetMethod<TextLinkOpenURLEx>(target, "TextLinkOpenURLEx");
544
+ sfmljs::SetMethod<Image>(target, "Image");
545
+ sfmljs::SetMethod<ImageEx>(target, "ImageEx");
546
+ sfmljs::SetMethod<ImageWithBg>(target, "ImageWithBg");
547
+ sfmljs::SetMethod<ImageWithBgEx>(target, "ImageWithBgEx");
548
+ sfmljs::SetMethod<ImageButton>(target, "ImageButton");
549
+ sfmljs::SetMethod<ImageButtonEx>(target, "ImageButtonEx");
550
+ sfmljs::SetMethod<BeginCombo>(target, "BeginCombo");
551
+ sfmljs::SetMethod<EndCombo>(target, "EndCombo");
552
+ sfmljs::SetMethod<ComboChar>(target, "ComboChar");
553
+ sfmljs::SetMethod<ComboCharEx>(target, "ComboCharEx");
554
+ sfmljs::SetMethod<Combo>(target, "Combo");
555
+ sfmljs::SetMethod<ComboEx>(target, "ComboEx");
556
+ sfmljs::SetMethod<ColorEdit3>(target, "ColorEdit3");
557
+ sfmljs::SetMethod<ColorEdit4>(target, "ColorEdit4");
558
+ sfmljs::SetMethod<ColorPicker3>(target, "ColorPicker3");
559
+ sfmljs::SetMethod<ColorPicker4>(target, "ColorPicker4");
560
+ sfmljs::SetMethod<ColorButton>(target, "ColorButton");
561
+ sfmljs::SetMethod<ColorButtonEx>(target, "ColorButtonEx");
562
+ sfmljs::SetMethod<SetColorEditOptions>(target, "SetColorEditOptions");
563
+ sfmljs::SetMethod<PlotLines>(target, "PlotLines");
564
+ sfmljs::SetMethod<PlotLinesEx>(target, "PlotLinesEx");
565
+ sfmljs::SetMethod<PlotHistogram>(target, "PlotHistogram");
566
+ sfmljs::SetMethod<PlotHistogramEx>(target, "PlotHistogramEx");
567
+ sfmljs::SetMethod<ImageImVec4>(target, "ImageImVec4");
568
+ }
569
+
570
+ } // namespace sfmlimgui