Package fr.iut.tetris.models
Class BlockModel
- java.lang.Object
-
- fr.iut.tetris.models.BlockModel
-
public class BlockModel extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description java.awt.image.BufferedImage
base_image
java.awt.Color
color
java.awt.image.BufferedImage
image
PieceModel
parent
java.awt.Dimension
size
java.awt.Point
standAlonePos
-
Constructor Summary
Constructors Constructor Description BlockModel(java.awt.Color color)
BlockModel(java.awt.Color color, java.awt.image.BufferedImage base_image, java.awt.Dimension size, java.awt.Point standAlonePos, PieceModel parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BlockModel
clone()
void
recalculate()
Recalculate the piece color based on the stored color variable(package private) void
setBaseImage()
Load the image of the blockvoid
setParent(PieceModel parent)
Set to which piece this perticular block is linkedvoid
setSize(java.awt.Dimension size)
Change the size of the block (used for the image calculation)
-
-
-
Field Detail
-
color
public java.awt.Color color
-
image
public java.awt.image.BufferedImage image
-
base_image
public java.awt.image.BufferedImage base_image
-
size
public java.awt.Dimension size
-
standAlonePos
public java.awt.Point standAlonePos
-
parent
public PieceModel parent
-
-
Constructor Detail
-
BlockModel
public BlockModel(java.awt.Color color)
-
BlockModel
public BlockModel(java.awt.Color color, java.awt.image.BufferedImage base_image, java.awt.Dimension size, java.awt.Point standAlonePos, PieceModel parent)
-
-
Method Detail
-
setSize
public void setSize(java.awt.Dimension size)
Change the size of the block (used for the image calculation)- Parameters:
size
- the size
-
setParent
public void setParent(PieceModel parent)
Set to which piece this perticular block is linked- Parameters:
parent
- the piece
-
setBaseImage
void setBaseImage()
Load the image of the block
-
recalculate
public void recalculate()
Recalculate the piece color based on the stored color variable
-
clone
public BlockModel clone()
- Overrides:
clone
in classjava.lang.Object
-
-