Skip to content

Commit 10df353

Browse files
committed
fix: ImKmobs bug
fix: ImSpinner bug fix: ImGuiFileDialog bug feat: Confirmed executing on Linux: Debian13 Trixie on WSL2
1 parent c212e73 commit 10df353

File tree

72 files changed

+2269
-514
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+2269
-514
lines changed

README.md

Lines changed: 100 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
- [IgRuby Examples](#igruby-examples)
55
- [Prerequisites](#prerequisites)
6-
- [Donwload and running examples](#donwload-and-running-examples)
6+
- [Donwload and running examples on Windows OS](#donwload-and-running-examples-on-windows-os)
77
- [Snapshots](#snapshots)
88
- [ImGui-Toggle / CImGui-Toggle](#imgui-toggle--cimgui-toggle)
99
- [ImDrawList party](#imdrawlist-party)
@@ -16,37 +16,38 @@
1616
- [Iconfonts viewer](#iconfonts-viewer)
1717
- [Image loading](#image-loading)
1818
- [Showing CJK fonts](#showing-cjk-fonts)
19+
- [For Linux x86_64](#for-linux-x86_64)
1920

2021
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
2122

22-
2323
### IgRuby Examples
2424

2525
---
2626

27-
Ruby language + Dear ImGui + Additional libraries project
27+
Ruby language + [Dear ImGui](https://github.com/ocornut/imgui) + Additional libraries and examples project
2828

2929
See [ruby-imgui-dev](https://github.com/dinau/ruby-imgui-dev)
3030

3131
#### Prerequisites
3232

3333
---
3434

35-
Windows10 or later
36-
- Install [RubyInstaller + **Devkit** ](https://rubyinstaller.org/downloads/) 3.4.6 or later
37-
(Install Devkit (MSys2/MinGW))
35+
Windows11 or later
36+
- Install [RubyInstaller + **Devkit** ](https://rubyinstaller.org/downloads/) 3.4.7 or later
37+
(You must install Devkit)
3838

39-
🟥 ~~Linux OS~~
39+
✅ Linux OS x86_64
40+
- Debian13 Trixie, Ubuntu families and Windows WSL2
4041

4142

42-
#### Donwload and running examples
43+
#### Donwload and running examples on Windows OS
4344
---
4445

45-
1. Download `igruby_examples-1.9x.y.w.zip` from [Release page](https://github.com/dinau/igruby_examples/releases) and extract zip file.
46+
1. Download `igruby_examples-1.9x.y-bdn.zip` from [Release page](https://github.com/dinau/igruby_examples/releases) then extract zip file.
4647
1. Execute bundler command,
4748

4849
```sh
49-
$ cd igruby_examples-1.9x.y.w/igruby_examples
50+
$ cd igruby_examples-1.91.8-bd2/igruby_examples
5051
$ bundle install
5152

5253
Fetching gem metadata from https://rubygems.org/..
@@ -62,7 +63,7 @@ See [ruby-imgui-dev](https://github.com/dinau/ruby-imgui-dev)
6263
```sh
6364
cd glfw_opengl3
6465
r.bat # Or double click glfw_opengl3.rbw in Windows explorer
65-
# Ignore many warnings emmited in console
66+
# Ignore many warnings emmited in console window
6667
```
6768

6869

@@ -114,6 +115,7 @@ Amazing !
114115

115116
![alt](img/imspinner.gif)
116117

118+
117119
##### ImGuizmo / CImGuizmo
118120

119121
---
@@ -177,3 +179,90 @@ Amazing !
177179
[glfw_opengl3_jp.rb](https://github.com/dinau/igruby_examples/blob/main/glfw_opengl3_jp/glfw_opengl3_jp.rb)
178180

179181
![alt](https://github.com/dinau/igruby_examples/raw/main/img/glfw_opengl3_jp.png)
182+
183+
184+
185+
#### For Linux x86_64
186+
187+
---
188+
1. Install tools
189+
190+
```sh
191+
$ sudo apt install clang git make ninja-build
192+
$ sudo apt install lib{opengl-dev,gl1-mesa-dev,glfw3,glfw3-dev,xcursor-dev,xinerama-dev,xi-dev}
193+
$ sudo apt install libsdl2-dev libsdl3-dev
194+
```
195+
196+
1. Download files,
197+
198+
```sh
199+
$ pwd
200+
my_dev_folder
201+
$ git clone --recursive https://github.com/dinau/ruby-imgui-dev
202+
$ git clone https://github.com/dinau/igruby_examples
203+
```
204+
205+
Folder structure,
206+
207+
```txt
208+
my_dev_folder
209+
|--- igruby_examples
210+
`--- ruby-imgui-dev
211+
```
212+
213+
1. Generate imgui.so
214+
215+
```sh
216+
$ cd ruby-imgui-dev/imgui_dll
217+
$ make
218+
```
219+
220+
`imgui.so` file is generated in `ruby-imgui-dev/lib`
221+
222+
1. Install bundler
223+
224+
```sh
225+
$ sudo apt install ruby-dev gcc
226+
$ gem install --user-install bundler
227+
```
228+
229+
1. Set environment variable,
230+
231+
```sh
232+
export GEM_HOME =~/.local/share/gem/ruby/3.3.0/bin
233+
```
234+
235+
Part of the `3.3.0` depends on your system.
236+
237+
1. Execute `bundle install`
238+
239+
```sh
240+
$ pwd
241+
igruby_examples
242+
243+
$ bundle install
244+
245+
Fetching gem metadata from https://rubygems.org/..
246+
Resolving dependencies...
247+
Installing fiddle 1.1.8 with native extensions
248+
Fetching opengl-bindings2 2.0.4
249+
Installing opengl-bindings2 2.0.4
250+
Bundle complete! 6 Gemfile dependencies, 9 gems now installed.
251+
Use `bundle info [gemname]` to see where a bundled gem is installed.
252+
```
253+
254+
1. Execute a example
255+
256+
```sh
257+
$ cd glfw_opengl3
258+
$ sh r.sh
259+
```
260+
261+
or
262+
263+
`$ chmod +x glfw_opengl3.rbw`
264+
then double click `glfw_opengl3.rbw` in your file explorer
265+
266+
or
267+
268+
`$ bundle exec ruby glfw_opengl3.rb` on your console

glfw_opengl3/glfw_opengl3.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"window": {
3-
"startupPosX": 373,
4-
"startupPosY": 72,
5-
"viewportWidth": 900.0,
6-
"viewportHeight": 900.0,
3+
"startupPosX": 480,
4+
"startupPosY": 112,
5+
"viewportWidth": 897.0,
6+
"viewportHeight": 817.0,
77
"colBGx": 0.25275719165802,
88
"colBGy": 0.720984160900116,
99
"colBGz": 0.8222222328186035,

glfw_opengl3/glfw_opengl3.rbw

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
require "pathname"
1+
#!/usr/bin/env ruby
22

3-
# Gemfile.lock が1つ上にある場合のみ Bundler を有効化
4-
lockfile = Pathname.new(__dir__).parent.join("Gemfile.lock")
5-
require "bundler/setup" if lockfile.file?
3+
require "pathname"
4+
5+
# Gemfile.lock が1つ上にある場合のみ Bundler を有効化
6+
lockfile = Pathname.new(__dir__).parent.join("Gemfile.lock")
7+
require "bundler/setup" if lockfile.file?
68

79
# # フォルダ名と同名の rb ファイルを require
810
require File.join(__dir__, "#{File.basename(__dir__)}.rb")

glfw_opengl3/imgui.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Size=415,153
7979
Collapsed=0
8080

8181
[Window][Image window]
82-
Pos=7,228
82+
Pos=21,272
8383
Size=414,441
8484
Collapsed=0
8585

@@ -99,7 +99,7 @@ Size=416,207
9999
Collapsed=0
100100

101101
[Window][Info window ]
102-
Pos=6,4
103-
Size=415,218
102+
Pos=19,9
103+
Size=436,243
104104
Collapsed=0
105105

glfw_opengl3/r.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
DIR_CURRENT="$(cd "$(dirname "$0")" && pwd)"
4+
5+
TARGET="$(basename "$DIR_CURRENT").rb"
6+
7+
if [ ! -f "$DIR_CURRENT/$TARGET" ]; then
8+
echo "Error: $TARGET not found in $DIR_CURRENT"
9+
exit 1
10+
fi
11+
12+
if [ -f "../Gemfile.lock" ]; then
13+
if ! command -v bundle >/dev/null 2>&1; then
14+
echo "Error: bundle command not found. Install with 'sudo gem install bundler'"
15+
exit 1
16+
fi
17+
echo "Running with bundle exec..."
18+
bundle exec ruby "$@" "$DIR_CURRENT/$TARGET"
19+
else
20+
if ! command -v ruby >/dev/null 2>&1; then
21+
echo "Error: ruby command not found. Install with 'sudo apt install ruby-full'"
22+
exit 1
23+
fi
24+
echo "Running without bundle..."
25+
ruby "$@" "$DIR_CURRENT/$TARGET"
26+
fi

glfw_opengl3_iconfont_viewer/glfw_opengl3_iconfont_viewer.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"window": {
3-
"startupPosX": 70,
4-
"startupPosY": 100,
3+
"startupPosX": 69,
4+
"startupPosY": 176,
55
"viewportWidth": 1748.0,
66
"viewportHeight": 703.0,
77
"colBGx": 0.32290810346603394,

glfw_opengl3_iconfont_viewer/glfw_opengl3_iconfont_viewer.rb

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,15 @@ def gui_main(window)
1313
setupFonts()
1414

1515
# For Listbox
16-
item_current = FFI::MemoryPointer.new(:int)
17-
item_current.write(:int, 0)
16+
item_current = FFIint.new()
1817
string_pointers = $IconFontsTbl.map { |str| FFI::MemoryPointer.from_string(str)}
1918
pIconFontsTbl = FFI::MemoryPointer.new(:pointer, $IconFontsTbl.size)
2019
string_pointers.each_with_index do |ptr, i|
2120
pIconFontsTbl.put_pointer(i * FFI::Pointer.size, ptr)
2221
end
2322

2423
# For Slider
25-
wsZoom = FFI::MemoryPointer.new(:float)
26-
wsZoom.write(:float, 2.5)
24+
wsZoom = FFIfloat.new(2.5)
2725

2826
filterAry = Array.new
2927

@@ -48,8 +46,8 @@ def gui_main(window)
4846
#
4947
listBoxWidth = 340
5048
begin
51-
ImGui::Text("No.[%4d]", :int, item_current.read_int); ImGui::SameLine()
52-
sBuf = $IconFontsTbl[item_current.read_int]
49+
ImGui::Text("No.[%4d]", :int, item_current.read); ImGui::SameLine()
50+
sBuf = $IconFontsTbl[item_current.read]
5351
if ImGui::Button(ICON_FA_COPY + " Copy to", ImVec2.create(0, 0))
5452
if sBuf =~ /.+(ICON.+)/
5553
ImGui::SetClipboardText($1)
@@ -65,7 +63,7 @@ def gui_main(window)
6563
# Show ListBox main
6664
ImGui::NewLine()
6765
ImGui::SetNextItemWidth(listBoxWidth)
68-
ImGui::ListBox("##lsitbox1", item_current, pIconFontsTbl, $IconFontsTbl.length, 30)
66+
ImGui::ListBox("##lsitbox1", item_current.addr, pIconFontsTbl, $IconFontsTbl.length, 30)
6967
ensure
7068
ImGui::End()
7169
end
@@ -75,7 +73,7 @@ def gui_main(window)
7573
#---------------------
7674
begin ImGui::Begin("Icon Font Viewer2", nil, 0)
7775
ImGui::Text("%s", :string, " Zoom x"); ImGui::SameLine(0,-1.0)
78-
ImGui::SliderFloat("##Zoom1", wsZoom, 0.8, 5.0, "%.1f", 0)
76+
ImGui::SliderFloat("##Zoom1", wsZoom.addr, 0.8, 5.0, "%.1f", 0)
7977
ImGui::Separator()
8078
ImGui::BeginChild("child2", ImVec2.create(0,0), 0, 0)
8179
wsNormal = 1.0
@@ -89,10 +87,10 @@ def gui_main(window)
8987
for column in 0 ... col do
9088
ix = (row * col) + column
9189
ImGui::TableSetColumnIndex(column)
92-
ImGui::SetWindowFontScale(wsZoom.read(:float))
90+
ImGui::SetWindowFontScale(wsZoom.read)
9391
ImGui::Text("%s", :string, $IconFontsTbl2[ix][0])
9492
if ImGui::IsItemHovered(0)
95-
item_current.write(:int, ix)
93+
item_current.set(ix)
9694
end
9795
iconFontLabel = $IconFontsTbl2[ix][1]
9896
setTooltip(iconFontLabel)
@@ -103,7 +101,7 @@ def gui_main(window)
103101
if ImGui::BeginPopupContextItem("Contex Menu", 1)
104102
if ImGui::MenuItem("Copy to clip board", "" , false, true)
105103
#puts "#{$IconFontsTbl2[ix][1]}"
106-
item_current.write(:int, ix)
104+
item_current.set(ix)
107105
ImGui::SetClipboardText($IconFontsTbl2[ix][1])
108106
end
109107
ImGui::EndPopup()

glfw_opengl3_iconfont_viewer/glfw_opengl3_iconfont_viewer.rbw

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!/usr/bin/env ruby
12
require "pathname"
23

34
# Gemfile.lock が1つ上にある場合のみ Bundler を有効化

glfw_opengl3_iconfont_viewer/r.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
DIR_CURRENT="$(cd "$(dirname "$0")" && pwd)"
4+
5+
TARGET="$(basename "$DIR_CURRENT").rb"
6+
7+
if [ ! -f "$DIR_CURRENT/$TARGET" ]; then
8+
echo "Error: $TARGET not found in $DIR_CURRENT"
9+
exit 1
10+
fi
11+
12+
if [ -f "../Gemfile.lock" ]; then
13+
if ! command -v bundle >/dev/null 2>&1; then
14+
echo "Error: bundle command not found. Install with 'sudo gem install bundler'"
15+
exit 1
16+
fi
17+
echo "Running with bundle exec..."
18+
bundle exec ruby "$@" "$DIR_CURRENT/$TARGET"
19+
else
20+
if ! command -v ruby >/dev/null 2>&1; then
21+
echo "Error: ruby command not found. Install with 'sudo apt install ruby-full'"
22+
exit 1
23+
fi
24+
echo "Running without bundle..."
25+
ruby "$@" "$DIR_CURRENT/$TARGET"
26+
fi

glfw_opengl3_imcolortextedit/glfw_opengl3_imcolortextedit.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"window": {
3-
"startupPosX": 150,
4-
"startupPosY": 60,
3+
"startupPosX": 337,
4+
"startupPosY": 193,
55
"viewportWidth": 1302.0,
66
"viewportHeight": 711.0,
77
"colBGx": 0.25,

0 commit comments

Comments
 (0)