mountKarakuri関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
Plays one game of the package in host: a canvas that scales to the box it is given, the pointer (finger or mouse)
wired to the game, a fixed-step loop that runs only while something moves, and (with ui: "full") the bar, the buttons and the card that
says how a level ended. Safe to call again on the same host: the old game is taken down first.
The focused canvas accepts arrows, Enter/Space, Escape and Home when keyboard is enabled.
インポート
import { mountKarakuri } from "@johnmorrisdotca/karakuri/play";
定義
function mountKarakuri(host: HTMLElement, options: MountOptions): KarakuriMount
引数
| 名前 | 型 | 説明 |
|---|---|---|
host | HTMLElement | The element that owns this player's canvas and controls. |
options | MountOptions | Native game/controller, presentation, clock and lifecycle choices. |
戻り値
KarakuriMount
A handle for reading the controller, changing levels/language, stepping, fitting and cleanup.
例
import { mountKarakuri } from "@johnmorrisdotca/karakuri/play";
if (typeof document !== "undefined") {
const player = mountKarakuri(document.createElement("div"), { game: "tube-sort", clock: "manual" });
player.destroy();
}
console.log(typeof mountKarakuri);function出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。