From: Ian Jackson Date: Sun, 23 May 2021 00:45:54 +0000 (+0100) Subject: docs: wip document shapelibs, move from shapelib-toml X-Git-Tag: otter-0.6.0~36 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=b55ece67198f22ca676baa4a419828ef3ad12033;p=otter.git docs: wip document shapelibs, move from shapelib-toml Signed-off-by: Ian Jackson --- diff --git a/docs/shapelibs.rst b/docs/shapelibs.rst index 8b0bb031..390fe081 100644 --- a/docs/shapelibs.rst +++ b/docs/shapelibs.rst @@ -184,3 +184,15 @@ Parameters to ``size``. If both ``size`` and ```orig_size`` are 2 elements, this can scale by different amounts in x and y, distorting the image. + + * ``centre`` [2-element array]. The centre of the image, measured + from the top left in the image's own internal units. If not + supplied, calculated from the size. + + * ``flip`` [boolean, default: false]. Whether this piece can "flip". + If true, the piece will have two faces, one of which is a mirror + image of the other. The default face will be un-reflected version; + the other face is the same image, but flipped left-to-right. It + doesn't make sense to enable this for pieces with a symmetrical + appearance. (It is a bad idea to have the game contain state which + is not visible to the players.) diff --git a/src/shapelib-toml.rs b/src/shapelib-toml.rs index 89d581e9..7bea1e28 100644 --- a/src/shapelib-toml.rs +++ b/src/shapelib-toml.rs @@ -23,14 +23,8 @@ pub struct GroupDetails { #[cfg(doc)]inherit: String, // handled specially pub size: Vec, // scaled when put into GroupData #[serde(default)] pub orig_size: Vec, - - #[serde(default)] - /// Default if not supplied is the centre according to the size. - pub centre: Option<[f64; 2]>, - - #[serde(default)] - /// Default is `false` - pub flip: bool, + #[serde(default)] pub centre: Option<[f64; 2]>, + #[serde(default)] pub flip: bool, /// The back of this is some other item. Doesn't make sense /// with `flip`.