Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 7 additions & 20 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,15 @@ name: Deploy to GitHub Pages
on:
push:
branches:
- main
- main
workflow_dispatch:

permissions:
contents: write
pages: write
id-token: write
contents: write

jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
MOONBIT_INSTALL_VERSION: latest

steps:
- uses: actions/checkout@v4

Expand All @@ -25,24 +20,16 @@ jobs:
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash -s latest
echo "$HOME/.moon/bin" >> $GITHUB_PATH

- name: Build project
- name: Build Pages
run: |
moon update
moon build --target js --release --deny-warn

- name: Collect Pages files
run: |
site="$RUNNER_TEMP/selene-pages"
mkdir -p "$site"
cp page/index.html "$site/index.html"
cp -R --parents \
examples/index.html examples/preload-assets.js \
examples/*/index.html examples/*/screenshot.png examples/*/assets \
_build/js/release/build/Milky2018/selene-examples-web/*/web/web.js \
"$site"
for game in cards pixeladventure survivors; do
cp "_build/js/release/build/Milky2018/selene-examples-web/$game/web/web.js" "page/examples/$game/web.js"
done

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ${{ runner.temp }}/selene-pages
publish_dir: page
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.DS_Store
__pycache__/
page/examples/
page/preload-assets.js
page/assets/
/page/examples/*/web.js
todo.md

.mooncakes/
_build/
target

examples/*/embedded_assets/*.g.mbt
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- Follow [CONTRIBUTING.md](CONTRIBUTING.md#release-process) for the release sequence.

## Pages
- Build examples from the repository root with `moon build --target js --release`. Serve the repository root to preview `examples/index.html`.
- Build examples from the repository root with `moon build --target js --release`, then copy the generated JavaScript as described in [page/README.md](page/README.md). Serve `page/` to preview the same directory published by Pages.

## Release Manifest Behavior
- Stable publish flow rewrites each release module `moon.mod` version and internal Selene deps to `@x.y.z`.
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ To try a change in the browser:

```sh
moon build --target js --release
python3 -m http.server 8000
```

Open <http://localhost:8000/examples/index.html>.
Follow the [Pages preview instructions](page/README.md) to copy the generated
JavaScript and serve `page/`.
See the [README](README.md) for package roles and tutorials.

## Changes and pull requests
Expand Down
3 changes: 1 addition & 2 deletions README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ Selene 是一个面向 MoonBit 的 ECS 游戏引擎,提供浏览器 WebGPU 渲
```bash
moon update
moon build --target js --release
python3 -m http.server 8000
```

打开 `http://localhost:8000/examples/index.html`。
本地游玩示例请参阅 [Pages 预览说明](page/README.md)。

## 文档

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ which may report syntax deprecation warnings until `latest` supports the replace
```bash
moon update
moon build --target js --release
python3 -m http.server 8000
```

Open `http://localhost:8000/examples/index.html`.
To play the examples locally, follow the [Pages preview instructions](page/README.md).

## Documentation

Expand Down
17 changes: 17 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@

### Added

- Add typed `Assets[T]` collections and `Handle[T]`, with independent resource
construction, registration, replacement, and removal. Embedded images, fonts,
and audio are used directly without hand-maintained path catalogues.
- Expose backend preparation states separately from file-loader completion.
- Share image resources and handles across Sprite, UI, autotile visuals, and
3D materials; remove
the separate 3D image registry and image synchronization records.

- Expose registered asset paths for Tiled world pattern discovery without host
directory scans.

- Add `Query::set(entity, row)` for World-bound point writes that preserve
component layouts and iterator validity and reject non-matching rows.

Expand Down Expand Up @@ -48,6 +59,12 @@

### Changed

- Keep the complete Pages site in `page/`, with each example loading an
adjacent `web.js`. Build and copy the three game bundles, then deploy `page/`
directly without collecting a separate staging directory.
- Embed example game assets with `moonbit-community/embed` through `dev_build`
and route WebGPU image, font, and audio loading through the embedded data.
Remove the network preloader, asset manifests, and `moonbitlang/x` dependency.
- Migrate ordinary gameplay, UI, camera, firing, collision-event, and animation
helpers in Cards, Pixel Adventure, and Survivors to injected queries,
resources, Commands, and clocks. Private named parameter views combine
Expand Down
14 changes: 7 additions & 7 deletions docs/tutorial-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ This chapter shows how to build a complete platformer-style game with Selene and

The game we will build looks like this:

![](../examples/pixeladventure/screenshot.png)
![](../page/examples/pixeladventure/screenshot.png)

In the following process, we will build:

Expand Down Expand Up @@ -111,7 +111,6 @@ import {
"Milky2018/selene/transform",
"Milky2018/selene/ui",
"moonbitlang/core/json",
"moonbitlang/x/fs",
}
```

Expand Down Expand Up @@ -422,19 +421,20 @@ fn volume_button_input_system(_world : @ecs.World) -> Unit {
Build command:

```shell
moon -C examples-web build ./pixeladventure/web --target js --release
moon build examples-web/pixeladventure/web --target js --release
cp _build/js/release/build/Milky2018/selene-examples-web/pixeladventure/web/web.js page/examples/pixeladventure/web.js
```

Then use `examples/pixeladventure/index.html`, which references:
Then use `page/examples/pixeladventure/index.html`, which references:

```html
<script src="../../_build/js/release/build/Milky2018/selene-examples-web/pixeladventure/web/web.js" defer></script>
<script src="web.js" defer></script>
```

Run the local server from the repository root:
Run the local server from the repository root, serving the Pages directory:

```shell
python3 -m http.server 8000
python3 -m http.server --directory page 8000
```

Open `http://localhost:8000/examples/pixeladventure/` to play.
Expand Down
14 changes: 7 additions & 7 deletions docs/tutorial-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ python3 -m http.server 8000

我们将要制作的游戏如下:

![](../examples/pixeladventure/screenshot.png)
![](../page/examples/pixeladventure/screenshot.png)

我们会在流程中展示如何制作:

Expand Down Expand Up @@ -111,7 +111,6 @@ import {
"Milky2018/selene/transform",
"Milky2018/selene/ui",
"moonbitlang/core/json",
"moonbitlang/x/fs",
}
```

Expand Down Expand Up @@ -418,19 +417,20 @@ fn volume_button_input_system(_world : @ecs.World) -> Unit {
构建命令:

```shell
moon -C examples-web build ./pixeladventure/web --target js --release
moon build examples-web/pixeladventure/web --target js --release
cp _build/js/release/build/Milky2018/selene-examples-web/pixeladventure/web/web.js page/examples/pixeladventure/web.js
```

构建后可直接使用 `examples/pixeladventure/index.html`,其中脚本路径如下:
构建后可直接使用 `page/examples/pixeladventure/index.html`,其中脚本路径如下:

```html
<script src="../../_build/js/release/build/Milky2018/selene-examples-web/pixeladventure/web/web.js" defer></script>
<script src="web.js" defer></script>
```

然后在仓库根目录启动本地 Web 服务:
然后在仓库根目录启动本地 Web 服务,以 `page/` 为站点目录:

```shell
python3 -m http.server 8000
python3 -m http.server --directory page 8000
```

访问 `http://localhost:8000/examples/pixeladventure/` 即可游玩。
Expand Down
55 changes: 0 additions & 55 deletions examples/cards/assets/cards/assets-manifest.json

This file was deleted.

59 changes: 59 additions & 0 deletions examples/cards/embedded_assets/moon.pkg
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
dev_build(
input: [
"../assets/cards/10-C.png",
"../assets/cards/10-D.png",
"../assets/cards/10-H.png",
"../assets/cards/10-S.png",
"../assets/cards/2-C.png",
"../assets/cards/2-D.png",
"../assets/cards/2-H.png",
"../assets/cards/2-S.png",
"../assets/cards/3-C.png",
"../assets/cards/3-D.png",
"../assets/cards/3-H.png",
"../assets/cards/3-S.png",
"../assets/cards/4-C.png",
"../assets/cards/4-D.png",
"../assets/cards/4-H.png",
"../assets/cards/4-S.png",
"../assets/cards/5-C.png",
"../assets/cards/5-D.png",
"../assets/cards/5-H.png",
"../assets/cards/5-S.png",
"../assets/cards/6-C.png",
"../assets/cards/6-D.png",
"../assets/cards/6-H.png",
"../assets/cards/6-S.png",
"../assets/cards/7-C.png",
"../assets/cards/7-D.png",
"../assets/cards/7-H.png",
"../assets/cards/7-S.png",
"../assets/cards/8-C.png",
"../assets/cards/8-D.png",
"../assets/cards/8-H.png",
"../assets/cards/8-S.png",
"../assets/cards/9-C.png",
"../assets/cards/9-D.png",
"../assets/cards/9-H.png",
"../assets/cards/9-S.png",
"../assets/cards/A-C.png",
"../assets/cards/A-D.png",
"../assets/cards/A-H.png",
"../assets/cards/A-S.png",
"../assets/cards/J-C.png",
"../assets/cards/J-D.png",
"../assets/cards/J-H.png",
"../assets/cards/J-S.png",
"../assets/cards/K-C.png",
"../assets/cards/K-D.png",
"../assets/cards/K-H.png",
"../assets/cards/K-S.png",
"../assets/cards/Q-C.png",
"../assets/cards/Q-D.png",
"../assets/cards/Q-H.png",
"../assets/cards/Q-S.png",
"../assets/cards/ThaleahFat.ttf",
],
output: "assets.g.mbt",
command: "moonx moonbit-community/embed@0.1.3 \"$pkg_dir/../assets\" -o \"$output\"",
)
Loading
Loading