Skip to content

Commit

Permalink
Prepped for 0.8.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Perlkonig committed Dec 27, 2021
1 parent 00679a9 commit 7a5ffb2
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 19 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.8.0] - 2021-12-27

### Added

Expand Down
4 changes: 2 additions & 2 deletions docs/api/interfaces/APRenderRep.html

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions docs/api/interfaces/Glyph.html

Large diffs are not rendered by default.

54 changes: 52 additions & 2 deletions docs/renderer.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export interface APRenderRep {
colour?: string;
player?: number;
arrow?: boolean;
static?: boolean & string;
[k: string]: unknown;
}
| {
Expand All @@ -46,7 +47,6 @@ export interface APRenderRep {
G: Stashstrings;
B: Stashstrings;
Y: Stashstrings;
[k: string]: unknown;
}
| {
type: "expandedColumn";
Expand All @@ -57,7 +57,57 @@ export interface APRenderRep {
type: "localStash";
label: string;
stash: string[][];
[k: string]: unknown;
}
| {
type: "buttonBar";
buttons: [
{
label: string;
value?: string;
attributes?: [
{
name: string;
value: string;
},
...{
name: string;
value: string;
}[]
];
[k: string]: unknown;
},
...{
label: string;
value?: string;
attributes?: [
{
name: string;
value: string;
},
...{
name: string;
value: string;
}[]
];
[k: string]: unknown;
}[]
];
position?: "left" | "right";
height?: number;
minWidth?: number;
buffer?: number;
colour?: string;
}
| {
type?: "key";
list: {
piece: string;
name: string;
}[];
height?: number;
buffer?: number;
position?: "left" | "right";
noclick?: boolean;
}
)[];
board:
Expand Down
7 changes: 6 additions & 1 deletion docs/schema.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,17 @@ For the Homeworlds renderer, this is an array of arrays of ships. Ships must des

=== `areas`

This section is unique to different renderers. The default renderer ignores it.
This section is unique to different renderers.

The Homewords renderer uses this for the global stash. Provide the stash contents of each of the four colours.

The `stacking-expanding` renderer uses this to display an expanded column of pieces in a stack when requested.

There are two generic areas available to most renderers:

buttonBar:: This lets you place a clickable bar of buttons next to the board. The text of the buttons can be styled using CSS. Used in Alfred's Wyke. See the playground for an example.
key:: This places a list of glyphs next to the board with a text label. Used to aid in move entry or to convey some other useful state information. Used in Volcano. See the playground for an example.

=== `annotations`

This is how a game tells the renderer how to illustrate state changes. The following annotations are available:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@abstractplay/renderer",
"version": "0.7.0",
"version": "0.8.0",
"description": "Renders Abstract Play game states graphically",
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions src/renderers/stackingExpanding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class StackingExpandingRenderer extends RendererBase {

// Add cell name
if ( ("cell" in area) && (area.cell !== undefined) ) {
const txt = nested.text(`Cell ${area.cell as string}`);
const txt = nested.text(`Cell ${area.cell }`);
txt.font("size", "50%");
txt.move(0, (this.cellsize / 4) * -1).fill("#000");
}
Expand Down Expand Up @@ -210,7 +210,7 @@ export class StackingExpandingRenderer extends RendererBase {

// Add cell name
if ( ("cell" in area) && (area.cell !== undefined) ) {
const txt = nested.text(`Cell ${area.cell as string}`);
const txt = nested.text(`Cell ${area.cell }`);
txt.font("size", "50%");
txt.move(0, (this.cellsize / 4) * -1).fill("#000");
}
Expand Down
4 changes: 2 additions & 2 deletions test/playground.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"niche-areas-bbar": {
"name": "Niche: Areas - Button Bar",
"description": "The `areas` property also supports a button bar, which places a vertical bar of buttons to the left or right of the game board, usually for use by the click handler.",
"render": "{\"board\":{\"style\":\"squares-checkered\",\"width\":8,\"height\":8},\"legend\":{\"A\":{\"name\":\"piece\",\"player\":1},\"B\":{\"name\":\"piece\",\"player\":2}},\"pieces\":\"BBBBBBBB\\nBBBBBBBB\\n_\\n_\\n_\\n_\\nAAAAAAAA\\nAAAAAAAA\",\"areas\":[{\"type\":\"buttonBar\",\"buttons\":[{\"label\":\"This\"},{\"label\":\"is\"},{\"label\":\"a\"},{\"label\":\"really long\",\"value\":\"long\"},{\"label\":\"test\"}],\"position\":\"right\",\"buffer\":0.1}]}"
"render": "{\"board\":{\"style\":\"vertex\",\"width\":4,\"height\":4,\"tileHeight\":1,\"tileWidth\":1,\"tileSpacing\":0.5},\"legend\":{\"B\":{\"name\":\"piece-square\",\"player\":1},\"D\":{\"name\":\"piece-square\",\"player\":2},\"W1\":\"wyke-1\",\"W2\":\"wyke-2\",\"W3\":\"wyke-3\",\"W4\":\"wyke-4\",\"W5\":\"wyke-5\",\"W6\":\"wyke-6\",\"W7\":\"wyke-7\"},\"pieces\":\"W3,W6,W4,W4\\nW5,W5,W4,W4\\nW4,W4,W5,W3\\nW4,W4,W3,D\",\"annotations\":[{\"type\":\"enter\",\"targets\":[{\"row\":2,\"col\":3}]},{\"type\":\"enter\",\"targets\":[{\"row\":3,\"col\":2}]},{\"type\":\"enter\",\"targets\":[{\"row\":2,\"col\":2}]},{\"type\":\"enter\",\"targets\":[{\"row\":1,\"col\":1}]},{\"type\":\"enter\",\"targets\":[{\"row\":0,\"col\":0}]}],\"areas\":[{\"type\":\"buttonBar\",\"position\":\"left\",\"buttons\":[{\"label\":\"1-1-1-1-1\",\"attributes\":[{\"name\":\"text-decoration\",\"value\":\"line-through\"}]},{\"label\":\"2-1-1\",\"attributes\":[{\"name\":\"text-decoration\",\"value\":\"line-through\"}]},{\"label\":\"2-2\"},{\"label\":\"3-1\"},{\"label\":\"4\"}]}]}"
},
"niche-areas-key": {
"name": "Niche: Areas - Legend Key",
Expand Down Expand Up @@ -243,7 +243,7 @@
<section>
<h1>Abstract Play: Renderer Playground</h1>
<p>This is a public place for people to interact and experiment with the Abstract Play rendering engine. Use the drop-down menu to select from a list of samples, and then tweak them to your heart's content. <a href="https://github.com/AbstractPlay/renderer">See the GitHub page for documentation and a list of available glyphs.</a> It should work correctly in Chrome, Firefox, Opera, and Edge. If you encounter issues, please let us know on the GitHub page.</p>
<p>Updated to version 0.7.0.</p>
<p>Updated to version 0.8.0.</p>
</section>
<section>
<h1>JSON Input</h1>
Expand Down

0 comments on commit 7a5ffb2

Please sign in to comment.