Apple Watch 向けのゲームを作る

Digital Crown でマーカーを動かします。各フレームはウォッチの runGame コールバックで処理します。

main.ts
import { initWindow, runGame, clearBackground, Colors } from "@bloomengine/engine";
import { getCrownRotation, getScreenWidth } from "@bloomengine/engine/core";
import { drawCircle } from "@bloomengine/engine/shapes";

initWindow(180, 180, "Bloom");
let x = 90;
runGame(() => {
  x = Math.max(8, Math.min(getScreenWidth() - 8, x + getCrownRotation() * 20));
  clearBackground(Colors.BLACK);
  drawCircle(x, 90, 8, Colors.GREEN);
});

現在の対応状況

watchOS では 2D を Canvas、3D を SceneKit が描画します。Jolt 物理演算とデスクトップの遅延レンダラーは使えません。

よくある質問

実機で遊べる公開作品はありますか?

App Store に Bloom Jump Watch 専用のページがあります。

出典