@tyrion - “I did take a look into the Sourcecode and found that “Button” always calls “getStyle(“Button”)”. I assume that’s what reads the xml Style-definition.
Maybe changing that to a String-Variable getStyle(buttonStyle)”
I would love to see this too! I do much the same, and find myself often doing stuff like this :-
[java]
Label b = new Label(screen, UIDUtil.getUID(), screen.getStyle(“Minimap”).getVector2f(positionStyle),
screen.getStyle(“Minimap”).getVector2f(“directionLabelSize”),
screen.getStyle(“Minimap”).getVector4f(“directionLabelResizeBorders”),
screen.getStyle(“Minimap”).getString(“directionLabelImg”));
[/java]
This works because you can put any styles you like in the style files. It would great to be able to do as you suggest …
[java]
Label b = new Label(screen, “MinimapDirectionLabel”);
// or if you can’t face yet more constructor arguments
b.setStyleName(“AnotherStyle”);
[/java]
In fact I use this pattern so much I extend a bunch of the tonegod controls to do exactly this. For example, this is a setStyles() for Button :-
[java]
protected void setStyles(String styleName) {
if (screen.getStyle(styleName).getString("defaultImg") != null) {
getElementTexture().setImage(screen.getApplication().getAssetManager().loadTexture(screen.getStyle(styleName).getString("defaultImg")).getImage());
}
if (screen.getStyle(styleName).getString("hoverImg") != null) {
setButtonHoverInfo(
screen.getStyle(styleName).getString("hoverImg"),
screen.getStyle(styleName).getColorRGBA("hoverColor"));
}
if (screen.getStyle(styleName).getString("pressedImg") != null) {
setButtonPressedInfo(
screen.getStyle(styleName).getString("pressedImg"),
screen.getStyle(styleName).getColorRGBA("pressedColor"));
}
buttonTextInsets = screen.getStyle(styleName).getFloat("buttonTextInsets");
setFontSize(screen.getStyle(styleName).getFloat("fontSize"));
setFont(screen.getStyle("Font").getString(screen.getStyle(styleName).getString("fontName")));
setFontColor(screen.getStyle(styleName).getColorRGBA("fontColor"));
setTextVAlign(BitmapFont.VAlign.valueOf(screen.getStyle(styleName).getString("textVAlign")));
setTextAlign(BitmapFont.Align.valueOf(screen.getStyle(styleName).getString("textAlign")));
setTextWrap(LineWrapMode.valueOf(screen.getStyle(styleName).getString("textWrap")));
setDimensions(screen.getStyle(styleName).getVector2f("defaultSize"));
orgDimensions = getDimensions().clone();
borders.set(screen.getStyle(styleName).getVector4f("resizeBorders"));
borderHandles.set(screen.getStyle(styleName).getVector4f("resizeBorders"));
getModel().updateDimensions(getWidth(), getHeight());
originalFontColor = fontColor.clone();
hoverSound = screen.getStyle(styleName).getString("hoverSound");
useHoverSound = screen.getStyle(styleName).getBoolean("useHoverSound");
hoverSoundVolume = screen.getStyle(styleName).getFloat("hoverSoundVolume");
pressedSound = screen.getStyle(styleName).getString("pressedSound");
usePressedSound = screen.getStyle(styleName).getBoolean("usePressedSound");
pressedSoundVolume = screen.getStyle(styleName).getFloat("pressedSoundVolume");
}
[/java]
@t0neg0d - Regarding blurring, I did post a patch for a couple of things (Button - already applied, ScrollArea - the one you haven’t look at yet).
However, there still is an issue I can’t seem to get rid of.The problem shows with center aligned text, particularly with tooltips for some reason :-
Is this what you mean by “there are some alignment issues with fonts using JME’s BitmapText”?