GameComponentViews

Table of contents
  1. Prior knowledge
  2. Introduction
  3. Generic Token
  4. Cards
  5. Dice
  6. Hexagons

Prior knowledge

All GameComponentViews inherit from ComponentView and DynamicView. It is therefore helpful to read those documentations first as the features from those superclasses don’t get repeated here.

Introduction

GameComponentViews are used to model interactive game elements like cards, meeples or any other form of game tokens. GameComponentViews can be added to GameComponentContainers and be made draggable as explained in this tutorial. Helpful animations can be found here

Generic Token

For a generic token use TokenView. It takes its position and dimensions as well as one visual as a constructor parameter.

Cards

For cards use CardView. It by default takes a front and back visual and offers additional functions to handle the card. As cards are a common concept, there exists a CardStack especially for CardViews. For card hands, a LinearLayout may become handy.

The CardView can also be used for other two-sided tokens.

Dice

The DiceView class takes a list of visuals for its sides. It is not limited to a D6 and has the exact amount of sides as it has visuals, where the visual at index i is the i-1th side e.g. the visual at index 0 is side 1. If the list of visuals gets altered the amount of sides changes too.

For a dice roll there exists a dedicated DiceAnimation.

Hexagons

The HexagonView component can also be utilized for hexagonal tokens, providing a versatile solution for displaying various hexagonal-shaped elements.

A Hexagon by default has its tips pointing up and down (HexOrientation.POINTY_TOP). It can however also have its tips pointing left and right (HexOrientation.FLAT_TOP).

Hexagons only have one visual.