com.codingame.gameengine.module.entities.BlendableEntity Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of module-entities Show documentation
Show all versions of module-entities Show documentation
Entity Manager module for the CodinGame engine toolkit. Simplify the management of shapes and drawings.
package com.codingame.gameengine.module.entities;
/**
* Any PIXI Entity that can be attributed a BlendMode
.
*
* @param a subclass inheriting Entity, used in order to return this as a T instead of a BlendableEntity
.
*/
public abstract class BlendableEntity> extends Entity {
/**
* The list of supported PIXI blend modes and their associated constant.
*
* @see PIXI BLEND_MODES
*/
public static enum BlendMode {
/**
* No pixel blend, only the values of the top layer are kept.
*/
NORMAL(0),
/**
* Adds pixel values of one layer with the other.
*/
ADD(1),
/**
* Multiplies the numbers for each pixel of the top layer with the corresponding pixel for the bottom layer. The result is a darker picture.
*/
MULTIPLY(2),
/**
* The values of the pixels in the two layers are inverted, multiplied, and then inverted again. The result is a brighter picture.
*/
SCREEN(3);
private int value;
private BlendMode(int value) {
this.value = value;
}
private int getValue() {
return value;
}
}
private BlendMode blendMode;
/**
* Returns the BlendMode
this TextureBasedEntity
is to be drawn with.
*
* @see PIXI BLEND_MODES
* @return the BlendMode
this TextureBasedEntity
is to be drawn with.
*/
public BlendMode getBlendMode() {
return blendMode;
}
/**
*
* Sets the blend mode for this TextureBasedEntity
.
*
* The possible values are found in BlendMode
.
*
* @see PIXI BLEND_MODES
* @param blendMode the BlendMode
to use.
* @return this TextureBasedEntity
.
*/
public T setBlendMode(BlendMode blendMode) {
this.blendMode = blendMode;
set("blendMode", blendMode.getValue(), null);
return self();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy