g2.setRenderingHints(rh);
} else
{
int alpha = (int) (menu.alpha * 255);
int color;
Color c;
canvas.beginShape(PApplet.QUADS);
canvas.stroke(canvas.color(style.strokeColor.getRGB(), alpha));
c = style.menuGradLo;
color = canvas.color(c.getRed(), c.getGreen(), c.getBlue(), alpha);
canvas.fill(color);
canvas.vertex((float) drawRect.getMinX(), (float) drawRect
.getMinY());
canvas.vertex((float) drawRect.getMaxX(), (float) drawRect
.getMinY());
c = style.menuGradHi;
color = canvas.color(c.getRed(), c.getGreen(), c.getBlue(), alpha);
canvas.fill(color);
canvas.vertex((float) drawRect.getMaxX(), (float) drawRect
.getMaxY());
canvas.vertex((float) drawRect.getMinX(), (float) drawRect
.getMaxY());
canvas.endShape();
}
if (hovered != null)
{
MenuItem i = hovered;
float fontSize = origWidth/2f;
float ascent = UIUtils.getTextAscent(menu.canvas.g,
menu.style.font, fontSize, false);
float descent = UIUtils.getTextDescent(menu.canvas.g,
menu.style.font, fontSize, false);
float tHeight = (ascent + descent);
float tWidth = UIUtils.getTextWidth(menu.canvas.g, menu.style.font,
fontSize, i.getName(), false);
float tX = 0;
float tY = 0;
switch (rotation.rot)
{
case (LEFT):
menu.canvas.textAlign(PApplet.LEFT);
tX = inset + maxPossibleWidth + menu.style.padX;
tY = i.getY() + i.getHeight() / 2 + tHeight / 2 - descent
/ 2;
break;
case (RIGHT):
menu.canvas.textAlign(PApplet.LEFT);
tX = menu.canvas.width - inset - maxPossibleWidth
- menu.style.padX - tWidth;
tY = i.getY() + i.getHeight() / 2 + tHeight / 2 - descent
/ 2;
break;
case (TOP):
menu.canvas.textAlign(PApplet.CENTER);
tX = i.getX() + i.getWidth() / 2;
tY = inset + maxPossibleWidth + menu.style.padX + tHeight
- descent;
break;
case (BOTTOM):
menu.canvas.textAlign(PApplet.CENTER);
tX = i.getX() + i.getWidth() / 2;
tY = menu.canvas.width - inset - maxPossibleWidth
- menu.style.padX;
break;
}
if (usesJava2D)
{
MenuUtils.drawWhiteTextRect(this, tX-menu.style.padX, tY-ascent-menu.style.padX,tWidth+menu.style.padX*2,tHeight+menu.style.padX*2);
}
Color c = menu.style.textColor;
int alpha = (int) (menu.alpha * 255);
menu.canvas.fill(menu.canvas.color(c.getRed(), c.getGreen(), c
.getBlue(), alpha));
// menu.canvas.fill(0,alpha);
menu.canvas.textFont(FontLoader.instance.vera);
menu.canvas.textSize(fontSize);
menu.canvas.text(i.getName(), tX, tY);
menu.canvas.textAlign(PApplet.LEFT);
}
if (lastPressed != null && triangleOnSelected)
{
MenuItem i = lastPressed;
PGraphics pg = canvas.g;
int alpha = (int) (menu.alpha * 255);
Color c = menu.style.strokeColor;
pg.fill(menu.canvas.color(c.getRed(), c.getGreen(), c.getBlue(),
alpha));
float height = i.getWidth() / 8;
switch (rotation.rot)
{