@ankhorage/zora-game 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +75 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -3,10 +3,84 @@
|
|
|
3
3
|
|
|
4
4
|
# @ankhorage/zora-game
|
|
5
5
|
|
|
6
|
-
         
|
|
7
7
|
|
|
8
8
|
Generic game presentation primitives for React Native and React Native Web apps built on ZORA.
|
|
9
9
|
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
Use @ankhorage/game for serializable gameplay semantics and @ankhorage/zora-game for the React Native / React Native Web presentation edge. Embed Game in ordinary ZORA layout, render session state with GameEntity and overlays, and add input/measurement adapters only where the platform needs them.
|
|
13
|
+
|
|
14
|
+
### Embed a config-driven Game inside ordinary ZORA content.
|
|
15
|
+
|
|
16
|
+
Game owns the local platform-neutral session, GameEntity renders positioned presentation, and
|
|
17
|
+
GameOverlay composes HUD/feedback content. Set `fill` when the surrounding layout should give
|
|
18
|
+
the game all available space; no dedicated GameScreen runtime type is required.
|
|
19
|
+
|
|
20
|
+
Source: `examples/basic-game-presentation/App.tsx`
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import {
|
|
24
|
+
AppBar,
|
|
25
|
+
AppShell,
|
|
26
|
+
Screen,
|
|
27
|
+
ScreenSection,
|
|
28
|
+
Text,
|
|
29
|
+
ZoraProvider,
|
|
30
|
+
type ZoraTheme,
|
|
31
|
+
} from '@ankhorage/zora';
|
|
32
|
+
import { Game, GameEntity, GameOverlay } from '@ankhorage/zora-game';
|
|
33
|
+
|
|
34
|
+
const gameTheme: ZoraTheme = {
|
|
35
|
+
id: 'basic-game-presentation',
|
|
36
|
+
name: 'Basic game presentation',
|
|
37
|
+
appCategory: 'games',
|
|
38
|
+
primaryColor: '#2563eb',
|
|
39
|
+
harmony: 'analogous',
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const definition = {
|
|
43
|
+
id: 'orb-field',
|
|
44
|
+
initialPhase: 'playing',
|
|
45
|
+
initialState: { score: 0 },
|
|
46
|
+
stages: [{ id: 'round' }],
|
|
47
|
+
rules: [],
|
|
48
|
+
} as const;
|
|
49
|
+
|
|
50
|
+
export default function BasicGamePresentationApp() {
|
|
51
|
+
return (
|
|
52
|
+
<ZoraProvider initialMode="light" theme={gameTheme}>
|
|
53
|
+
<AppShell header={<AppBar title="Orb field" subtitle="Generic embeddable game UI" />}>
|
|
54
|
+
<Screen>
|
|
55
|
+
<ScreenSection
|
|
56
|
+
title="Mini-game region"
|
|
57
|
+
description="The game lives beside ordinary screen content."
|
|
58
|
+
>
|
|
59
|
+
<Text emphasis="muted">
|
|
60
|
+
Game rules stay in @ankhorage/game; this package owns presentation and input adapters.
|
|
61
|
+
</Text>
|
|
62
|
+
<Game definition={definition} aspectRatio={1.4} minHeight={320}>
|
|
63
|
+
<GameEntity x={18} y={28} accessibilityLabel="Blue orb">
|
|
64
|
+
<Text>●</Text>
|
|
65
|
+
</GameEntity>
|
|
66
|
+
<GameEntity x={68} y={52} scale={1.4} accessibilityLabel="Large orb">
|
|
67
|
+
<Text>◆</Text>
|
|
68
|
+
</GameEntity>
|
|
69
|
+
<GameEntity x={46} y={78} accessibilityLabel="Player marker">
|
|
70
|
+
<Text>▲</Text>
|
|
71
|
+
</GameEntity>
|
|
72
|
+
<GameOverlay placement="top" padding={12}>
|
|
73
|
+
<Text>Score 0 / 5</Text>
|
|
74
|
+
</GameOverlay>
|
|
75
|
+
</Game>
|
|
76
|
+
</ScreenSection>
|
|
77
|
+
</Screen>
|
|
78
|
+
</AppShell>
|
|
79
|
+
</ZoraProvider>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
10
84
|
## Generated documentation
|
|
11
85
|
|
|
12
86
|
- [Interactive documentation app](././paradox/index.html)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/zora-game",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Generic game presentation primitives for React Native and React Native Web apps built on ZORA.",
|
|
6
6
|
"homepage": "https://github.com/ankhorage/zora-game#readme",
|