piecepackr v1.5.1
Breaking changes
There are no user-facing breaking changes in piecepackr
's API
but the internal grid
structure of the grobs drawn/returned by grid.piece()
, pieceGrob()
, and pmap_piece()
have been changed to make it easier to query or edit the grid graphics post initial drawing
with functions like grid::grid.get()
, grid::grid.edit()
, grid::grid.reorder()
etc. (#205).
- The "grob" returned by
grid.piece()
andpieceGrob()
now has a "piece" class and "named slots" which match the arguments ofgrid.piece()
. - The new "piece" class grob only generates its content to draw at drawing time, one must use
grid::grid.force()
to view/edit its internal grob "children". - The internal grob layout for included grob functions are better named and structured to more easily generate a matching
grid::gPath
. grobPoints()
methods have been written for the "grob" returned bygrid.piece() / pieceGrob()
and the "grob" returned bypmap_piece()
.- If no unique
name
in.l
thenpmap_piece()
will now generate/replace a uniquename
by concatenatingpiece.
with a uniqueid
if it exists or if it does not then by row number
in order to better label the "children" of the returnedgTree
grob object (#223).
Deprecated functions
The following utility functions have been deprecated in favor of methods provided by the new pp_shape()
object:
checkersGrob(c, s, t, n)
, usepp_shape(s, t)$checkers(n, gp=gpar(fill=c))
instead.concaveGrobFn(n, t, r)
, usepp_shape(paste0("concave", n), t, r)$shape
instead.convexGrobFn(n, t)
, usepp_shape(paste0("convex", n), t)$shape
instead.get_shape_grob_fn(s, t, r, b)
, usepp_shape(s, t, r, b)$shape
instead.gridlinesGrob(c, s, t, l, n)
, usepp_shape(s, t)$gridlines(n, gp=gpar(col=c, lex=l))
instead.halmaGrob(...)
, usepp_shape("halma")$shape(...)
instead.hexlinesGrob(c, s, n)
, usepp_shape(s)$hexlines(n, gp=gpar(col=c))
instead.kiteGrob(...)
, usepp_shape("kite")$shape(...)
instead.matGrob(c, s, t, mw, n)
, usepp_shape(s, t)$mat(mw, n, gp=gpar(fill=c))
instead.pyramidGrob(...)
, usepp_shape("pyramid")$shape(...)
instead.
New features
-
New function
pp_shape()
returns an R6 object that provides the following methods to create
various grobs for all the "shape"'s supported bypp_cfg()
:shape()
returns a grob of the shape.mat()
returns a grob of a matting "mat" within the shape.
Its argumentmat_width
controls how "wide" the matting should be.gridlines()
returns a grob of "gridlines" within the shape.checkers()
returns a grob of "checkers" within the shape.hexlines()
returns a grob of "hexlines" within the shape.polyclip()
returns a grob that is an "intersection", "minus", "union", or "xor" of another grob.
Note unlikegridGeometry::polyclipGrob
it can directly work with apieceGrob
"clip grob" argument.
-
Default functions used by
save_piece_obj()
,piece3d()
,piece()
now support a
"top", "base", "left", and "right" side for the two-sided token components:
"bit", "board", "card", "matchstick", "pawn", "saucer", and "tile" (#135). -
Function
game_systems
now returns a "meeple" configuration with "standard" meeple "bit" pieces (#232).
Bug fixes and minor improvements
pp_cfg()
now supports a "roundrect" (rounded rectangle)shape
(#214, #229).
Curvature of the corners are controlled by theshape_r
style.pp_cfg()
now supports a "meeple" shape (#104).
Meeple coordinates were extracted from Meeple icon
by Delapouite / CC BY 3.0.pp_cfg()
now supports setting multiple styles by using a greater-than-length-one vectors
(as well as continuing to support previously-supported comma-separated strings).- The default OBJ generating function (used by the default rgl and rayrender functions)
now produces six-faced cubes for the dice component (#186). R_to_AA()
now always returns an axis-angle parameterization with positiveaxis_z
value (#219).- Fixes bug in
R_to_AA()
for some 3D rotations with an "exactly" 180 degree angle (in the axis-angle representation). AA_to_R()
now accepts an optionalaxis_z
argument and automatically normalizes the axis vector.
In particularR_to_AA(AA_to_R(...))
can now be used to normalize alternative axis-angle parameterizations
with non-unit axis vectors and/or negativeaxis_z
values.- Improved drawing of oblique projection edges for the "oval" shape (#212) and the "halma" shape (#213).
- In oblique projection obscured edges are now drawn in case of transparent backgrounds (#221).
is_color_invisible()
will now correctly classify as "invisible" colors with an alpha channel value set to 0.- The named list returned by
pp_cfg()$get_piece_opt()
now also contains aback
value indicating whether this is a back of a piece
(and hence for some shapes may need to be flipped across a vertical line) and ableed_color
value indicating a good
color for a "bleed" effect (e.g. for print-and-play layouts) (#211). - Fixes bug in "circle" shape "mat" when drawn in a non-square grid viewport.
- Fixes bug in
op_transform()
for pieces whose "shape" is a non-symmetric (across vertical axis) polygon. grid.piece()
andpmap_piece()
now returns the grob invisibly ifdraw=TRUE
as documented
(while continuing to draw the grob to the active graphics device).- By default
piece3d()
will now try to infer a reasonabletextype
value by manually checking the png texture's alpha channel.