Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d11461c5ae | ||
|
|
db71e37cd2 | ||
|
|
199ec2d7b9 | ||
|
|
c2ab69c3d0 | ||
|
|
ed8803dbc1 | ||
|
|
325499d404 | ||
|
|
3bcfc32ef1 | ||
|
|
5e5537aee6 | ||
|
|
cd82f445d3 | ||
|
|
f0972f0d5b | ||
|
|
f4fd8cb523 | ||
|
|
d4da4325f9 | ||
|
|
3ab45ab003 | ||
|
|
32dd0ab113 | ||
|
|
b750dace76 | ||
|
|
ea68f48608 | ||
|
|
de36ad782c | ||
|
|
7bd72fc60a | ||
|
|
26528819a7 | ||
|
|
360be210c2 | ||
|
|
b9b7e91bcd | ||
|
|
6c142f794c | ||
|
|
f76932fd91 | ||
|
|
1f92c8e41c | ||
|
|
7b8c3181d5 | ||
|
|
b1dd0a5107 | ||
|
|
2fbaba4a51 | ||
|
|
cc2748efb7 | ||
|
|
9757a40b36 | ||
|
|
48f7d37c78 | ||
|
|
ac649266ac | ||
|
|
d613f3ace1 | ||
|
|
701e3a983a | ||
|
|
1dc202b1af | ||
|
|
aa541a8e23 | ||
|
|
3f94adf13a | ||
|
|
2ecd15e79f | ||
|
|
9d6c2aeb27 | ||
|
|
36392764f7 | ||
|
|
4d639fc6b5 | ||
|
|
730da461c3 | ||
|
|
bfc4b22b48 | ||
|
|
433afa5f9e | ||
|
|
7361f5c212 | ||
|
|
e6056ae8b2 | ||
|
|
9c5b298131 | ||
|
|
64bb22560c | ||
|
|
dfe16133df | ||
|
|
5a3f45dfa4 | ||
|
|
e3844dfb18 | ||
|
|
21605f98b4 | ||
|
|
1c841a18bb | ||
|
|
d0b45b6b99 | ||
|
|
cfd9f9c0af | ||
|
|
9101b9f5d4 | ||
|
|
3ee51fd355 | ||
|
|
7e511afb73 | ||
|
|
6e5a355fc8 | ||
|
|
5a875b44a8 | ||
|
|
4263d65090 |
No files matched your search
@@ -1,218 +1,120 @@
|
|||||||
# OGS Mahjong (`mj`)
|
# OGS applications (`mj`)
|
||||||
|
|
||||||
A macOS SwiftUI app for **OGS Mahjong**, built on the **Dialect v4** declarative
|
Native SwiftUI applications using the Dialect v4 declarative reactive engine.
|
||||||
reactive engine (see the sibling `../dialect` repo — this project is a
|
Version: `2.0.0`. Remote: `https://git.opengamestudio.org/mahjong/mahjong`.
|
||||||
downstream consumer of its code generator).
|
|
||||||
|
|
||||||
Business logic lives in `dialect.yml` (YAML). A generator turns it into
|
## Current status
|
||||||
`game/ver-mac/src/dialect.swift` (the runtime engine + `struct F` field
|
|
||||||
constants + component/should/effect registration). The Swift app shell
|
|
||||||
(`GameApp`/`AppDelegate`) and the SwiftUI views live outside the generated file
|
|
||||||
and talk to the engine through generated functions like `rootSet(...)`.
|
|
||||||
|
|
||||||
Remote: `https://git.opengamestudio.org/mahjong/mahjong` · Version: `2.0.0`
|
- `ogs-blue/` is the active minimal graphics example for macOS and iOS: a solid
|
||||||
|
blue raylib background with a SwiftUI overlay. It has no model/texture/shadow
|
||||||
|
scene; rlgl still creates its default internal GPU resources.
|
||||||
|
- `ogs-mahjong/` contains the macOS Mahjong scaffold and counter-template logic;
|
||||||
|
Mahjong gameplay has not been implemented.
|
||||||
|
- `ogs-chkgfx/` is a companion graphics scaffold with macOS/iOS project files.
|
||||||
|
Older targets can lag behind shared-component changes; verify each target
|
||||||
|
separately before claiming it builds.
|
||||||
|
- The previous `game/ver-mac` and root `dialect.yml` layout is obsolete.
|
||||||
|
|
||||||
> `dialect.yml` is still the "Root / counter" template with a `Render` context
|
## Source layout
|
||||||
> bolted on: the Mahjong game logic has not been written yet. The app shell,
|
|
||||||
> packaging, symlink wiring and the raylib renderer are in place.
|
|
||||||
|
|
||||||
## Structure
|
- `<app>/dialect.yml`: per-application logic; generates
|
||||||
|
`<app>/ver-mac/src/dialect.swift`. Blue iOS links to its macOS generated file.
|
||||||
|
- `components/`: shared source of truth. App `src/` files use relative symlinks;
|
||||||
|
edit real component files and preserve symlink parity.
|
||||||
|
- `components/render/`: shared component/model/constants, plus mirrored `ios/`
|
||||||
|
and `mac/` effects, helpers and native/SwiftUI views. macOS additionally has
|
||||||
|
`renderConstMac.swift` for native pixel-format attributes.
|
||||||
|
- `components/raybri/raybri.h`: declarations plus implementation gated by
|
||||||
|
`RAYBRI_IMPLEMENTATION`; clears blue, renders and shuts down rlgl.
|
||||||
|
- `components/raybri/raybriConst.h`: shared constants with an implementation macro.
|
||||||
|
`components/raybri/mac/raybriAux.h`: macOS OpenGL symbol loader.
|
||||||
|
- `components/egl/egl.h` and `eglConst.h`: EGL state/helpers and configuration,
|
||||||
|
using single-header implementation macros.
|
||||||
|
- `ogs-blue/ver-{mac,ios}/src/Blue.c`: platform C implementation translation units.
|
||||||
|
- `history/gitjs/`: historical JavaScript Mahjong reference, outside the build.
|
||||||
|
`ref/swiftraylib` links to the sibling renderer sample.
|
||||||
|
|
||||||
```
|
## Graphics ownership and platform differences
|
||||||
dialect.yml Single source of truth for the reactive logic.
|
|
||||||
Generates game/ver-mac/src/dialect.swift
|
|
||||||
|
|
||||||
components/ SHARED source-of-truth for all components.
|
Every GPU operation requires its context current on the calling thread.
|
||||||
other/other.swift Shared helpers (otherPrintStderr, otherWriteFile,
|
`rlLoadExtensions` also requires an existing current context; it precedes
|
||||||
otherSetupConsoleLogging, ...)
|
`rlglInit`, not native context creation.
|
||||||
raybri/raybri.h C API of the raylib bridge (raybri_config, raybri_init,
|
|
||||||
raybri_load_model, raybri_resize, raybri_set_rotation,
|
|
||||||
raybri_render, raybri_shutdown); extern "C" guards.
|
|
||||||
raybri/raybri.c Bridge implementation: rlgl scene, shadow pass, shaders.
|
|
||||||
root/root.swift RootComponent (owns DialectController, registers
|
|
||||||
effects + shoulds, sets didSetup on setup())
|
|
||||||
root/rootVM.swift RootVM (ObservableObject / @Published countText)
|
|
||||||
root/mac/view/RootView.swift SwiftUI view: RenderView in a ZStack + UI
|
|
||||||
render/render.swift RenderComponent (controller, effects + shoulds)
|
|
||||||
render/renderVM.swift RenderVM (weak shared; glView, didPrepareGL,
|
|
||||||
pixelSize, startTime, timer)
|
|
||||||
render/renderConst.swift RENDER_CONFIG (raybri_config), RENDER_FPS,
|
|
||||||
RENDER_MODEL_CUBE, RENDER_OPENGL_ATTRS
|
|
||||||
render/renderConstShader.swift RENDER_SHADER_* GLSL sources (GLSL 150)
|
|
||||||
render/renderAux.swift renderDraw(vm), renderPixelSize(view)
|
|
||||||
render/renderEffect.swift renderInit, renderLoadCubeModel,
|
|
||||||
renderStartTimer, renderDeinit
|
|
||||||
render/mac/view/RenderGLView.swift Thin NSOpenGLView: pixel format, callbacks
|
|
||||||
-> renderSet(...), draw -> renderDraw
|
|
||||||
render/mac/view/RenderView.swift NSViewRepresentable wrapper
|
|
||||||
|
|
||||||
game/ver-mac/ macOS app (SPM executable target "ogs-mahjong")
|
macOS uses `NSOpenGLView` (OpenGL 3.2 Core). `renderInit` makes its context
|
||||||
Package.swift SPM manifest (macOS 13+, swift-tools 5.9); C target
|
current, enables VSync, loads extensions with the C loader callback and starts
|
||||||
"RaylibBridge" (path src/raybri, publicHeadersPath ".") +
|
raylib. The timer requests `needsDisplay`; `draw(_:)` forwards to `renderDraw`,
|
||||||
links Homebrew raylib; the Swift target excludes raybri
|
which activates the context, renders and presents via `flushBuffer`.
|
||||||
and gets -Xcc -DGL_SILENCE_DEPRECATION
|
|
||||||
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, cube_normal.png
|
|
||||||
src/
|
|
||||||
GameApp.swift @main SwiftUI App entry
|
|
||||||
AppDelegate.swift Creates Render/Root components + VMs, calls setup()
|
|
||||||
dialect.swift GENERATED — do not hand-edit (see chicken-egg below)
|
|
||||||
other/other.swift -> symlink components/other/other.swift
|
|
||||||
raybri/raybri.c -> symlink components/raybri/raybri.c
|
|
||||||
raybri/raybri.h -> symlink components/raybri/raybri.h
|
|
||||||
render/render.swift -> symlink components/render/render.swift
|
|
||||||
render/renderAux.swift -> symlink components/render/renderAux.swift
|
|
||||||
render/renderConst.swift -> symlink components/render/renderConst.swift
|
|
||||||
render/renderConstShader.swift -> symlink .../renderConstShader.swift
|
|
||||||
render/renderEffect.swift -> symlink components/render/renderEffect.swift
|
|
||||||
render/renderVM.swift -> symlink components/render/renderVM.swift
|
|
||||||
render/view/RenderGLView.swift -> symlink components/render/mac/view/...
|
|
||||||
render/view/RenderView.swift -> symlink components/render/mac/view/...
|
|
||||||
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/...
|
|
||||||
|
|
||||||
ref/swiftraylib Symlink to ../../swiftraylib — the raylib/SwiftUI
|
Blue's SPM `RaylibBridge` target compiles `src/Blue.c`, exposes headers in
|
||||||
renderer sample the game will use for 3D rendering.
|
`src/raybri`, and links Homebrew raylib. It does NOT define
|
||||||
|
`RLGL_IMPLEMENTATION`: Homebrew headers omit the `external/glad.h` needed to
|
||||||
|
compile desktop rlgl locally. Swift imports `RaylibBridge`. `RAYLIB_PREFIX`
|
||||||
|
defaults to `/opt/homebrew`; build scripts detect `brew --prefix raylib`.
|
||||||
|
The installed raylib may produce a deployment-target linker warning.
|
||||||
|
|
||||||
util/ Build/run scripts (see Build & Run)
|
On iOS, UIKit owns the view/layer and `RenderGLView.st` owns an `EGLState`.
|
||||||
paths APP_MAC = .build/OGS Mahjong.app
|
Swift effects create EGL/ANGLE state and surface, make the context current,
|
||||||
build-mac generateDialect -> buildMac -> packageMac
|
and initialize raylib. Timer ticks call rendering directly; presentation uses
|
||||||
run-mac runMac
|
`eglSwapBuffers`. Pixel sizes come from view bounds and content scale.
|
||||||
rm-mac-geom Resets saved window geometry
|
Dialect's resize event triggers `renderRecreateSurface`; the macOS helper is
|
||||||
step/ Sourced steps: generateDialect, buildMac,
|
intentionally a no-op. Teardown must stop the timer, activate the context,
|
||||||
packageMac, runMac
|
release rlgl resources, then destroy EGL surface/context/display resources.
|
||||||
|
|
||||||
history/gitjs/ GitJS "Glavred" history + the original JS source of the
|
Blue iOS uses `src/BlueBridgingHeader.h` to expose C APIs to Swift. `Blue.c`
|
||||||
web Mahjong, kept for reference — not part of the build.
|
compiles EGL helpers and rlgl using their implementation macros exactly once.
|
||||||
|
It uses the raylib-iOS XCFramework headers but does not link its full raylib
|
||||||
|
library. The app links/embeds `libEGL` and `libGLESv2` (ANGLE's Metal backend).
|
||||||
|
The XcodeGen settings define `PLATFORM_IOS`, `GRAPHICS_API_OPENGL_ES3`, and
|
||||||
|
`GL_GLEXT_PROTOTYPES`. Minimum iOS is 15.0; portrait and both landscape
|
||||||
|
orientations are enabled in Blue's Info.plist.
|
||||||
|
|
||||||
|
## Build and prerequisites
|
||||||
|
|
||||||
|
- macOS: `brew install raylib`.
|
||||||
|
- iOS project generation: `brew install xcodegen`; supply sibling
|
||||||
|
`../raylib-ios-xcframeworks` containing raylib/libEGL/libGLESv2 XCFrameworks.
|
||||||
|
`checkRaylibIOS` checks presence; it does not download them.
|
||||||
|
- Dialect: sibling `../dialect`, built with `(cd ../dialect && util/build-generator)`.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
util/build-ogs-blue-mac
|
||||||
|
util/run-ogs-blue-mac
|
||||||
|
util/prepare-ogs-blue-ios
|
||||||
```
|
```
|
||||||
|
|
||||||
## Symlink parity rule
|
The corresponding macOS build/run scripts also exist for `ogs-chkgfx` and
|
||||||
|
`ogs-mahjong`; `prepare-ogs-chkgfx-ios` exists as well. Inspect their individual
|
||||||
|
configuration before assuming parity with Blue.
|
||||||
|
|
||||||
`components/` is the source of truth; `game/ver-mac/src/` contains real
|
macOS build scripts generate Dialect, run `swift build`, and package resources
|
||||||
directories whose files are **relative symlinks** back into `components/`:
|
from `ver-mac/res/` into `ver-mac/.build/<App Name>.app`. iOS preparation checks
|
||||||
|
XCFrameworks, generates Dialect, stages ANGLE include/library symlinks in
|
||||||
|
`ver-ios/.build/`, then runs XcodeGen. Build Blue for Simulator with:
|
||||||
|
|
||||||
```
|
```sh
|
||||||
src/other/other.swift -> ../../../../components/other/other.swift (4 up)
|
xcodebuild -project 'ogs-blue/ver-ios/OGS blue.xcodeproj' -scheme ogs-blue \
|
||||||
src/raybri/raybri.c -> ../../../../components/raybri/raybri.c (4 up)
|
-sdk iphonesimulator -destination 'generic/platform=iOS Simulator' \
|
||||||
src/raybri/raybri.h -> ../../../../components/raybri/raybri.h (4 up)
|
CODE_SIGNING_ALLOWED=NO build
|
||||||
src/render/render.swift -> ../../../../components/render/render.swift (4 up)
|
|
||||||
src/render/renderAux.swift -> ../../../../components/render/renderAux.swift (4 up)
|
|
||||||
src/render/renderConst.swift-> ../../../../components/render/renderConst.swift (4 up)
|
|
||||||
src/render/renderConstShader.swift -> ../../../../components/render/renderConstShader.swift (4 up)
|
|
||||||
src/render/renderEffect.swift -> ../../../../components/render/renderEffect.swift (4 up)
|
|
||||||
src/render/renderVM.swift -> ../../../../components/render/renderVM.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/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
|
Audit dangling source symlinks after moves (SPM can silently skip them):
|
||||||
`components/` or a subdir, audit for broken links:
|
|
||||||
|
|
||||||
```bash
|
```sh
|
||||||
find . -type l ! -exec test -e {} \; -not -path './.build/*'
|
find components ogs-blue ogs-chkgfx ogs-mahjong -type l ! -exec test -e {} \; -not -path '*/.build/*'
|
||||||
```
|
```
|
||||||
|
|
||||||
## Prerequisite: the generator
|
|
||||||
|
|
||||||
`util/step/generateDialect` calls the **sibling** dialect repo:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$SDIR/../../dialect/util/run-generator --file=$SDIR/../dialect.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
So `/Volumes/MOE/p/dialect` must exist and its generator must be built before
|
|
||||||
`util/build-mac` can regenerate:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
(cd ../dialect && util/build-generator) # once, or after dialect core changes
|
|
||||||
```
|
|
||||||
|
|
||||||
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 `RenderView` (backed by `RenderGLView`)
|
|
||||||
behind the SwiftUI UI in a `ZStack`. A textured cube is drawn from `Resources/assets` (`cube.gltf` +
|
|
||||||
`cube_texture.png` + `cube_normal.png`); the app rotates it each frame via `raybri_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.
|
|
||||||
|
|
||||||
Shaders and render constants live in **Swift**, not in C: GLSL sources are
|
|
||||||
`RENDER_SHADER_*` in `components/render/renderConstShader.swift`, and
|
|
||||||
`RENDER_CONFIG` / `raybri_config` tunables are in `renderConst.swift`. `raybri_init`
|
|
||||||
compiles the shaders in place (no storage/`strdup`). `cube_normal.png` drives
|
|
||||||
tangentless normal mapping via the derivative-based `cotangentFrame`. The
|
|
||||||
context is OpenGL 3.2 Core (`RENDER_OPENGL_ATTRS`); on Apple Silicon the driver
|
|
||||||
still reports 4.1/GLSL 4.10.
|
|
||||||
|
|
||||||
## Render architecture
|
|
||||||
|
|
||||||
The `Render` dialect context owns the GL scene. `RenderGLView` is a thin
|
|
||||||
`NSOpenGLView`; it only translates AppKit callbacks into dialect fields, and the
|
|
||||||
`render*` files do the actual work.
|
|
||||||
|
|
||||||
1. `AppDelegate` creates `RenderComponent` + `RenderVM` and calls
|
|
||||||
`render.setup()` -> `didSetup` -> `didLaunch` (should) -> `pixelSize = [1, 1]`.
|
|
||||||
2. SwiftUI builds `RenderView` -> `RenderGLView`; `prepareOpenGL()` sets
|
|
||||||
`F.didPrepareGL`. Its oneliners run `renderInit` (`raybri_init`), set
|
|
||||||
`RenderVM.didPrepareGL = true`, and `renderStartTimer`.
|
|
||||||
3. `reshape()` / `viewDidChangeBackingProperties()` compute the backing pixel
|
|
||||||
size via `renderPixelSize` and set `F.reshapePixelSize` /
|
|
||||||
`F.backingPixelSize`. The `pixelSize` shoulds fold these into `F.pixelSize`,
|
|
||||||
whose oneliner stores `RenderVM.pixelSize`.
|
|
||||||
4. The timer only sets `needsDisplay` every `1 / RENDER_FPS`. `draw(_:)` forwards
|
|
||||||
to `renderDraw` (make context current, `raybri_resize`, `raybri_set_rotation`,
|
|
||||||
`raybri_render`, `flushBuffer`).
|
|
||||||
5. A button click runs `rootSet(F.didClickIncrement)` -> RootComponent oneliner
|
|
||||||
`renderSet(F.didClickIncrement)` -> `renderLoadCubeModel` (the cube is loaded
|
|
||||||
on demand, not at startup).
|
|
||||||
6. `RenderGLView.deinit` sets `F.willDeinit` -> `renderDeinit` (stop timer,
|
|
||||||
`raybri_shutdown`).
|
|
||||||
|
|
||||||
**GL context rule**: every raylib call must run with the view's context current.
|
|
||||||
`renderInit`, `renderLoadCubeModel`, `renderDeinit` and `renderDraw` all call
|
|
||||||
`openGLContext?.makeCurrentContext()` first. Loading a model/texture without it
|
|
||||||
fails silently with `WARNING: TEXTURE: Failed to load texture`.
|
|
||||||
|
|
||||||
## Build & Run
|
|
||||||
|
|
||||||
```bash
|
|
||||||
util/build-mac # generateDialect + swift build + package OGS Mahjong.app
|
|
||||||
util/run-mac # runs .build/OGS Mahjong.app/Contents/MacOS/ogs-mahjong
|
|
||||||
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` — `brew --prefix raylib` -> `RAYLIB_PREFIX`, `swift build`
|
|
||||||
3. `packageMac` — assembles `.build/OGS Mahjong.app` (binary `ogs-mahjong`,
|
|
||||||
`Info.plist`, `Resources/AppIcon.icns`, `Resources/assets/`)
|
|
||||||
|
|
||||||
## Editing the dialect
|
## Editing the dialect
|
||||||
|
|
||||||
- Add/modify contexts and components in `dialect.yml`, then run
|
- Add/modify contexts and components in `<app>/dialect.yml`, then run
|
||||||
`util/build-mac` to regenerate `dialect.swift`.
|
`util/build-<app>-mac` to regenerate `dialect.swift`.
|
||||||
- **Chicken-egg**: `struct F` (field-name constants) lives only in the
|
- **Chicken-egg**: `struct F` (field-name constants) lives only in the
|
||||||
generated `dialect.swift`. Adding a new field to a context in `dialect.yml`
|
generated `dialect.swift`. Adding a new field to a context in `<app>/dialect.yml`
|
||||||
requires hand-patching its `static let <field> = "<field>"` into `struct F`
|
requires hand-patching its `static let <field> = "<field>"` into `struct F`
|
||||||
in `dialect.swift` (ASCII-alphabetical order) if you cannot regenerate first,
|
in `dialect.swift` (ASCII-alphabetical order) if you cannot regenerate first,
|
||||||
otherwise the build fails on `F.<field>` being unresolved.
|
otherwise the build fails on `F.<field>` being unresolved.
|
||||||
- `dialect.swift` is generated — edits there are overwritten on the next
|
- `dialect.swift` is generated — edits there are overwritten on the next
|
||||||
`util/build-mac`. Change the source (`dialect.yml` / `components/`) instead.
|
`util/build-<app>-mac`. Change the source (`<app>/dialect.yml` / `components/`) instead.
|
||||||
- **Validate `dialect.yml` after edits** (e.g. `ruby -ryaml -e 'YAML.load_file("dialect.yml")'`).
|
- **Validate `<app>/dialect.yml` after edits** (e.g. `ruby -ryaml -e 'YAML.load_file("ogs-blue/dialect.yml")'`).
|
||||||
Every should-branch label (`1. Upon each ...`) MUST end with a colon — the
|
Every should-branch label (`1. Upon each ...`) MUST end with a colon — the
|
||||||
parser (`components/yml/ymlFun.swift`) blindly `dropLast()`s it, so a missing
|
parser (`components/yml/ymlFun.swift`) blindly `dropLast()`s it, so a missing
|
||||||
colon silently eats the label's last character in the generated `about`
|
colon silently eats the label's last character in the generated `about`
|
||||||
@@ -235,6 +137,22 @@ Do not flip it on without addressing those.
|
|||||||
|
|
||||||
## Conventions
|
## Conventions
|
||||||
|
|
||||||
|
- When generating or mirroring Swift/iOS code into Android, stay as close to
|
||||||
|
the Swift original as possible: preserve naming, capitalization, visible text,
|
||||||
|
layout, styling, behavior and structure. Use the closest platform equivalent
|
||||||
|
where a direct translation is unavailable; avoid unrelated redesigns or
|
||||||
|
Android-specific changes unless requested. In particular, use `OGS blue`
|
||||||
|
(not `OGS Blue`) for the Android project name and app labels, matching iOS.
|
||||||
|
|
||||||
|
- Android Compose typography: prefer named `MaterialTheme.typography` styles
|
||||||
|
over explicit numeric `fontSize` values. Use `headlineLarge` for Blue's title
|
||||||
|
as the counterpart to SwiftUI's `.largeTitle`, on both overlaid text layers.
|
||||||
|
|
||||||
|
- Android Kotlin imports: use wildcard imports (`package.*`) when importing
|
||||||
|
multiple declarations from the same package, including newly generated imports.
|
||||||
|
Keep single imports and aliases explicit where needed to avoid name conflicts.
|
||||||
|
Wildcards do not include subpackages; import those separately.
|
||||||
|
|
||||||
- `game/ver-mac/.build/`, `build/`, `.DS_Store`, Xcode/Gradle artifacts are
|
- `game/ver-mac/.build/`, `build/`, `.DS_Store`, Xcode/Gradle artifacts are
|
||||||
git-ignored.
|
git-ignored.
|
||||||
- Prefer editing files in `components/` (the real files); the `src/` entries are
|
- Prefer editing files in `components/` (the real files); the `src/` entries are
|
||||||
@@ -246,17 +164,13 @@ Do not flip it on without addressing those.
|
|||||||
- Never call raylib / `raybri_*` without making the view's GL context current first
|
- Never call raylib / `raybri_*` without making the view's GL context current first
|
||||||
(see the GL context rule above).
|
(see the GL context rule above).
|
||||||
|
|
||||||
## Skill: source-file study documents
|
## Source study documents
|
||||||
|
|
||||||
When the task is to produce a source-code study document — a self-contained,
|
|
||||||
downloadable HTML file with a line-by-line table of the file and its
|
|
||||||
explanations (and, on request, a second version highlighting changes after a
|
|
||||||
fix) — follow the skill in `docs/file-summary.md`.
|
|
||||||
|
|
||||||
- Write the result to `docs/<FileName>.html` (e.g. `docs/RaylibGLView.html`) and
|
|
||||||
name the file's Git revision in the header. The file is the source of truth —
|
|
||||||
document the exact revision requested, not the working tree.
|
|
||||||
- Existing example: `docs/RaylibGLView.html` — documents the historical
|
|
||||||
single-cube `RaylibGLView.swift`, since split into `RenderGLView.swift` plus
|
|
||||||
the `render*` files.
|
|
||||||
|
|
||||||
|
- Single-file source studies: follow [docs/file-summary.md](docs/file-summary.md).
|
||||||
|
- Mirrored platform studies: follow [docs/mirror-summary.md](docs/mirror-summary.md).
|
||||||
|
Produce one self-contained downloadable HTML with aligned function starts,
|
||||||
|
original line numbers, green/orange number fills, counts/percentages and a
|
||||||
|
non-repetitive explanation column.
|
||||||
|
- Existing mirrored example: `docs/render-platform-comparison.html`, documenting
|
||||||
|
the revision named in its header. Never silently substitute working-tree code
|
||||||
|
for a requested historical revision.
|
||||||
@@ -1,9 +1,17 @@
|
|||||||
|
## Targets
|
||||||
|
|
||||||
|
| № | Target | macOS | iOS/iPadOS | Android |
|
||||||
|
| 1 | ogs-blue | √ | √ | ? |
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
* macOS
|
### macOS
|
||||||
|
|
||||||
`brew install raylib`
|
* `brew install raylib`
|
||||||
|
|
||||||
* iOS
|
### iOS
|
||||||
|
|
||||||
`brew install xcodegen`
|
* `brew install xcodegen`
|
||||||
|
* ghera's [raylib-ios-xcframeworks][rzip] release unpacked and placed alongside the project
|
||||||
|
|
||||||
|
[rzip]: https://github.com/ghera/raylib-iOS/releases/download/6.2.0-iOS/raylib-ios-xcframeworks-6.2.0-iOS.zip
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package org.opengamestudio
|
||||||
|
|
||||||
|
object BlueComponent {
|
||||||
|
val ctrl = DialectController(BlueContext())
|
||||||
|
|
||||||
|
init {
|
||||||
|
blueRegisterEffects(ctrl)
|
||||||
|
blueRegisterShoulds(ctrl)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setup() {
|
||||||
|
blueSet(F.didSetup, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package org.opengamestudio
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.*
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun BlueView() {
|
||||||
|
Column(
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.spacedBy(16.dp),
|
||||||
|
modifier = Modifier.padding(40.dp)
|
||||||
|
) {
|
||||||
|
Box(contentAlignment = Alignment.Center) {
|
||||||
|
Text(
|
||||||
|
text = "Blue",
|
||||||
|
style = MaterialTheme.typography.headlineLarge,
|
||||||
|
color = Color.White,
|
||||||
|
modifier = Modifier.offset(x = 1.dp, y = 1.dp)
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = "Blue",
|
||||||
|
style = MaterialTheme.typography.headlineLarge,
|
||||||
|
color = Color.Black
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
#ifndef EGL_H
|
||||||
|
#define EGL_H
|
||||||
|
|
||||||
|
#include "eglConst.h"
|
||||||
|
#include <libEGL/libEGL.h>
|
||||||
|
#include <libGLESv2/GLES/gl.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
typedef struct EGLState {
|
||||||
|
void *caLayer;
|
||||||
|
EGLConfig cfg;
|
||||||
|
EGLContext ctx;
|
||||||
|
EGLDisplay display;
|
||||||
|
EGLSurface surface;
|
||||||
|
} EGLState;
|
||||||
|
|
||||||
|
bool eglInit(EGLState *st);
|
||||||
|
bool eglMakeCurrentContext(EGLState *st);
|
||||||
|
bool eglResetSurface(EGLState *st);
|
||||||
|
|
||||||
|
// Source
|
||||||
|
|
||||||
|
#if defined(EGL_IMPLEMENTATION)
|
||||||
|
|
||||||
|
bool eglInit(EGLState *st) {
|
||||||
|
st->display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||||
|
if (st->display == EGL_NO_DISPLAY) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eglInitialize(st->display, NULL, NULL) == EGL_FALSE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eglBindAPI(EGL_OPENGL_ES_API) == EGL_FALSE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
EGLint cfgCount = 0;
|
||||||
|
if (
|
||||||
|
eglChooseConfig(st->display, EGL_CFG, &st->cfg, 1, &cfgCount) == EGL_FALSE ||
|
||||||
|
cfgCount < 1
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
st->ctx = eglCreateContext(st->display, st->cfg, EGL_NO_CONTEXT, EGL_CTX);
|
||||||
|
if (st->ctx == EGL_NO_CONTEXT) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool eglMakeCurrentContext(EGLState *st) {
|
||||||
|
if (eglMakeCurrent(st->display, st->surface, st->surface, st->ctx) == EGL_FALSE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool eglResetSurface(EGLState *st) {
|
||||||
|
// Destroy previous surface
|
||||||
|
if (st->surface != EGL_NO_SURFACE) {
|
||||||
|
eglDestroySurface(st->display, st->surface);
|
||||||
|
st->surface = EGL_NO_SURFACE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create new surface
|
||||||
|
// ANGLE on iOS takes a CALayer as the native window
|
||||||
|
st->surface = eglCreateWindowSurface(
|
||||||
|
st->display,
|
||||||
|
st->cfg,
|
||||||
|
(EGLNativeWindowType)st->caLayer,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
if (st->surface == EGL_NO_SURFACE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // EGL_IMPLEMENTATION
|
||||||
|
|
||||||
|
#endif // EGL_H
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
#ifndef EGL_CONST_H
|
||||||
|
#define EGL_CONST_H
|
||||||
|
|
||||||
|
#include <libEGL/libEGL.h>
|
||||||
|
|
||||||
|
// Header
|
||||||
|
|
||||||
|
extern const EGLint EGL_CFG[];
|
||||||
|
extern const EGLint EGL_CTX[];
|
||||||
|
|
||||||
|
// Source
|
||||||
|
|
||||||
|
#if defined(EGL_CONST_IMPLEMENTATION)
|
||||||
|
|
||||||
|
const EGLint EGL_CFG[] = {
|
||||||
|
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT,
|
||||||
|
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||||
|
EGL_RED_SIZE, 8,
|
||||||
|
EGL_GREEN_SIZE, 8,
|
||||||
|
EGL_BLUE_SIZE, 8,
|
||||||
|
EGL_ALPHA_SIZE, 8,
|
||||||
|
EGL_DEPTH_SIZE, 16,
|
||||||
|
EGL_NONE
|
||||||
|
};
|
||||||
|
|
||||||
|
const EGLint EGL_CTX[] = {
|
||||||
|
EGL_CONTEXT_CLIENT_VERSION, 3,
|
||||||
|
EGL_NONE
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // EGL_CONST_IMPLEMENTATION
|
||||||
|
|
||||||
|
#endif // EGL_CONST_H
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.opengamestudio
|
||||||
|
|
||||||
|
fun otherPrintStderr(txt: String) {
|
||||||
|
System.err.println(txt)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun otherSetupConsoleLogging(
|
||||||
|
ctrl: DialectController,
|
||||||
|
prefix: String
|
||||||
|
) {
|
||||||
|
ctrl.registerCallback { c ->
|
||||||
|
val value = c.fieldAny(c.recentField)
|
||||||
|
val line = "ИГР $prefix k/v: '${c.recentField}'/'$value'"
|
||||||
|
otherPrintStderr(line)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,18 @@
|
|||||||
|
#ifndef RAYBRI_AUX_H
|
||||||
|
#define RAYBRI_AUX_H
|
||||||
|
|
||||||
|
// Header
|
||||||
|
|
||||||
|
void *raybriGLLoader(const char *name);
|
||||||
|
void raybriLoadExtensions(void);
|
||||||
|
|
||||||
|
// Source
|
||||||
|
|
||||||
|
#if defined(RAYBRI_AUX_IMPLEMENTATION)
|
||||||
|
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include "raybriAux.h"
|
|
||||||
#include "raybriConst.h"
|
#include "raybriConst.h"
|
||||||
|
#include "rlgl.h"
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
// raylib is built as a static/dynamic library with GLFW baked in, but we never
|
// raylib is built as a static/dynamic library with GLFW baked in, but we never
|
||||||
@@ -19,3 +31,11 @@ void *raybriGLLoader(const char *name) {
|
|||||||
|
|
||||||
return dlsym(handle, name);
|
return dlsym(handle, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void raybriLoadExtensions(void) {
|
||||||
|
rlLoadExtensions(raybriGLLoader);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // RAYBRI_AUX_IMPLEMENTATION
|
||||||
|
|
||||||
|
#endif // RAYBRI_AUX_H
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
#include "raybri.h"
|
|
||||||
#include "raybriAux.h"
|
|
||||||
#include "rlgl.h"
|
|
||||||
|
|
||||||
void raybriInit(void) {
|
|
||||||
//SetTraceLogLevel(LOG_WARNING);
|
|
||||||
|
|
||||||
// Load OpenGL extensions
|
|
||||||
rlLoadExtensions((void *)raybriGLLoader);
|
|
||||||
// Initialize raylib graphics layer with a placeholder 1x1 framebuffer size
|
|
||||||
// Graphics layer includes default texture, shader, render batch and OpenGL state
|
|
||||||
rlglInit(1, 1);
|
|
||||||
// Background is painted in blue
|
|
||||||
rlClearColor(0, 0, 255, 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
void raybriRender(int width, int height) {
|
|
||||||
// Set the drawing area to the current pixel size
|
|
||||||
rlViewport(0, 0, width, height);
|
|
||||||
// Clear color and depth buffers for the next frame
|
|
||||||
rlClearScreenBuffers();
|
|
||||||
// Draw any queued geometry
|
|
||||||
rlDrawRenderBatchActive();
|
|
||||||
}
|
|
||||||
|
|
||||||
void raybriShutdown(void) {
|
|
||||||
// Release rlgl buffers, shaders and textures
|
|
||||||
rlglClose();
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,42 @@
|
|||||||
#ifndef RAYBRI_H
|
#ifndef RAYBRI_H
|
||||||
#define RAYBRI_H
|
#define RAYBRI_H
|
||||||
|
|
||||||
|
// Header
|
||||||
|
|
||||||
void raybriInit(void);
|
void raybriInit(void);
|
||||||
void raybriRender(int width, int height);
|
void raybriRender(int width, int height);
|
||||||
void raybriShutdown(void);
|
void raybriShutdown(void);
|
||||||
|
|
||||||
|
// Source
|
||||||
|
|
||||||
|
#if defined(RAYBRI_IMPLEMENTATION)
|
||||||
|
|
||||||
|
#include "rlgl.h"
|
||||||
|
|
||||||
|
void raybriInit(void) {
|
||||||
|
//SetTraceLogLevel(LOG_WARNING);
|
||||||
|
|
||||||
|
// Initialize raylib graphics layer with a placeholder 1x1 framebuffer size
|
||||||
|
// Graphics layer includes default texture, shader, render batch and OpenGL state
|
||||||
|
rlglInit(1, 1);
|
||||||
|
// Background is painted in blue
|
||||||
|
rlClearColor(0, 0, 255, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
void raybriRender(int width, int height) {
|
||||||
|
// Set the drawing area to the current pixel size
|
||||||
|
rlViewport(0, 0, width, height);
|
||||||
|
// Clear color and depth buffers for the next frame
|
||||||
|
rlClearScreenBuffers();
|
||||||
|
// Draw any queued geometry
|
||||||
|
rlDrawRenderBatchActive();
|
||||||
|
}
|
||||||
|
|
||||||
|
void raybriShutdown(void) {
|
||||||
|
// Release rlgl buffers, shaders and textures
|
||||||
|
rlglClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // RAYBRI_IMPLEMENTATION
|
||||||
|
|
||||||
#endif // RAYBRI_H
|
#endif // RAYBRI_H
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#ifndef RAYBRI_AUX_H
|
|
||||||
#define RAYBRI_AUX_H
|
|
||||||
|
|
||||||
void *raybriGLLoader(const char *name);
|
|
||||||
|
|
||||||
#endif // RAYBRI_AUX_H
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#include "raybriConst.h"
|
|
||||||
|
|
||||||
const char RAYBRI_MAC_GL[] = "/System/Library/Frameworks/OpenGL.framework/OpenGL";
|
|
||||||
@@ -1,6 +1,16 @@
|
|||||||
#ifndef RAYBRI_CONST_H
|
#ifndef RAYBRI_CONST_H
|
||||||
#define RAYBRI_CONST_H
|
#define RAYBRI_CONST_H
|
||||||
|
|
||||||
|
// Header
|
||||||
|
|
||||||
extern const char RAYBRI_MAC_GL[];
|
extern const char RAYBRI_MAC_GL[];
|
||||||
|
|
||||||
|
// Source
|
||||||
|
|
||||||
|
#if defined(RAYBRI_CONST_IMPLEMENTATION)
|
||||||
|
|
||||||
|
const char RAYBRI_MAC_GL[] = "/System/Library/Frameworks/OpenGL.framework/OpenGL";
|
||||||
|
|
||||||
|
#endif // RAYBRI_CONST_IMPLEMENTATION
|
||||||
|
|
||||||
#endif // RAYBRI_CONST_H
|
#endif // RAYBRI_CONST_H
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import UIKit
|
||||||
|
|
||||||
|
func renderDraw(_ vm: RenderVM) {
|
||||||
|
guard eglMakeCurrentContext(&vm.glView.st) else { return }
|
||||||
|
raybriRender(vm.pixelSize[0], vm.pixelSize[1])
|
||||||
|
eglSwapBuffers(vm.glView.st.display, vm.glView.st.surface)
|
||||||
|
}
|
||||||
|
|
||||||
|
func renderPixelSize(_ view: UIView) -> [Int32] {
|
||||||
|
let scale = view.contentScaleFactor
|
||||||
|
let w = Int32(max(1, (view.bounds.width * scale).rounded()))
|
||||||
|
let h = Int32(max(1, (view.bounds.height * scale).rounded()))
|
||||||
|
return [w, h]
|
||||||
|
}
|
||||||
|
|
||||||
|
func renderRecreateSurface(_ vm: RenderVM) {
|
||||||
|
eglResetSurface(&vm.glView.st)
|
||||||
|
eglMakeCurrentContext(&vm.glView.st)
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import Foundation
|
||||||
|
import QuartzCore
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
func renderDeinit(_ vm: RenderVM) {
|
||||||
|
vm.timer?.invalidate()
|
||||||
|
vm.timer = nil
|
||||||
|
eglMakeCurrentContext(&vm.glView.st)
|
||||||
|
raybriShutdown()
|
||||||
|
|
||||||
|
eglMakeCurrent(vm.glView.st.display, nil, nil, nil)
|
||||||
|
eglDestroySurface(vm.glView.st.display, vm.glView.st.surface)
|
||||||
|
eglDestroyContext(vm.glView.st.display, vm.glView.st.ctx)
|
||||||
|
eglTerminate(vm.glView.st.display)
|
||||||
|
}
|
||||||
|
|
||||||
|
func renderInit(_ vm: RenderVM) {
|
||||||
|
// On iOS EGL/ANGLE renders into the UIView's layer
|
||||||
|
let layer = Unmanaged.passUnretained(vm.glView.layer).toOpaque()
|
||||||
|
vm.glView.st.caLayer = layer
|
||||||
|
|
||||||
|
guard eglInit(&vm.glView.st) else { fatalError("ERROR Could not initialize EGL") }
|
||||||
|
guard eglResetSurface(&vm.glView.st) else { fatalError("ERROR Could not reset EGL surface") }
|
||||||
|
guard eglMakeCurrentContext(&vm.glView.st) else { fatalError("ERROR Could not make EGL context current") }
|
||||||
|
|
||||||
|
raybriInit()
|
||||||
|
}
|
||||||
|
|
||||||
|
func renderStartTimer(_ vm: RenderVM) {
|
||||||
|
// Make a time mark for calculating time delta
|
||||||
|
vm.startTime = CACurrentMediaTime()
|
||||||
|
|
||||||
|
// The frame is presented by eglSwapBuffers into the view's layer, not by
|
||||||
|
// CoreGraphics, so the timer drives the rendering itself instead of
|
||||||
|
// invalidating the view for a draw(_:) pass the way macOS does
|
||||||
|
let timer = Timer(timeInterval: 1.0 / RENDER_FPS, repeats: true) { [weak vm] _ in
|
||||||
|
guard let vm else { return }
|
||||||
|
renderDraw(vm)
|
||||||
|
}
|
||||||
|
vm.timer = timer
|
||||||
|
// .common means holding buttons in UI does not pause this rendering timer
|
||||||
|
RunLoop.main.add(timer, forMode: .common)
|
||||||
|
}
|
||||||
@@ -1,11 +1,35 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
final class RenderGLView: UIView {
|
final class RenderGLView: UIView {
|
||||||
|
var st = EGLState()
|
||||||
|
|
||||||
override init(frame: CGRect) {
|
override init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
|
isOpaque = true
|
||||||
|
isUserInteractionEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
required init?(coder: NSCoder) {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deinit {
|
||||||
|
renderSet(F.willDeinit, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
override func didMoveToWindow() {
|
||||||
|
super.didMoveToWindow()
|
||||||
|
guard let window else { return }
|
||||||
|
contentScaleFactor = window.screen.nativeScale
|
||||||
|
layer.contentsScale = contentScaleFactor
|
||||||
|
|
||||||
|
renderSet(F.didPrepareIOSGL, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
override func layoutSubviews() {
|
||||||
|
super.layoutSubviews()
|
||||||
|
let ps = renderPixelSize(self)
|
||||||
|
renderSet(F.reshapePixelSize, ps)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import SwiftUI
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
struct RenderView: UIViewRepresentable {
|
||||||
|
func makeUIView(context: Context) -> RenderGLView {
|
||||||
|
RenderVM.shared!.glView
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateUIView(_ uiView: RenderGLView, context: Context) {}
|
||||||
|
}
|
||||||
@@ -13,3 +13,7 @@ func renderPixelSize(_ view: NSView) -> [Int32] {
|
|||||||
let h = Int32(max(1, backing.height))
|
let h = Int32(max(1, backing.height))
|
||||||
return [w, h]
|
return [w, h]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func renderRecreateSurface(_ vm: RenderVM) {
|
||||||
|
// No-op on macOS
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import AppKit
|
||||||
|
|
||||||
|
let RENDER_OPENGL_ATTRS: [NSOpenGLPixelFormatAttribute] = [
|
||||||
|
UInt32(NSOpenGLPFAOpenGLProfile), UInt32(NSOpenGLProfileVersion3_2Core),
|
||||||
|
UInt32(NSOpenGLPFAColorSize), 24,
|
||||||
|
UInt32(NSOpenGLPFAAlphaSize), 8,
|
||||||
|
UInt32(NSOpenGLPFADepthSize), 24,
|
||||||
|
UInt32(NSOpenGLPFADoubleBuffer),
|
||||||
|
UInt32(NSOpenGLPFAAccelerated),
|
||||||
|
0
|
||||||
|
]
|
||||||
@@ -3,8 +3,8 @@ import RaylibBridge
|
|||||||
import QuartzCore
|
import QuartzCore
|
||||||
|
|
||||||
func renderDeinit(_ vm: RenderVM) {
|
func renderDeinit(_ vm: RenderVM) {
|
||||||
print("ИГР renderD")
|
|
||||||
vm.timer?.invalidate()
|
vm.timer?.invalidate()
|
||||||
|
vm.timer = nil
|
||||||
vm.glView.openGLContext?.makeCurrentContext()
|
vm.glView.openGLContext?.makeCurrentContext()
|
||||||
raybriShutdown()
|
raybriShutdown()
|
||||||
}
|
}
|
||||||
@@ -16,6 +16,7 @@ func renderInit(_ vm: RenderVM) {
|
|||||||
var swapInterval: Int32 = 1
|
var swapInterval: Int32 = 1
|
||||||
vm.glView.openGLContext?.setValues(&swapInterval, for: .swapInterval)
|
vm.glView.openGLContext?.setValues(&swapInterval, for: .swapInterval)
|
||||||
|
|
||||||
|
raybriLoadExtensions()
|
||||||
raybriInit()
|
raybriInit()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15,9 +15,20 @@ final class RenderGLView: NSOpenGLView {
|
|||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deinit {
|
||||||
|
renderSet(F.willDeinit, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
override func draw(_ dirtyRect: NSRect) {
|
||||||
|
let vm = RenderVM.shared!
|
||||||
|
if vm.didPrepareGL {
|
||||||
|
renderDraw(vm)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override func prepareOpenGL() {
|
override func prepareOpenGL() {
|
||||||
super.prepareOpenGL()
|
super.prepareOpenGL()
|
||||||
renderSet(F.didPrepareGL, true)
|
renderSet(F.didPrepareMacGL, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func reshape() {
|
override func reshape() {
|
||||||
@@ -33,15 +44,4 @@ final class RenderGLView: NSOpenGLView {
|
|||||||
let ps = renderPixelSize(self)
|
let ps = renderPixelSize(self)
|
||||||
renderSet(F.backingPixelSize, ps)
|
renderSet(F.backingPixelSize, ps)
|
||||||
}
|
}
|
||||||
|
|
||||||
override func draw(_ dirtyRect: NSRect) {
|
|
||||||
let vm = RenderVM.shared!
|
|
||||||
if vm.didPrepareGL {
|
|
||||||
renderDraw(vm)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
deinit {
|
|
||||||
renderSet(F.willDeinit, true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
import AppKit
|
import AppKit
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
/// Render view for SwiftUI
|
|
||||||
struct RenderView: NSViewRepresentable {
|
struct RenderView: NSViewRepresentable {
|
||||||
func makeNSView(context: Context) -> RenderGLView {
|
func makeNSView(context: Context) -> RenderGLView {
|
||||||
RenderVM.shared!.glView
|
RenderVM.shared!.glView
|
||||||
|
|||||||
@@ -1,15 +1,2 @@
|
|||||||
import AppKit
|
|
||||||
|
|
||||||
let RENDER_FPS = 60.0
|
let RENDER_FPS = 60.0
|
||||||
|
|
||||||
let RENDER_MODEL_CUBE = "/cube/cube.gltf"
|
let RENDER_MODEL_CUBE = "/cube/cube.gltf"
|
||||||
|
|
||||||
let RENDER_OPENGL_ATTRS: [NSOpenGLPixelFormatAttribute] = [
|
|
||||||
UInt32(NSOpenGLPFAOpenGLProfile), UInt32(NSOpenGLProfileVersion3_2Core),
|
|
||||||
UInt32(NSOpenGLPFAColorSize), 24,
|
|
||||||
UInt32(NSOpenGLPFAAlphaSize), 8,
|
|
||||||
UInt32(NSOpenGLPFADepthSize), 24,
|
|
||||||
UInt32(NSOpenGLPFADoubleBuffer),
|
|
||||||
UInt32(NSOpenGLPFAAccelerated),
|
|
||||||
0
|
|
||||||
]
|
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
# Mirrored source-file study documents
|
||||||
|
|
||||||
|
Use this workflow when comparing corresponding source files across platforms.
|
||||||
|
The established example is `docs/render-platform-comparison.html`.
|
||||||
|
For a single-file study, follow `docs/file-summary.md` instead.
|
||||||
|
|
||||||
|
## Source and scope
|
||||||
|
|
||||||
|
- Read sources from the exact requested Git revision with `git show REV:path`.
|
||||||
|
If no revision is specified, use HEAD and record its full commit hash.
|
||||||
|
- Discover matching relative filenames beneath the two platform directories.
|
||||||
|
State which platform-only files are excluded; never invent a counterpart.
|
||||||
|
- Produce one downloadable, self-contained HTML document in `docs/`, with
|
||||||
|
navigation links and one section per file pair. Preserve earlier documents
|
||||||
|
unless removal is requested.
|
||||||
|
- Record both source paths and the source revision. Preserve every source line,
|
||||||
|
original line number, indentation and blank line. Escape HTML characters.
|
||||||
|
|
||||||
|
## Comparison layout
|
||||||
|
|
||||||
|
- Use one table per pair with three columns: first platform's numbered source,
|
||||||
|
second platform's numbered source, and explanation. Do not create separate
|
||||||
|
line-by-line explanation tables or a Status column.
|
||||||
|
- Align corresponding function starts where possible. Insert missing-line
|
||||||
|
placeholders to keep later functions aligned; preserve source order and
|
||||||
|
original numbers. For example, macOS renderEffect line 12 aligns with iOS
|
||||||
|
line 16 at revision f0972f0d5ba796e3fa417081f43c00a9654b2aa6.
|
||||||
|
- Within each function or intervening block, align lines sequentially unless
|
||||||
|
better semantic alignment is needed. Equal line numbers need not share a row
|
||||||
|
when function alignment requires padding.
|
||||||
|
- Compare the exact source text in each aligned row, including whitespace.
|
||||||
|
Fill BOTH line-number backgrounds green when they match. Fill numbers orange
|
||||||
|
when they differ. A missing line is an orange-filled dash, not a plain dash.
|
||||||
|
Keep code backgrounds neutral and retain syntax highlighting.
|
||||||
|
- Include two filled statistics boxes beneath each section heading: green for
|
||||||
|
matching line count and percentage, orange for mismatched count and percentage.
|
||||||
|
Show the total line count as plain text alongside them.
|
||||||
|
- Count actual lines across BOTH files, including blank lines. A matching pair
|
||||||
|
contributes two matching lines; a differing pair contributes two mismatches;
|
||||||
|
a platform-only line contributes one mismatch. Missing placeholders do not
|
||||||
|
count. Percentages use the combined actual-line total. Recalculate after any
|
||||||
|
alignment change, and explain this counting convention in the document.
|
||||||
|
|
||||||
|
## Explanations
|
||||||
|
|
||||||
|
- Explain each distinct point once across the document, at its first relevant
|
||||||
|
occurrence. Leave later cells empty unless they add information.
|
||||||
|
- Eliminate semantic repetition, not just identical sentences. Do not repeat
|
||||||
|
platform/import boilerplate such as “UIKit serves iOS” for every import.
|
||||||
|
- Explain shared behavior once. Label iOS/macOS details only when needed to
|
||||||
|
distinguish behavior. Explain the reason or consequence of platform differences.
|
||||||
|
- Avoid redundant function summaries when the individual operations already
|
||||||
|
explain the same behavior. Leave blank lines and closing braces unexplained.
|
||||||
|
- When realigning rows, anchor each platform-specific explanation to its own
|
||||||
|
source line rather than to the old visual row.
|
||||||
|
|
||||||
|
## Presentation and verification
|
||||||
|
|
||||||
|
- Inline all CSS and syntax highlighting; no external fonts, scripts or requests.
|
||||||
|
- Use `<pre><code>`, `white-space: pre-wrap`, and `overflow-wrap: anywhere`.
|
||||||
|
Give the code columns equal width; ensure long lines remain readable without
|
||||||
|
horizontal scrolling. Do not use striped row shading.
|
||||||
|
- Verify every source line and number against the named Git revision, in order,
|
||||||
|
with no omissions or duplicates. Check function anchors, placeholder fills,
|
||||||
|
both matching-number fills, statistics, and explanation attachment.
|
||||||
|
- Review explanations for repeated clauses as well as repeated sentences.
|
||||||
|
- Inspect the rendered HTML for layout problems. Return a clickable file link;
|
||||||
|
tell the user to refresh an already open document after updates.
|
||||||
@@ -4,6 +4,12 @@ output:
|
|||||||
ver-mac/src/dialect.swift:
|
ver-mac/src/dialect.swift:
|
||||||
type: swift
|
type: swift
|
||||||
|
|
||||||
|
BlueContext:
|
||||||
|
type: context
|
||||||
|
fields:
|
||||||
|
didLaunch: Bool
|
||||||
|
didSetup: Bool
|
||||||
|
|
||||||
BlueComponent:
|
BlueComponent:
|
||||||
type: component
|
type: component
|
||||||
shoulds:
|
shoulds:
|
||||||
@@ -15,22 +21,19 @@ BlueComponent:
|
|||||||
then:
|
then:
|
||||||
c.didLaunch = true
|
c.didLaunch = true
|
||||||
|
|
||||||
BlueContext:
|
|
||||||
type: context
|
|
||||||
fields:
|
|
||||||
didLaunch: Bool
|
|
||||||
didSetup: Bool
|
|
||||||
|
|
||||||
RenderContext:
|
RenderContext:
|
||||||
type: context
|
type: context
|
||||||
fields:
|
fields:
|
||||||
backingPixelSize: [Int32]
|
backingPixelSize: [Int32]
|
||||||
didLaunch: Bool
|
didLaunch: Bool
|
||||||
didPrepareGL: Bool
|
didPrepareGL: Bool
|
||||||
|
didPrepareIOSGL: Bool
|
||||||
|
didPrepareMacGL: Bool
|
||||||
didSetup: Bool
|
didSetup: Bool
|
||||||
pixelSize: [Int32]
|
pixelSize: [Int32]
|
||||||
reshapePixelSize: [Int32]
|
reshapePixelSize: [Int32]
|
||||||
willDeinit: Bool
|
willDeinit: Bool
|
||||||
|
willRecreateSurface: Bool
|
||||||
|
|
||||||
RenderComponent:
|
RenderComponent:
|
||||||
type: component
|
type: component
|
||||||
@@ -40,6 +43,7 @@ RenderComponent:
|
|||||||
- didPrepareGL: renderStartTimer(RenderVM.shared!)
|
- didPrepareGL: renderStartTimer(RenderVM.shared!)
|
||||||
- pixelSize: RenderVM.shared!.pixelSize = c.pixelSize
|
- pixelSize: RenderVM.shared!.pixelSize = c.pixelSize
|
||||||
- willDeinit: renderDeinit(RenderVM.shared!)
|
- willDeinit: renderDeinit(RenderVM.shared!)
|
||||||
|
- willRecreateSurface: renderRecreateSurface(RenderVM.shared!)
|
||||||
shoulds:
|
shoulds:
|
||||||
didLaunch:
|
didLaunch:
|
||||||
1. Only once during the first setup:
|
1. Only once during the first setup:
|
||||||
@@ -48,6 +52,18 @@ RenderComponent:
|
|||||||
c.didLaunch == false
|
c.didLaunch == false
|
||||||
then:
|
then:
|
||||||
c.didLaunch = true
|
c.didLaunch = true
|
||||||
|
didPrepareGL:
|
||||||
|
1. For macOS:
|
||||||
|
if:
|
||||||
|
c.recentField == F.didPrepareMacGL
|
||||||
|
then:
|
||||||
|
c.didPrepareGL = true
|
||||||
|
2. For iOS:
|
||||||
|
if:
|
||||||
|
c.recentField == F.didPrepareIOSGL &&
|
||||||
|
!c.didPrepareGL
|
||||||
|
then:
|
||||||
|
c.didPrepareGL = true
|
||||||
pixelSize:
|
pixelSize:
|
||||||
1. Upon launch:
|
1. Upon launch:
|
||||||
if:
|
if:
|
||||||
@@ -64,3 +80,9 @@ RenderComponent:
|
|||||||
c.recentField == F.backingPixelSize
|
c.recentField == F.backingPixelSize
|
||||||
then:
|
then:
|
||||||
c.pixelSize = c.backingPixelSize
|
c.pixelSize = c.backingPixelSize
|
||||||
|
willRecreateSurface:
|
||||||
|
1. Upon resize:
|
||||||
|
if:
|
||||||
|
c.recentField == F.reshapePixelSize
|
||||||
|
then:
|
||||||
|
c.willRecreateSurface = true
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.*
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.application)
|
||||||
|
alias(libs.plugins.kotlin.android)
|
||||||
|
alias(libs.plugins.kotlin.compose)
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace = "org.opengamestudio"
|
||||||
|
compileSdk = 35
|
||||||
|
|
||||||
|
buildFeatures {
|
||||||
|
compose = true
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
defaultConfig {
|
||||||
|
applicationId = "org.opengamestudio.blue"
|
||||||
|
minSdk = 23
|
||||||
|
targetSdk = 35
|
||||||
|
versionCode = 1
|
||||||
|
versionName = "0.0.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(libs.androidx.core.ktx)
|
||||||
|
implementation(libs.androidx.lifecycle.runtime.ktx)
|
||||||
|
implementation(libs.androidx.activity.compose)
|
||||||
|
implementation(platform(libs.androidx.compose.bom))
|
||||||
|
implementation(libs.androidx.ui)
|
||||||
|
implementation(libs.androidx.ui.graphics)
|
||||||
|
implementation(libs.androidx.ui.tooling.preview)
|
||||||
|
implementation(libs.androidx.material3)
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
compilerOptions {
|
||||||
|
jvmTarget = JVM_1_8
|
||||||
|
}
|
||||||
|
sourceSets {
|
||||||
|
val main by getting {
|
||||||
|
dependencies {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="OGS blue"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/Theme.MyApplication"
|
||||||
|
tools:targetApi="35">
|
||||||
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:label="OGS blue"
|
||||||
|
android:theme="@style/Theme.MyApplication"
|
||||||
|
>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package org.opengamestudio
|
||||||
|
|
||||||
|
object ActivityDelegate {
|
||||||
|
val blue = BlueComponent
|
||||||
|
|
||||||
|
init {
|
||||||
|
otherSetupConsoleLogging(blue.ctrl, "Blue")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setup() {
|
||||||
|
blue.setup()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package org.opengamestudio
|
||||||
|
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.activity.*
|
||||||
|
import androidx.activity.compose.setContent
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.ui.*
|
||||||
|
import androidx.compose.ui.graphics.Color as ComposeColor
|
||||||
|
import org.opengamestudio.ui.theme.MyApplicationTheme
|
||||||
|
|
||||||
|
class MainActivity: ComponentActivity() {
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
ActivityDelegate.setup()
|
||||||
|
|
||||||
|
enableEdgeToEdge(
|
||||||
|
navigationBarStyle = SystemBarStyle.dark(Color.TRANSPARENT),
|
||||||
|
statusBarStyle = SystemBarStyle.dark(Color.TRANSPARENT)
|
||||||
|
)
|
||||||
|
setContent {
|
||||||
|
MyApplicationTheme {
|
||||||
|
Box(
|
||||||
|
contentAlignment = Alignment.Center,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(ComposeColor.White)
|
||||||
|
) {
|
||||||
|
BlueView()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../../../../../../components/blue/android/blue.kt
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../../../../../../../components/blue/android/view/BlueView.kt
|
||||||
@@ -0,0 +1,209 @@
|
|||||||
|
package org.opengamestudio
|
||||||
|
|
||||||
|
|
||||||
|
val DIALECT_CONTEXT_RECENT_FIELD_NONE = "none"
|
||||||
|
|
||||||
|
interface DialectContext {
|
||||||
|
/**
|
||||||
|
* Name of the field that has just been changed
|
||||||
|
*
|
||||||
|
* Allows should-functions (reducers) to react only to
|
||||||
|
* relevant changes and ignore other changes of DialectContext
|
||||||
|
*/
|
||||||
|
var recentField: String
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get field's value by its name
|
||||||
|
*/
|
||||||
|
fun <T> field(name: String): T
|
||||||
|
/**
|
||||||
|
* Erase type
|
||||||
|
*
|
||||||
|
* Used by DialectController to assign recent field's value
|
||||||
|
*/
|
||||||
|
fun fieldAny(name: String): Any {
|
||||||
|
return field(name)
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Create a copy of the DialectContext derivative
|
||||||
|
*
|
||||||
|
* Used by DialectController to treat all derived contexts as DialectContext
|
||||||
|
*/
|
||||||
|
fun selfCopy(): DialectContext
|
||||||
|
/**
|
||||||
|
* Set field's value by its name
|
||||||
|
*/
|
||||||
|
fun setField(name: String, value: Any?)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class DialectController(
|
||||||
|
var context: DialectContext
|
||||||
|
) {
|
||||||
|
internal var callbacks = mutableListOf<(c: DialectContext) -> Unit>()
|
||||||
|
internal var functions = mutableListOf<(c: DialectContext) -> DialectContext>()
|
||||||
|
var isProcessingQueue = false
|
||||||
|
internal var queue = mutableListOf<DialectContext>()
|
||||||
|
|
||||||
|
fun executeFunctions() {
|
||||||
|
val c = queue.removeAt(0)
|
||||||
|
// Keep SSOT: Only allow single field change per should-function
|
||||||
|
context.recentField = c.recentField
|
||||||
|
context.setField(c.recentField, c.fieldAny(c.recentField))
|
||||||
|
|
||||||
|
for (f in functions) {
|
||||||
|
val ctx = f(context.selfCopy())
|
||||||
|
if (ctx.recentField != DIALECT_CONTEXT_RECENT_FIELD_NONE) {
|
||||||
|
queue.add(ctx)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reportContext()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun processQueue() {
|
||||||
|
// Prevent recursion.
|
||||||
|
if (isProcessingQueue) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
isProcessingQueue = true
|
||||||
|
|
||||||
|
while (queue.size > 0) {
|
||||||
|
executeFunctions()
|
||||||
|
}
|
||||||
|
|
||||||
|
isProcessingQueue = false
|
||||||
|
}
|
||||||
|
|
||||||
|
fun registerCallback(cb: (c: DialectContext) -> Unit) {
|
||||||
|
callbacks.add(cb)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun registerFieldCallback(
|
||||||
|
fieldName: String,
|
||||||
|
cb: (DialectContext) -> Unit
|
||||||
|
) {
|
||||||
|
callbacks.add({ c ->
|
||||||
|
if (c.recentField == fieldName) {
|
||||||
|
cb(c)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun registerFunction(f: (DialectContext) -> DialectContext) {
|
||||||
|
functions.add(f)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun reportContext() {
|
||||||
|
for (cb in callbacks) {
|
||||||
|
cb(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun set(fieldName: String, value: Any) {
|
||||||
|
var c = context.selfCopy()
|
||||||
|
c.setField(fieldName, value)
|
||||||
|
c.recentField = fieldName
|
||||||
|
queue.add(c)
|
||||||
|
processQueue()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Register several oneliner callbacks to a controller
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
fun registerOneliners(
|
||||||
|
ctrl: DialectController,
|
||||||
|
items: Array<Any>
|
||||||
|
) {
|
||||||
|
val halfCount = items.size / 2
|
||||||
|
for (i in 0..<halfCount) {
|
||||||
|
val field = items[i * 2] as String
|
||||||
|
val callback = items[i * 2 + 1] as (c: DialectContext) -> Unit
|
||||||
|
ctrl.registerFieldCallback(field, callback)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Context field names for static type check
|
||||||
|
object F {
|
||||||
|
const val didLaunch = "didLaunch"
|
||||||
|
const val didSetup = "didSetup"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
data class BlueContext(
|
||||||
|
var didLaunch: Boolean = false,
|
||||||
|
var didSetup: Boolean = false,
|
||||||
|
|
||||||
|
override var recentField: String = ""
|
||||||
|
) : DialectContext {
|
||||||
|
override fun <T> field(name: String): T {
|
||||||
|
if (name == "didLaunch") {
|
||||||
|
return didLaunch as T
|
||||||
|
}
|
||||||
|
else if (name == "didSetup") {
|
||||||
|
return didSetup as T
|
||||||
|
}
|
||||||
|
|
||||||
|
return "" as T
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun selfCopy(): DialectContext {
|
||||||
|
return this.copy()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setField(
|
||||||
|
name: String,
|
||||||
|
value: Any?
|
||||||
|
) {
|
||||||
|
if (name == "didLaunch") {
|
||||||
|
didLaunch = value as Boolean
|
||||||
|
}
|
||||||
|
else if (name == "didSetup") {
|
||||||
|
didSetup = value as Boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun blueSet(
|
||||||
|
key: String,
|
||||||
|
value: Any
|
||||||
|
) {
|
||||||
|
BlueComponent.ctrl.set(key, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun blueShouldResetDidLaunch(c: BlueContext): BlueContext {
|
||||||
|
val c = c
|
||||||
|
|
||||||
|
// 1. Only once during the first setup
|
||||||
|
if (
|
||||||
|
c.recentField == F.didSetup &&
|
||||||
|
c.didLaunch == false
|
||||||
|
) {
|
||||||
|
c.didLaunch = true
|
||||||
|
c.recentField = F.didLaunch
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
c.recentField = DIALECT_CONTEXT_RECENT_FIELD_NONE
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
fun blueRegisterShoulds(ctrl: DialectController) {
|
||||||
|
listOf(
|
||||||
|
::blueShouldResetDidLaunch,
|
||||||
|
|
||||||
|
).forEach { f ->
|
||||||
|
ctrl.registerFunction { c -> f(c as BlueContext) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun blueRegisterEffects(ctrl: DialectController) {
|
||||||
|
registerOneliners(ctrl, arrayOf(
|
||||||
|
F.didLaunch, { c: BlueContext -> print("Blue launched") },
|
||||||
|
|
||||||
|
))
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../../../../../../components/other/other.kt
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package org.opengamestudio.ui.theme
|
||||||
|
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
|
val Purple80 = Color(0xFFD0BCFF)
|
||||||
|
val PurpleGrey80 = Color(0xFFCCC2DC)
|
||||||
|
val Pink80 = Color(0xFFEFB8C8)
|
||||||
|
|
||||||
|
val Purple40 = Color(0xFF6650a4)
|
||||||
|
val PurpleGrey40 = Color(0xFF625b71)
|
||||||
|
val Pink40 = Color(0xFF7D5260)
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package org.opengamestudio.ui.theme
|
||||||
|
|
||||||
|
import android.os.Build
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
|
||||||
|
private val DarkColorScheme = darkColorScheme(
|
||||||
|
primary = Purple80,
|
||||||
|
secondary = PurpleGrey80,
|
||||||
|
tertiary = Pink80
|
||||||
|
)
|
||||||
|
|
||||||
|
private val LightColorScheme = lightColorScheme(
|
||||||
|
primary = Purple40,
|
||||||
|
secondary = PurpleGrey40,
|
||||||
|
tertiary = Pink40
|
||||||
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun MyApplicationTheme(
|
||||||
|
darkTheme: Boolean = false,
|
||||||
|
dynamicColor: Boolean = false,
|
||||||
|
content: @Composable () -> Unit
|
||||||
|
) {
|
||||||
|
val colorScheme = when {
|
||||||
|
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ->
|
||||||
|
if (darkTheme) dynamicDarkColorScheme(LocalContext.current)
|
||||||
|
else dynamicLightColorScheme(LocalContext.current)
|
||||||
|
darkTheme -> DarkColorScheme
|
||||||
|
else -> LightColorScheme
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialTheme(
|
||||||
|
colorScheme = colorScheme,
|
||||||
|
typography = Typography,
|
||||||
|
content = content
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.opengamestudio.ui.theme
|
||||||
|
|
||||||
|
import androidx.compose.material3.Typography
|
||||||
|
import androidx.compose.ui.text.TextStyle
|
||||||
|
import androidx.compose.ui.text.font.*
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
|
||||||
|
val Typography = Typography(
|
||||||
|
bodyLarge = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
fontSize = 16.sp,
|
||||||
|
lineHeight = 24.sp,
|
||||||
|
letterSpacing = 0.5.sp
|
||||||
|
)
|
||||||
|
)
|
||||||
|
After Width: | Height: | Size: 63 KiB |
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@drawable/ic_launcher_artwork" />
|
||||||
|
<foreground android:drawable="@android:color/transparent" />
|
||||||
|
</adaptive-icon>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@drawable/ic_launcher_artwork" />
|
||||||
|
<foreground android:drawable="@android:color/transparent" />
|
||||||
|
</adaptive-icon>
|
||||||
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 18 KiB |
@@ -0,0 +1,3 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">OGS blue</string>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<style name="Theme.MyApplication" parent="android:Theme.Material.NoActionBar">
|
||||||
|
<item name="android:windowBackground">#000000</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<full-backup-content>
|
||||||
|
</full-backup-content>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<data-extraction-rules>
|
||||||
|
<cloud-backup>
|
||||||
|
<exclude domain="root" />
|
||||||
|
</cloud-backup>
|
||||||
|
<device-transfer>
|
||||||
|
<exclude domain="root" />
|
||||||
|
</device-transfer>
|
||||||
|
</data-extraction-rules>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.application) apply false
|
||||||
|
alias(libs.plugins.android.library) apply false
|
||||||
|
alias(libs.plugins.kotlin.android) apply false
|
||||||
|
alias(libs.plugins.kotlin.compose) apply false
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
version: 4
|
||||||
|
|
||||||
|
output:
|
||||||
|
.build/dialect.swift:
|
||||||
|
type: swift
|
||||||
|
app/src/main/kotlin/org/opengamestudio/dialect.kt:
|
||||||
|
type: kotlin
|
||||||
|
|
||||||
|
BlueContext:
|
||||||
|
type: context
|
||||||
|
fields:
|
||||||
|
didLaunch: Bool
|
||||||
|
didSetup: Bool
|
||||||
|
|
||||||
|
BlueComponent:
|
||||||
|
type: component
|
||||||
|
oneliners:
|
||||||
|
- didLaunch: print("Blue launched")
|
||||||
|
shoulds:
|
||||||
|
didLaunch:
|
||||||
|
1. Only once during the first setup:
|
||||||
|
if:
|
||||||
|
c.recentField == F.didSetup &&
|
||||||
|
c.didLaunch == false
|
||||||
|
then:
|
||||||
|
c.didLaunch = true
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# Use Compose for Android
|
||||||
|
android.useAndroidX=true
|
||||||
|
# Verbose build log
|
||||||
|
org.gradle.console=verbose
|
||||||
|
# Cache artifacts
|
||||||
|
org.gradle.caching=true
|
||||||
|
# JVM heap for Gradle and daemon
|
||||||
|
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
[versions]
|
||||||
|
activityCompose = "1.9.3"
|
||||||
|
agp = "8.7.3"
|
||||||
|
composeBom = "2024.12.01"
|
||||||
|
coreKtx = "1.15.0"
|
||||||
|
kotlin = "2.1.0"
|
||||||
|
lifecycleRuntimeKtx = "2.8.7"
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
|
||||||
|
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
|
||||||
|
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||||
|
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
|
||||||
|
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
|
||||||
|
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
|
||||||
|
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
|
||||||
|
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
|
||||||
|
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
|
android-library = { id = "com.android.library", version.ref = "agp" }
|
||||||
|
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||||
|
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
@@ -0,0 +1,251 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
google {
|
||||||
|
content {
|
||||||
|
includeGroupByRegex("com\\.android.*")
|
||||||
|
includeGroupByRegex("com\\.google.*")
|
||||||
|
includeGroupByRegex("androidx.*")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "OGS blue"
|
||||||
|
include("app")
|
||||||
@@ -20,7 +20,10 @@
|
|||||||
<dict/>
|
<dict/>
|
||||||
<key>UISupportedInterfaceOrientations</key>
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
<array>
|
<array>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
@@ -3,13 +3,29 @@ options:
|
|||||||
bundleIdPrefix: org.opengamestudio
|
bundleIdPrefix: org.opengamestudio
|
||||||
targets:
|
targets:
|
||||||
ogs-blue:
|
ogs-blue:
|
||||||
type: application
|
dependencies:
|
||||||
platform: iOS
|
- framework: .build/lib/libEGL.xcframework
|
||||||
|
embed: true
|
||||||
|
- framework: .build/lib/libGLESv2.xcframework
|
||||||
|
embed: true
|
||||||
deploymentTarget: "15.0"
|
deploymentTarget: "15.0"
|
||||||
|
platform: iOS
|
||||||
sources:
|
sources:
|
||||||
- path: Assets.xcassets
|
- path: Assets.xcassets
|
||||||
- path: src
|
- path: src
|
||||||
settings:
|
settings:
|
||||||
base:
|
base:
|
||||||
PRODUCT_BUNDLE_IDENTIFIER: org.opengamestudio.blue
|
GCC_PREPROCESSOR_DEFINITIONS:
|
||||||
|
- GL_GLEXT_PROTOTYPES=1
|
||||||
|
- GRAPHICS_API_OPENGL_ES3=1
|
||||||
|
- PLATFORM_IOS=1
|
||||||
|
HEADER_SEARCH_PATHS:
|
||||||
|
- "$(SRCROOT)/.build/include"
|
||||||
|
- "$(SRCROOT)/.build/lib/raylib.xcframework/ios-arm64_x86_64-simulator/raylib.framework/Headers"
|
||||||
|
- "$(SRCROOT)/.build/lib/raylib.xcframework/ios-arm64/raylib.framework/Headers"
|
||||||
INFOPLIST_FILE: Info.plist
|
INFOPLIST_FILE: Info.plist
|
||||||
|
LD_RUNPATH_SEARCH_PATHS:
|
||||||
|
- "$(inherited) @executable_path/Frameworks"
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER: org.opengamestudio.blue
|
||||||
|
SWIFT_OBJC_BRIDGING_HEADER: src/BlueBridgingHeader.h
|
||||||
|
type: application
|
||||||
@@ -6,6 +6,8 @@ final class AppDelegate:
|
|||||||
{
|
{
|
||||||
let blue = BlueComponent()
|
let blue = BlueComponent()
|
||||||
let blueVM = BlueVM()
|
let blueVM = BlueVM()
|
||||||
|
let render = RenderComponent()
|
||||||
|
let renderVM = RenderVM()
|
||||||
|
|
||||||
func application(
|
func application(
|
||||||
_ application: UIApplication,
|
_ application: UIApplication,
|
||||||
@@ -13,6 +15,8 @@ final class AppDelegate:
|
|||||||
) -> Bool {
|
) -> Bool {
|
||||||
otherSetupConsoleLogging(blue.ctrl, "Blue")
|
otherSetupConsoleLogging(blue.ctrl, "Blue")
|
||||||
blue.setup()
|
blue.setup()
|
||||||
|
otherSetupConsoleLogging(render.ctrl, "Render")
|
||||||
|
render.setup()
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
#define EGL_CONST_IMPLEMENTATION
|
||||||
|
#include "eglConst.h"
|
||||||
|
|
||||||
|
#define EGL_IMPLEMENTATION
|
||||||
|
#include "egl.h"
|
||||||
|
|
||||||
|
#define RAYBRI_CONST_IMPLEMENTATION
|
||||||
|
#include "raybriConst.h"
|
||||||
|
|
||||||
|
#define RAYBRI_IMPLEMENTATION
|
||||||
|
#include "raybri.h"
|
||||||
|
|
||||||
|
#define RLGL_IMPLEMENTATION
|
||||||
|
#include "rlgl.h"
|
||||||
|
|
||||||
@@ -6,7 +6,11 @@ struct BlueApp: App {
|
|||||||
|
|
||||||
var body: some Scene {
|
var body: some Scene {
|
||||||
WindowGroup {
|
WindowGroup {
|
||||||
BlueView(appDelegate.blueVM)
|
ZStack {
|
||||||
|
RenderView()
|
||||||
|
.ignoresSafeArea()
|
||||||
|
BlueView(appDelegate.blueVM)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
#ifndef OGS_BLUE_BRIDGING_HEADER_H
|
||||||
|
#define OGS_BLUE_BRIDGING_HEADER_H
|
||||||
|
|
||||||
|
#include "egl/egl.h"
|
||||||
|
#include "raybri/raybri.h"
|
||||||
|
|
||||||
|
#endif // OGS_BLUE_BRIDGING_HEADER_H
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../components/egl/egl.h
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../components/egl/eglConst.h
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../components/raybri/raybri.h
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../components/raybri/raybriConst.h
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../components/render/ios/renderAux.swift
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../components/render/renderConst.swift
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../components/render/ios/renderEffect.swift
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
func renderDeinit(_ vm: RenderVM) { }
|
|
||||||
func renderInit(_ vm: RenderVM) { }
|
|
||||||
func renderLoadCubeModel(_ vm: RenderVM) { }
|
|
||||||
func renderStartTimer(_ vm: RenderVM) { }
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../../components/render/ios/view/RenderView.swift
|
||||||
@@ -12,9 +12,11 @@ let package = Package(
|
|||||||
targets: [
|
targets: [
|
||||||
.target(
|
.target(
|
||||||
name: "RaylibBridge",
|
name: "RaylibBridge",
|
||||||
path: "src/raybri",
|
path: "src",
|
||||||
publicHeadersPath: ".",
|
sources: ["Blue.c"],
|
||||||
|
publicHeadersPath: "raybri",
|
||||||
cSettings: [
|
cSettings: [
|
||||||
|
.headerSearchPath("raybri"),
|
||||||
.unsafeFlags(["-I", "\(raylibPrefix)/include"])
|
.unsafeFlags(["-I", "\(raylibPrefix)/include"])
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
@@ -22,9 +24,9 @@ let package = Package(
|
|||||||
name: "ogs-blue",
|
name: "ogs-blue",
|
||||||
dependencies: ["RaylibBridge"],
|
dependencies: ["RaylibBridge"],
|
||||||
path: "src",
|
path: "src",
|
||||||
exclude: ["raybri"],
|
exclude: ["raybri", "Blue.c"],
|
||||||
swiftSettings: [
|
swiftSettings: [
|
||||||
.unsafeFlags(["-Xcc", "-DGL_SILENCE_DEPRECATION"])
|
.unsafeFlags(["-Xcc", "-DGL_SILENCE_DEPRECATION", "-Xcc", "-I\(raylibPrefix)/include"])
|
||||||
],
|
],
|
||||||
linkerSettings: [
|
linkerSettings: [
|
||||||
.unsafeFlags([
|
.unsafeFlags([
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#define RAYBRI_CONST_IMPLEMENTATION
|
||||||
|
#include "raybriConst.h"
|
||||||
|
|
||||||
|
#define RAYBRI_AUX_IMPLEMENTATION
|
||||||
|
#include "raybriAux.h"
|
||||||
|
|
||||||
|
#define RAYBRI_IMPLEMENTATION
|
||||||
|
#include "raybri.h"
|
||||||
@@ -122,10 +122,13 @@ public struct F {
|
|||||||
public static let backingPixelSize = "backingPixelSize"
|
public static let backingPixelSize = "backingPixelSize"
|
||||||
public static let didLaunch = "didLaunch"
|
public static let didLaunch = "didLaunch"
|
||||||
public static let didPrepareGL = "didPrepareGL"
|
public static let didPrepareGL = "didPrepareGL"
|
||||||
|
public static let didPrepareIOSGL = "didPrepareIOSGL"
|
||||||
|
public static let didPrepareMacGL = "didPrepareMacGL"
|
||||||
public static let didSetup = "didSetup"
|
public static let didSetup = "didSetup"
|
||||||
public static let pixelSize = "pixelSize"
|
public static let pixelSize = "pixelSize"
|
||||||
public static let reshapePixelSize = "reshapePixelSize"
|
public static let reshapePixelSize = "reshapePixelSize"
|
||||||
public static let willDeinit = "willDeinit"
|
public static let willDeinit = "willDeinit"
|
||||||
|
public static let willRecreateSurface = "willRecreateSurface"
|
||||||
|
|
||||||
}
|
}
|
||||||
public struct BlueContext: DialectContext {
|
public struct BlueContext: DialectContext {
|
||||||
@@ -163,10 +166,13 @@ public struct RenderContext: DialectContext {
|
|||||||
public var backingPixelSize = [Int32]()
|
public var backingPixelSize = [Int32]()
|
||||||
public var didLaunch = Bool()
|
public var didLaunch = Bool()
|
||||||
public var didPrepareGL = Bool()
|
public var didPrepareGL = Bool()
|
||||||
|
public var didPrepareIOSGL = Bool()
|
||||||
|
public var didPrepareMacGL = Bool()
|
||||||
public var didSetup = Bool()
|
public var didSetup = Bool()
|
||||||
public var pixelSize = [Int32]()
|
public var pixelSize = [Int32]()
|
||||||
public var reshapePixelSize = [Int32]()
|
public var reshapePixelSize = [Int32]()
|
||||||
public var willDeinit = Bool()
|
public var willDeinit = Bool()
|
||||||
|
public var willRecreateSurface = Bool()
|
||||||
|
|
||||||
public var recentField = ""
|
public var recentField = ""
|
||||||
|
|
||||||
@@ -180,6 +186,12 @@ public struct RenderContext: DialectContext {
|
|||||||
else if (name == "didPrepareGL") {
|
else if (name == "didPrepareGL") {
|
||||||
return didPrepareGL as! T
|
return didPrepareGL as! T
|
||||||
}
|
}
|
||||||
|
else if (name == "didPrepareIOSGL") {
|
||||||
|
return didPrepareIOSGL as! T
|
||||||
|
}
|
||||||
|
else if (name == "didPrepareMacGL") {
|
||||||
|
return didPrepareMacGL as! T
|
||||||
|
}
|
||||||
else if (name == "didSetup") {
|
else if (name == "didSetup") {
|
||||||
return didSetup as! T
|
return didSetup as! T
|
||||||
}
|
}
|
||||||
@@ -192,6 +204,9 @@ public struct RenderContext: DialectContext {
|
|||||||
else if (name == "willDeinit") {
|
else if (name == "willDeinit") {
|
||||||
return willDeinit as! T
|
return willDeinit as! T
|
||||||
}
|
}
|
||||||
|
else if (name == "willRecreateSurface") {
|
||||||
|
return willRecreateSurface as! T
|
||||||
|
}
|
||||||
|
|
||||||
return "unknown-field-name" as! T
|
return "unknown-field-name" as! T
|
||||||
}
|
}
|
||||||
@@ -209,6 +224,12 @@ public struct RenderContext: DialectContext {
|
|||||||
else if (name == "didPrepareGL") {
|
else if (name == "didPrepareGL") {
|
||||||
didPrepareGL = value as! Bool
|
didPrepareGL = value as! Bool
|
||||||
}
|
}
|
||||||
|
else if (name == "didPrepareIOSGL") {
|
||||||
|
didPrepareIOSGL = value as! Bool
|
||||||
|
}
|
||||||
|
else if (name == "didPrepareMacGL") {
|
||||||
|
didPrepareMacGL = value as! Bool
|
||||||
|
}
|
||||||
else if (name == "didSetup") {
|
else if (name == "didSetup") {
|
||||||
didSetup = value as! Bool
|
didSetup = value as! Bool
|
||||||
}
|
}
|
||||||
@@ -221,6 +242,9 @@ public struct RenderContext: DialectContext {
|
|||||||
else if (name == "willDeinit") {
|
else if (name == "willDeinit") {
|
||||||
willDeinit = value as! Bool
|
willDeinit = value as! Bool
|
||||||
}
|
}
|
||||||
|
else if (name == "willRecreateSurface") {
|
||||||
|
willRecreateSurface = value as! Bool
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -275,6 +299,33 @@ func renderShouldResetDidLaunch(_ c: RenderContext) -> RenderContext {
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func renderShouldResetDidPrepareGL(_ c: RenderContext) -> RenderContext {
|
||||||
|
var c = c
|
||||||
|
|
||||||
|
/* 1. For macOS */
|
||||||
|
if
|
||||||
|
c.recentField == F.didPrepareMacGL
|
||||||
|
{
|
||||||
|
c.didPrepareGL = true
|
||||||
|
c.recentField = F.didPrepareGL
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 2. For iOS */
|
||||||
|
if
|
||||||
|
c.recentField == F.didPrepareIOSGL &&
|
||||||
|
!c.didPrepareGL
|
||||||
|
{
|
||||||
|
c.didPrepareGL = true
|
||||||
|
c.recentField = F.didPrepareGL
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
c.recentField = DIALECT_CONTEXT_RECENT_FIELD_NONE
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
func renderShouldResetPixelSize(_ c: RenderContext) -> RenderContext {
|
func renderShouldResetPixelSize(_ c: RenderContext) -> RenderContext {
|
||||||
var c = c
|
var c = c
|
||||||
|
|
||||||
@@ -310,6 +361,23 @@ func renderShouldResetPixelSize(_ c: RenderContext) -> RenderContext {
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func renderShouldResetWillRecreateSurface(_ c: RenderContext) -> RenderContext {
|
||||||
|
var c = c
|
||||||
|
|
||||||
|
/* 1. Upon resize */
|
||||||
|
if
|
||||||
|
c.recentField == F.reshapePixelSize
|
||||||
|
{
|
||||||
|
c.willRecreateSurface = true
|
||||||
|
c.recentField = F.willRecreateSurface
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
c.recentField = DIALECT_CONTEXT_RECENT_FIELD_NONE
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
func blueRegisterShoulds(_ ctrl: DialectController) {
|
func blueRegisterShoulds(_ ctrl: DialectController) {
|
||||||
[
|
[
|
||||||
blueShouldResetDidLaunch,
|
blueShouldResetDidLaunch,
|
||||||
@@ -322,7 +390,9 @@ func blueRegisterShoulds(_ ctrl: DialectController) {
|
|||||||
func renderRegisterShoulds(_ ctrl: DialectController) {
|
func renderRegisterShoulds(_ ctrl: DialectController) {
|
||||||
[
|
[
|
||||||
renderShouldResetDidLaunch,
|
renderShouldResetDidLaunch,
|
||||||
|
renderShouldResetDidPrepareGL,
|
||||||
renderShouldResetPixelSize,
|
renderShouldResetPixelSize,
|
||||||
|
renderShouldResetWillRecreateSurface,
|
||||||
|
|
||||||
].forEach { f in
|
].forEach { f in
|
||||||
ctrl.registerFunction { c in f(c as! RenderContext) }
|
ctrl.registerFunction { c in f(c as! RenderContext) }
|
||||||
@@ -336,6 +406,7 @@ func renderRegisterEffects(_ ctrl: DialectController) {
|
|||||||
F.didPrepareGL, { (c: RenderContext) in renderStartTimer(RenderVM.shared!) },
|
F.didPrepareGL, { (c: RenderContext) in renderStartTimer(RenderVM.shared!) },
|
||||||
F.pixelSize, { (c: RenderContext) in RenderVM.shared!.pixelSize = c.pixelSize },
|
F.pixelSize, { (c: RenderContext) in RenderVM.shared!.pixelSize = c.pixelSize },
|
||||||
F.willDeinit, { (c: RenderContext) in renderDeinit(RenderVM.shared!) },
|
F.willDeinit, { (c: RenderContext) in renderDeinit(RenderVM.shared!) },
|
||||||
|
F.willRecreateSurface, { (c: RenderContext) in renderRecreateSurface(RenderVM.shared!) },
|
||||||
|
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../../components/raybri/raybri.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../../components/raybri/raybriAux.c
|
|
||||||
@@ -1 +1 @@
|
|||||||
../../../../components/raybri/raybriAux.h
|
../../../../components/raybri/mac/raybriAux.h
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../../components/raybri/raybriConst.c
|
|
||||||
@@ -1 +1 @@
|
|||||||
../../../../components/render/renderAux.swift
|
../../../../components/render/mac/renderAux.swift
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../components/render/mac/renderConstMac.swift
|
||||||
@@ -1 +1 @@
|
|||||||
../../../../components/render/renderEffect.swift
|
../../../../components/render/mac/renderEffect.swift
|
||||||
@@ -1 +1 @@
|
|||||||
../../../../components/raybri/raybri.c
|
../../../../components/raybri/mac/raybri.c
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../components/raybri/mac/raybriAux.c
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../components/raybri/mac/raybriAux.h
|
||||||
@@ -1 +1 @@
|
|||||||
../../../../components/raybri/raybriConst.c
|
../../../../components/raybri/mac/raybriConst.c
|
||||||
@@ -1 +1 @@
|
|||||||
../../../../components/raybri/raybriConst.h
|
../../../../components/raybri/mac/raybriConst.h
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../../components/raybri/raybriConst.c
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
RAYLIB_IOS="raylib-ios-xcframeworks/raylib.xcframework"
|
||||||
|
RAYLIB_IOS_EGL="raylib-ios-xcframeworks/libEGL.xcframework"
|
||||||
|
RAYLIB_IOS_GLES="raylib-ios-xcframeworks/libGLESv2.xcframework"
|
||||||
@@ -7,5 +7,7 @@ source $SDIR/paths
|
|||||||
TARGET=ogs-blue
|
TARGET=ogs-blue
|
||||||
|
|
||||||
STEP=0
|
STEP=0
|
||||||
|
source $T/checkRaylibIOS $TARGET
|
||||||
source $T/generateDialect $TARGET
|
source $T/generateDialect $TARGET
|
||||||
source $T/prepareIOS $TARGET
|
source $T/prepareANGLE $TARGET
|
||||||
|
source $T/generateIOS $TARGET
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
DEP="raylib-ios-xcframeworks"
|
||||||
|
|
||||||
|
STEP=$((STEP+1))
|
||||||
|
echo -e "\n> > > > Step №$STEP. Check $DEP presence"
|
||||||
|
|
||||||
|
MISSING=0
|
||||||
|
[[ -e $SDIR/../../$RAYLIB_IOS ]] || MISSING=1
|
||||||
|
[[ -e $SDIR/../../$RAYLIB_IOS_EGL ]] || MISSING=1
|
||||||
|
[[ -e $SDIR/../../$RAYLIB_IOS_GLES ]] || MISSING=1
|
||||||
|
|
||||||
|
if [[ $MISSING -eq 1 ]]; then
|
||||||
|
echo "ERROR $DEP not found alongside this project"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
TARGET=$1
|
||||||
|
|
||||||
|
STEP=$((STEP+1))
|
||||||
|
echo -e "\n> > > > Step №$STEP. Prepare ANGLE includes for '$TARGET'"
|
||||||
|
|
||||||
|
BUILD=$SDIR/../$TARGET/ver-ios/.build
|
||||||
|
INC=$BUILD/include
|
||||||
|
LIB=$BUILD/lib
|
||||||
|
mkdir -p $INC $LIB
|
||||||
|
|
||||||
|
# Create EGL and GLES symlinks because their internal includes refer to each other
|
||||||
|
# without knowing of XCFramework bounderies
|
||||||
|
ln -sfn "$SDIR/../../$RAYLIB_IOS_EGL/ios-arm64_x86_64-simulator/libEGL.framework/Headers" "$INC/libEGL"
|
||||||
|
ln -sfn "$SDIR/../../$RAYLIB_IOS_GLES/ios-arm64_x86_64-simulator/libGLESv2.framework/Headers" "$INC/libGLESv2"
|
||||||
|
|
||||||
|
# Symlink libraries for convenience, too
|
||||||
|
|
||||||
|
ln -sfn "$SDIR/../../$RAYLIB_IOS" "$LIB"
|
||||||
|
ln -sfn "$SDIR/../../$RAYLIB_IOS_EGL" "$LIB"
|
||||||
|
ln -sfn "$SDIR/../../$RAYLIB_IOS_GLES" "$LIB"
|
||||||