This commit is contained in:
kornerr committed 2026-11-11 11:44:35 +03:00
1 parent 51bd709c2f
commit 868fe386cc
5 files changed
+7 -7

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@ Remote: `https://git.opengamestudio.org/mahjong/mahjong`.
## Apps
- `hello/hello-selection/` — macOS continuation of hello-raylib: four rlgl quads
with IDs 1–4 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
enabled; Android/Kotlin support is deferred. Source ownership, coordinates,
build commands and mirroring boundaries are in section 13 of
+1 -1
View File
@@ -23,5 +23,5 @@ func hstItemId(
x >= item.x && x < item.x + item.width &&
y >= item.y && y < item.y + item.height
}
return index.map { $0 + 1 } ?? 0
return index ?? -1
}
+3 -3
View File
@@ -979,7 +979,7 @@ 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
Context/Component/VM names. The app displays four
light-colored rlgl quads over the existing blue background. IDs run left to
right, top to bottom: 1, 2, 3, 4. The centered native label starts as
right, top to bottom: 0, 1, 2, 3. The centered native label starts as
hello-selection and becomes the clicked quad's ID. Clicking a gap or outside the
grid leaves the label unchanged. This sample has no pair matching or textures
loaded from image assets yet.
@@ -1040,7 +1040,7 @@ HSTItem is generated from dialect.yml. The app keeps hstGenerateItems and
hstItemId in components/hst/hstFun.swift as an exception for helpers that use
this generated value type. Launch initializes HSTContext.items and publishes the
same array to HSTVM for drawing. Four 100x100-unit tiles have 25-unit gaps and are
centered at scene (0, 0). IDs are one-based array positions. Hit regions include
centered at scene (0, 0). IDs are zero-based array indices. Hit regions include
left/top edges and exclude right/bottom edges.
RenderContext owns cameraPosition and cameraZoom. Launch rules initialize them
@@ -1056,7 +1056,7 @@ backing pixels, then supplies framebuffer size, camera position and scale to
renderCoordFBtoSC for scene coordinates. The resulting
pointerDownPos is forwarded to HST; HST no longer needs viewport bounds.
hstItemId takes the current item array and scene position.
It returns 0 for a miss; HST's YAML rule accepts positive IDs only. A miss still
It returns -1 for a miss, which HST's YAML rule treats as invalid. A miss still
forwards the pointer event but leaves selection and title unchanged.
Render's drawing helper uses renderCoordSCtoFB for rectangle origins and
+1 -1
View File
@@ -37,7 +37,7 @@ HSTComponent:
1. Upon pointer down:
if:
c.recentField == F.pointerDownPos &&
hstItemId(c.items, c.pointerDownPos) > 0
hstItemId(c.items, c.pointerDownPos) != -1
then:
c.selectedItemId = hstItemId(c.items, c.pointerDownPos)
title:
@@ -404,7 +404,7 @@ func hstShouldResetSelectedItemId(_ c: HSTContext) -> HSTContext {
/* 1. Upon pointer down */
if
c.recentField == F.pointerDownPos &&
hstItemId(c.items, c.pointerDownPos) > 0
hstItemId(c.items, c.pointerDownPos) != -1
{
c.selectedItemId = hstItemId(c.items, c.pointerDownPos)
c.recentField = F.selectedItemId