Skip to content

Images (Generally)

ddyer0 edited this page Feb 16, 2024 · 1 revision

Boardspace uses it's own image class, lib.Image, which encapsulates the standard java image class, and provides some useful abstractions that the standard image class does not. Boardspace images are always loaded, have a well defined size, and are always ready to draw.

The external representation of Boardspace images are either jpg or png images. Most jpg images are in pairs, "imagename.jpg" and "imagename-mask.jpg". Most of the image loading functions expect this naming convention. Images named "imagename-nomask" will be loaded without looking for a mask file.

Using this separate image+mask file structure has a number of advantages.

  • the combined size of image+mask is typically smaller than a single png
  • the separate image and mask images are easier to manipulate in photoshop
  • it's possible to use the same mask for many images (ie; a whole deck cards)

Generally speaking, the images should be larger than they need to be, and are automatically scaled down to the actual size needed, and both the original and scaled images are managed automatically to keep the memory footprint reasonably small.

There are a bunch of stock images in found in /lib/stockart There are collections of dice in /boardspace-games/dice/ There are collections of markers and stones in /boardspace-games/stones/

Generally speaking, each game has a preloadImages() function which is called as the game is started, and should prepare all the images needed for the game. For the most part, the actual images are loaded into a per-game subclass which will inherent from /online/game/chip

Clone this wiki locally