rename
This commit is contained in:
1 parent
0010ef00a6
commit
fbea0673c1
7 files changed
+26
-22
No files matched your search
@@ -44,10 +44,12 @@ game/ver-mac/ macOS app (SPM executable target "ogs-mahjong")
|
||||
AppDelegate.swift Creates RootComponent + RootVM, calls root.setup()
|
||||
dialect.swift GENERATED — do not hand-edit (see chicken-egg below)
|
||||
other/other.swift -> symlink components/other/other.swift
|
||||
render/renderConstShader.swift -> symlink components/render/renderConstShader.swift
|
||||
render/view/RenderGLView.swift -> symlink components/render/mac/view/RenderGLView.swift
|
||||
render/view/RenderView.swift -> symlink components/render/mac/view/RenderView.swift
|
||||
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.
|
||||
@@ -71,10 +73,12 @@ directories whose files are **relative symlinks** back into `components/`:
|
||||
|
||||
```
|
||||
src/other/other.swift -> ../../../../components/other/other.swift (4 up)
|
||||
src/render/renderConstShader.swift -> ../../../../components/render/renderConstShader.swift (4 up)
|
||||
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)
|
||||
src/render/view/RenderGLView.swift -> ../../../../../components/render/mac/view/RenderGLView.swift (5 up)
|
||||
src/render/view/RenderView.swift -> ../../../../../components/render/mac/view/RenderView.swift (5 up)
|
||||
```
|
||||
|
||||
SPM silently **skips** a dangling symlink (no error), so after moving
|
||||
@@ -108,8 +112,8 @@ 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` +
|
||||
creates its own window. `RootView` puts `RenderView` (backed by `RenderGLView`)
|
||||
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
|
||||
|
||||
+2
-16
@@ -1,23 +1,9 @@
|
||||
import SwiftUI
|
||||
import AppKit
|
||||
import QuartzCore
|
||||
import RaylibBridge
|
||||
import SwiftUI
|
||||
|
||||
/// A raylib-driven 3D scene (rendered through rlgl into an NSOpenGLView) that
|
||||
/// sits behind the SwiftUI interface.
|
||||
struct RaylibGLView: NSViewRepresentable {
|
||||
func makeNSView(context: Context) -> RaylibGLNSView {
|
||||
RaylibGLNSView(frame: .zero)
|
||||
}
|
||||
|
||||
func updateNSView(_ nsView: RaylibGLNSView, context: Context) {}
|
||||
}
|
||||
|
||||
/// An OpenGL view whose context is rendered directly by raylib's rlgl layer,
|
||||
/// without letting raylib create its own window. Mirrors the reference sample
|
||||
/// (`swiftraylib`), but drives a single cube that is rotated by the application
|
||||
/// every frame.
|
||||
final class RaylibGLNSView: NSOpenGLView {
|
||||
final class RenderGLView: NSOpenGLView {
|
||||
private var renderTimer: Timer?
|
||||
private var ready = false
|
||||
private var pixelWidth: Int32 = 1
|
||||
@@ -0,0 +1,13 @@
|
||||
import AppKit
|
||||
import QuartzCore
|
||||
import RaylibBridge
|
||||
import SwiftUI
|
||||
|
||||
/// Render view for SwiftUI
|
||||
struct RenderView: NSViewRepresentable {
|
||||
func makeNSView(context: Context) -> RenderGLView {
|
||||
RenderGLView(frame: .zero)
|
||||
}
|
||||
|
||||
func updateNSView(_ nsView: RenderGLView, context: Context) {}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ struct RootView: View {
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
RaylibGLView()
|
||||
RenderView()
|
||||
.ignoresSafeArea()
|
||||
|
||||
VStack(spacing: 16) {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
../../../../../components/render/mac/view/RenderGLView.swift
|
||||
@@ -0,0 +1 @@
|
||||
../../../../../components/render/mac/view/RenderView.swift
|
||||
@@ -1 +0,0 @@
|
||||
../../../../../components/root/mac/view/RaylibGLView.swift
|
||||
Reference in new issue
Block a user