Package com.starpoints
Class Colors
- java.lang.Object
-
- com.starpoints.Colors
-
public final class Colors extends java.lang.ObjectColor constants and helper methods for the Starpoints game. Colors in Starpoint Arena are represented by an int-value calculated by the formula (opacity * 16777216 + red * 65536 + green * 256 + blue), with a value of 0-255 for each color and opacity.
-
-
Field Summary
Fields Modifier and Type Field Description static intblackBlack color.static intblueBlue color.static int[]blueColorsThe blue colors.static intblueswirlingPlaceholder for a random color.static intbrownYellow color.static intcyanCyan color.static intdarkblueDark blue color.static intdarkgrayDark gray color.static intdarkgreenDark green color.static intdarkredDark red color.static intglassGlass color.static intglass0Glass colors. glass0 is equal to glass.static intglass1static intglass2static intglass3static int[]glassColorsGlass colors for splintering.static intgrayGray color.static intgreenGreen color.static intlavaLava color.static intlightblueLight blue color.static intlightgrayLight gray color.static intlightgreenLight green color.static intlightredLight red color.static intmagentaMagenta color.static intMAX_GLASSINDEXMaximum glass index.static intnonePlaceholder for no color.static intorangeOrange color.static intpinkPink color.static intrandomPlaceholder for a random color.static intredRed color.static intswirlingPlaceholder for a random color.static intverydarkblueDarker blue color.static intwhiteWhite color.static intyellowYellow color.
-
Constructor Summary
Constructors Constructor Description Colors()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intbrighter(int color)Gets a brighter version of a color (adding 20% to every color value, or setting it to 40, if 0 in the original color).static intdarker(int color)Gets a darker version of a color (reducing every color value by 20%).static intgetBlue(int color)Gets the blue value of the color representationstatic intgetColor(int r, int g, int b)Gets the int representation for the rgb valuesstatic intgetColor(int r, int g, int b, int o)Gets the int representation for the rgb valuesstatic intgetColorFromInputString(java.lang.String s)Returns the color for the given string.static intgetGlassColorIndex(int color)Returns the splinter index if color is a glass color. 0 for undamaged glass, 3 is last index before disappearing.static intgetGreen(int color)Gets the green value of the color representationstatic intgetLighterBlueColor(int color)Returns the lighter blue color.static intgetOpacity(int color)Gets the opacity value of the color representationstatic intgetRandomBlueColor()Returns a random blue color.static intgetRed(int color)Gets the red value of the color representationstatic java.lang.StringgetStringForColor(int color)Gets a string for the given color.static booleanisBlueColor(int c)Checks, if the color is a blue color.static intmakeTransparent(int color, int opacity)Creates a transparent version of the color.
-
-
-
Field Detail
-
white
public static final int white
White color.
-
black
public static final int black
Black color.
-
green
public static final int green
Green color.
-
gray
public static final int gray
Gray color.
-
lightgray
public static final int lightgray
Light gray color.
-
darkgray
public static final int darkgray
Dark gray color.
-
red
public static final int red
Red color.
-
blue
public static final int blue
Blue color.
-
yellow
public static final int yellow
Yellow color.
-
brown
public static final int brown
Yellow color.
-
magenta
public static final int magenta
Magenta color.
-
cyan
public static final int cyan
Cyan color.
-
darkblue
public static final int darkblue
Dark blue color.
-
verydarkblue
public static final int verydarkblue
Darker blue color.
-
darkred
public static final int darkred
Dark red color.
-
darkgreen
public static final int darkgreen
Dark green color.
-
lightblue
public static final int lightblue
Light blue color.
-
lightred
public static final int lightred
Light red color.
-
lightgreen
public static final int lightgreen
Light green color.
-
orange
public static final int orange
Orange color.
-
pink
public static final int pink
Pink color.
-
lava
public static final int lava
Lava color.
-
glass
public static final int glass
Glass color.
-
glass0
public static final int glass0
Glass colors. glass0 is equal to glass.
-
glass1
public static final int glass1
-
glass2
public static final int glass2
-
glass3
public static final int glass3
-
glassColors
public static final int[] glassColors
Glass colors for splintering.
-
MAX_GLASSINDEX
public static final int MAX_GLASSINDEX
Maximum glass index.
-
random
public static final int random
Placeholder for a random color.
-
swirling
public static final int swirling
Placeholder for a random color.
-
blueswirling
public static final int blueswirling
Placeholder for a random color.
-
none
public static final int none
Placeholder for no color.
-
blueColors
public static final int[] blueColors
The blue colors.
-
-
Method Detail
-
getColor
public static int getColor(int r, int g, int b, int o)Gets the int representation for the rgb values- Parameters:
r- The red byte.g- The green byte.b- The blue byte.o- The opacity.- Returns:
- The int representation
-
getColor
public static int getColor(int r, int g, int b)Gets the int representation for the rgb values- Parameters:
r- The red byte.g- The green byte.b- The blue byte.- Returns:
- The int representation.
-
getOpacity
public static int getOpacity(int color)
Gets the opacity value of the color representation- Parameters:
color- The color.- Returns:
- the opacity value [0-255].
-
getGreen
public static int getGreen(int color)
Gets the green value of the color representation- Parameters:
color- The color.- Returns:
- the green value [0-255].
-
getRed
public static int getRed(int color)
Gets the red value of the color representation- Parameters:
color- The color.- Returns:
- the red value [0-255].
-
getBlue
public static int getBlue(int color)
Gets the blue value of the color representation- Parameters:
color- the color.- Returns:
- the blue value [0-255]
-
darker
public static int darker(int color)
Gets a darker version of a color (reducing every color value by 20%).- Parameters:
color- The color.- Returns:
- The darker color.
-
brighter
public static int brighter(int color)
Gets a brighter version of a color (adding 20% to every color value, or setting it to 40, if 0 in the original color).- Parameters:
color- The color.- Returns:
- The brighter color.
-
makeTransparent
public static int makeTransparent(int color, int opacity)Creates a transparent version of the color.- Parameters:
color- The color.opacity- The opacity of the desired color (0: transparent, 255: opaque).- Returns:
- The transparent version of the color.
-
getStringForColor
public static java.lang.String getStringForColor(int color)
Gets a string for the given color.- Parameters:
color- The color.- Returns:
- The color name (equal to the constants name).
-
getColorFromInputString
public static int getColorFromInputString(java.lang.String s)
Returns the color for the given string.- Parameters:
s- The color name.- Returns:
- The color.
-
isBlueColor
public static boolean isBlueColor(int c)
Checks, if the color is a blue color.- Parameters:
c- The color to check.- Returns:
- true, if the point is blue, lightBlue, darkBlue or veryDarkBlue.
-
getLighterBlueColor
public static int getLighterBlueColor(int color)
Returns the lighter blue color.- Parameters:
color- The blue color.- Returns:
- The next lighter blue color if color is a blue color, or lightgray otherwise or for lightBlue.
-
getGlassColorIndex
public static int getGlassColorIndex(int color)
Returns the splinter index if color is a glass color. 0 for undamaged glass, 3 is last index before disappearing.- Parameters:
color- The color to check- Returns:
- The splinter index if color is a glass color or -1 for any non-glass color.
-
getRandomBlueColor
public static int getRandomBlueColor()
Returns a random blue color. Used for blue swirling effect in points.- Returns:
- The random blue color. Possible return colors are: Colors.lightBlue, Colors.blue, Colors.darkBlue, Colors.veryDarkBlue
-
-