Skip to content

Commit bc5ce87

Browse files
committed
added: IconFontViewer example
1 parent 4b70f63 commit bc5ce87

File tree

31 files changed

+3464
-79
lines changed

31 files changed

+3464
-79
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ examples/glfw_opengl3_bench
22
examples/sdl2
33
examples/gui
44
stringArray/
5-
iconFontViewer/
65
node_modules/
76
.build/
87
.vs/

README.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- [Examples](#examples)
77
- [implot3d_sample.lua](#implot3d_samplelua)
88
- [glfw_opengl3_simple](#glfw_opengl3_simple)
9+
- [iconFontViewer](#iconfontviewer)
910
- [glfw_opengl3](#glfw_opengl3)
1011
- [glfw_opengl3_implot](#glfw_opengl3_implot)
1112
- [glfw_opengl3_jp](#glfw_opengl3_jp)
@@ -18,7 +19,7 @@
1819
- [house.lua](#houselua)
1920
- [corazon.lua](#corazonlua)
2021
- [CTE_windows.lua](#cte_windowslua)
21-
- [conpute_shader.lua](#conpute_shaderlua)
22+
- [compute_shader.lua](#compute_shaderlua)
2223
- [Download Zip binary](#download-zip-binary)
2324
- [Running examples](#running-examples)
2425
- [Other examples](#other-examples)
@@ -72,52 +73,56 @@ This sample is attached by [anima](https://github.com/sonoro1234/anima) project.
7273
[implot3d_sample.bat](bin/examples/LuaJIT-ImGui/examples/implot3d_sample.bat)
7374
in [bin/examples/LuaJIT-ImGui/examples](bin/examples/LuaJIT-ImGui/examples) folder.
7475

75-
![implot3d_sample](examples/img/cimplot3d.gif)
76+
![alt](examples/img/cimplot3d.gif)
7677

7778
##### [glfw_opengl3_simple](examples/glfw_opengl3_simple/glfw_opengl3_simple.lua)
7879

79-
![glfw_opengl3_simple](examples/img/glfw_opengl3_simple.png)
80+
![alt](examples/img/glfw_opengl3_simple.png)
81+
82+
##### [iconFontViewer](examples/iconFontViewer/iconFontViewer.lua)
83+
84+
![alt](examples/img/iconFontViewer.png)
8085

8186
##### [glfw_opengl3](examples/glfw_opengl3/glfw_opengl3.lua)
8287

8388
This can load and save image file with magnifying glass.
8489

85-
![glfw_opengl3](examples/img/glfw_opengl3.png)
90+
![alt](examples/img/glfw_opengl3.png)
8691

8792
##### [glfw_opengl3_implot](examples/glfw_opengl3_implot/glfw_opengl3_implot.lua)
8893

8994
With magnifying glass.
9095

91-
![glfw_opengl3_implot](examples/img/glfw_opengl3_implot.png)
96+
![alt](examples/img/glfw_opengl3_implot.png)
9297
See more example: [implot_sample.lua](bin/examples/LuaJIT-ImGui/examples/implot_sample.lua)
9398

9499
##### [glfw_opengl3_jp](examples/glfw_opengl3_jp/glfw_opengl3_jp.lua)
95100

96101
Showing font of local language with magnifying glass.
97102

98-
![glfw_opengl3_jp](examples/img/glfw_opengl3_jp.png)
103+
![alt](examples/img/glfw_opengl3_jp.png)
99104

100105
##### [sdl2_opengl3](examples/sdl2_opengl3/sdl2_opengl3.lua)
101106

102107
With magnifying glass.
103108

104-
![sdl2_opengl3](examples/img/sdl2_opengl3.png)
109+
![alt](examples/img/sdl2_opengl3.png)
105110

106111
##### [ImGuizmo_sample.lua](bin/examples/LuaJIT-ImGui/examples/ImGuizmo_sample.lua)
107112

108113
This sample is attached by [anima](https://github.com/sonoro1234/anima) project. You can execute this sample using
109114
[ImGuizmo_sample.bat](bin/examples/LuaJIT-ImGui/examples/ImGuizmo_sample.bat)
110115
in [bin/examples/LuaJIT-ImGui/examples](bin/examples/LuaJIT-ImGui/examples) folder.
111116

112-
![ImGuizmo_sample](examples/img/ImGuizmo_sample.png)
117+
![alt](examples/img/ImGuizmo_sample.png)
113118

114119
##### [imnodes_graph_sample.lua](bin/examples/LuaJIT-ImGui/examples/imnodes_graph_sample.lua)
115120

116121
This sample is attached by [anima](https://github.com/sonoro1234/anima) project. You can execute this sample using
117122
[imnodes_graph_sample.bat](bin/examples/LuaJIT-ImGui/examples/imnodes_graph_sample.bat)
118123
in [bin/examples/LuaJIT-ImGui/examples](bin/examples/LuaJIT-ImGui/examples) folder.
119124

120-
![imnodes_graph_sample](examples/img/imnodes_graph_sample.png)
125+
![alt](examples/img/imnodes_graph_sample.png)
121126

122127

123128
#### Other samples
@@ -127,21 +132,27 @@ in [bin/examples/LuaJIT-ImGui/examples](bin/examples/LuaJIT-ImGui/examples) fold
127132
These samples are attached by [anima](https://github.com/sonoro1234/anima) project. You can execute samples with \*.bat files.
128133

129134
##### [delaunay_particles.lua](bin/examples/delaunay_particles.lua)
130-
![delaunay_particles](examples/img/delaunay_particles.png)
135+
136+
![alt](examples/img/delaunay_particles.png)
131137

132138
##### [bacteria.lua](bin/examples/shadertoy/bacteria.lua)
139+
133140
![alt](examples/img/bacteria.png)
134141

135142
##### [house.lua](bin/examples/modeling/house/house.lua)
143+
136144
![alt](examples/img/house.png)
137145

138146
##### [corazon.lua](bin/examples/modeling/heart/corazon.lua)
147+
139148
![alt](examples/img/corazon.png)
140149

141150
##### [CTE_windows.lua](bin/examples/LuaJIT-ImGui/examples/CTE_windows.lua)
151+
142152
![alt](examples/img/CTE_Windows.png)
143153

144-
##### [conpute_shader.lua](bin/examples/compute_shader/compute_shader.lua)
154+
##### [compute_shader.lua](bin/examples/compute_shader/compute_shader.lua)
155+
145156
![alt](examples/img/compute_shader.png)
146157

147158
#### Download Zip binary
@@ -150,9 +161,10 @@ These samples are attached by [anima](https://github.com/sonoro1234/anima) proje
150161

151162
- WindowsOS 64bit
152163
- Latest
153-
[luajitImGui-1.91.8.1.zip](https://bitbucket.org/dinau/storage/downloads/luajitImGui-1.91.8.1.zip) 2025/03
164+
[luajitImGui-1.91.8.2.zip](https://bitbucket.org/dinau/storage/downloads/luajitImGui-1.91.8.2.zip) 2025/03
154165

155166
- Old
167+
[luajitImGui-1.91.8.1.zip](https://bitbucket.org/dinau/storage/downloads/luajitImGui-1.91.8.1.zip) 2025/03
156168
[luajitImGui-1.91.8.0.zip](https://bitbucket.org/dinau/storage/downloads/luajitImGui-1.91.8.0.zip) 2025/03
157169
[luajitImGui-1.91.6.0.zip](https://bitbucket.org/dinau/storage/downloads/luajitImGui-1.91.6.0.zip) 2025/01
158170
[luajitImGui-1.91.4.0.zip](https://bitbucket.org/dinau/storage/downloads/luajitImGui-1.91.4.0.zip) 2024/10
@@ -222,7 +234,7 @@ Refer to nice exmaples: [bin/examples](bin/examples)
222234
- WindowsOS 64bit versions
223235
| Date | ImGui / CImGui | LuaJITImGui | Commemt |
224236
| --- | ----------- | --- | --- |
225-
| 2025/03 | v1.91.8 | v1.91.8.0 | |
237+
| 2025/03 | v1.91.8 | v1.91.8.2 | |
226238
| 2025/01 | v1.91.6 | v1.91.6.0 | |
227239
| 2024/10 | v1.91.4 | v1.91.4.0 | |
228240
| 2024/10 | v1.91.2 | v1.91.2.0 | |

bin/examples/LuaJIT-ImGui/examples/imgui.ini

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
[Window][WindowOverViewport_11111111]
2-
Pos=0,0
32
Size=800,400
43
Collapsed=0
54

@@ -23,6 +22,8 @@ Pos=50,50
2322
Size=600,750
2423
Collapsed=0
2524

26-
[Docking][Data]
27-
DockSpace ID=0x08BD597D Window=0x1BBC0F80 Pos=0,0 Size=800,400 CentralNode=1
25+
[Window][Dear ImGui Demo]
26+
Pos=650,20
27+
Size=550,680
28+
Collapsed=0
2829

bin/examples/LuaJIT-ImGui/examples/minimal_sdl.lua

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ local sdl = require"sdl2_ffi"
77
local gllib = require"gl"
88
gllib.set_loader(sdl)
99
local gl, glc, glu, glext = gllib.libraries()
10-
1110
local ig = require"imgui.sdl"
1211

1312
if (sdl.init(sdl.INIT_VIDEO+sdl.INIT_TIMER) ~= 0) then
@@ -25,19 +24,19 @@ end
2524
sdl.gL_SetAttribute(sdl.GL_CONTEXT_MINOR_VERSION, 2);
2625
local current = ffi.new("SDL_DisplayMode[1]")
2726
sdl.getCurrentDisplayMode(0, current);
28-
local window = sdl.createWindow("ImGui SDL2+OpenGL3 example", sdl.WINDOWPOS_CENTERED, sdl.WINDOWPOS_CENTERED, 700, 500, sdl.WINDOW_OPENGL+sdl.WINDOW_RESIZABLE);
27+
local window = sdl.createWindow("ImGui SDL2+OpenGL3 example", sdl.WINDOWPOS_CENTERED, sdl.WINDOWPOS_CENTERED, 700, 500, sdl.WINDOW_OPENGL+sdl.WINDOW_RESIZABLE);
2928
local gl_context = sdl.gL_CreateContext(window);
3029
sdl.gL_SetSwapInterval(1); -- Enable vsync
31-
30+
3231
local ig_Impl = ig.Imgui_Impl_SDL_opengl3()
33-
32+
3433
ig_Impl:Init(window, gl_context)
3534

3635
local igio = ig.GetIO()
37-
36+
3837
local done = false;
3938
while (not done) do
40-
--SDL_Event
39+
--SDL_Event
4140
local event = ffi.new"SDL_Event"
4241
while (sdl.pollEvent(event) ~=0) do
4342
ig.lib.ImGui_ImplSDL2_ProcessEvent(event);
@@ -54,21 +53,20 @@ end
5453
gl.glClear(glc.GL_COLOR_BUFFER_BIT)
5554

5655
ig_Impl:NewFrame()
57-
58-
56+
57+
5958
if ig.Button"Hello" then
6059
print"Hello World!!"
6160
end
6261
ig.ShowDemoWindow(showdemo)
63-
62+
6463
ig_Impl:Render()
6564
sdl.gL_SwapWindow(window);
6665
end
67-
66+
6867
-- Cleanup
6968
ig_Impl:destroy()
7069

7170
sdl.gL_DeleteContext(gl_context);
7271
sdl.destroyWindow(window);
7372
sdl.quit();
74-

bin/lua/mylib/utils.lua

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,20 @@ function M.saveImage(glext, filename, formato, width, height, xPos, yPos)
176176
image:Destroy()
177177
end
178178

179+
---------------
180+
--- setTooltip
181+
---------------
182+
function M.setTooltip(ig, str, delay, color)
183+
delay = delay or ig.ImguiHoveredFlags_DelayNormal
184+
if ig.IsItemHovered(delay) then
185+
if ig.BeginTooltip() then
186+
color = color or ig.ImVec4(1.0, 1.0, 1.0, 1.0)
187+
ig.PushStyleColor(ig.lib.ImGuiCol_Text, color)
188+
ig.Text(str)
189+
ig.PopStyleColor(1)
190+
ig.EndTooltip()
191+
end
192+
end
193+
end
194+
179195
return M

examples/glfw_opengl3/glfw_opengl3.lua

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ local gl, glc, glu, glext = gllib.libraries()
99
require"mylib.loadimage"
1010
require"mylib.setupFonts"
1111
require"mylib.zoomglass"
12+
local utils = require"mylib.utils"
1213
local IFA = require"mylib.fonticon.IconsFontAwesome6"
1314

1415
--- Global var: app
@@ -104,18 +105,6 @@ end
104105

105106
ig.StyleColorsClassic()
106107

107-
---------------
108-
--- setTooltip
109-
---------------
110-
function setTooltip(str)
111-
if ig.IsItemHovered(ig.ImguiHoveredFlags_DelayNormal) then
112-
if ig.BeginTooltip() then
113-
ig.Text(str)
114-
ig.EndTooltip()
115-
end
116-
end
117-
end
118-
119108
--------------
120109
--- main loop
121110
--------------
@@ -185,7 +174,7 @@ while not window:shouldClose() do
185174
-- Show tooltip help
186175
local imgSaveFormatStr = imageFormatTbl[cmbItemIndex]
187176
svName = SaveImageName .. "_" .. counter .. utils.imageExt[imgSaveFormatStr]
188-
setTooltip(string.format("Save to \"%s\"", svName))
177+
utils.setTooltip(ig, string.format("Save to \"%s\"", svName), ig.ImguiHoveredFlags_DelayNormal, ig.ImVec4(0.0, 1.0, 0.0, 1.0))
189178
-- End Save button of window image
190179
ig.SameLine(0.0,-1.0)
191180

@@ -204,7 +193,7 @@ while not window:shouldClose() do
204193
App.image.imageSaveFormatIndex = cmbItemIndex
205194
ig.EndCombo()
206195
end
207-
setTooltip("Select image format")
196+
utils.setTooltip(ig, "Select image format", ig.ImguiHoveredFlags_DelayNormal, ig.ImVec4(1.0, 1.0, 0.0, 1.0))
208197

209198
-- Icon font test
210199
ig.SeparatorText(IFA.ICON_FA_WRENCH .. " Icon font test ")

examples/glfw_opengl3/r.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ rem ---------------------------------
1111
set bin=..\..\bin
1212
set LUA_PATH=;;..\lib\?.lua;%bin%\examples\LuaJIT-ImGui\examples\?.lua
1313
rem Clear PATH if you need.
14+
setlocal
1415
set PATH=
1516
set PATH=%path%;..\lib
1617

1718
rem ----------------
1819
rem Execute program
1920
rem ----------------
2021
%bin%\luajit.exe %TARGET%
22+
23+
endlocal

examples/glfw_opengl3_implot/glfw_opengl3_implot.lua

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,6 @@ end
106106

107107
--ig.StyleColorsClassic()
108108

109-
---------------
110-
--- setTooltip
111-
---------------
112-
function setTooltip(str)
113-
if ig.IsItemHovered(ig.ImguiHoveredFlags_DelayNormal) then
114-
if ig.BeginTooltip() then
115-
ig.Text(str)
116-
ig.EndTooltip()
117-
end
118-
end
119-
end
120-
121109
--------------
122110
--- main loop
123111
--------------
@@ -193,7 +181,7 @@ while not window:shouldClose() do
193181
-- Show tooltip help
194182
local imgSaveFormatStr = imageFormatTbl[cmbItemIndex]
195183
svName = SaveImageName .. "_" .. counter .. utils.imageExt[imgSaveFormatStr]
196-
setTooltip(string.format("Save to \"%s\"", svName))
184+
utils.setTooltip(ig, string.format("Save to \"%s\"", svName), ig.ImguiHoveredFlags_DelayNormal, ig.ImVec4(0.0, 1.0, 0.0, 1.0))
197185
-- End Save button of window image
198186
ig.SameLine(0.0,-1.0)
199187

@@ -212,7 +200,7 @@ while not window:shouldClose() do
212200
App.image.imageSaveFormatIndex = cmbItemIndex
213201
ig.EndCombo()
214202
end
215-
setTooltip("Select image format")
203+
utils.setTooltip(ig, "Select image format", ig.ImguiHoveredFlags_DelayNormal, ig.ImVec4(1.0, 1.0, 0.0, 1.0))
216204

217205
-- Icon font test
218206
ig.SeparatorText(IFA.ICON_FA_WRENCH .. " Icon font test ")

examples/glfw_opengl3_implot/r.bat

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@ rem ---------------------------------
1111
set bin=..\..\bin
1212
set LUA_PATH=;;..\lib\?.lua;%bin%\examples\LuaJIT-ImGui\examples\?.lua
1313
rem Clear PATH if you need.
14-
set PATH=c:\drvdx\msys64\ucrt64\bin;
14+
setlocal
15+
set PATH=
16+
set PATH=%path%;..\lib
1517

1618
rem ----------------
1719
rem Execute program
1820
rem ----------------
1921
%bin%\luajit.exe %TARGET%
22+
23+
endlocal

examples/glfw_opengl3_jp/glfw_opengl3_jp.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[mainWindow]
22
height=944
3-
posy=66
4-
posx=545
3+
posy=82
4+
posx=381
55
width=1000
66

77
[image]

0 commit comments

Comments
 (0)