Compare commits

...
2 Commits
Author SHA1 Message Date
waozi 3cead1f217 Release Apfelwurm 0.2.2
Entity ca637d0 saves account aliases typed with capitals, an @ or spaces
and says when an alias is taken.
2026-10-27 02:11:20 -03:00
waozi 941c0c1b73 Use host navigation and accounts when Apfelwurm is embedded 2026-10-26 23:26:06 -03:00
12 changed files with 223 additions and 32 deletions

No files matched your search

+9
View File
@@ -1,5 +1,14 @@
# Changelog
## [0.2.2] - 2026-10-27
- Set an account alias with capitals, an @ or spaces; a taken alias now says so.
## [0.2.1] - 2026-10-26
- Use Arcade or Inner Breeze's Profile, Dew and navigation when playing inside them, without duplicate title controls or an extra Back button.
- Open the shared Profile reliably from the skin shop's sign-in button.
## [0.2.0] - 2026-10-26
- Play with softer Dusk, Forest and Sage themes, with saved sound and control settings.
+2
View File
@@ -75,6 +75,8 @@ other version. Playtest always uses the selected layout.
Open **Settings** on the title to choose the softer Dusk, Forest or Sage theme,
change controls or switch sound on and off. **Profile** uses the same account
system as Shovey: create an account, import your key or link another device.
Inside Arcade or Inner Breeze, the host supplies Profile, Dew and navigation;
the game's title keeps Shop and Settings without duplicating those controls.
Completion marks, active playtime, preferences and your chosen skin follow the
signed-in account. Guest progress and each account stay separate. Your
unfinished run and personal editor records stay on this device.
+15 -9
View File
@@ -207,7 +207,6 @@ GameSecondaryPointer :: (session: Session) -> Input.SecondaryPointerFrame {
}
}
AtTitle :: () -> bool { return game.mode == MODE_STAGES }
NavigateBack :: (now: s64) -> bool {
if game.mode == MODE_STAGES { return false }
HandleInput(Input.KeyEscape, now)
@@ -292,15 +291,22 @@ DewText :: () -> string {
TitleActions :: (session: Session, area: Rectangle) {
right := area.x + area.width - 12.0
top := area.y + 12.0
if Button(session, ButtonProps.{.key = 28000, .bounds = Rectangle.{right - 220.0, top, 44.0, 44.0},
shop_right := right - 176.0
#if #defined(WURM_PORTABLE) {
// Embedded games use the enclosing host's navigation and account UI.
shop_right = right - 48.0
}
if Button(session, ButtonProps.{.key = 28000, .bounds = Rectangle.{shop_right - 44.0, top, 44.0, 44.0},
.label = Locale.Text("Skin shop"), .icon_only = true, .icon_shape = "S1.8rr:M5 8H19L20 21H4ZM8 8V6C8 1 16 1 16 6V8",
.class_name = 11}) != 0 { game.mode = MODE_SHOP; Wardrobe.poll_at = 0; unused Account.Service("entity.game-shop", "refresh") }
if Button(session, ButtonProps.{.key = 28001, .bounds = Rectangle.{right - 168.0, top, 68.0, 44.0},
.label = DewText(), .icon_shape = DewIcon.Shape,
.class_name = 11}) != 0 { Account.OpenProfile() }
if Button(session, ButtonProps.{.key = 28002, .bounds = Rectangle.{right - 92.0, top, 44.0, 44.0},
.label = Locale.Text("Profile"), .icon_only = true, .icon_shape = ProfileIcon.Shape,
.class_name = 11}) != 0 { Account.OpenProfile() }
#if !#defined(WURM_PORTABLE) {
if Button(session, ButtonProps.{.key = 28001, .bounds = Rectangle.{right - 168.0, top, 68.0, 44.0},
.label = DewText(), .icon_shape = DewIcon.Shape,
.class_name = 11}) != 0 { Account.OpenProfile() }
if Button(session, ButtonProps.{.key = 28002, .bounds = Rectangle.{right - 92.0, top, 44.0, 44.0},
.label = Locale.Text("Profile"), .icon_only = true, .icon_shape = ProfileIcon.Shape,
.class_name = 11}) != 0 { Account.OpenProfile() }
}
if Button(session, ButtonProps.{.key = 28003, .bounds = Rectangle.{right - 44.0, top, 44.0, 44.0},
.label = Locale.Text("Settings"), .icon_only = true, .icon_shape = "S1.8rr:M4 6H20M4 12H20M4 18H20M8 3V9M16 9V15M10 15V21",
.class_name = 11}) != 0 { game.mode = MODE_SETTINGS }
@@ -407,7 +413,7 @@ DrawShop :: (session: Session, area: Rectangle) {
width := area.width - 32.0
if width > 360.0 { width = 360.0 }
x := area.x + (area.width - width) / 2.0; y := area.y + 112.0
Character(session, 28310, Rectangle.{x + width / 2.0 - 26.0, y, 52.0, 52.0}, id, true)
Character(session, 28320, Rectangle.{x + width / 2.0 - 26.0, y, 52.0, 52.0}, id, true)
GameText(session, 28311, SkinName(id), Rectangle.{x, y + 68.0, width, 28.0}, 22, false, true)
price := SkinPriceText(id)
GameText(session, 28312, price, Rectangle.{x, y + 106.0, width, 24.0}, 18, false, true)
-7
View File
@@ -1,9 +1,5 @@
#import "apps/node_types"
#import "kryon/geometry"
#import "kryon/button_widget"
#import "kryon/button_props"
#import "kryon/control_props"
#import "translations"
App :: #import, file "app.zi";
Runtime :: #import "portable_runtime";
Locale :: #import, file "localization.zi";
@@ -25,9 +21,6 @@ Main :: () -> s32 {
area := Rectangle.{0.0, cast(float32)frame.top, cast(float32)frame.width,
cast(float32)(frame.height - frame.top - frame.bottom)}
message.succeeded = App.Frame(frame.session, area) == 0
if App.AtTitle() && Button(frame.session, ButtonProps.{.key = cast(u64)900001,
.label = GameLocaleText(message.locale, "wurm_back"), .bounds = Rectangle.{12.0, area.y + 68.0, 84.0, 48.0},
.tone = ButtonTone.ButtonToneNeutral, .emphasis = ButtonEmphasis.ButtonEmphasisSoft}) != 0 { Runtime.Leave() }
}
if message.action == APP_BACK {
message.succeeded = App.NavigateBack(Runtime.MonotonicMilliseconds())
-1
View File
@@ -35,4 +35,3 @@ WriteLevel :: (name: string, bytes: []u8) -> bool {
return SaveAppRecordHost(name, TextView(text[:bytes.count * 2]))
}
RemoveLevel :: (name: string) -> bool { return SaveAppRecordHost(name, "") }
Leave :: () { unused AppServiceHost("arcade.navigation", "back") }
+7
View File
@@ -111,6 +111,13 @@ def main():
command('press', label='Buy', index=0, visible=1, enabled=1)
nodes = tree('confirm-' + size)
assert 'Sign in' in [node['label'] for node in nodes]
press('Sign in')
nodes = tree('shop-profile-' + size)
assert all(label in [node['label'] for node in nodes] for label in
('Profile', 'Import key', 'Link from another device')), 'Shop sign-in must open shared Profile'
press('Back')
nodes = tree('confirm-return-' + size)
assert 'Sign in' in [node['label'] for node in nodes]
press('Cancel')
press('Back')
press('Profile')
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env python3
"""Run the real portable entry with a private host account and retained UI tree."""
from pathlib import Path
import subprocess
import sys
ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT / 'tools'))
from account_build import environment, package
def main():
env = environment()
toolchain, kryon = package('ziran'), package('kryon')
command = [str(toolchain / 'build/bin/ziran'), 'build', '--root', str(ROOT / 'src'),
'--module-path', str(ROOT / 'tests'), '--module-path', str(ROOT / 'src'),
'--module-path', 'kryon=' + str(kryon / 'src/ui'),
'--module-path', 'kryon=' + str(kryon / 'src/backend'),
'--module-path', str(kryon / 'src/ui'),
'--module-path', 'std=' + str(toolchain / 'std'),
'--module-path', str(toolchain / 'std')]
for name in ('apps', 'mingcute', 'entity'):
command += ['--module-path', name + '=' + str(package(name) / 'src')]
command += ['--define', 'WURM_PORTABLE', '--target=c', '--entry', 'hosted_test:main',
'--exe', '-o', str(ROOT / 'build/hosted-test'), str(ROOT / 'tests/hosted_test.zi')]
subprocess.run(command, cwd=ROOT, env=env, check=True)
subprocess.run([str(ROOT / 'build/hosted-test/hosted_test')], cwd=ROOT, env=env, check=True)
if __name__ == '__main__':
main()
+137
View File
@@ -0,0 +1,137 @@
#import "kryon/session"
#import "kryon/tree"
#import "kryon/tree_input"
#import "kryon/tree_draw"
#import "kryon/geometry"
#import "kryon/widget_kind"
#import "kryon/input_protocol"
#import "kryon/pixmap"
#import "apps/node_types"
#import "std/text_buffer"
#import "std/vec"
Portable :: #import, file "../src/portable.zi";
Account :: #import, file "../src/account.zi";
Progress :: #import, file "../src/progress.zi";
using WidgetKind;
message: AppMessage;
frame: AppUiFrame;
profile_opens: s32;
balance_reads: s32;
failures: s32;
connected: bool = true;
host_account :: "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
answer: [256]u8;
pointer: PointerFrame;
#program_export
ReadAppHost :: () -> AppMessage { return message }
#program_export
WriteAppHost :: (value: AppMessage) { message = value }
#program_export
ReadAppUiHost :: () -> AppUiFrame { return frame }
#program_export
AppKeyHost :: () -> s32 { return 0 }
#program_export
PollPointer :: () -> PointerFrame { return pointer }
#program_export
AppSoundHost :: (name: string) -> bool { unused name; return true }
#program_export
AppRecordHost :: (name: string) -> string { unused name; return "" }
#program_export
SaveAppRecordHost :: (name: string, value: string) -> bool { unused name; unused value; return true }
#program_export
AppServiceHost :: (name: string, request: string) -> string {
if name == "entity.profile" && request == "open" { profile_opens += 1; return "available" }
if name == "entity.records" {
if request == "{\"operation\":\"status\"}" {
out: Vec(u8)
BuilderPrint(*out, "{\"status\":\"done\",\"account\":\"%\"}", ifx connected then host_account else "")
text := BuilderFinish(out)
for byte, index: text { answer[index] = byte }
answer[text.count] = 0
return TextUntilNul(answer[:])
}
return "{\"status\":\"missing\"}"
}
if name == "entity.dew" {
if request == "balance" { balance_reads += 1; return "{\"units\":123000000}" }
return "{\"status\":\"done\",\"owned\":0}"
}
return ""
}
Expect :: (ok: bool, reason: string) {
if !ok { print("FAIL: %\n", reason); failures += 1 }
}
Draw :: () {
frame.now += 0.1
Expect(cast(s32)BeginFrame(frame.session, 1, Rectangle.{0.0, 0.0, cast(float32)frame.width, cast(float32)frame.height}) == 0, "start hosted frame")
message.action = APP_FRAME
unused Portable.Main()
Expect(message.succeeded && cast(s32)EndFrame(frame.session) == 0, "hosted frame accepted")
}
Find :: (label: string) -> s32 {
for index: cast(s32)0..TreeCount(frame.session) - 1 {
node := TreeNodeAt(frame.session, index)
if node.kind == WidgetKindButton && node.semantic_label == label { return index }
}
return -1
}
Click :: (label: string) {
index := Find(label)
Expect(index >= 0, label)
if index < 0 { return }
bounds := TreeNodeAt(frame.session, index).bounds
pointer = PointerFrame.{bounds.x + bounds.width / 2.0, bounds.y + bounds.height / 2.0, true, true, false}
unused TreePointerUpdate(frame.session, pointer)
Draw()
pointer.down = false; pointer.pressed = false; pointer.released = true
unused TreePointerUpdate(frame.session, pointer)
Draw()
pointer.released = false
unused TreePointerUpdate(frame.session, pointer)
Draw()
}
#program_export
main :: () -> s32 {
message.abi = MODULE_ABI
message.locale = "en"
frame.session = SessionOpen()
frame.top = 56
frame.now = 1.0
for portrait: 0..1 {
frame.width = ifx portrait == 1 then 390 else 844
frame.height = ifx portrait == 1 then 844 else 390
Draw()
Expect(Find("Play") >= 0 && Find("Skin shop") >= 0 && Find("Settings") >= 0, "hosted title retains play, shop and settings")
Expect(Find("Back") < 0 && Find("Profile") < 0 && Find("123") < 0, "host owns title navigation and account controls")
Expect(balance_reads == 0, "hosted title does not duplicate the host wallet")
Expect(TextUntilNul(Progress.owner[:]) == host_account, "game uses the enclosing host account")
message.action = APP_BACK
unused Portable.Main()
Expect(!message.succeeded, "title Back is left to the enclosing host")
Click("Settings")
Expect(Find("Back") >= 0, "settings retains its in-game Back")
message.action = APP_BACK
unused Portable.Main()
Expect(message.succeeded, "settings Back returns inside the game")
Draw()
Click("Skin shop")
Expect(Find("Buy") >= 0, "shop remains available inside a host")
message.action = APP_BACK
unused Portable.Main()
Expect(message.succeeded, "shop Back returns inside the game")
Draw()
}
connected = false
Progress.poll_at = 0
Draw()
Click("Skin shop")
Click("Buy")
Expect(Find("Sign in") >= 0, "signed-out shop offers the host sign-in")
Click("Sign in")
Expect(profile_opens == 1 && !Account.ProfileVisible(), "profile requests open the enclosing host profile")
Expect(SessionClose(frame.session), "close hosted test session")
print("Hosted UI local test failures: %\n", failures)
return failures
}
+6
View File
@@ -0,0 +1,6 @@
// The hosted title/settings/shop probe never starts a campaign board.
BundledLevel :: (level: s32, output: []u8) -> s64 {
unused level
unused output
return -1
}
+1
View File
@@ -29,6 +29,7 @@ ziran build $lock --project --root tests --target=c --entry progress_test:main -
build/progress-test/progress_test
ziran build $lock --project --root tests --define WURM_ACCOUNT_TEST --target=c --entry account_test:main --exe -o build/account-test tests/account_test.zi
build/account-test/account_test
python3 tests/hosted_test.py
ziran build $lock --project --root tests --target=c --entry editor_test:main --exe -o build/editor-test tests/editor_test.zi
build/editor-test/editor_test
ziran build $lock --project --root tests --target=c --entry level_probe:main --exe -o build/level-probe tests/level_probe.zi
+2 -2
View File
@@ -1,4 +1,4 @@
{
"version": "0.2.0",
"version_code": 10
"version": "0.2.2",
"version_code": 12
}
+13 -13
View File
@@ -3,7 +3,7 @@
"packages": [
{
"commit": "dc1cfe389905c63c0bb453727d06d72afc1fa0b0",
"dependencies": {"crypto": "pc23fbf455e97614d", "kryon": "peb24c24393004f5f"},
"dependencies": {"crypto": "pc23fbf455e97614d", "kryon": "p3127065409ca96f6"},
"id": "p00b93f1ddcd2802f",
"name": "Apps",
"ref": "master",
@@ -17,6 +17,14 @@
"ref": "master",
"url": "https://github.com/ziranlang/qrcode.git"
},
{
"commit": "0931212f92d5f1a3f8b1be80abab7a9695bda50e",
"dependencies": {"raylib": "p5a77c9c35110e925"},
"id": "p3127065409ca96f6",
"name": "kryon",
"ref": "master",
"url": "https://github.com/kryonlabs/kryon.git"
},
{
"commit": "e1f480f382d9443c4412133b55948374c77a5c21",
"dependencies": {},
@@ -27,9 +35,9 @@
"url": "https://github.com/open-quantum-safe/liboqs.git"
},
{
"commit": "91ef8713174a1d88106dd8ea2293ef8d46f8ee66",
"dependencies": {"daochi_client": "p9972fcdd2d5ba999", "kryon": "peb24c24393004f5f", "monocypher": "p809b4d31a48625a3", "qrcode": "p0dfa70137405b096"},
"id": "p4d0db653f861a40d",
"commit": "ca637d08b0d6b54ab6bb56bbfd9a25d7fb70f56c",
"dependencies": {"daochi_client": "p9972fcdd2d5ba999", "kryon": "p3127065409ca96f6", "monocypher": "p809b4d31a48625a3", "qrcode": "p0dfa70137405b096"},
"id": "p52862c0351d05875",
"name": "Entity",
"ref": "master",
"url": "https://github.com/waozixyz/entity.git"
@@ -83,18 +91,10 @@
"name": "mingcute",
"ref": "master",
"url": "https://github.com/kryonlabs/mingcute.git"
},
{
"commit": "65d207e21ebc8969c920d7d495d448db1e90d849",
"dependencies": {"raylib": "p5a77c9c35110e925"},
"id": "peb24c24393004f5f",
"name": "kryon",
"ref": "master",
"url": "https://github.com/kryonlabs/kryon.git"
}
],
"root": {
"dependencies": {"apps": "p00b93f1ddcd2802f", "entity": "p4d0db653f861a40d", "kryon": "peb24c24393004f5f", "mingcute": "pe1027b9d16704793"},
"dependencies": {"apps": "p00b93f1ddcd2802f", "entity": "p52862c0351d05875", "kryon": "p3127065409ca96f6", "mingcute": "pe1027b9d16704793"},
"name": "Apfelwurm"
},
"toolchain": {