This commit is contained in:
Михаил Капелько committed 2026-10-17 11:20:21 +03:00
1 parent 55482633c4
commit 5646345322
10 files changed
+743 -197

No files matched your search

+23 -3
View File
@@ -31,9 +31,14 @@ components/ SHARED source-of-truth for all components.
root/mac/view/RootView.swift Per-platform SwiftUI view
game/ver-mac/ macOS app (SPM executable target "ogs-mahjong")
Package.swift SPM manifest (macOS 13+, swift-tools 5.9)
Package.swift SPM manifest (macOS 13+, swift-tools 5.9); SPM C target
"RaylibBridge" (bridge/) + links Homebrew raylib
Info.plist Bundle id org.opengamestudio.Mahjong, exec ogs-mahjong
Resources/AppIcon.icns App icon
Resources/assets/ Bundled glTF assets: cube.gltf (static),
cube_texture.png
bridge/ C target "RaylibBridge": raylib_bridge.{c,h}. Renders a
rlgl scene (no raylib window) into an NSOpenGLView.
src/
GameApp.swift @main SwiftUI App entry
AppDelegate.swift Creates RootComponent + RootVM, calls root.setup()
@@ -42,6 +47,7 @@ game/ver-mac/ macOS app (SPM executable target "ogs-mahjong")
root/root.swift -> symlink components/root/root.swift
root/rootVM.swift -> symlink components/root/rootVM.swift
root/view/RootView.swift-> symlink components/root/mac/view/RootView.swift
root/view/RaylibGLView.swift -> symlink components/root/mac/view/RaylibGLView.swift
ref/swiftraylib Symlink to ../../swiftraylib — the raylib/SwiftUI
renderer sample the game will use for 3D rendering.
@@ -68,6 +74,7 @@ src/other/other.swift -> ../../../../components/other/other.swift (
src/root/root.swift -> ../../../../components/root/root.swift (4 up)
src/root/rootVM.swift -> ../../../../components/root/rootVM.swift (4 up)
src/root/view/RootView.swift-> ../../../../../components/root/mac/view/RootView.swift (5 up)
src/root/view/RaylibGLView.swift -> ../../../../../components/root/mac/view/RaylibGLView.swift (5 up)
```
SPM silently **skips** a dangling symlink (no error), so after moving
@@ -95,6 +102,19 @@ So `/Volumes/MOE/p/dialect` must exist and its generator must be built before
The generator resolves the `output:` path **relative to `dialect.yml`'s
directory**, which is why `dialect.yml` says `game/ver-mac/src/dialect.swift`.
## Prerequisite: raylib
The 3D scene links against Homebrew **raylib** (`brew install raylib`). The
`RaylibBridge` C target and the link step read `RAYLIB_PREFIX` (default
`/opt/homebrew`); `util/step/buildMac` auto-detects it via `brew --prefix raylib`.
The bridge renders with raylib's rlgl layer into an `NSOpenGLView` — raylib never
creates its own window. `RootView` puts `RaylibGLView` behind the SwiftUI UI in a
`ZStack`. A textured cube is drawn from `Resources/assets` (`cube.gltf` +
`cube_texture.png`); the app rotates it each frame via `sr_set_rotation`.
(raylib's `LoadModelAnimations` only handles *skinned* meshes, so a plain
node-rotation glTF animation cannot be played by the renderer — hence the cube is
app-driven.) `packageMac` bundles `Resources/assets/` into the app.
## Build & Run
```bash
@@ -106,9 +126,9 @@ util/rm-mac-geom # reset the app's saved window geometry
`build-mac` sources `util/paths` then the `util/step/*` scripts in order:
1. `generateDialect` — runs the sibling generator, writes `src/dialect.swift`
2. `buildMac` — `cd game/ver-mac && swift build`
2. `buildMac` — `brew --prefix raylib` -> `RAYLIB_PREFIX`, `swift build`
3. `packageMac` — assembles `.build/OGS Mahjong.app` (binary `ogs-mahjong`,
`Info.plist`, `Resources/AppIcon.icns`)
`Info.plist`, `Resources/AppIcon.icns`, `Resources/assets/`)
## Editing the dialect