Add support for HEX-defined colors
This commit is contained in:
@@ -5,6 +5,10 @@ public interface Color {
|
||||
|
||||
void setRGBA(float red, float green, float blue, float alpha);
|
||||
|
||||
void setRGB(int hex);
|
||||
|
||||
void setRGBA(long hex);
|
||||
|
||||
void setRed(float value);
|
||||
|
||||
void setGreen(float value);
|
||||
@@ -13,6 +17,14 @@ public interface Color {
|
||||
|
||||
void setAlpha(float value);
|
||||
|
||||
void setRed(int value);
|
||||
|
||||
void setGreen(int value);
|
||||
|
||||
void setBlue(int value);
|
||||
|
||||
void setAlpha(int value);
|
||||
|
||||
float getRed();
|
||||
|
||||
float getGreen();
|
||||
|
||||
@@ -19,6 +19,7 @@ public class Label extends BaseComponent {
|
||||
public Label(Context context, GUI gui) {
|
||||
super(context, gui);
|
||||
this.color = gui.createColor();
|
||||
this.color.setRGBA(0xFFFFFFFF);
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
@@ -61,6 +62,10 @@ public class Label extends BaseComponent {
|
||||
color.setRed(value);
|
||||
}
|
||||
|
||||
public void setRed(Integer value) {
|
||||
color.setRed(value);
|
||||
}
|
||||
|
||||
public float getGreen() {
|
||||
return color.getGreen();
|
||||
}
|
||||
@@ -69,6 +74,10 @@ public class Label extends BaseComponent {
|
||||
color.setGreen(value);
|
||||
}
|
||||
|
||||
public void setGreen(Integer value) {
|
||||
color.setGreen(value);
|
||||
}
|
||||
|
||||
public float getBlue() {
|
||||
return color.getBlue();
|
||||
}
|
||||
@@ -77,6 +86,10 @@ public class Label extends BaseComponent {
|
||||
color.setBlue(value);
|
||||
}
|
||||
|
||||
public void setBlue(Integer value) {
|
||||
color.setBlue(value);
|
||||
}
|
||||
|
||||
public float getAlpha() {
|
||||
return color.getAlpha();
|
||||
}
|
||||
@@ -85,6 +98,10 @@ public class Label extends BaseComponent {
|
||||
color.setAlpha(value);
|
||||
}
|
||||
|
||||
public void setAlpha(Integer value) {
|
||||
color.setAlpha(value);
|
||||
}
|
||||
|
||||
public void setColor(Float red, Float green, Float blue, Float alpha) {
|
||||
color.setRGBA(red, green, blue, alpha);
|
||||
}
|
||||
@@ -93,6 +110,10 @@ public class Label extends BaseComponent {
|
||||
color.setRGB(red, green, blue);
|
||||
}
|
||||
|
||||
public void setColor(Integer hex) {
|
||||
color.setRGB(hex);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getContentWidth() {
|
||||
return bounds[2] - bounds[0];
|
||||
|
||||
Reference in New Issue
Block a user