libui 0.2.0-x64-mingw32 → 0.2.1-x64-mingw32

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91d54754e872e9a585ad733a4ccd3a1e4d7d99ca73dd9cf1c942fe8761dee885
4
- data.tar.gz: d4add4d9188e464e4e9e485ec51c6f1038f561f3aa9dbfbba3e54b8268f15455
3
+ metadata.gz: 7eefd580fcf73715dc1505861820f0df4212a662379d3809ecda8eb9bf161a2a
4
+ data.tar.gz: d830ac4fea836527a01e4ec6d452b9b39f8ecc721d760ae4434847197e1ec6cf
5
5
  SHA512:
6
- metadata.gz: 2db0fce6cb32de25e9510b72b285af07fb8da17f6c3840b5edf0967c1f951a9671af348d206464087b9a8621b8f7f3ddd2ff397568498e3c7eb0449f99f8c768
7
- data.tar.gz: 057bee04c3c94d3b33ab578b3ab4ff6d79da53215de7406c788d11625dd737912e722296aacedfa4b2db64aff54c2bccc11cd77c3856f48f2aa55d308f00c98a
6
+ metadata.gz: b6121b99aaaf4801d37ffa4d78361d5654763d9a023428248a0fb5ea4da5529cdc18deec7bc548579eb076cdb259f94ce846a89cd4eaa809c46968d5aacaac85
7
+ data.tar.gz: 48c4598ea1ac04f6b9f9d0866180c34d3abe1df0e5aa05d86b08887c8274cf96c1557f30c7ddf172a9299945f9d0c188da6e1d5d91c24b51bcf7e0dfeaa7dd91
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2020-2025 kojix2
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020-present kojix2
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,261 +1,281 @@
1
- # LibUI
2
-
3
- [![test](https://github.com/kojix2/LibUI/actions/workflows/test.yml/badge.svg)](https://github.com/kojix2/LibUI/actions/workflows/test.yml)
4
- [![Gem Version](https://badge.fury.io/rb/libui.svg)](https://badge.fury.io/rb/libui)
5
- <a href="https://github.com/AndyObtiva/glimmer-dsl-libui"><img alt="glimmer-dsl-libui" src="https://github.com/AndyObtiva/glimmer/blob/master/images/glimmer-logo-hi-res.svg" width="50" height="50" align="right"></a>
6
- [![Pre-build](https://github.com/kojix2/libui-ng/actions/workflows/pre-build.yml/badge.svg?branch=pre-build)](https://github.com/kojix2/libui-ng/actions/workflows/pre-build.yml)
7
- [![Lines of Code](https://img.shields.io/endpoint?url=https%3A%2F%2Ftokei.kojix2.net%2Fbadge%2Fgithub%2Fkojix2%2FLibUI%2Flines)](https://tokei.kojix2.net/github/kojix2/LibUI)
8
-
9
- LibUI is a Ruby wrapper for libui family.
10
-
11
- :rocket: [libui-ng](https://github.com/libui-ng/libui-ng) - A cross-platform portable GUI library
12
-
13
- :wrench: [libui-dev](https://github.com/petabyt/libui-dev) - Native UI library for C - with some extras
14
-
15
- :radio_button: [libui](https://github.com/andlabs/libui) - Original version by andlabs.
16
-
17
- ## Installation
18
-
19
- It is recommended to use libui-ng, via the --pre commandline flag:
20
-
21
- ```sh
22
- gem install libui --pre # libui-ng; this will fetch libui-0.1.3.pre-x86_64-linux.gem
23
- ```
24
-
25
- If for some reason you would like to install the slightly older libui-0.1.2.gem release, issue:
26
-
27
- ```sh
28
- gem install libui
29
- ```
30
-
31
- - The gem package includes the libui-ng shared library for Windows, Mac, and Linux.
32
- - Namely `libui.dll`, `libui.dylib`, or `libui.so`.
33
- - No dependencies required.
34
- - The libui gem uses the standard Ruby library [Fiddle](https://github.com/ruby/fiddle) to call C functions.
35
-
36
- | Windows | Mac | Linux |
37
- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
38
- | <img src="https://user-images.githubusercontent.com/5798442/103118046-900ea780-46b0-11eb-81fc-32626762e4df.png"> | <img src="https://user-images.githubusercontent.com/5798442/103118059-99980f80-46b0-11eb-9d12-324ec4d297c9.png"> | <img src="https://user-images.githubusercontent.com/5798442/103118068-a0bf1d80-46b0-11eb-8c5c-3bdcc3dcfb26.png"> |
39
-
40
- Notes:
41
-
42
- - If you are using the 32-bit (x86) version of Ruby, you need to download the 32-bit (x86) native dll. See the [Development](#development) section.
43
- - On Windows, libui may not work due to missing DLLs. In that case, you need to install [Visual C++ Redistributable](https://docs.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist). See ([#48](https://github.com/kojix2/LibUI/issues/48))
44
- - Users with [Raspberry Pi](https://www.raspberrypi.com/) or other platforms will need to compile the C libui library. See the [Development](#development) section.
45
-
46
- ## Usage
47
-
48
- ```ruby
49
- require 'libui'
50
-
51
- UI = LibUI
52
-
53
- UI.init
54
-
55
- main_window = UI.new_window('hello world', 200, 100, 1)
56
-
57
- button = UI.new_button('Button')
58
-
59
- UI.button_on_clicked(button) do
60
- UI.msg_box(main_window, 'Information', 'You clicked the button')
61
- end
62
-
63
- UI.window_on_closing(main_window) do
64
- puts 'Bye Bye'
65
- UI.quit
66
- 1
67
- end
68
-
69
- UI.window_set_child(main_window, button)
70
- UI.control_show(main_window)
71
-
72
- UI.main
73
- UI.quit
74
- ```
75
-
76
- For more examples, see the [examples](https://github.com/kojix2/libui/tree/main/examples) directory.
77
-
78
- ### General Rules
79
-
80
- Compared to the original libui library written in C:
81
-
82
- - Method names use snake_case.
83
- - The last argument can be omitted if it's nil.
84
- - A block can be passed as a callback.
85
- - The block will be converted to a Proc object and added as the last argument.
86
- - The last argument can still be omitted when nil.
87
-
88
- You can use [the documentation for libui's Go bindings](https://pkg.go.dev/github.com/andlabs/ui) as a reference.
89
-
90
- ### DSLs for LibUI
91
-
92
- LibUI is not object-oriented because it is a thin Ruby wrapper (binding) for the procedural C libui library, mirroring its API structure.
93
-
94
- To build actual applications, it is recommended to use a DSL for LibUI, as they enable writing object-oriented code the Ruby way (instead of procedural code the C way):
95
-
96
- - [Glimmer DSL for LibUI](https://github.com/AndyObtiva/glimmer-dsl-libui)
97
- - [libui_paradise](https://rubygems.org/gems/libui_paradise)
98
-
99
- ### Working with fiddle pointers
100
-
101
- ```ruby
102
- require 'libui'
103
- UI = LibUI
104
- UI.init
105
- ```
106
-
107
- To convert a pointer to a string:
108
-
109
- ```ruby
110
- label = UI.new_label("Ruby")
111
- p pointer = UI.label_text(label) # #<Fiddle::Pointer>
112
- p pointer.to_s # Ruby
113
- ```
114
-
115
- If you need to use C structs, you can do the following:
116
-
117
- ```ruby
118
- font_button = UI.new_font_button
119
-
120
- # Allocate memory
121
- font_descriptor = UI::FFI::FontDescriptor.malloc
122
- font_descriptor.to_ptr.free = Fiddle::RUBY_FREE
123
- # font_descriptor = UI::FFI::FontDescriptor.malloc(Fiddle::RUBY_FREE) # fiddle 1.0.1 or higher
124
-
125
- UI.font_button_on_changed(font_button) do
126
- UI.font_button_font(font_button, font_descriptor)
127
- p family: font_descriptor.Family.to_s,
128
- size: font_descriptor.Size,
129
- weight: font_descriptor.Weight,
130
- italic: font_descriptor.Italic,
131
- stretch: font_descriptor.Stretch
132
- end
133
- ```
134
-
135
- - Callbacks
136
- - In Ruby/Fiddle, a C callback function is written as an object of
137
- `Fiddle::Closure::BlockCaller` or `Fiddle::Closure`.
138
- Be careful about Ruby's garbage collection - if the function object is collected, memory will be freed resulting in a segmentation violation when the callback is invoked.
139
-
140
- ```ruby
141
- # Assign to a local variable to prevent it from being collected by GC.
142
- handler.MouseEvent = (c1 = Fiddle::Closure::BlockCaller.new(0, [0]) {})
143
- handler.MouseCrossed = (c2 = Fiddle::Closure::BlockCaller.new(0, [0]) {})
144
- handler.DragBroken = (c3 = Fiddle::Closure::BlockCaller.new(0, [0]) {})
145
- ```
146
-
147
- ### Creating a Windows executable (.exe) with OCRA
148
-
149
- OCRA (One-Click Ruby Application) builds Windows executables from Ruby source code.
150
-
151
- - https://github.com/larsch/ocra/
152
-
153
- To build an exe with Ocra, include 3 DLLs from the ruby_builtin_dlls folder:
154
-
155
- ```sh
156
- ocra examples/control_gallery.rb ^
157
- --dll ruby_builtin_dlls/libssp-0.dll ^
158
- --dll ruby_builtin_dlls/libgmp-10.dll ^
159
- --dll ruby_builtin_dlls/libffi-7.dll ^
160
- --gem-all=fiddle ^
161
- ```
162
-
163
- Add additional options below if necessary:
164
-
165
- ```sh
166
- --window ^
167
- --add-all-core ^
168
- --chdir-first ^
169
- --icon assets\app.ico ^
170
- --verbose ^
171
- --output out\gallery.exe
172
- ```
173
-
174
- ## Development
175
-
176
- ```sh
177
- git clone https://github.com/kojix2/libui
178
- cd libui
179
- bundle install
180
- bundle exec rake vendor:auto
181
- bundle exec rake test
182
- ```
183
-
184
- ### Pre-built shared libraries for libui-ng
185
-
186
- Download pre-built libui-ng shared libraries (per your current platform):
187
-
188
- ```sh
189
- bundle exec rake vendor:auto
190
- ```
191
-
192
- Clean downloaded vendor files (keeps `vendor/{LICENSE,README}.md`):
193
-
194
- ```sh
195
- bundle exec rake vendor:clean
196
- ```
197
-
198
- ### Using your own libui build
199
-
200
- If you build libui-ng yourself, set `LIBUIDIR` to the directory containing the compiled `.so/.dylib/.dll` so LibUI can load it. You may also replace files under `vendor/` with your build if preferred. See [#46](https://github.com/kojix2/LibUI/issues/46#issuecomment-1041575792).
201
-
202
- ### Publishing gems
203
-
204
- #### Automated Publishing
205
-
206
- Push a version tag to automatically publish platform-specific gems:
207
-
208
- ```sh
209
- git tag v0.1.3
210
- git push origin v0.1.3
211
- ```
212
-
213
- Requires `RUBYGEMS_API_KEY` repository secret with scoped API key.
214
-
215
- #### Manual Publishing
216
-
217
- ```sh
218
- ls vendor # check the vendor directory
219
- rm -rf pkg # remove previously built gems
220
- rake build_platform # build gems
221
-
222
- # Check the contents of the gem
223
- find pkg -name *.gem -exec sh -c "echo; echo \# {}; tar -O -f {} -x data.tar.gz | tar zt" \;
224
-
225
- rake release_platform # publish gems
226
- ```
227
-
228
- ### libui or libui-ng
229
-
230
- - From version 0.1.X, we plan to support only libui-ng/libui-ng.
231
- - Version 0.0.X only supports andlabs/libui.
232
-
233
- ## Contributing
234
-
235
- Would you like to contribute to LibUI?
236
-
237
- - Please feel free to send us your [pull requests](https://github.com/kojix2/libui/pulls).
238
- - Small corrections, such as typo fixes, are appreciated.
239
- - Did you find any bugs? Submit them in the [issues](https://github.com/kojix2/LibUI/issues) section!
240
-
241
- Do you need commit rights?
242
-
243
- - If you need commit rights to my repository or want to get admin rights and take over the project, please feel free to contact @kojix2.
244
- - Many OSS projects become abandoned because only the founder has commit rights to the original repository.
245
-
246
- Support libui-ng development
247
-
248
- - Contributing to the development of libui-ng is a contribution to the entire libui community, including Ruby's LibUI.
249
- - For example, it would be easier to release LibUI in Ruby if libui-ng could be built easily and official shared libraries could be distributed.
250
-
251
- ## Acknowledgements
252
-
253
- This project is inspired by libui-ruby.
254
-
255
- - https://github.com/jamescook/libui-ruby
256
-
257
- While libui-ruby uses [Ruby-FFI](https://github.com/ffi/ffi), this gem uses [Fiddle](https://github.com/ruby/fiddle).
258
-
259
- ## License
260
-
261
- [MIT License](https://opensource.org/licenses/MIT).
1
+ # LibUI
2
+
3
+ [![test](https://github.com/kojix2/LibUI/actions/workflows/test.yml/badge.svg)](https://github.com/kojix2/LibUI/actions/workflows/test.yml)
4
+ [![Gem Version](https://badge.fury.io/rb/libui.svg)](https://badge.fury.io/rb/libui)
5
+ <a href="https://github.com/AndyObtiva/glimmer-dsl-libui"><img alt="glimmer-dsl-libui" src="https://github.com/AndyObtiva/glimmer/blob/master/images/glimmer-logo-hi-res.svg" width="50" height="50" align="right"></a>
6
+ [![Pre-build](https://github.com/kojix2/libui-ng/actions/workflows/pre-build.yml/badge.svg?branch=pre-build)](https://github.com/kojix2/libui-ng/actions/workflows/pre-build.yml)
7
+ [![Lines of Code](https://img.shields.io/endpoint?url=https%3A%2F%2Ftokei.kojix2.net%2Fbadge%2Fgithub%2Fkojix2%2FLibUI%2Flines)](https://tokei.kojix2.net/github/kojix2/LibUI)
8
+
9
+ LibUI is a Ruby wrapper for libui family.
10
+
11
+ :rocket: [libui-ng](https://github.com/libui-ng/libui-ng) - A cross-platform portable GUI library
12
+
13
+ :wrench: [libui-dev](https://github.com/petabyt/libui-dev) - Native UI library for C - with some extras
14
+
15
+ :radio_button: [libui](https://github.com/andlabs/libui) - Original version by andlabs.
16
+
17
+ ## Installation
18
+
19
+ ```sh
20
+ gem install libui # --pre
21
+ ```
22
+
23
+ - The gem package includes the libui-ng shared library for Windows, Mac, and Linux.
24
+ - Namely `libui.x64.dll`/`libui.x86.dll`, `libui.x86_64.dylib`/`libui.arm64.dylib`, or `libui.x86_64.so`/`libui.aarch64.so`.
25
+ - No dependencies required.
26
+ - The libui gem uses the standard Ruby library [Fiddle](https://github.com/ruby/fiddle) to call C functions.
27
+
28
+ | Windows | Mac | Linux |
29
+ | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
30
+ | <img src="https://user-images.githubusercontent.com/5798442/103118046-900ea780-46b0-11eb-81fc-32626762e4df.png"> | <img src="https://user-images.githubusercontent.com/5798442/103118059-99980f80-46b0-11eb-9d12-324ec4d297c9.png"> | <img src="https://user-images.githubusercontent.com/5798442/103118068-a0bf1d80-46b0-11eb-8c5c-3bdcc3dcfb26.png"> |
31
+
32
+ Notes:
33
+
34
+ - If you are using the 32-bit (x86) version of Ruby, you need to download the 32-bit (x86) native dll. See the [Development](#development) section.
35
+ - On Windows, libui may not work due to missing DLLs. In that case, you need to install [Visual C++ Redistributable](https://docs.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist). See ([#48](https://github.com/kojix2/LibUI/issues/48))
36
+ - Users with [Raspberry Pi](https://www.raspberrypi.com/) or other platforms will need to compile the C libui library. See the [Development](#development) section.
37
+
38
+ ## Usage
39
+
40
+ ```ruby
41
+ require 'libui'
42
+
43
+ UI = LibUI
44
+
45
+ UI.init
46
+
47
+ main_window = UI.new_window('hello world', 200, 100, 1)
48
+
49
+ button = UI.new_button('Button')
50
+
51
+ UI.button_on_clicked(button) do
52
+ UI.msg_box(main_window, 'Information', 'You clicked the button')
53
+ end
54
+
55
+ UI.window_on_closing(main_window) do
56
+ puts 'Bye Bye'
57
+ UI.quit
58
+ 1
59
+ end
60
+
61
+ UI.window_set_child(main_window, button)
62
+ UI.control_show(main_window)
63
+
64
+ UI.main
65
+ UI.quit
66
+ ```
67
+
68
+ For more examples, see the [examples](https://github.com/kojix2/libui/tree/main/examples) directory.
69
+
70
+ ### General Rules
71
+
72
+ Compared to the original libui library written in C:
73
+
74
+ - Method names use snake_case.
75
+ - The last argument can be omitted if it's nil.
76
+ - A block can be passed as a callback.
77
+ - The block will be converted to a Proc object and added as the last argument.
78
+ - The last argument can still be omitted when nil.
79
+
80
+ You can use [the libui-ng API documentation](https://libui-ng.github.io/libui-ng/) as a reference.
81
+
82
+ ### DSLs for LibUI
83
+
84
+ LibUI is not object-oriented because it is a thin Ruby wrapper (binding) for the procedural C libui library, mirroring its API structure.
85
+
86
+ To build actual applications, it is recommended to use a DSL for LibUI, as they enable writing object-oriented code the Ruby way (instead of procedural code the C way):
87
+
88
+ - [Glimmer DSL for LibUI](https://github.com/AndyObtiva/glimmer-dsl-libui)
89
+ - [libui_paradise](https://rubygems.org/gems/libui_paradise)
90
+
91
+ ### Working with fiddle pointers
92
+
93
+ ```ruby
94
+ require 'libui'
95
+ UI = LibUI
96
+ UI.init
97
+ ```
98
+
99
+ Text getter methods such as `label_text`, `entry_text`, and `window_title`
100
+ return `Fiddle::Pointer` objects for strings allocated by libui. Convert the
101
+ pointer to a Ruby string, then release it with `free_text`.
102
+
103
+ ```ruby
104
+ label = UI.new_label("Ruby")
105
+ pointer = UI.label_text(label) # #<Fiddle::Pointer>
106
+ text = pointer.to_s
107
+ UI.free_text(pointer)
108
+ p text # Ruby
109
+ ```
110
+
111
+ Use `ensure` if the code between conversion and cleanup can raise:
112
+
113
+ ```ruby
114
+ def ui_text(text_pointer)
115
+ text_pointer.to_s
116
+ ensure
117
+ UI.free_text(text_pointer) if text_pointer && !text_pointer.null?
118
+ end
119
+ ```
120
+
121
+ If you need to use C structs, you can do the following:
122
+
123
+ ```ruby
124
+ font_button = UI.new_font_button
125
+
126
+ # Allocate memory
127
+ font_descriptor = UI::FFI::FontDescriptor.malloc
128
+ font_descriptor.to_ptr.free = Fiddle::RUBY_FREE
129
+ # font_descriptor = UI::FFI::FontDescriptor.malloc(Fiddle::RUBY_FREE) # fiddle 1.0.1 or higher
130
+
131
+ UI.font_button_on_changed(font_button) do
132
+ UI.font_button_font(font_button, font_descriptor)
133
+ begin
134
+ p family: font_descriptor.Family.to_s,
135
+ size: font_descriptor.Size,
136
+ weight: font_descriptor.Weight,
137
+ italic: font_descriptor.Italic,
138
+ stretch: font_descriptor.Stretch
139
+ ensure
140
+ UI.free_font_button_font(font_descriptor)
141
+ end
142
+ end
143
+ ```
144
+
145
+ - Callbacks
146
+ - In Ruby/Fiddle, a C callback function is written as an object of
147
+ `Fiddle::Closure::BlockCaller` or `Fiddle::Closure`.
148
+ Be careful about Ruby's garbage collection - if the function object is collected, memory will be freed resulting in a segmentation violation when the callback is invoked.
149
+
150
+ ```ruby
151
+ # Assign to a local variable to prevent it from being collected by GC.
152
+ handler.MouseEvent = (c1 = Fiddle::Closure::BlockCaller.new(0, [0]) {})
153
+ handler.MouseCrossed = (c2 = Fiddle::Closure::BlockCaller.new(0, [0]) {})
154
+ handler.DragBroken = (c3 = Fiddle::Closure::BlockCaller.new(0, [0]) {})
155
+ ```
156
+
157
+ ### Creating a Windows executable (.exe) with OCRA
158
+
159
+ OCRA (One-Click Ruby Application) builds Windows executables from Ruby source code.
160
+
161
+ - https://github.com/larsch/ocra/
162
+
163
+ To build an exe with Ocra, include 3 DLLs from the ruby_builtin_dlls folder:
164
+
165
+ ```sh
166
+ ocra examples/control_gallery.rb ^
167
+ --dll ruby_builtin_dlls/libssp-0.dll ^
168
+ --dll ruby_builtin_dlls/libgmp-10.dll ^
169
+ --dll ruby_builtin_dlls/libffi-7.dll ^
170
+ --gem-all=fiddle ^
171
+ ```
172
+
173
+ Add additional options below if necessary:
174
+
175
+ ```sh
176
+ --window ^
177
+ --add-all-core ^
178
+ --chdir-first ^
179
+ --icon assets\app.ico ^
180
+ --verbose ^
181
+ --output out\gallery.exe
182
+ ```
183
+
184
+ ## Development
185
+
186
+ ```sh
187
+ git clone https://github.com/kojix2/libui
188
+ cd libui
189
+ bundle install
190
+ bundle exec rake vendor:auto
191
+ bundle exec rake test
192
+ ```
193
+
194
+ ### Pre-built shared libraries for libui-ng
195
+
196
+ Download pre-built libui-ng shared libraries (per your current platform):
197
+
198
+ ```sh
199
+ bundle exec rake vendor:auto
200
+ ```
201
+
202
+ Clean downloaded vendor files (keeps `vendor/{LICENSE,README}.md`):
203
+
204
+ ```sh
205
+ bundle exec rake vendor:clean
206
+ ```
207
+
208
+ ### Using your own libui build
209
+
210
+ If you build libui-ng yourself, set `LIBUIDIR` to the directory containing the compiled `.so/.dylib/.dll` so LibUI can load it. You may also replace files under `vendor/` with your build if preferred. See [#46](https://github.com/kojix2/LibUI/issues/46#issuecomment-1041575792).
211
+
212
+ ### Publishing gems
213
+
214
+ #### Automated Publishing
215
+
216
+ Push a version tag to automatically publish platform-specific gems:
217
+
218
+ ```sh
219
+ git tag v0.2.0
220
+ git push origin v0.2.0
221
+ ```
222
+
223
+ Requires `RUBYGEMS_API_KEY` repository secret with scoped API key.
224
+
225
+ #### Manual Publishing
226
+
227
+ ```sh
228
+ ls vendor # check the vendor directory
229
+ rm -rf pkg # remove previously built gems
230
+ rake build_platform # build gems
231
+
232
+ # Check the contents of the gem
233
+ find pkg -name *.gem -exec sh -c "echo; echo \# {}; tar -O -f {} -x data.tar.gz | tar zt" \;
234
+
235
+ rake release_platform # publish gems
236
+ ```
237
+
238
+ Windows Ruby (x64-mingw32 or x64-mingw-ucrt)
239
+
240
+ ```sh
241
+ gem install rake rubyzip
242
+ GEM_PLATFORM=x64-mingw32 rake vendor:clean
243
+ GEM_PLATFORM=x64-mingw32 rake vendor:auto
244
+ GEM_PLATFORM=x64-mingw32 gem build libui.gemspec
245
+ gem push libui-0.2.0-x64-mingw32.gem
246
+ ```
247
+
248
+ ### libui or libui-ng
249
+
250
+ - From version 0.1.X, LibUI supports only libui-ng.
251
+ - Version 0.0.X only supports andlabs/libui.
252
+
253
+ ## Contributing
254
+
255
+ Would you like to contribute to LibUI?
256
+
257
+ - Please feel free to send us your [pull requests](https://github.com/kojix2/libui/pulls).
258
+ - Small corrections, such as typo fixes, are appreciated.
259
+ - Did you find any bugs? Submit them in the [issues](https://github.com/kojix2/LibUI/issues) section!
260
+
261
+ Do you need commit rights?
262
+
263
+ - If you need commit rights to my repository or want to get admin rights and take over the project, please feel free to contact @kojix2.
264
+ - Many OSS projects become abandoned because only the founder has commit rights to the original repository.
265
+
266
+ Support libui-ng development
267
+
268
+ - Contributing to the development of libui-ng is a contribution to the entire libui community, including Ruby's LibUI.
269
+ - For example, it would be easier to release LibUI in Ruby if libui-ng could be built easily and official shared libraries could be distributed.
270
+
271
+ ## Acknowledgements
272
+
273
+ This project is inspired by libui-ruby.
274
+
275
+ - https://github.com/jamescook/libui-ruby
276
+
277
+ While libui-ruby uses [Ruby-FFI](https://github.com/ffi/ffi), this gem uses [Fiddle](https://github.com/ruby/fiddle).
278
+
279
+ ## License
280
+
281
+ [MIT License](https://opensource.org/licenses/MIT).
data/lib/libui/error.rb CHANGED
@@ -1,10 +1,10 @@
1
- module LibUI
2
- # base error class
3
- class Error < StandardError; end
4
-
5
- # LibUI shared library not found error
6
- class LibraryNotFoundError < Error; end
7
-
8
- # LibUI shared library load error
9
- class LibraryLoadError < Error; end
10
- end
1
+ module LibUI
2
+ # base error class
3
+ class Error < StandardError; end
4
+
5
+ # LibUI shared library not found error
6
+ class LibraryNotFoundError < Error; end
7
+
8
+ # LibUI shared library load error
9
+ class LibraryLoadError < Error; end
10
+ end