Skip to content

Components

TechLogic edited this page Oct 13, 2013 · 9 revisions

Basic use


A component is every class that implement the GameComponent interface or extends the AbstractGameComponent class. The interface consists out of the following methods:

draw()
getComponent()
getHeight()
getWidth()
getX()
getY()
setHeight()
setWidth()
setX()
setY()

All this methods must be implemented to create a new component .

Functions


Every single component in the BaSliGc library could be decorated with this functions:

Component Factory


For decorating a component with one of the functions above a implementation of the AbstractGameComponent Factory should be used. The factory check if the compoent is already decorated with the same type and if it raise an DecoratedClassException. It also add the component to the Componentlist and the Collisionchecker if a new decoration is created.

To use the factory simply call the creation method of the specific decoration and as a parameter the GameComponent which should be decorated.

 createClickable(GameComponent)
 createDragable(GameComponent)
 createSolid(GameComponent)

A list of all Components


Clone this wiki locally