This commit is contained in:
kornerr committed 2026-11-11 19:49:00 +03:00
1 parent 9230c12f8f
commit 3b3f43d526
41 files changed
+244 -5

No files matched your search

+3 -2
View File
@@ -5,10 +5,11 @@ Remote: `https://git.opengamestudio.org/mahjong/mahjong`.
## Apps ## Apps
- `hello/hello-selection/` — macOS continuation of hello-raylib: four rlgl quads - `hello/hello-selection/` — macOS and iOS continuation of hello-raylib: four rlgl quads
with IDs 0–3 update a native label through the HST Dialect component. with IDs 0–3 update a native label through the HST Dialect component.
Drawing and hit testing share one rectangle layout. Only Swift generation is Drawing and hit testing share one rectangle layout. Only Swift generation is
enabled; Android/Kotlin support is deferred. Source ownership, coordinates, enabled; Android/Kotlin support is deferred. iOS uses the ANGLE renderer and
selects tiles on touch down. Source ownership, coordinates,
build commands and mirroring boundaries are in section 13 of build commands and mirroring boundaries are in section 13 of
[docs/components-over-platforms.md](docs/components-over-platforms.md). [docs/components-over-platforms.md](docs/components-over-platforms.md).
- `hello/hello-raylib/` — macOS + iOS + Android + Linux raylib blue-screen sample with - `hello/hello-raylib/` — macOS + iOS + Android + Linux raylib blue-screen sample with
+4
View File
@@ -12,6 +12,10 @@ func renderRecreateSurface(_ vm: RenderVM) {
glbriMakeCurrentContext(&vm.glView.st) glbriMakeCurrentContext(&vm.glView.st)
} }
func renderUISize(_ view: UIView) -> [Float] {
[Float(view.bounds.width), Float(view.bounds.height)]
}
func renderViewPtr(_ view: RenderGLView) -> UnsafeMutableRawPointer { func renderViewPtr(_ view: RenderGLView) -> UnsafeMutableRawPointer {
Unmanaged.passUnretained(view.layer).toOpaque() Unmanaged.passUnretained(view.layer).toOpaque()
} }
@@ -6,7 +6,6 @@ final class RenderGLView: UIView {
override init(frame: CGRect) { override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
isOpaque = true isOpaque = true
isUserInteractionEnabled = false
} }
required init?(coder: NSCoder) { required init?(coder: NSCoder) {
@@ -32,4 +31,9 @@ final class RenderGLView: UIView {
renderSet(F.reshapePixelSize, ps) renderSet(F.reshapePixelSize, ps)
} }
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
guard let touch = touches.first else { return }
let point = touch.location(in: self)
renderSet(F.mouseDownPos, [Float(point.x - bounds.minX), Float(bounds.maxY - point.y)])
}
} }
+27 -1
View File
@@ -973,7 +973,7 @@ blue behind the black/white title, resize/minimize/restore, and close it cleanly
Host source checks and Apple builds do not establish that WinUI activation, Host source checks and Apple builds do not establish that WinUI activation,
ANGLE surface attachment and native presentation work on Windows. ANGLE surface attachment and native presentation work on Windows.
## 13. hello-selection: macOS quad selection ## 13. hello-selection: macOS and iOS quad selection
Added on 2026-11-10 as the next step after hello-raylib. Hello-SelecTion uses Added on 2026-11-10 as the next step after hello-raylib. Hello-SelecTion uses
the component prefix HST, including HSTApp, HSTAppDelegate, HSTView and its YAML the component prefix HST, including HSTApp, HSTAppDelegate, HSTView and its YAML
@@ -1109,6 +1109,32 @@ util/build-mac
util/run-mac util/run-mac
``` ```
### iOS target
`ver-ios` uses the same UIKit and ANGLE lifecycle as hello-raylib. Its
`RenderGLView` dispatches the first touch as `mouseDownPos` in local points,
measured from the bottom-left corner to match the shared coordinate helper.
The SwiftUI title passes touches through to the render view. The target links
directly to hello-selection's macOS Dialect output, RenderVM and drawing function.
Its app-owned `raybri.c` compiles the same drawing headers with the iOS rlgl
implementation. `HSTBridgingHeader.h` exposes the C API to Swift.
From hello-selection, generate the project and build for the IVA simulator:
```sh
util/prepare-ios
xcodebuild -project ver-ios/hello-selection.xcodeproj -scheme hello-selection \
-destination 'id=EB867790-F2C0-4392-9F99-C509D4487FDA' \
-derivedDataPath ver-ios/.build/derived CODE_SIGNING_ALLOWED=NO build
```
`prepare-ios` uses the same ANGLE dependencies as hello-raylib. Set
`RAYLIB_IOS_PREFIX` when the xcframeworks live outside the default sibling
`raylib-ios-xcframeworks` directory.
Verified on IVA (iPhone 17, iOS 26.5) that the app launches with four white
tiles and that tapping items 0 and 3 updates the title and moves the red highlight.
Validation on 2026-11-10: generation, build and app packaging passed. Validation on 2026-11-10: generation, build and app packaging passed.
Live macOS checks covered the initial four quads, IDs 1–4, repeated/outside Live macOS checks covered the initial four quads, IDs 1–4, repeated/outside
clicks and selection after zoom/restore on a 2x Retina display; the user also clicks and selection after zoom/restore on a 2x Retina display; the user also
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash -e
SDIR=$(cd "$(dirname "$0")" ; pwd -P)
T=$SDIR/step
TARGET=hello-selection
STEP=0
source $T/generateDialect $TARGET
source $T/prepareANGLE $TARGET
source $T/prepareIOS $TARGET
+1
View File
@@ -0,0 +1 @@
../../../hello-raylib/util/step/prepareANGLE
+1
View File
@@ -0,0 +1 @@
../../../hello-platform/util/step/prepareIOS
@@ -0,0 +1 @@
../../../../../res/AppIcon.png
@@ -0,0 +1,14 @@
{
"images" : [
{
"filename" : "AppIcon.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
+29
View File
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>hello-selection</string>
<key>CFBundleDisplayName</key>
<string>hello-selection</string>
<key>CFBundleIdentifier</key>
<string>org.opengamestudio.hello-selection</string>
<key>CFBundleExecutable</key>
<string>hello-selection</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>UILaunchScreen</key>
<dict/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
</dict>
</plist>
+35
View File
@@ -0,0 +1,35 @@
name: hello-selection
options:
bundleIdPrefix: org.opengamestudio
targets:
hello-selection:
type: application
platform: iOS
deploymentTarget: "15.0"
dependencies:
- framework: .build/lib/libEGL.xcframework
embed: true
- framework: .build/lib/libGLESv2.xcframework
embed: true
sources:
- path: Assets.xcassets
- path: src
settings:
base:
GCC_PREPROCESSOR_DEFINITIONS:
- $(inherited)
- GL_GLEXT_PROTOTYPES=1
- GRAPHICS_API_OPENGL_ES3=1
- PLATFORM_IOS=1
HEADER_SEARCH_PATHS:
- $(inherited)
- "$(SRCROOT)/src"
- "$(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
LD_RUNPATH_SEARCH_PATHS:
- $(inherited)
- "@executable_path/Frameworks"
PRODUCT_BUNDLE_IDENTIFIER: org.opengamestudio.hello-selection
SWIFT_OBJC_BRIDGING_HEADER: src/HSTBridgingHeader.h
@@ -0,0 +1,17 @@
import SwiftUI
@main
struct HSTApp: App {
@UIApplicationDelegateAdaptor(HSTAppDelegate.self) private var appDelegate
var body: some Scene {
WindowGroup {
ZStack {
RenderView()
.ignoresSafeArea()
HSTView(appDelegate.hstVM)
.allowsHitTesting(false)
}
}
}
}
@@ -0,0 +1,19 @@
import UIKit
final class HSTAppDelegate: NSObject, UIApplicationDelegate {
let hst = HSTComponent()
let hstVM = HSTVM()
let render = RenderComponent()
let renderVM = RenderVM()
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
otherSetupConsoleLogging(hst.ctrl, "HST")
hst.setup()
otherSetupConsoleLogging(render.ctrl, "Render")
render.setup()
return true
}
}
@@ -0,0 +1,14 @@
#ifndef HST_BRIDGING_HEADER_H
#define HST_BRIDGING_HEADER_H
#include "glbri/glbri.h"
#include "raybri/raybri.h"
#include "raybri/raybriAux.h"
#include "raybri/raybriClear.h"
#include "raybri/raybriDrawAxes.h"
#include "raybri/raybriDrawQuad.h"
#include "raybri/raybriFlush.h"
#include "raybri/raybriSetColor.h"
#include "raybri/raybriSetup2DFramebuffer.h"
#endif // HST_BRIDGING_HEADER_H
+1
View File
@@ -0,0 +1 @@
../../ver-mac/src/dialect.swift
+1
View File
@@ -0,0 +1 @@
../../../../../components/glbri/glbri.h
+1
View File
@@ -0,0 +1 @@
../../../../../components/glbri/glbriConst.h
+1
View File
@@ -0,0 +1 @@
../../../../../components/hst/hst.swift
+1
View File
@@ -0,0 +1 @@
../../../../../components/hst/hstFun.swift
+1
View File
@@ -0,0 +1 @@
../../../../../components/hst/mac/hstVM.swift
@@ -0,0 +1 @@
../../../../../../components/hst/mac/view/HSTView.swift
+1
View File
@@ -0,0 +1 @@
../../../../../components/other/other.swift
@@ -0,0 +1,36 @@
#include <stdio.h>
#define TRACELOG(level, ...) do { fprintf(stderr, __VA_ARGS__); fputc('\n', stderr); } while (0)
#define GLBRI_CONST_IMPLEMENTATION
#include "glbri/glbriConst.h"
#define GLBRI_IMPLEMENTATION
#include "glbri/glbri.h"
#define RAYBRI_AUX_IMPLEMENTATION
#include "raybri/raybriAux.h"
#define RAYBRI_IMPLEMENTATION
#include "raybri/raybri.h"
#define RAYBRI_CLEAR_IMPLEMENTATION
#include "raybri/raybriClear.h"
#define RAYBRI_DRAW_AXES_IMPLEMENTATION
#include "raybri/raybriDrawAxes.h"
#define RAYBRI_DRAW_QUAD_IMPLEMENTATION
#include "raybri/raybriDrawQuad.h"
#define RAYBRI_FLUSH_IMPLEMENTATION
#include "raybri/raybriFlush.h"
#define RAYBRI_SET_COLOR_IMPLEMENTATION
#include "raybri/raybriSetColor.h"
#define RAYBRI_SETUP_2D_FRAMEBUFFER_IMPLEMENTATION
#include "raybri/raybriSetup2DFramebuffer.h"
#define RLGL_IMPLEMENTATION
#include "rlgl.h"
+1
View File
@@ -0,0 +1 @@
../../../../../components/raybri/raybri.h
+1
View File
@@ -0,0 +1 @@
../../../../../components/raybri/ios/raybriAux.h
@@ -0,0 +1 @@
../../../../../components/raybri/raybriClear.h
@@ -0,0 +1 @@
../../../../../components/raybri/raybriDrawAxes.h
@@ -0,0 +1 @@
../../../../../components/raybri/raybriDrawQuad.h
@@ -0,0 +1 @@
../../../../../components/raybri/raybriFlush.h
@@ -0,0 +1 @@
../../../../../components/raybri/raybriSetColor.h
@@ -0,0 +1 @@
../../../../../components/raybri/raybriSetup2DFramebuffer.h
@@ -0,0 +1 @@
../../../../../components/render/mac/render.swift
@@ -0,0 +1 @@
../../../../../components/render/ios/renderAux.swift
@@ -0,0 +1 @@
../../../../../components/render/mac/renderConst.swift
@@ -0,0 +1 @@
../../../ver-mac/src/render/renderDraw.swift
@@ -0,0 +1 @@
../../../../../components/render/ios/renderEffect.swift
@@ -0,0 +1 @@
../../../../../components/render/mac/renderFun.swift
@@ -0,0 +1 @@
../../../ver-mac/src/render/renderVM.swift
@@ -0,0 +1 @@
../../../../../../components/render/ios/view/RenderGLView.swift
@@ -0,0 +1 @@
../../../../../../components/render/ios/view/RenderView.swift
@@ -1,4 +1,6 @@
import RaylibBridge #if canImport(RaylibBridge)
import RaylibBridge
#endif
func renderDraw(_ vm: RenderVM) { func renderDraw(_ vm: RenderVM) {
let fbSize = [Int32(vm.pixelSize[0]), Int32(vm.pixelSize[1])] let fbSize = [Int32(vm.pixelSize[0]), Int32(vm.pixelSize[1])]