You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
896 B
53 lines
896 B
10 years ago
|
package net.tortuga.gui.widgets.display;
|
||
|
|
||
|
|
||
|
import net.tortuga.fonts.LoadedFont;
|
||
|
import net.tortuga.util.RenderUtils;
|
||
|
|
||
|
import com.porcupine.color.RGB;
|
||
|
import com.porcupine.coord.Coord;
|
||
|
|
||
|
|
||
|
public class TextWithBackground extends Text {
|
||
|
|
||
|
private RGB bgColor = new RGB(0x479EF5);
|
||
|
|
||
|
|
||
|
public TextWithBackground setBackgroundColor(RGB color)
|
||
|
{
|
||
|
this.bgColor = color;
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
|
||
|
public TextWithBackground(String text) {
|
||
|
super(text);
|
||
|
}
|
||
|
|
||
|
|
||
|
public TextWithBackground(String text, LoadedFont font) {
|
||
|
super(text, font);
|
||
|
}
|
||
|
|
||
|
|
||
|
@Override
|
||
|
public void render(Coord mouse)
|
||
|
{
|
||
|
boolean over = isMouseOver(mouse);
|
||
|
|
||
|
RGB color = new RGB(bgColor, 0.3);
|
||
|
|
||
|
if (over) {
|
||
|
color = new RGB(bgColor, 0.9);
|
||
|
}
|
||
|
|
||
|
RenderUtils.setColor(color);
|
||
|
RenderUtils.quadSize(rect.getMin().x, rect.getMin().y, rect.getSize().x, rect.getSize().y);
|
||
|
|
||
|
RenderUtils.setColor(RGB.WHITE);
|
||
|
|
||
|
super.render(mouse);
|
||
|
}
|
||
|
|
||
|
}
|