Author: | Unspecified |
Home Page: | |
Version: | Unspecified |
Release Tag: | $ |
Release Date: | 2000/04/11 01:15:36 |
JVM Required: | 1.1 |
License: | GNU Library General Public License |
Categories: | None |
Requirements: | |
Dependencies: | No dependencies |
Externals: | None |
A framework for implementing 2D tiled board games. These have a 2D structure where each tile is the same shape, and "tiles" the 2D plain in the mathematical sense (fills it with no gaps). Squares, hexagons, and diamonds are tile shapes.
GamePiece
Tile
TiledBoard
. TiledBoard
JComponent
subclass for displaying a tiled board. An initial implementation displays only square tiles; an advanced would use the Java 2D API to allow diamonds, hexagons, and so on. TiledBoardModel
Several methods have signatures of the form
SomeType getSomething(SomeType x, ...)To allow for flyweight implementations of
SomeType
, these methods have the option to create and return new objects only if parameter x
is null; otherwise they can store their results in pre-existing x
and return x
. It should be possible, using these techniques, to implement gigantic virtual boards represented as an array of bytes, indexing into a small table of tile types. Objects would only be needed for playing pieces and whatever special features existed on certain tiles, plus the few tiles currently displayed. To get some small type security with minimal overhead, coordinates are represented as a pair of short
integers or as a single int
encoding both, and directions are represented as a byte
.