本文へ移動

Tenka天下

2〜6人で、シードから始まる世界征服ゲームを遊べます。さいころでの戦い、カード、コンピューターの相手、ゲームの保存に対応します。

「天下」は、天の下に広がる世界を表す言葉です。 名前について(英語)

目次

リファレンス · ブラウザーの卓とSVG

tenkaMapSvg関数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

THE WORLD AS AN SVG ELEMENT, drawn from a model (tenkaMapModel): the sea, each territory in its owner's colour, the continents' borders and the sea links, the rings of a choice, and a counter of armies on each. Every territory's shape and counter carries data-territory with its number, so one listener on the element can tell which was pressed, and each shape data-owner and data-armies as well.

label is the drawing's accessible name; view the part of the map to show (continentView); pixels the drawing's width on the screen, so that counters and rings are one size whatever is shown. A territory is a button to a screen reader and can be focused (not by Tab: tabindex is -1, for the page to choose which one Tab lands on); describe words what a reader hears for each, and keys is the drawing's description.

インポート

import { tenkaMapSvg } from "@johnmorrisdotca/tenka/ui";

定義

function tenkaMapSvg(model: TenkaMapModel, options?: { label?: string; view?: TenkaView; pixels?: number; describe?: (land: TenkaLand) => string; keys?: string; }): SVGSVGElement

引数

名前型説明
modelTenkaMapModel

The map model containing outlines and army counters.

options (省略可){ label?: string; view?: TenkaView; pixels?: number; describe?: (land: TenkaLand) => string; keys?: string; }

The component, table or display options.

戻り値

SVGSVGElement

An SVG DOM element representing the model and its labels.

例

import { startTenka } from "@johnmorrisdotca/tenka";
import { tenkaMapModel, tenkaMapSvg } from "@johnmorrisdotca/tenka/ui";

const game = startTenka(10,["Seat 1","Seat 2"],42)!;
const svg = tenkaMapSvg(tenkaMapModel(game),{label:"World conquest"});
document.body.append(svg);
console.log(svg.tagName);

ソースを見るGitHub で編集@johnmorrisdotca/tenka 2.2.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。