color palettes, fps in overlay, main menu screen w/ buttons
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package mightypork.util.math.color;
|
||||
|
||||
|
||||
/**
|
||||
* CGA palette
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public interface CGA {
|
||||
|
||||
Color BLACK = Color.fromHex(0x000000);
|
||||
Color GRAY_DARK = Color.fromHex(0x686868);
|
||||
Color GRAY_LIGHT = Color.fromHex(0xB8B8B8);
|
||||
Color WHITE = Color.fromHex(0xFFFFFF);
|
||||
|
||||
Color RED_DARK = Color.fromHex(0xC41F0C);
|
||||
Color RED_LIGHT = Color.fromHex(0xFF706A);
|
||||
Color MAGENTA_DARK = Color.fromHex(0xC12BB6);
|
||||
Color MAGENTA_LIGHT = Color.fromHex(0xFF76FD);
|
||||
Color BLUE_DARK = Color.fromHex(0x0019B6);
|
||||
Color BLUE_LIGHT = Color.fromHex(0x5F6EFC);
|
||||
Color CYAN_DARK = Color.fromHex(0x00B6B8);
|
||||
Color CYAN_LIGHT = Color.fromHex(0x23FCFE);
|
||||
Color GREEN_DARK = Color.fromHex(0x00B41D);
|
||||
Color GREEN_LIGHT = Color.fromHex(0x39FA6F);
|
||||
|
||||
Color YELLOW = Color.fromHex(0xFFFD72);
|
||||
Color BROWN = Color.fromHex(0xC16A14);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package mightypork.util.math.color;
|
||||
|
||||
|
||||
/**
|
||||
* COMMODORE palette
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public interface COMMODORE {
|
||||
|
||||
Color BLACK = Color.fromHex(0x040013);
|
||||
Color WHITE = Color.fromHex(0xFFFFFF);
|
||||
Color RED = Color.fromHex(0x883932);
|
||||
Color CYAN = Color.fromHex(0x67B6BD);
|
||||
Color PURPLE = Color.fromHex(0x8B3F96);
|
||||
Color GREEN = Color.fromHex(0x55A049);
|
||||
Color BLUE = Color.fromHex(0x40318D);
|
||||
Color YELLOW = Color.fromHex(0xBFCE72);
|
||||
Color ORANGE = Color.fromHex(0x8B5429);
|
||||
Color BROWN = Color.fromHex(0x574200);
|
||||
Color RED_LIGHT = Color.fromHex(0xB86962);
|
||||
Color GRAY_DARK = Color.fromHex(0x505050);
|
||||
Color GRAY = Color.fromHex(0x787878);
|
||||
Color GREEN_LIGHT = Color.fromHex(0x94E089);
|
||||
Color BLUE_LIGHT = Color.fromHex(0x7869C4);
|
||||
Color GRAY_LIGHT = Color.fromHex(0x9F9F9F);
|
||||
}
|
||||
@@ -19,9 +19,9 @@ public abstract class Color {
|
||||
public static final Color NONE = rgba(0, 0, 0, 0);
|
||||
public static final Color SHADOW = rgba(0, 0, 0, 0.5);
|
||||
|
||||
public static final Color WHITE = rgb(1, 1, 1);
|
||||
public static final Color BLACK = rgb(0, 0, 0);
|
||||
public static final Color DARK_GRAY = rgb(0.25, 0.25, 0.25);
|
||||
public static final Color WHITE = fromHex(0xFFFFFF);
|
||||
public static final Color BLACK = fromHex(0x000000);
|
||||
public static final Color DARK_GRAY = fromHex(0x808080);
|
||||
public static final Color GRAY = rgb(0.5, 0.5, 0.5);
|
||||
public static final Color LIGHT_GRAY = rgb(0.75, 0.75, 0.75);
|
||||
|
||||
@@ -40,6 +40,16 @@ public abstract class Color {
|
||||
private static volatile boolean alphaStackEnabled = true;
|
||||
|
||||
|
||||
@FactoryMethod
|
||||
public static final Color fromHex(int rgb_hex)
|
||||
{
|
||||
final int bi = rgb_hex & 0xff;
|
||||
final int gi = (rgb_hex >> 8) & 0xff;
|
||||
final int ri = (rgb_hex >> 16) & 0xff;
|
||||
return rgb(ri / 255D, gi / 255D, bi / 255D);
|
||||
}
|
||||
|
||||
|
||||
@FactoryMethod
|
||||
public static final Color rgb(double r, double g, double b)
|
||||
{
|
||||
@@ -163,7 +173,7 @@ public abstract class Color {
|
||||
|
||||
if (alphaStackEnabled) {
|
||||
|
||||
for (Num n : alphaStack) {
|
||||
for (final Num n : alphaStack) {
|
||||
alpha *= clamp(n.value());
|
||||
}
|
||||
}
|
||||
@@ -241,4 +251,16 @@ public abstract class Color {
|
||||
{
|
||||
return alphaStackEnabled;
|
||||
}
|
||||
|
||||
|
||||
public Color withAlpha(double multiplier)
|
||||
{
|
||||
return new ColorAlphaAdjuster(this, Num.make(multiplier));
|
||||
}
|
||||
|
||||
|
||||
public Color withAlpha(Num multiplier)
|
||||
{
|
||||
return new ColorAlphaAdjuster(this, Num.make(multiplier));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package mightypork.util.math.color;
|
||||
|
||||
|
||||
import mightypork.util.constraints.num.Num;
|
||||
|
||||
|
||||
public class ColorAlphaAdjuster extends Color {
|
||||
|
||||
private final Color source;
|
||||
private final Num alphaAdjust;
|
||||
|
||||
|
||||
public ColorAlphaAdjuster(Color source, Num alphaMul) {
|
||||
this.source = source;
|
||||
this.alphaAdjust = alphaMul;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double red()
|
||||
{
|
||||
return source.red();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double green()
|
||||
{
|
||||
return source.green();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double blue()
|
||||
{
|
||||
return source.blue();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected double rawAlpha()
|
||||
{
|
||||
return source.rawAlpha() * alphaAdjust.value();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package mightypork.util.math.color;
|
||||
|
||||
|
||||
/**
|
||||
* PAL16 palette via http://androidarts.com/palette/16pal.htm
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public interface PAL16 {
|
||||
|
||||
Color VOID = Color.fromHex(0x000000);
|
||||
Color ASH = Color.fromHex(0x9D9D9D);
|
||||
Color BLIND = Color.fromHex(0xFFFFFF);
|
||||
|
||||
Color BLOODRED = Color.fromHex(0xBE2633);
|
||||
Color PIGMEAT = Color.fromHex(0xE06F8B);
|
||||
|
||||
Color OLDPOOP = Color.fromHex(0x493C2B);
|
||||
Color NEWPOOP = Color.fromHex(0xA46422);
|
||||
Color BLAZE = Color.fromHex(0xEB8931);
|
||||
Color ZORNSKIN = Color.fromHex(0xF7E26B);
|
||||
|
||||
Color SHADEGREEN = Color.fromHex(0x2F484E);
|
||||
Color LEAFGREEN = Color.fromHex(0x44891A);
|
||||
Color SLIMEGREEN = Color.fromHex(0xA3CE27);
|
||||
|
||||
Color NIGHTBLUE = Color.fromHex(0x1B2632);
|
||||
Color SEABLUE = Color.fromHex(0x005784);
|
||||
Color SKYBLUE = Color.fromHex(0x31A2F2);
|
||||
Color CLOUDBLUE = Color.fromHex(0xB2DCEF);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package mightypork.util.math.color;
|
||||
|
||||
|
||||
/**
|
||||
* Basic RGB palette
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public interface RGB {
|
||||
|
||||
Color WHITE = Color.fromHex(0xFFFFFF);
|
||||
Color BLACK = Color.fromHex(0x000000);
|
||||
Color GRAY_DARK = Color.fromHex(0x808080);
|
||||
Color GRAY_LIGHT = Color.fromHex(0xC0C0C0);
|
||||
|
||||
Color RED = Color.fromHex(0xFF0000);
|
||||
Color GREEN = Color.fromHex(0x00FF00);
|
||||
Color BLUE = Color.fromHex(0x0000FF);
|
||||
|
||||
Color YELLOW = Color.fromHex(0xFFFF00);
|
||||
Color CYAN = Color.fromHex(0x00FFFF);
|
||||
Color MAGENTA = Color.fromHex(0xFF00FF);
|
||||
|
||||
Color PINK = Color.fromHex(0xFF3FFC);
|
||||
Color ORANGE = Color.fromHex(0xFC4800);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package mightypork.util.math.color;
|
||||
|
||||
|
||||
/**
|
||||
* ZX Spectrum palette
|
||||
*
|
||||
* @author MightyPork
|
||||
*/
|
||||
public interface ZX {
|
||||
|
||||
Color BLACK = Color.fromHex(0x000000);
|
||||
Color GRAY = Color.fromHex(0xCBCBCB);
|
||||
Color WHITE = Color.fromHex(0xFFFFFF);
|
||||
|
||||
Color RED_DARK = Color.fromHex(0xD8240F);
|
||||
Color RED_LIGHT = Color.fromHex(0xFF3016);
|
||||
Color MAGENTA_DARK = Color.fromHex(0xD530C9);
|
||||
Color MAGENTA_LIGHT = Color.fromHex(0xFF3FFC);
|
||||
Color BLUE_DARK = Color.fromHex(0x001DC8);
|
||||
Color BLUE_LIGHT = Color.fromHex(0x0027FB);
|
||||
Color CYAN_DARK = Color.fromHex(0x00C9CB);
|
||||
Color CYAN_LIGHT = Color.fromHex(0xFFFD33);
|
||||
Color GREEN_DARK = Color.fromHex(0x00C721);
|
||||
Color GREEN_LIGHT = Color.fromHex(0x00F92C);
|
||||
|
||||
Color YELLOW_DARK = Color.fromHex(0xCECA26);
|
||||
Color YELLOW_LIGHT = Color.fromHex(0xFFFD33);
|
||||
}
|
||||
Reference in New Issue
Block a user