Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Our visual novel engine with Rust! #1

Merged
merged 480 commits into from Sep 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
480 commits
Select commit Hold shift + click to select a range
442857a
Add back button for records.
Berrysoft Jul 12, 2022
b587b7c
Exact ActionCard as component.
Berrysoft Jul 12, 2022
8a6edd3
Exact IconButton to components.
Berrysoft Jul 12, 2022
8c5026f
Flatten ActionData in Action
Berrysoft Jul 12, 2022
3e4238f
Enable plugins access Program.
Berrysoft Jul 12, 2022
b23f152
Rename slog => galog
Berrysoft Jul 12, 2022
597381f
Add gal-latex to pipelines.
Berrysoft Jul 12, 2022
721dc55
Add para title to action.
Berrysoft Jul 12, 2022
984ae04
Add dependabot.
Berrysoft Jul 12, 2022
993223e
Add more archs to build.
Berrysoft Jul 12, 2022
b50e77e
Fix pipelines to specify target.
Berrysoft Jul 12, 2022
ecb19ba
Fix STATIC_VCRUNTIME
Berrysoft Jul 12, 2022
cbf6757
Remove win-x86 & win-arm64 due to limitation
Berrysoft Jul 12, 2022
b5599c3
Merge pull request #15 from Berrysoft/morearch
Berrysoft Jul 13, 2022
91b8825
Rewrite progress future.
Berrysoft Jul 13, 2022
7c4c11d
Remove useless try_join.
Berrysoft Jul 13, 2022
46e1bf5
Reduce format!
Berrysoft Jul 13, 2022
1b423d1
Enable bg, bgm, video use string as filename.
Berrysoft Jul 13, 2022
3598362
Format code.
Berrysoft Jul 14, 2022
a6af227
Exact ProgressFuture
Berrysoft Jul 14, 2022
6733133
Wrap ProgressFuture
Berrysoft Jul 14, 2022
f76ecba
Fix set_settings
Berrysoft Jul 14, 2022
d435802
Organize files.
Berrysoft Jul 14, 2022
43fe791
Move gal-bindings to utils.
Berrysoft Jul 14, 2022
1c9a25f
Merge pull request #17 from Berrysoft/organize
Berrysoft Jul 14, 2022
73e1f04
Add test in CI.
Berrysoft Jul 15, 2022
f4b9436
Add some tests.
Berrysoft Jul 15, 2022
0c75e93
[WIP] Divide Locale & LocaleBuf.
Berrysoft Jul 15, 2022
25a05fe
Adjust impls of Locale.
Berrysoft Jul 15, 2022
554a949
Set locale in command line.
Berrysoft Jul 15, 2022
8b2bb24
Add new icon.
Berrysoft Jul 16, 2022
c538d78
Add logo for StartView
Berrysoft Jul 17, 2022
2808ded
Update packages.
Berrysoft Jul 17, 2022
9bb0878
Fix cross build.
Berrysoft Jul 17, 2022
63dbb6b
ICUResult
Berrysoft Jul 17, 2022
eea975b
Check status when open enum.
Berrysoft Jul 17, 2022
734d2ec
Merge branch 'master' into citest
Berrysoft Jul 17, 2022
3ab4485
Try to fix on mac.
Berrysoft Jul 17, 2022
6a2da9c
Use refs instead of id.
Berrysoft Jul 19, 2022
de6047d
Add ActionLine.
Berrysoft Jul 19, 2022
c65a818
Support ActionLine.
Berrysoft Jul 19, 2022
4ca132d
Fix HTML tags to block.
Berrysoft Jul 19, 2022
9dacdca
Remove useless newlines in markdown.
Berrysoft Jul 19, 2022
f942a1e
Fix line display in record & history.
Berrysoft Jul 19, 2022
108eda5
Adjust test for locale::accept
Berrysoft Jul 19, 2022
3c0d5c4
Merge pull request #23 from Berrysoft/dev/actionline
Berrysoft Jul 19, 2022
f0b4f7d
Fix log in StartView.
Berrysoft Jul 19, 2022
304f8ca
Add new plugin type: Text
Berrysoft Jul 19, 2022
9ee7f05
[WIP] move some command to plugins.
Berrysoft Jul 19, 2022
2f33f16
Add media plugin.
Berrysoft Jul 19, 2022
b2ed966
Add text support for markdown plugin.
Berrysoft Jul 20, 2022
50893dc
Add existance interop for plugins.
Berrysoft Jul 20, 2022
c6d8e4e
Use different wasm32 targets.
Berrysoft Jul 20, 2022
8fcc8d2
Update packages.
Berrysoft Jul 20, 2022
1beac25
Add basictex plugin.
Berrysoft Jul 20, 2022
8b80212
Fix space trimming.
Berrysoft Jul 20, 2022
0fdf0da
Fix pipelines.
Berrysoft Jul 20, 2022
b0b0826
Use regex to trim spaces.
Berrysoft Jul 20, 2022
4ca1b8b
Fix trimming in text
Berrysoft Jul 20, 2022
c2b2e8c
Fix autoskip.
Berrysoft Jul 20, 2022
cb13ecc
Use VecDeque in Action.line
Berrysoft Jul 21, 2022
ec24cad
Add \ruby{}{}
Berrysoft Jul 21, 2022
d5aca9d
Adjust runtime structure.
Berrysoft Jul 21, 2022
2e1e6d6
Warn if TeX command is overrided.
Berrysoft Jul 21, 2022
c3a6bde
Reduce clone by TextProcessContextRef
Berrysoft Jul 21, 2022
1cf6dcb
Simplify plugin.rs
Berrysoft Jul 21, 2022
1ee8a97
Small adust to construct contextref
Berrysoft Jul 21, 2022
33538ab
Fix history showing.
Berrysoft Jul 22, 2022
952a497
Wrap ActionLines.
Berrysoft Jul 22, 2022
c4a3992
Use wasmer
Berrysoft Jul 22, 2022
a0f77c4
Disable info log of wasmer.
Berrysoft Jul 22, 2022
7b86512
Remove RuntimeRef.
Berrysoft Jul 22, 2022
4bfa39e
Add more platforms to build.
Berrysoft Jul 22, 2022
435266f
Revert "Add more platforms to build."
Berrysoft Jul 22, 2022
d14a4eb
Full permission of file for plugins.
Berrysoft Jul 22, 2022
1508a32
Merge pull request #24 from Berrysoft/dev/wasmer
Berrysoft Jul 23, 2022
01c4a88
Reduce copy and length in ActionLines.
Berrysoft Jul 23, 2022
e8e014b
Reduce dependencies.
Berrysoft Jul 23, 2022
414ef8d
Fix Makefile to clean correctly.
Berrysoft Jul 23, 2022
707dc2d
Fix logger to use UTC time on UNIX.
Berrysoft Jul 23, 2022
80739c1
Save detailed history.
Berrysoft Jul 24, 2022
1ce060f
Save records unpretty.
Berrysoft Jul 24, 2022
9cbb972
Split history to a single page.
Berrysoft Jul 24, 2022
ae2645e
Enable going back.
Berrysoft Jul 24, 2022
0332b2e
Enable ProgressFuture with lifetime.
Berrysoft Jul 24, 2022
4eb332c
Make ProgressFuture private.
Berrysoft Jul 24, 2022
e3cb282
Simplify ProgressFuture.
Berrysoft Jul 24, 2022
af91077
Use mpsc channel.
Berrysoft Jul 25, 2022
7009170
Merge windows & macos icu imports.
Berrysoft Jul 25, 2022
e887dd0
Remove imp_* functions.
Berrysoft Jul 25, 2022
e0ded1c
Fix icu bindings build on Linux.
Berrysoft Jul 25, 2022
6eb7029
Add linux ARM64 build. (#25)
Berrysoft Jul 26, 2022
4648329
Add README.
Berrysoft Jul 26, 2022
da7f450
Add doc for gal-primitive.
Berrysoft Jul 26, 2022
bdceb05
Add doc for gal-locale.
Berrysoft Jul 26, 2022
c943b42
[WIP] Doc for gal-fallback.
Berrysoft Jul 26, 2022
e9ec22d
Add doc for gal-fallback.
Berrysoft Jul 26, 2022
6bf57f2
Docs for gal-bindings-types.
Berrysoft Jul 27, 2022
b6655a2
Docs for gal-script.
Berrysoft Jul 27, 2022
9a5b743
Remove empty line in the doc.
Berrysoft Jul 27, 2022
01442c1
Add make doc in Makefile.
Berrysoft Jul 27, 2022
e295d91
Docs for gal-runtime.
Berrysoft Jul 27, 2022
84c9b08
Only export ProgressFuture.
Berrysoft Jul 27, 2022
173de3f
Add make doc.
Berrysoft Jul 27, 2022
a2d231c
Add gal-book.
Berrysoft Jul 30, 2022
0ff7da1
Add book Makefile.
Berrysoft Jul 30, 2022
0099723
Add character.md
Berrysoft Jul 30, 2022
0c2eddf
Some more texts in book.
Berrysoft Jul 30, 2022
68f54dd
Fix typo.
Berrysoft Jul 30, 2022
1ca655c
Add intro.
Berrysoft Jul 30, 2022
8a15c4f
Add i18n doc to book.
Berrysoft Jul 30, 2022
103690d
Simplify README.
Berrysoft Jul 30, 2022
eecd0e2
Fix test in mdbook.
Berrysoft Jul 30, 2022
754c750
Add runtime part in book.
Berrysoft Jul 30, 2022
f65d0e5
Add docs about fallback.
Berrysoft Jul 30, 2022
3f70168
Rename files in book.
Berrysoft Jul 30, 2022
8af7a41
Add script plugin doc to the book.
Berrysoft Jul 30, 2022
6102570
Plugin docs in book.
Berrysoft Aug 1, 2022
8183faf
[WIP] Add efm and voice.
Berrysoft Aug 2, 2022
fedd2f2
Add efm & voice command in media plugin.
Berrysoft Aug 2, 2022
68ed394
Add efm & voice support in frontend.
Berrysoft Aug 2, 2022
7575a5d
Remove HistoryAction
Berrysoft Aug 4, 2022
8b3b463
Remove \voice
Berrysoft Aug 4, 2022
ee12e32
Allow fallback as is.
Berrysoft Aug 4, 2022
d13c341
Enable to test if current action has been visited.
Berrysoft Aug 6, 2022
c0751fa
[WIP] Add bg at StartView.
Berrysoft Aug 6, 2022
3b8c9f8
Add background image at HomeView.
Berrysoft Aug 6, 2022
5ac14ee
Add more docs.
Berrysoft Aug 6, 2022
275b983
Add example of game plugins in book.
Berrysoft Aug 6, 2022
bfb260d
[WIP] Fix next_back.
Berrysoft Aug 6, 2022
c8f91fb
Split context & record.
Berrysoft Aug 6, 2022
07b97fd
Fix records loading.
Berrysoft Aug 6, 2022
f1fe872
Add comments.
Berrysoft Aug 6, 2022
42acedd
Update packages.
Berrysoft Aug 10, 2022
4b26380
Simplify some if let.
Berrysoft Aug 10, 2022
b0b0871
Remove PeekableChars
Berrysoft Aug 10, 2022
cf7b479
Normalize some unsafe.
Berrysoft Aug 10, 2022
40ff706
Use pin_project to remove some unsafe with pin.
Berrysoft Aug 11, 2022
2814950
Update npm packages.
Berrysoft Aug 11, 2022
7d57e78
Fix clippy warnings.
Berrysoft Aug 11, 2022
4c30fbd
Reduce unreachable in TextParser.
Berrysoft Aug 12, 2022
243513a
Wait for voice ended.
Berrysoft Aug 13, 2022
f9e013b
Add min timeout for one line.
Berrysoft Aug 13, 2022
7014091
Merge branch 'master' into citest
Berrysoft Aug 13, 2022
af07d99
Use pixi-live2d.
Berrysoft Jul 19, 2022
95263ab
Fix SDK loading.
Berrysoft Aug 19, 2022
511c28f
Fix resource loading.
Berrysoft Aug 19, 2022
1819e15
Add support for live2d 2.1
Berrysoft Aug 19, 2022
9d55c7a
Simplify source convertion.
Berrysoft Aug 20, 2022
f31653d
Add live2d plugin.
Berrysoft Aug 20, 2022
c2f8ac3
Fix model loading.
Berrysoft Aug 20, 2022
d481b77
Fix PIXI loading.
Berrysoft Aug 20, 2022
6710906
Change game prop from models to ch_models.
Berrysoft Aug 20, 2022
fec0d10
Add scale for characters.
Berrysoft Aug 20, 2022
c166017
Merge pull request #26 from Berrysoft/dev/live2d-2
Berrysoft Aug 20, 2022
ed217b8
Fix string in float warning.
Berrysoft Aug 20, 2022
c545e22
Fix home background.
Berrysoft Aug 20, 2022
bd78bb9
Remove timeout in manual mode.
Berrysoft Aug 20, 2022
bdfe8ab
Add settings page to gui.
Berrysoft Aug 20, 2022
753a682
Fix live2d scaling
Berrysoft Aug 21, 2022
ca48535
Add \show command.
Berrysoft Aug 21, 2022
c3613b8
Cache loaded live2d model.
Berrysoft Aug 21, 2022
9a7d08e
Simplify the ch_models array.
Berrysoft Aug 21, 2022
892b879
Enable default for \show and \hide.
Berrysoft Aug 21, 2022
8690594
Add basic description of Live2D.
Berrysoft Aug 21, 2022
f02d42d
Enable settings button in GameView.
Berrysoft Aug 21, 2022
be01366
Add go home confirm.
Berrysoft Aug 21, 2022
45f6518
Reduce warnings on building frontend.
Berrysoft Aug 21, 2022
fce0315
Adjust free order in plugin runtime.
Berrysoft Aug 22, 2022
f01b752
Get display names of locales with typescript.
Berrysoft Aug 23, 2022
4283e3b
Use CLDR to implement language matcher.
Berrysoft Aug 23, 2022
ae2e075
Document new ICU usage.
Berrysoft Aug 23, 2022
8964062
Merge branch 'master' into citest
Berrysoft Aug 23, 2022
78f913d
Remove book test.
Berrysoft Aug 23, 2022
9b99611
Test after plugins built.
Berrysoft Aug 23, 2022
4ebaaa0
Merge pull request #18 from Berrysoft/citest
Berrysoft Aug 23, 2022
0e362c7
Use tokio::test
Berrysoft Aug 23, 2022
81061aa
Adjust matcher api.
Berrysoft Aug 24, 2022
0c418ab
Add test for distance.
Berrysoft Aug 24, 2022
231bd29
Add locale!, mainly for tests.
Berrysoft Aug 24, 2022
88ba385
Remove ParserError wrapper.
Berrysoft Aug 24, 2022
d54d29a
Remove default locale "en".
Berrysoft Aug 24, 2022
1453b29
Fix doc for Locale.
Berrysoft Aug 24, 2022
4b2169b
Remove gal_ prefix for some crates.
Berrysoft Aug 25, 2022
6f90bcb
Rewrite progress future.
Berrysoft Aug 25, 2022
df26b85
Add tests for progress_future.
Berrysoft Aug 25, 2022
f76fe88
Add more tests to test proc macros.
Berrysoft Aug 25, 2022
34dd0f9
Rename progress_future to stream_future.
Berrysoft Aug 25, 2022
a708dd5
Move yield to it's own visitor.
Berrysoft Aug 25, 2022
c9376fd
Cleanup stream-future.
Berrysoft Aug 25, 2022
3fb7a60
Move out stream-future.
Berrysoft Aug 26, 2022
fde0145
Remove unused nightly features.
Berrysoft Aug 26, 2022
90c6c58
Remove progress future from book.
Berrysoft Aug 26, 2022
74c1f62
Update packages.
Berrysoft Aug 26, 2022
9fa7b40
Update flexi_logger requirement from 0.22 to 0.23 in /bins
dependabot[bot] Aug 26, 2022
b2836b1
Merge pull request #27 from Berrysoft/dependabot/cargo/bins/flexi_log…
Berrysoft Aug 26, 2022
edf88f2
Fix window center.
Berrysoft Aug 26, 2022
69b51ea
Use scopeguard to ensure the wasm data freed.
Berrysoft Aug 28, 2022
9f0dd3c
Simplify plugin ABI.
Berrysoft Aug 28, 2022
9b7e937
Remove package-lock.json when cleaning.
Berrysoft Aug 28, 2022
ff1fc0d
Adjust logs.
Berrysoft Aug 28, 2022
0e11762
Fix reference when locale matching.
Berrysoft Aug 28, 2022
aca73ef
Fix doc test of locale.
Berrysoft Aug 28, 2022
1f57c93
Fix matcher matches.
Berrysoft Aug 29, 2022
cbd7eb2
Update stream-future requirement from 0.1 to 0.2 in /utils
dependabot[bot] Aug 29, 2022
c7c7c35
Merge pull request #30 from Berrysoft/dependabot/cargo/utils/stream-f…
Berrysoft Aug 29, 2022
0578e04
Fix clippy warnings.
Berrysoft Aug 31, 2022
2faecb9
Bump stream-future version.
Berrysoft Aug 31, 2022
c41d50c
Use precedence of lalrpop.
Berrysoft Aug 31, 2022
c01c99c
Fix clippy warnings.
Berrysoft Aug 31, 2022
581656d
Load plugins in parallel.
Berrysoft Aug 31, 2022
eeaca52
Change PluginType to struct.
Berrysoft Sep 1, 2022
f637899
Add doc of PluginTypeBuilder.
Berrysoft Sep 1, 2022
c831e0f
Remove useless dependencies.
Berrysoft Sep 1, 2022
c087b18
Fix reexports.
Berrysoft Sep 1, 2022
7418f6b
Report error when loading.
Berrysoft Sep 1, 2022
d85b18f
Update serde-xml-rs requirement from 0.5 to 0.6 in /utils
dependabot[bot] Sep 1, 2022
dc9f826
Custom LaTeX writer
Berrysoft Sep 1, 2022
ef1172c
Add ident for gal-latex.
Berrysoft Sep 1, 2022
5542257
Merge pull request #31 from Berrysoft/dependabot/cargo/utils/serde-xm…
Berrysoft Sep 1, 2022
cd152a7
Enable exec inherits.
Berrysoft Sep 2, 2022
8b0f9ae
Enable no-escape-brace.
Berrysoft Sep 2, 2022
3b29d0e
Remove try_join_all.
Berrysoft Sep 3, 2022
29174db
Merge branch 'dev/ayaka'
Berrysoft Sep 9, 2022
e18d59f
Rename gal to ayaka.
Berrysoft Sep 9, 2022
30fe86d
Rename the corner `gal`s.
Berrysoft Sep 9, 2022
ac20857
Fix local select on first start.
Berrysoft Sep 9, 2022
c5a95d1
Rename galog to ayalog.
Berrysoft Sep 9, 2022
fef2268
Remove inline doc for pub use.
Berrysoft Sep 9, 2022
a2c9bb3
Remove separated crates.
Berrysoft Sep 10, 2022
5ab5b2c
Add github action workflows.
Berrysoft Sep 10, 2022
4222114
Run actions on master.
Berrysoft Sep 10, 2022
cfa6d3d
Add step names.
Berrysoft Sep 10, 2022
83a1271
Remove macos-latest temporarily
Berrysoft Sep 10, 2022
bec3061
Checkout repo first.
Berrysoft Sep 10, 2022
6fb91bc
Add quick start instructions in README.
Berrysoft Sep 10, 2022
c0a4734
Merge primitive to ayaka-script.
Berrysoft Sep 10, 2022
bff9f0b
Split script-types to new crate.
Berrysoft Sep 10, 2022
df816dd
Fix settings load in GUI frontend.
Berrysoft Sep 10, 2022
28d79b9
Add release action.
Berrysoft Sep 10, 2022
a134f3e
Fix next_back_run at first action.
Berrysoft Sep 11, 2022
8f1f49e
Fix plugins in book.
Berrysoft Sep 11, 2022
e4401a5
Publish plugins & binaries when building release.
Berrysoft Sep 12, 2022
21d7c83
Adjust Action struct.
Berrysoft Sep 12, 2022
7404e91
Fix release action: install wasm targets
Berrysoft Sep 12, 2022
82055ef
Find the config file in exe directory
Berrysoft Sep 13, 2022
a2019ff
Wait at least 1 sec at StartView.
Berrysoft Sep 13, 2022
6807a0e
Add animation for loading logo.
Berrysoft Sep 13, 2022
728455a
Fill Ayaka info.
Berrysoft Sep 13, 2022
7c2391e
Let rotate simpler
Berrysoft Sep 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,16 @@
version: 2
updates:
- package-ecosystem: cargo
directory: "/utils"
schedule:
interval: daily

- package-ecosystem: cargo
directory: "/plugins"
schedule:
interval: daily

- package-ecosystem: cargo
directory: "/bins"
schedule:
interval: daily
51 changes: 51 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,51 @@
name: Release
on:
push:
branches: ["master"]
jobs:
Build:
strategy:
matrix:
platform:
- name: linux-x64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
postfix:
- name: windows-x64
os: windows-latest
target: x86_64-pc-windows-msvc
postfix: .exe
- name: macos-x64
os: macos-latest
target: x86_64-apple-darwin
postfix:
- name: macos-arm64
os: macos-latest
target: aarch64-apple-darwin
postfix:
runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get install -y libwebkit2gtk-4.0-dev
if: matrix.platform.name == 'linux-x64'
- name: Install targets
run: |
rustup target add ${{ matrix.platform.target }}
rustup target add wasm32-unknown-unknown
rustup target add wasm32-wasi
- name: Build
run: make plugins release-cross TARGET=${{ matrix.platform.target }}
- name: Publish plugins
uses: actions/upload-artifact@v3
with:
name: plugins
path: examples/plugins/
- name: Publish binaries
uses: actions/upload-artifact@v3
with:
name: release-${{ matrix.platform.name }}
path: |
bins/target/${{ matrix.platform.target }}/release/ayaka-check${{ matrix.platform.postfix }}
bins/target/${{ matrix.platform.target }}/release/ayaka-gui${{ matrix.platform.postfix }}
bins/target/${{ matrix.platform.target }}/release/ayaka-latex${{ matrix.platform.postfix }}
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
@@ -0,0 +1,23 @@
name: Test
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
Test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get install -y libwebkit2gtk-4.0-dev
if: matrix.os == 'ubuntu-latest'
- name: Install targets
run: |
rustup target add wasm32-unknown-unknown
rustup target add wasm32-wasi
- name: Test
run: make test
9 changes: 9 additions & 0 deletions .gitignore
@@ -0,0 +1,9 @@
**/target
**/*.rs.bk
.cargo
Cargo.lock

.vscode
.cache
.clangd
.vs
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Berrysoft

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
51 changes: 51 additions & 0 deletions Makefile
@@ -0,0 +1,51 @@
.PHONY: test nextest clean update doc serve-book
test: plugins
cd utils && $(MAKE) test
nextest: plugins
cd utils && $(MAKE) nextest
clean:
cd bins && $(MAKE) clean
cd utils && $(MAKE) clean
cd plugins && $(MAKE) clean
cd book && $(MAKE) clean
update:
cd bins && $(MAKE) update
cd utils && $(MAKE) update
cd plugins && $(MAKE) update
doc:
cd utils && $(MAKE) doc
cd book && $(MAKE) build
serve-book:
cd book && $(MAKE) serve

.PHONY: plugins release release-cross
plugins:
cd plugins && $(MAKE) plugins
release:
cd bins && $(MAKE) release
release-cross:
cd bins && $(MAKE) release-cross TARGET=$(TARGET)

EXAMPLES:=Fibonacci Fibonacci2 Gacha Live2D Orga Styles

define example-tpl
.PHONY: example-$(1) example-$(1)-gui example-$(1)-release example-$(1)-gui-release examples/$(1)/config.tex
example-$(1): examples/$(1)/config.yaml plugins
cd bins && $$(MAKE) run FILE=$$(realpath $$<)
example-$(1)-gui: examples/$(1)/config.yaml plugins
cd bins && $$(MAKE) run-gui FILE=$$(realpath $$<)
example-$(1)-release: examples/$(1)/config.yaml plugins release
bins/target/release/ayaka-check $$< --auto
example-$(1)-gui-release: examples/$(1)/config.yaml plugins release
bins/target/release/ayaka-gui $$<
examples/$(1)/config.tex: examples/$(1)/config.yaml
cd bins && $$(MAKE) run-latex FILE=$$(realpath $$<)

endef

$(eval $(foreach ex,$(EXAMPLES),$(call example-tpl,$(ex))))

%.pdf: %.tex
cd $(dir $<) && latexmk -lualatex $(notdir $<)

.SECONDARY:
32 changes: 31 additions & 1 deletion README.md
@@ -1,3 +1,33 @@
# Ayaka
Berrysoft marked this conversation as resolved.
Show resolved Hide resolved

This is the main repository of Ayaka, a visual novel engine written by Rust.
Ayaka is currently a project for [OSPP 2022](https://summer-ospp.ac.cn/).

## About the name
The frontend is Ayaka. The runtime is Ayaka. The script is Ayaka. [Just Ayaka.](https://bbs.mihoyo.com/ys/article/21828380)

## What we've done
* A cross-platform visual noval (VN) runtime with rust
* A well-defined and easy-to-author VN config file format, based on YAML.
* An embedded custom script.
* [CLDR](https://github.com/unicode-org/cldr)-based i18n support.
* A flexible plugin system based on [WebAssembly](https://webassembly.org/). It provides hooks of the runtime and interop functionalities with the script.
* A decoupled framework - the frontend, backend and plugins are decoupled.
* A CLI frontend to check grammar errors and debug quickly.
* A GUI frontend powered by [Tauri](https://tauri.app/) and [Vue](https://vuejs.org/).
* A proto LaTeX frontend to generate PDF from the config.

## Docs
See Ayaka Book:
``` bash
$ make serve-book
```
If you don't have `mdbook` installed, simply read the markdown files in `book` folder.
To start quickly, follow the instructions in [Quick start](./book/src/quick_start.md).

Build API docs into `utils/target/doc`:
``` bash
$ make doc
```

## Screenshot
![Orga](assets/galgui.png)
Binary file added assets/galgui.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/glogo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions bins/Cargo.toml
@@ -0,0 +1,12 @@
[workspace]
members = [
"ayaka-check",
"ayaka-gui/src-tauri",
"ayaka-latex",
]

resolver = "2"

[profile.release]
lto = true
codegen-units = 1
22 changes: 22 additions & 0 deletions bins/Makefile
@@ -0,0 +1,22 @@
.PHONY: clean update
clean:
cargo clean
cd ayaka-gui && $(MAKE) clean
update:
cargo update

.PHONY: dist release release-cross
dist:
cd ayaka-gui && $(MAKE) dist
release: dist
STATIC_VCRUNTIME=false cargo build --release
release-cross: dist
STATIC_VCRUNTIME=false PKG_CONFIG_ALLOW_CROSS=1 cargo build --release --target=$(TARGET)

.PHONY: run run-gui run-latex
run:
RUST_LOG=info cargo run --package ayaka-check -- $(FILE) --auto
run-gui:
cd ayaka-gui && $(MAKE) run FILE=$(FILE)
run-latex:
RUST_LOG=info cargo run --package ayaka-latex -- $(FILE) -o $(basename $(FILE)).tex
10 changes: 10 additions & 0 deletions bins/ayaka-check/Cargo.toml
@@ -0,0 +1,10 @@
[package]
name = "ayaka-check"
version = "0.1.0"
edition = "2021"

[dependencies]
ayaka-runtime = { path = "../../utils/ayaka-runtime" }
tokio = { version = "1", features = ["macros", "rt"] }
clap = { version = "3.1", features = ["derive"] }
env_logger = "0.9"
96 changes: 96 additions & 0 deletions bins/ayaka-check/src/main.rs
@@ -0,0 +1,96 @@
use ayaka_runtime::{
anyhow::{bail, Result},
log::LevelFilter,
*,
};
use clap::Parser;
use std::{
ffi::OsString,
io::{stdin, stdout, Write},
};

#[derive(Debug, Parser)]
#[clap(about, version, author)]
pub struct Options {
input: OsString,
#[clap(long)]
check: bool,
#[clap(long)]
auto: bool,
#[clap(short, long)]
locale: Option<Locale>,
}

fn read_line() -> Result<String> {
stdout().flush()?;
let mut s = String::new();
stdin().read_line(&mut s)?;
Ok(s)
}

fn pause(auto: bool) -> Result<()> {
if auto {
println!();
} else {
read_line()?;
}
Ok(())
}

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<()> {
let opts = Options::parse();
env_logger::Builder::from_default_env()
.filter_module("wasmer", LevelFilter::Warn)
.try_init()?;
let context = Context::open(&opts.input, FrontendType::Text);
pin_mut!(context);
while let Some(status) = context.next().await {
match status {
OpenStatus::LoadProfile => println!("Loading profile..."),
OpenStatus::CreateRuntime => println!("Creating runtime..."),
OpenStatus::LoadPlugin(name, i, len) => {
println!("Loading plugin {} ({}/{})", name, i + 1, len)
}
}
}
let mut ctx = context.await?;
if opts.check && !ctx.check() {
bail!("Check failed.");
}
ctx.init_new();
ctx.set_locale(opts.locale.unwrap_or_else(Locale::current));
while let Some(action) = ctx.next_run() {
if let Some(name) = &action.character {
print!("_{}_", name);
}
for s in action.line {
print!("{}", s.as_str());
}
if !action.switches.is_empty() {
for (i, s) in action.switches.iter().enumerate() {
if s.enabled {
print!("\n-{}- {}", i + 1, s.text);
} else {
print!("\n-x- {}", s.text);
}
}
println!();
loop {
let s = read_line()?;
if let Ok(i) = s.trim().parse::<usize>() {
let valid =
i > 0 && i <= action.switches.len() && action.switches[i - 1].enabled;
if valid {
ctx.call(&action.switches[i - 1].action);
break;
}
}
println!("Invalid switch, enter again!");
}
} else {
pause(opts.auto)?;
}
}
Ok(())
}
29 changes: 29 additions & 0 deletions bins/ayaka-gui/.gitignore
@@ -0,0 +1,29 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
.DS_Store
dist
dist-ssr
coverage
*.local
package-lock.json

/cypress/videos/
/cypress/screenshots/

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?