nightingale-play 0.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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +59 -0
- data/CODE_OF_CONDUCT.md +10 -0
- data/Cargo.lock +557 -0
- data/Cargo.toml +13 -0
- data/LICENSE.txt +21 -0
- data/README.md +19 -0
- data/Rakefile +146 -0
- data/ext/nightingale_play/Cargo.toml +23 -0
- data/ext/nightingale_play/build.rs +5 -0
- data/ext/nightingale_play/extconf.rb +6 -0
- data/ext/nightingale_play/src/lib.rs +199 -0
- data/lib/nightingale-play.rb +3 -0
- data/lib/nightingale_play/version.rb +5 -0
- data/lib/nightingale_play.rb +9 -0
- data/mise.toml +2 -0
- data/sig/nightingale_play.rbs +4 -0
- data/test.rb +4 -0
- metadata +77 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 29b388bea8dbc002e405506c5522571b854b149eef4d7ac5e020b365be2825e5
|
|
4
|
+
data.tar.gz: 2db8f5c1e3b24312fa03d27392dea1bf43053f980c0ef160e3e0d8ec6120bebd
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ffc95918ecabde48dc30307bd62a3cb1cc81b2d4e7bcf7f5f4203d9719b6fc01ad27aae925ef1dfda959ff3ddca43af73356b14fcc4a63672fda1d7983d46c22
|
|
7
|
+
data.tar.gz: 994e697f255fe644641650d955ccd66cd247f710d2a0eaa08d21b4fc07bc811f2f75a7883cfc4859250303f5c925ad13542795c073e01039d5bbd49f8a13f804
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
## [Unreleased]
|
|
2
|
+
|
|
3
|
+
## [0.2.1] - 2026-06-21
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Add Rakefile
|
|
7
|
+
- Add mise
|
|
8
|
+
- Add playable entity
|
|
9
|
+
- Enable pressing key
|
|
10
|
+
- Add test.rb
|
|
11
|
+
- Add magnus init
|
|
12
|
+
- Add lazy_static
|
|
13
|
+
- Add update related function
|
|
14
|
+
- Add dependencies
|
|
15
|
+
- Add nightingale-play gem
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Automate GitHub releases
|
|
19
|
+
- CHANGELOG
|
|
20
|
+
- Make bird face movement direction
|
|
21
|
+
- Edit README.md
|
|
22
|
+
- Change background color
|
|
23
|
+
- Edit gemspec
|
|
24
|
+
- Edit dependencies
|
|
25
|
+
- Use Mutex to manage state
|
|
26
|
+
|
|
27
|
+
### Removed
|
|
28
|
+
- Delete unnecessary spec
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## [0.2.0] - 2026-06-21
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
- Add Rakefile
|
|
35
|
+
- Add mise
|
|
36
|
+
- Add playable entity
|
|
37
|
+
- Enable pressing key
|
|
38
|
+
- Add test.rb
|
|
39
|
+
- Add magnus init
|
|
40
|
+
- Add lazy_static
|
|
41
|
+
- Add update related function
|
|
42
|
+
- Add dependencies
|
|
43
|
+
- Add nightingale-play gem
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
- Make bird face movement direction
|
|
47
|
+
- Edit README.md
|
|
48
|
+
- Change background color
|
|
49
|
+
- Edit gemspec
|
|
50
|
+
- Edit dependencies
|
|
51
|
+
- Use Mutex to manage state
|
|
52
|
+
|
|
53
|
+
### Removed
|
|
54
|
+
- Delete unnecessary spec
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## [0.1.0] - 2026-06-20
|
|
58
|
+
|
|
59
|
+
- Initial release
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
"nightingale-play" follows [The Ruby Community Conduct Guideline](https://www.ruby-lang.org/en/conduct) in all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.):
|
|
4
|
+
|
|
5
|
+
* Participants will be tolerant of opposing views.
|
|
6
|
+
* Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
|
|
7
|
+
* When interpreting the words and actions of others, participants should always assume good intentions.
|
|
8
|
+
* Behaviour which can be reasonably considered harassment will not be tolerated.
|
|
9
|
+
|
|
10
|
+
If you have any concerns about behaviour within this project, please contact us at ["yusei.kaida@giftee.co"](mailto:"yusei.kaida@giftee.co").
|
data/Cargo.lock
ADDED
|
@@ -0,0 +1,557 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "adler2"
|
|
7
|
+
version = "2.0.1"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "aho-corasick"
|
|
13
|
+
version = "1.1.4"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
|
|
16
|
+
dependencies = [
|
|
17
|
+
"memchr",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[[package]]
|
|
21
|
+
name = "allocator-api2"
|
|
22
|
+
version = "0.2.21"
|
|
23
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
24
|
+
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
|
|
25
|
+
|
|
26
|
+
[[package]]
|
|
27
|
+
name = "autocfg"
|
|
28
|
+
version = "1.5.1"
|
|
29
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
30
|
+
checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53"
|
|
31
|
+
|
|
32
|
+
[[package]]
|
|
33
|
+
name = "bindgen"
|
|
34
|
+
version = "0.72.1"
|
|
35
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
36
|
+
checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
|
|
37
|
+
dependencies = [
|
|
38
|
+
"bitflags 2.13.0",
|
|
39
|
+
"cexpr",
|
|
40
|
+
"clang-sys",
|
|
41
|
+
"itertools",
|
|
42
|
+
"proc-macro2",
|
|
43
|
+
"quote",
|
|
44
|
+
"regex",
|
|
45
|
+
"rustc-hash",
|
|
46
|
+
"shlex",
|
|
47
|
+
"syn",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
[[package]]
|
|
51
|
+
name = "bitflags"
|
|
52
|
+
version = "1.3.2"
|
|
53
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
54
|
+
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
|
55
|
+
|
|
56
|
+
[[package]]
|
|
57
|
+
name = "bitflags"
|
|
58
|
+
version = "2.13.0"
|
|
59
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
60
|
+
checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8"
|
|
61
|
+
|
|
62
|
+
[[package]]
|
|
63
|
+
name = "bytemuck"
|
|
64
|
+
version = "1.25.0"
|
|
65
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
66
|
+
checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec"
|
|
67
|
+
|
|
68
|
+
[[package]]
|
|
69
|
+
name = "byteorder"
|
|
70
|
+
version = "1.5.0"
|
|
71
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
72
|
+
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
|
73
|
+
|
|
74
|
+
[[package]]
|
|
75
|
+
name = "cexpr"
|
|
76
|
+
version = "0.6.0"
|
|
77
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
78
|
+
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
|
|
79
|
+
dependencies = [
|
|
80
|
+
"nom",
|
|
81
|
+
]
|
|
82
|
+
|
|
83
|
+
[[package]]
|
|
84
|
+
name = "cfg-if"
|
|
85
|
+
version = "1.0.4"
|
|
86
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
87
|
+
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
88
|
+
|
|
89
|
+
[[package]]
|
|
90
|
+
name = "clang-sys"
|
|
91
|
+
version = "1.8.1"
|
|
92
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
93
|
+
checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
|
|
94
|
+
dependencies = [
|
|
95
|
+
"glob",
|
|
96
|
+
"libc",
|
|
97
|
+
"libloading",
|
|
98
|
+
]
|
|
99
|
+
|
|
100
|
+
[[package]]
|
|
101
|
+
name = "color_quant"
|
|
102
|
+
version = "1.1.0"
|
|
103
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
104
|
+
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
|
|
105
|
+
|
|
106
|
+
[[package]]
|
|
107
|
+
name = "crc32fast"
|
|
108
|
+
version = "1.5.0"
|
|
109
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
110
|
+
checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"
|
|
111
|
+
dependencies = [
|
|
112
|
+
"cfg-if",
|
|
113
|
+
]
|
|
114
|
+
|
|
115
|
+
[[package]]
|
|
116
|
+
name = "either"
|
|
117
|
+
version = "1.16.0"
|
|
118
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
119
|
+
checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e"
|
|
120
|
+
|
|
121
|
+
[[package]]
|
|
122
|
+
name = "equivalent"
|
|
123
|
+
version = "1.0.2"
|
|
124
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
125
|
+
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
|
126
|
+
|
|
127
|
+
[[package]]
|
|
128
|
+
name = "fdeflate"
|
|
129
|
+
version = "0.3.7"
|
|
130
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
131
|
+
checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c"
|
|
132
|
+
dependencies = [
|
|
133
|
+
"simd-adler32",
|
|
134
|
+
]
|
|
135
|
+
|
|
136
|
+
[[package]]
|
|
137
|
+
name = "flate2"
|
|
138
|
+
version = "1.1.9"
|
|
139
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
140
|
+
checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"
|
|
141
|
+
dependencies = [
|
|
142
|
+
"crc32fast",
|
|
143
|
+
"miniz_oxide",
|
|
144
|
+
]
|
|
145
|
+
|
|
146
|
+
[[package]]
|
|
147
|
+
name = "foldhash"
|
|
148
|
+
version = "0.1.5"
|
|
149
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
150
|
+
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
|
|
151
|
+
|
|
152
|
+
[[package]]
|
|
153
|
+
name = "fontdue"
|
|
154
|
+
version = "0.9.3"
|
|
155
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
156
|
+
checksum = "2e57e16b3fe8ff4364c0661fdaac543fb38b29ea9bc9c2f45612d90adf931d2b"
|
|
157
|
+
dependencies = [
|
|
158
|
+
"hashbrown",
|
|
159
|
+
"ttf-parser",
|
|
160
|
+
]
|
|
161
|
+
|
|
162
|
+
[[package]]
|
|
163
|
+
name = "glam"
|
|
164
|
+
version = "0.27.0"
|
|
165
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
166
|
+
checksum = "9e05e7e6723e3455f4818c7b26e855439f7546cf617ef669d1adedb8669e5cb9"
|
|
167
|
+
|
|
168
|
+
[[package]]
|
|
169
|
+
name = "glob"
|
|
170
|
+
version = "0.3.3"
|
|
171
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
172
|
+
checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
|
|
173
|
+
|
|
174
|
+
[[package]]
|
|
175
|
+
name = "hashbrown"
|
|
176
|
+
version = "0.15.5"
|
|
177
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
178
|
+
checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
|
|
179
|
+
dependencies = [
|
|
180
|
+
"allocator-api2",
|
|
181
|
+
"equivalent",
|
|
182
|
+
"foldhash",
|
|
183
|
+
]
|
|
184
|
+
|
|
185
|
+
[[package]]
|
|
186
|
+
name = "image"
|
|
187
|
+
version = "0.24.9"
|
|
188
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
189
|
+
checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d"
|
|
190
|
+
dependencies = [
|
|
191
|
+
"bytemuck",
|
|
192
|
+
"byteorder",
|
|
193
|
+
"color_quant",
|
|
194
|
+
"num-traits",
|
|
195
|
+
"png",
|
|
196
|
+
]
|
|
197
|
+
|
|
198
|
+
[[package]]
|
|
199
|
+
name = "itertools"
|
|
200
|
+
version = "0.13.0"
|
|
201
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
202
|
+
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
|
|
203
|
+
dependencies = [
|
|
204
|
+
"either",
|
|
205
|
+
]
|
|
206
|
+
|
|
207
|
+
[[package]]
|
|
208
|
+
name = "lazy_static"
|
|
209
|
+
version = "1.5.0"
|
|
210
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
211
|
+
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
|
212
|
+
|
|
213
|
+
[[package]]
|
|
214
|
+
name = "libc"
|
|
215
|
+
version = "0.2.186"
|
|
216
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
217
|
+
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
|
|
218
|
+
|
|
219
|
+
[[package]]
|
|
220
|
+
name = "libloading"
|
|
221
|
+
version = "0.8.9"
|
|
222
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
223
|
+
checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
|
|
224
|
+
dependencies = [
|
|
225
|
+
"cfg-if",
|
|
226
|
+
"windows-link",
|
|
227
|
+
]
|
|
228
|
+
|
|
229
|
+
[[package]]
|
|
230
|
+
name = "macroquad"
|
|
231
|
+
version = "0.4.15"
|
|
232
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
233
|
+
checksum = "41f7d60318b52b19e909db1f01c522977da28a5e515127a73ecd8b7488498edb"
|
|
234
|
+
dependencies = [
|
|
235
|
+
"fontdue",
|
|
236
|
+
"glam",
|
|
237
|
+
"image",
|
|
238
|
+
"macroquad_macro",
|
|
239
|
+
"miniquad",
|
|
240
|
+
"quad-rand",
|
|
241
|
+
]
|
|
242
|
+
|
|
243
|
+
[[package]]
|
|
244
|
+
name = "macroquad_macro"
|
|
245
|
+
version = "0.1.8"
|
|
246
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
247
|
+
checksum = "64b1d96218903768c1ce078b657c0d5965465c95a60d2682fd97443c9d2483dd"
|
|
248
|
+
|
|
249
|
+
[[package]]
|
|
250
|
+
name = "magnus"
|
|
251
|
+
version = "0.8.2"
|
|
252
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
253
|
+
checksum = "3b36a5b126bbe97eb0d02d07acfeb327036c6319fd816139a49824a83b7f9012"
|
|
254
|
+
dependencies = [
|
|
255
|
+
"magnus-macros",
|
|
256
|
+
"rb-sys",
|
|
257
|
+
"rb-sys-env",
|
|
258
|
+
"seq-macro",
|
|
259
|
+
]
|
|
260
|
+
|
|
261
|
+
[[package]]
|
|
262
|
+
name = "magnus-macros"
|
|
263
|
+
version = "0.8.0"
|
|
264
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
265
|
+
checksum = "47607461fd8e1513cb4f2076c197d8092d921a1ea75bd08af97398f593751892"
|
|
266
|
+
dependencies = [
|
|
267
|
+
"proc-macro2",
|
|
268
|
+
"quote",
|
|
269
|
+
"syn",
|
|
270
|
+
]
|
|
271
|
+
|
|
272
|
+
[[package]]
|
|
273
|
+
name = "malloc_buf"
|
|
274
|
+
version = "0.0.6"
|
|
275
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
276
|
+
checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
|
|
277
|
+
dependencies = [
|
|
278
|
+
"libc",
|
|
279
|
+
]
|
|
280
|
+
|
|
281
|
+
[[package]]
|
|
282
|
+
name = "memchr"
|
|
283
|
+
version = "2.8.2"
|
|
284
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
285
|
+
checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4"
|
|
286
|
+
|
|
287
|
+
[[package]]
|
|
288
|
+
name = "minimal-lexical"
|
|
289
|
+
version = "0.2.1"
|
|
290
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
291
|
+
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
|
292
|
+
|
|
293
|
+
[[package]]
|
|
294
|
+
name = "miniquad"
|
|
295
|
+
version = "0.4.10"
|
|
296
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
297
|
+
checksum = "2f64fd94ff70fdc425766c78a3fa9f263d02cb25725a49f255f6a66d8a186c3f"
|
|
298
|
+
dependencies = [
|
|
299
|
+
"libc",
|
|
300
|
+
"ndk-sys",
|
|
301
|
+
"objc-rs",
|
|
302
|
+
"winapi",
|
|
303
|
+
]
|
|
304
|
+
|
|
305
|
+
[[package]]
|
|
306
|
+
name = "miniz_oxide"
|
|
307
|
+
version = "0.8.9"
|
|
308
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
309
|
+
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
|
|
310
|
+
dependencies = [
|
|
311
|
+
"adler2",
|
|
312
|
+
"simd-adler32",
|
|
313
|
+
]
|
|
314
|
+
|
|
315
|
+
[[package]]
|
|
316
|
+
name = "ndk-sys"
|
|
317
|
+
version = "0.2.2"
|
|
318
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
319
|
+
checksum = "e1bcdd74c20ad5d95aacd60ef9ba40fdf77f767051040541df557b7a9b2a2121"
|
|
320
|
+
|
|
321
|
+
[[package]]
|
|
322
|
+
name = "nightingale-play"
|
|
323
|
+
version = "0.2.1"
|
|
324
|
+
dependencies = [
|
|
325
|
+
"lazy_static",
|
|
326
|
+
"macroquad",
|
|
327
|
+
"magnus",
|
|
328
|
+
"rb-sys",
|
|
329
|
+
"rb-sys-env",
|
|
330
|
+
"rb-sys-test-helpers",
|
|
331
|
+
]
|
|
332
|
+
|
|
333
|
+
[[package]]
|
|
334
|
+
name = "nom"
|
|
335
|
+
version = "7.1.3"
|
|
336
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
337
|
+
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
|
|
338
|
+
dependencies = [
|
|
339
|
+
"memchr",
|
|
340
|
+
"minimal-lexical",
|
|
341
|
+
]
|
|
342
|
+
|
|
343
|
+
[[package]]
|
|
344
|
+
name = "num-traits"
|
|
345
|
+
version = "0.2.19"
|
|
346
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
347
|
+
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
|
|
348
|
+
dependencies = [
|
|
349
|
+
"autocfg",
|
|
350
|
+
]
|
|
351
|
+
|
|
352
|
+
[[package]]
|
|
353
|
+
name = "objc-rs"
|
|
354
|
+
version = "0.2.8"
|
|
355
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
356
|
+
checksum = "64a1e7069a2525126bf12a9f1f7916835fafade384fb27cabf698e745e2a1eb8"
|
|
357
|
+
dependencies = [
|
|
358
|
+
"malloc_buf",
|
|
359
|
+
]
|
|
360
|
+
|
|
361
|
+
[[package]]
|
|
362
|
+
name = "png"
|
|
363
|
+
version = "0.17.16"
|
|
364
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
365
|
+
checksum = "82151a2fc869e011c153adc57cf2789ccb8d9906ce52c0b39a6b5697749d7526"
|
|
366
|
+
dependencies = [
|
|
367
|
+
"bitflags 1.3.2",
|
|
368
|
+
"crc32fast",
|
|
369
|
+
"fdeflate",
|
|
370
|
+
"flate2",
|
|
371
|
+
"miniz_oxide",
|
|
372
|
+
]
|
|
373
|
+
|
|
374
|
+
[[package]]
|
|
375
|
+
name = "proc-macro2"
|
|
376
|
+
version = "1.0.106"
|
|
377
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
378
|
+
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
|
379
|
+
dependencies = [
|
|
380
|
+
"unicode-ident",
|
|
381
|
+
]
|
|
382
|
+
|
|
383
|
+
[[package]]
|
|
384
|
+
name = "quad-rand"
|
|
385
|
+
version = "0.2.3"
|
|
386
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
387
|
+
checksum = "5a651516ddc9168ebd67b24afd085a718be02f8858fe406591b013d101ce2f40"
|
|
388
|
+
|
|
389
|
+
[[package]]
|
|
390
|
+
name = "quote"
|
|
391
|
+
version = "1.0.45"
|
|
392
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
393
|
+
checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
|
|
394
|
+
dependencies = [
|
|
395
|
+
"proc-macro2",
|
|
396
|
+
]
|
|
397
|
+
|
|
398
|
+
[[package]]
|
|
399
|
+
name = "rb-sys"
|
|
400
|
+
version = "0.9.128"
|
|
401
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
402
|
+
checksum = "45ca28513560e56cfb79a62b1fce363c73af170a182024ce880c77ee9429920a"
|
|
403
|
+
dependencies = [
|
|
404
|
+
"rb-sys-build",
|
|
405
|
+
]
|
|
406
|
+
|
|
407
|
+
[[package]]
|
|
408
|
+
name = "rb-sys-build"
|
|
409
|
+
version = "0.9.128"
|
|
410
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
411
|
+
checksum = "ce04b2c55eff3a21aaa623fcc655d94373238e72cac6b3e1a3641ff31649f99a"
|
|
412
|
+
dependencies = [
|
|
413
|
+
"bindgen",
|
|
414
|
+
"lazy_static",
|
|
415
|
+
"proc-macro2",
|
|
416
|
+
"quote",
|
|
417
|
+
"regex",
|
|
418
|
+
"shell-words",
|
|
419
|
+
"syn",
|
|
420
|
+
]
|
|
421
|
+
|
|
422
|
+
[[package]]
|
|
423
|
+
name = "rb-sys-env"
|
|
424
|
+
version = "0.2.3"
|
|
425
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
426
|
+
checksum = "cca7ad6a7e21e72151d56fe2495a259b5670e204c3adac41ee7ef676ea08117a"
|
|
427
|
+
|
|
428
|
+
[[package]]
|
|
429
|
+
name = "rb-sys-test-helpers"
|
|
430
|
+
version = "0.2.2"
|
|
431
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
432
|
+
checksum = "d6ccb543252549fc28f5d290322e041cd682bd199a8e1caaa813fb6e63dd221e"
|
|
433
|
+
dependencies = [
|
|
434
|
+
"rb-sys",
|
|
435
|
+
"rb-sys-env",
|
|
436
|
+
"rb-sys-test-helpers-macros",
|
|
437
|
+
]
|
|
438
|
+
|
|
439
|
+
[[package]]
|
|
440
|
+
name = "rb-sys-test-helpers-macros"
|
|
441
|
+
version = "0.2.2"
|
|
442
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
443
|
+
checksum = "1508caed999cb659ab1b3308e7b2985186b3b550ef5492dc18da71b560c55615"
|
|
444
|
+
dependencies = [
|
|
445
|
+
"quote",
|
|
446
|
+
"syn",
|
|
447
|
+
]
|
|
448
|
+
|
|
449
|
+
[[package]]
|
|
450
|
+
name = "regex"
|
|
451
|
+
version = "1.12.4"
|
|
452
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
453
|
+
checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba"
|
|
454
|
+
dependencies = [
|
|
455
|
+
"aho-corasick",
|
|
456
|
+
"memchr",
|
|
457
|
+
"regex-automata",
|
|
458
|
+
"regex-syntax",
|
|
459
|
+
]
|
|
460
|
+
|
|
461
|
+
[[package]]
|
|
462
|
+
name = "regex-automata"
|
|
463
|
+
version = "0.4.14"
|
|
464
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
465
|
+
checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
|
|
466
|
+
dependencies = [
|
|
467
|
+
"aho-corasick",
|
|
468
|
+
"memchr",
|
|
469
|
+
"regex-syntax",
|
|
470
|
+
]
|
|
471
|
+
|
|
472
|
+
[[package]]
|
|
473
|
+
name = "regex-syntax"
|
|
474
|
+
version = "0.8.11"
|
|
475
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
476
|
+
checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4"
|
|
477
|
+
|
|
478
|
+
[[package]]
|
|
479
|
+
name = "rustc-hash"
|
|
480
|
+
version = "2.1.2"
|
|
481
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
482
|
+
checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"
|
|
483
|
+
|
|
484
|
+
[[package]]
|
|
485
|
+
name = "seq-macro"
|
|
486
|
+
version = "0.3.6"
|
|
487
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
488
|
+
checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
|
|
489
|
+
|
|
490
|
+
[[package]]
|
|
491
|
+
name = "shell-words"
|
|
492
|
+
version = "1.1.1"
|
|
493
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
494
|
+
checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77"
|
|
495
|
+
|
|
496
|
+
[[package]]
|
|
497
|
+
name = "shlex"
|
|
498
|
+
version = "1.3.0"
|
|
499
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
500
|
+
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
|
501
|
+
|
|
502
|
+
[[package]]
|
|
503
|
+
name = "simd-adler32"
|
|
504
|
+
version = "0.3.9"
|
|
505
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
506
|
+
checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214"
|
|
507
|
+
|
|
508
|
+
[[package]]
|
|
509
|
+
name = "syn"
|
|
510
|
+
version = "2.0.118"
|
|
511
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
512
|
+
checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422"
|
|
513
|
+
dependencies = [
|
|
514
|
+
"proc-macro2",
|
|
515
|
+
"quote",
|
|
516
|
+
"unicode-ident",
|
|
517
|
+
]
|
|
518
|
+
|
|
519
|
+
[[package]]
|
|
520
|
+
name = "ttf-parser"
|
|
521
|
+
version = "0.21.1"
|
|
522
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
523
|
+
checksum = "2c591d83f69777866b9126b24c6dd9a18351f177e49d625920d19f989fd31cf8"
|
|
524
|
+
|
|
525
|
+
[[package]]
|
|
526
|
+
name = "unicode-ident"
|
|
527
|
+
version = "1.0.24"
|
|
528
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
529
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
530
|
+
|
|
531
|
+
[[package]]
|
|
532
|
+
name = "winapi"
|
|
533
|
+
version = "0.3.9"
|
|
534
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
535
|
+
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
|
536
|
+
dependencies = [
|
|
537
|
+
"winapi-i686-pc-windows-gnu",
|
|
538
|
+
"winapi-x86_64-pc-windows-gnu",
|
|
539
|
+
]
|
|
540
|
+
|
|
541
|
+
[[package]]
|
|
542
|
+
name = "winapi-i686-pc-windows-gnu"
|
|
543
|
+
version = "0.4.0"
|
|
544
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
545
|
+
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
|
546
|
+
|
|
547
|
+
[[package]]
|
|
548
|
+
name = "winapi-x86_64-pc-windows-gnu"
|
|
549
|
+
version = "0.4.0"
|
|
550
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
551
|
+
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
|
552
|
+
|
|
553
|
+
[[package]]
|
|
554
|
+
name = "windows-link"
|
|
555
|
+
version = "0.2.1"
|
|
556
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
557
|
+
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
data/Cargo.toml
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# This Cargo.toml is here to let externals tools (IDEs, etc.) know that this is
|
|
2
|
+
# a Rust project. Your extensions dependencies should be added to the Cargo.toml
|
|
3
|
+
# in the ext/ directory.
|
|
4
|
+
|
|
5
|
+
[workspace]
|
|
6
|
+
members = ["./ext/nightingale_play"]
|
|
7
|
+
resolver = "2"
|
|
8
|
+
|
|
9
|
+
[profile.release]
|
|
10
|
+
# By default, debug symbols are stripped from the final binary which makes it
|
|
11
|
+
# harder to debug if something goes wrong. It's recommended to keep debug
|
|
12
|
+
# symbols in the release build so that you can debug the final binary if needed.
|
|
13
|
+
debug = true
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 aidyak
|
|
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
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Nightingale Play
|
|
2
|
+
|
|
3
|
+
## Release notes
|
|
4
|
+
|
|
5
|
+
Generate draft release notes from git history:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
bundle exec rake release:notes VERSION=0.1.1
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Write the generated notes into `CHANGELOG.md` under `Unreleased`:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
bundle exec rake release:changelog VERSION=0.1.1
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Both tasks use the latest git tag as the starting point. If no tag exists yet, they use the full history. You can override the range with `FROM=<ref>` and `TO=<ref>`.
|
|
18
|
+
|
|
19
|
+
Pushing a `v*` tag also triggers GitHub Actions to build the gem packages, create a GitHub Release, and attach the generated `.gem` files as release assets.
|
data/Rakefile
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "date"
|
|
4
|
+
require "bundler/gem_tasks"
|
|
5
|
+
require "open3"
|
|
6
|
+
require "rspec/core/rake_task"
|
|
7
|
+
|
|
8
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
9
|
+
|
|
10
|
+
require "rb_sys/extensiontask"
|
|
11
|
+
|
|
12
|
+
task build: :compile
|
|
13
|
+
|
|
14
|
+
GEMSPEC = Gem::Specification.load("nightingale-play.gemspec")
|
|
15
|
+
|
|
16
|
+
RbSys::ExtensionTask.new("nightingale-play", GEMSPEC) do |ext|
|
|
17
|
+
ext.lib_dir = "lib/nightingale_play"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
module ReleaseNotes
|
|
21
|
+
module_function
|
|
22
|
+
|
|
23
|
+
CATEGORY_RULES = {
|
|
24
|
+
"Added" => [
|
|
25
|
+
/\Afeat(?:\(.+\))?!?:/i,
|
|
26
|
+
/\Aadd\b/i,
|
|
27
|
+
/\Acreate\b/i,
|
|
28
|
+
/\Aenable\b/i
|
|
29
|
+
],
|
|
30
|
+
"Fixed" => [
|
|
31
|
+
/\Afix(?:\(.+\))?!?:/i,
|
|
32
|
+
/\Afix\b/i
|
|
33
|
+
],
|
|
34
|
+
"Removed" => [
|
|
35
|
+
/\Aremove\b/i,
|
|
36
|
+
/\Adelete\b/i,
|
|
37
|
+
/\Adrop\b/i
|
|
38
|
+
],
|
|
39
|
+
"Changed" => [
|
|
40
|
+
/\Achange\b/i,
|
|
41
|
+
/\Aedit\b/i,
|
|
42
|
+
/\Amake\b/i,
|
|
43
|
+
/\Aupdate\b/i,
|
|
44
|
+
/\Ause\b/i,
|
|
45
|
+
/\Abump\b/i,
|
|
46
|
+
/\Arefactor\b/i,
|
|
47
|
+
/\Aimprove\b/i
|
|
48
|
+
]
|
|
49
|
+
}.freeze
|
|
50
|
+
|
|
51
|
+
CATEGORY_ORDER = ["Added", "Changed", "Fixed", "Removed"].freeze
|
|
52
|
+
|
|
53
|
+
def commits(from_ref:, to_ref:)
|
|
54
|
+
range = from_ref && !from_ref.empty? ? "#{from_ref}..#{to_ref}" : to_ref
|
|
55
|
+
output, status = Open3.capture2("git", "log", range, "--pretty=format:%s")
|
|
56
|
+
raise "git log failed" unless status.success?
|
|
57
|
+
|
|
58
|
+
output.lines(chomp: true).reject(&:empty?)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def latest_tag
|
|
62
|
+
tag, status = Open3.capture2("git", "describe", "--tags", "--abbrev=0", err: File::NULL)
|
|
63
|
+
status.success? ? tag.strip : nil
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def categorize(messages)
|
|
67
|
+
grouped = Hash.new { |hash, key| hash[key] = [] }
|
|
68
|
+
|
|
69
|
+
messages.each do |message|
|
|
70
|
+
category = CATEGORY_RULES.find { |_, patterns| patterns.any? { |pattern| pattern.match?(message) } }&.first || "Changed"
|
|
71
|
+
grouped[category] << normalize(message)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
grouped
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def normalize(message)
|
|
78
|
+
normalized = message.dup
|
|
79
|
+
normalized.sub!(/\A(?:feat|fix|docs|chore|refactor)(?:\(.+\))?!?:\s*/i, "")
|
|
80
|
+
normalized = normalized.strip
|
|
81
|
+
normalized[0] = normalized[0].upcase if normalized[0]
|
|
82
|
+
normalized
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def render(version:, date:, from_ref:, to_ref:)
|
|
86
|
+
messages = commits(from_ref:, to_ref:)
|
|
87
|
+
raise "No commits found for release notes" if messages.empty?
|
|
88
|
+
|
|
89
|
+
grouped = categorize(messages)
|
|
90
|
+
lines = []
|
|
91
|
+
lines << "## [#{version}] - #{date}"
|
|
92
|
+
lines << ""
|
|
93
|
+
|
|
94
|
+
CATEGORY_ORDER.each do |category|
|
|
95
|
+
next if grouped[category].empty?
|
|
96
|
+
|
|
97
|
+
lines << "### #{category}"
|
|
98
|
+
grouped[category].each do |message|
|
|
99
|
+
lines << "- #{message}"
|
|
100
|
+
end
|
|
101
|
+
lines << ""
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
lines.join("\n").rstrip + "\n"
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def update_changelog!(path:, version:, date:, from_ref:, to_ref:)
|
|
108
|
+
release_notes = render(version:, date:, from_ref:, to_ref:)
|
|
109
|
+
content = File.read(path)
|
|
110
|
+
raise "Version #{version} already exists in #{path}" if content.include?("## [#{version}]")
|
|
111
|
+
raise "Missing Unreleased section in #{path}" unless content.include?("## [Unreleased]")
|
|
112
|
+
|
|
113
|
+
updated = content.sub("## [Unreleased]\n", "## [Unreleased]\n\n#{release_notes}\n")
|
|
114
|
+
File.write(path, updated)
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
namespace :release do
|
|
119
|
+
desc "Print release notes from the previous tag to HEAD"
|
|
120
|
+
task :notes do
|
|
121
|
+
version = ENV["VERSION"] || NightingalePlay::VERSION
|
|
122
|
+
date = ENV["DATE"] || Date.today.iso8601
|
|
123
|
+
from_ref = ENV["FROM"] || ReleaseNotes.latest_tag
|
|
124
|
+
to_ref = ENV["TO"] || "HEAD"
|
|
125
|
+
|
|
126
|
+
puts ReleaseNotes.render(version:, date:, from_ref:, to_ref:)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
desc "Write release notes into CHANGELOG.md under Unreleased"
|
|
130
|
+
task :changelog do
|
|
131
|
+
version = ENV.fetch("VERSION")
|
|
132
|
+
date = ENV["DATE"] || Date.today.iso8601
|
|
133
|
+
from_ref = ENV["FROM"] || ReleaseNotes.latest_tag
|
|
134
|
+
to_ref = ENV["TO"] || "HEAD"
|
|
135
|
+
|
|
136
|
+
ReleaseNotes.update_changelog!(
|
|
137
|
+
path: "CHANGELOG.md",
|
|
138
|
+
version:,
|
|
139
|
+
date:,
|
|
140
|
+
from_ref:,
|
|
141
|
+
to_ref:
|
|
142
|
+
)
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
task default: %i[compile spec]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "nightingale-play"
|
|
3
|
+
version = "0.2.1"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
authors = ["aidyak <yusei.kaida@giftee.co>"]
|
|
6
|
+
license = "MIT"
|
|
7
|
+
publish = false
|
|
8
|
+
|
|
9
|
+
[lib]
|
|
10
|
+
crate-type = ["cdylib"]
|
|
11
|
+
|
|
12
|
+
[dependencies]
|
|
13
|
+
lazy_static = "1.5.0"
|
|
14
|
+
macroquad = "0.4.15"
|
|
15
|
+
magnus = "0.8.2"
|
|
16
|
+
rb-sys = { version = "0.9", features = ["stable-api-compiled-fallback"] }
|
|
17
|
+
# tokio = { version = "1.52.3", features = ["full"] }
|
|
18
|
+
|
|
19
|
+
[build-dependencies]
|
|
20
|
+
rb-sys-env = "0.2.2"
|
|
21
|
+
|
|
22
|
+
[dev-dependencies]
|
|
23
|
+
rb-sys-test-helpers = { version = "0.2.2" }
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
use lazy_static::lazy_static;
|
|
2
|
+
use macroquad::prelude::*;
|
|
3
|
+
use magnus::{function, Error, Ruby, Symbol};
|
|
4
|
+
use std::sync::Mutex;
|
|
5
|
+
|
|
6
|
+
struct EngineState {
|
|
7
|
+
x: f32,
|
|
8
|
+
y: f32,
|
|
9
|
+
facing_direction: FacingDirection,
|
|
10
|
+
pressed_left: bool,
|
|
11
|
+
pressed_right: bool,
|
|
12
|
+
pressed_up: bool,
|
|
13
|
+
pressed_down: bool,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
#[derive(Clone, Copy)]
|
|
17
|
+
enum FacingDirection {
|
|
18
|
+
Left,
|
|
19
|
+
Right,
|
|
20
|
+
Up,
|
|
21
|
+
Down,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
lazy_static! {
|
|
25
|
+
static ref STATE: Mutex<EngineState> = Mutex::new(EngineState {
|
|
26
|
+
x: 100.0,
|
|
27
|
+
y: 100.0,
|
|
28
|
+
facing_direction: FacingDirection::Right,
|
|
29
|
+
pressed_left: false,
|
|
30
|
+
pressed_right: false,
|
|
31
|
+
pressed_up: false,
|
|
32
|
+
pressed_down: false
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
fn update_position(x: f32, y: f32) {
|
|
37
|
+
let mut state = STATE.lock().unwrap();
|
|
38
|
+
state.x = x as f32;
|
|
39
|
+
state.y = y as f32;
|
|
40
|
+
|
|
41
|
+
if state.x > 800.0 {
|
|
42
|
+
state.x = 0.0;
|
|
43
|
+
}
|
|
44
|
+
if state.y > 600.0 {
|
|
45
|
+
state.y = 0.0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
fn is_key_down_ruby(key_symbol: Symbol) -> bool {
|
|
50
|
+
let state = STATE.lock().unwrap();
|
|
51
|
+
let key_str = key_symbol.to_string();
|
|
52
|
+
match key_str.as_str() {
|
|
53
|
+
"up" => state.pressed_up,
|
|
54
|
+
"down" => state.pressed_down,
|
|
55
|
+
"left" => state.pressed_left,
|
|
56
|
+
"right" => state.pressed_right,
|
|
57
|
+
_ => false,
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
fn draw_player(x: f32, y: f32, facing_direction: FacingDirection) {
|
|
62
|
+
let body = Color::from_rgba(220, 74, 58, 255);
|
|
63
|
+
let wing = Color::from_rgba(84, 132, 183, 255);
|
|
64
|
+
let belly = Color::from_rgba(255, 214, 170, 255);
|
|
65
|
+
let beak = Color::from_rgba(245, 180, 66, 255);
|
|
66
|
+
|
|
67
|
+
match facing_direction {
|
|
68
|
+
FacingDirection::Up | FacingDirection::Down => {
|
|
69
|
+
let direction = if matches!(facing_direction, FacingDirection::Up) {
|
|
70
|
+
-1.0
|
|
71
|
+
} else {
|
|
72
|
+
1.0
|
|
73
|
+
};
|
|
74
|
+
let body_center = vec2(x + 25.0, y + 29.0);
|
|
75
|
+
let head_center = vec2(body_center.x, body_center.y + direction * 16.0);
|
|
76
|
+
let beak_tip = vec2(head_center.x, head_center.y + direction * 18.0);
|
|
77
|
+
|
|
78
|
+
draw_circle(body_center.x, body_center.y, 21.0, body);
|
|
79
|
+
draw_circle(body_center.x, body_center.y + direction * 5.0, 12.0, belly);
|
|
80
|
+
draw_circle(head_center.x, head_center.y, 13.0, body);
|
|
81
|
+
draw_triangle(
|
|
82
|
+
vec2(head_center.x - 5.0, head_center.y + direction * 10.0),
|
|
83
|
+
vec2(head_center.x + 6.0, head_center.y + direction * 10.0),
|
|
84
|
+
beak_tip,
|
|
85
|
+
beak,
|
|
86
|
+
);
|
|
87
|
+
draw_circle(
|
|
88
|
+
head_center.x + 4.0,
|
|
89
|
+
head_center.y - direction * 5.0,
|
|
90
|
+
2.5,
|
|
91
|
+
BLACK,
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
draw_triangle(
|
|
95
|
+
vec2(body_center.x - 9.0, body_center.y - direction * 2.0),
|
|
96
|
+
vec2(body_center.x + 13.0, body_center.y - direction * 4.0),
|
|
97
|
+
vec2(body_center.x + 2.0, body_center.y - direction * 27.0),
|
|
98
|
+
wing,
|
|
99
|
+
);
|
|
100
|
+
draw_triangle(
|
|
101
|
+
vec2(body_center.x - 11.0, body_center.y - direction * 22.0),
|
|
102
|
+
vec2(body_center.x - 20.0, body_center.y - direction * 38.0),
|
|
103
|
+
vec2(body_center.x + 2.0, body_center.y - direction * 32.0),
|
|
104
|
+
body,
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
FacingDirection::Left | FacingDirection::Right => {
|
|
108
|
+
let direction = if matches!(facing_direction, FacingDirection::Right) {
|
|
109
|
+
1.0
|
|
110
|
+
} else {
|
|
111
|
+
-1.0
|
|
112
|
+
};
|
|
113
|
+
let body_center = vec2(x + 25.0, y + 29.0);
|
|
114
|
+
let head_center = vec2(x + 25.0 + direction * 14.0, y + 16.0);
|
|
115
|
+
let beak_tip = vec2(head_center.x + direction * 18.0, head_center.y + 1.0);
|
|
116
|
+
|
|
117
|
+
draw_circle(body_center.x, body_center.y, 21.0, body);
|
|
118
|
+
draw_circle(
|
|
119
|
+
body_center.x + direction * 5.0,
|
|
120
|
+
body_center.y + 6.0,
|
|
121
|
+
12.0,
|
|
122
|
+
belly,
|
|
123
|
+
);
|
|
124
|
+
draw_circle(head_center.x, head_center.y, 13.0, body);
|
|
125
|
+
draw_triangle(
|
|
126
|
+
vec2(head_center.x + direction * 10.0, head_center.y - 5.0),
|
|
127
|
+
vec2(head_center.x + direction * 10.0, head_center.y + 6.0),
|
|
128
|
+
beak_tip,
|
|
129
|
+
beak,
|
|
130
|
+
);
|
|
131
|
+
draw_circle(
|
|
132
|
+
head_center.x + direction * 5.0,
|
|
133
|
+
head_center.y - 4.0,
|
|
134
|
+
2.5,
|
|
135
|
+
BLACK,
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
draw_triangle(
|
|
139
|
+
vec2(body_center.x - direction * 2.0, body_center.y - 9.0),
|
|
140
|
+
vec2(body_center.x - direction * 4.0, body_center.y + 13.0),
|
|
141
|
+
vec2(body_center.x - direction * 27.0, body_center.y + 2.0),
|
|
142
|
+
wing,
|
|
143
|
+
);
|
|
144
|
+
draw_triangle(
|
|
145
|
+
vec2(x + 6.0 - direction * 2.0, y + 31.0),
|
|
146
|
+
vec2(x - direction * 16.0, y + 20.0),
|
|
147
|
+
vec2(x - direction * 10.0, y + 42.0),
|
|
148
|
+
body,
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
fn state_engine() {
|
|
155
|
+
macroquad::Window::new("Nightingale Play Game Engine", async {
|
|
156
|
+
loop {
|
|
157
|
+
let mut state = STATE.lock().unwrap();
|
|
158
|
+
state.pressed_left = is_key_down(KeyCode::Left) || is_key_down(KeyCode::A);
|
|
159
|
+
state.pressed_right = is_key_down(KeyCode::Right) || is_key_down(KeyCode::D);
|
|
160
|
+
state.pressed_up = is_key_down(KeyCode::Up) || is_key_down(KeyCode::W);
|
|
161
|
+
state.pressed_down = is_key_down(KeyCode::Down) || is_key_down(KeyCode::S);
|
|
162
|
+
|
|
163
|
+
let speed = 4.0;
|
|
164
|
+
if state.pressed_left {
|
|
165
|
+
state.x -= speed;
|
|
166
|
+
state.facing_direction = FacingDirection::Left;
|
|
167
|
+
}
|
|
168
|
+
if state.pressed_right {
|
|
169
|
+
state.x += speed;
|
|
170
|
+
state.facing_direction = FacingDirection::Right;
|
|
171
|
+
}
|
|
172
|
+
if state.pressed_up {
|
|
173
|
+
state.y -= speed;
|
|
174
|
+
state.facing_direction = FacingDirection::Up;
|
|
175
|
+
}
|
|
176
|
+
if state.pressed_down {
|
|
177
|
+
state.y += speed;
|
|
178
|
+
state.facing_direction = FacingDirection::Down;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
state.x = state.x.clamp(0.0, 750.0);
|
|
182
|
+
state.y = state.y.clamp(0.0, 550.0);
|
|
183
|
+
|
|
184
|
+
clear_background(BLACK);
|
|
185
|
+
draw_player(state.x, state.y, state.facing_direction);
|
|
186
|
+
drop(state);
|
|
187
|
+
|
|
188
|
+
next_frame().await;
|
|
189
|
+
}
|
|
190
|
+
})
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
#[magnus::init]
|
|
194
|
+
fn init(ruby: &Ruby) -> Result<(), Error> {
|
|
195
|
+
ruby.define_global_function("start_game_engine", function!(state_engine, 0));
|
|
196
|
+
ruby.define_global_function("update_box_position", function!(update_position, 2));
|
|
197
|
+
ruby.define_global_function("key_down?", function!(is_key_down_ruby, 1));
|
|
198
|
+
Ok(())
|
|
199
|
+
}
|
data/mise.toml
ADDED
data/test.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: nightingale-play
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.2.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- aidyak
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: rb_sys
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: 0.9.91
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: 0.9.91
|
|
26
|
+
description: Game engine for Ruby
|
|
27
|
+
email:
|
|
28
|
+
- contact@aidyak.dev
|
|
29
|
+
executables: []
|
|
30
|
+
extensions:
|
|
31
|
+
- ext/nightingale_play/extconf.rb
|
|
32
|
+
extra_rdoc_files: []
|
|
33
|
+
files:
|
|
34
|
+
- CHANGELOG.md
|
|
35
|
+
- CODE_OF_CONDUCT.md
|
|
36
|
+
- Cargo.lock
|
|
37
|
+
- Cargo.toml
|
|
38
|
+
- LICENSE.txt
|
|
39
|
+
- README.md
|
|
40
|
+
- Rakefile
|
|
41
|
+
- ext/nightingale_play/Cargo.toml
|
|
42
|
+
- ext/nightingale_play/build.rs
|
|
43
|
+
- ext/nightingale_play/extconf.rb
|
|
44
|
+
- ext/nightingale_play/src/lib.rs
|
|
45
|
+
- lib/nightingale-play.rb
|
|
46
|
+
- lib/nightingale_play.rb
|
|
47
|
+
- lib/nightingale_play/version.rb
|
|
48
|
+
- mise.toml
|
|
49
|
+
- sig/nightingale_play.rbs
|
|
50
|
+
- test.rb
|
|
51
|
+
homepage: https://github.com/aidyak/nightingale
|
|
52
|
+
licenses:
|
|
53
|
+
- MIT
|
|
54
|
+
metadata:
|
|
55
|
+
homepage_uri: https://github.com/aidyak/nightingale
|
|
56
|
+
source_code_uri: https://github.com/aidyak/nightingale
|
|
57
|
+
changelog_uri: https://github.com/aidyak/nightingale/blob/main/CHANGELOG.md
|
|
58
|
+
github_repo: ssh://github.com/aidyak/nightingale
|
|
59
|
+
rubygems_mfa_required: 'true'
|
|
60
|
+
rdoc_options: []
|
|
61
|
+
require_paths:
|
|
62
|
+
- lib
|
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: 3.2.0
|
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
|
+
requirements:
|
|
70
|
+
- - ">="
|
|
71
|
+
- !ruby/object:Gem::Version
|
|
72
|
+
version: '0'
|
|
73
|
+
requirements: []
|
|
74
|
+
rubygems_version: 4.0.10
|
|
75
|
+
specification_version: 4
|
|
76
|
+
summary: Game engine for Ruby
|
|
77
|
+
test_files: []
|