save_promo_image: Save promo image of game

View source: R/save_promo_image.R

save_promo_imageR Documentation

Save promo image of game

Description

save_promo_image() saves a promo image of a game. This is usually just a starting diagram for the game but sometimes we may create a custom image.

Usage

save_promo_image(game, gk = game_kit(), file = NULL, ...)

Arguments

game

Game name. Will be normalized by normalize_name().

gk

A game_kit R6 object.

file

Filename for the image. If NULL we'll generate a pdf image with an appropriate name given game.

...

Passed to piecepackr::render_piece().

Details

If we haven't created a custom image for this game then basically we'll convert the game name to snake case, prepend a "df_" in front and then dynGet() a function with that name and use the resulting data frame with piecepackr::render_piece(). See df_game for list of games directly supported by this package.

Value

A list with the width, height, and filename of the promo image. As a side effect we save an image to disk.

Examples

file <- tempfile(fileext = ".pdf")
whf <- save_promo_image("Fuji-san", gk = game_kit(), file = file)
print(whf)
unlink(whf$file)

piecepackr/ppgames documentation built on Jan. 17, 2025, 2:24 p.m.