This commit is contained in:
Luca Puderbach 2024-11-18 08:05:35 +01:00
commit 20949b641e
3 changed files with 35 additions and 21 deletions

View File

@ -11,14 +11,16 @@ import com.simsilica.lemur.Insets3f
import com.simsilica.lemur.component.QuadBackgroundComponent
import com.simsilica.lemur.component.TbtQuadBackgroundComponent
def bgColor = color(0.25, 0.5, 0.5, 1)
def buttonEnabledColor = color(0.8, 0.9, 1, 1)
def bgColor = color(1, 1, 1, 1)
def buttonEnabledColor = color(0, 0, 0, 1)
def buttonDisabledColor = color(0.8, 0.9, 1, 0.2)
def buttonBgColor = color(0, 0.75, 0.75, 1)
def buttonBgColor = color(1, 1, 1, 1)
def sliderColor = color(0.6, 0.8, 0.8, 1)
def sliderBgColor = color(0.5, 0.75, 0.75, 1)
def gradientColor = color(0.5, 0.75, 0.85, 0.5)
def tabbuttonEnabledColor = color(0.4, 0.45, 0.5, 1)
def solidWhiteBackground = new QuadBackgroundComponent(color(1, 1, 1, 1)) // Solid white
def gradient = TbtQuadBackgroundComponent.create(
@ -31,6 +33,13 @@ def doubleGradient = new QuadBackgroundComponent(gradientColor)
doubleGradient.texture = texture(name: "/com/simsilica/lemur/icons/double-gradient-128.png",
generateMips: false)
def orangeBorder = TbtQuadBackgroundComponent.create(
texture(name: "/com/simsilica/lemur/icons/bordered-gradient.png", // Replace with an appropriate texture if needed
generateMips: false),
1, 1, 1, 126, 126,
1f, false)
orangeBorder.color = color(1, 0.5, 0, 1) // Orange color
selector("pp") {
font = font("Interface/Fonts/Metropolis/Metropolis-Regular-32.fnt")
}
@ -48,7 +57,7 @@ selector("header", "pp") {
}
selector("container", "pp") {
background = gradient.clone()
background = solidWhiteBackground.clone()
background.setColor(bgColor)
}
@ -125,11 +134,14 @@ selector("title", "pp") {
selector("button", "pp") {
background = gradient.clone()
color = buttonEnabledColor
background.setColor(buttonBgColor)
insets = new Insets3f(2, 2, 2, 2)
def outerBackground = new QuadBackgroundComponent(color(1, 0.5, 0, 1)) // Orange border
def innerBackground = new QuadBackgroundComponent(buttonBgColor) // Inner button background
// Apply the outer border as the main background
background = outerBackground
// Use insets to create a margin/padding effect for the inner background
insets = new Insets3f(3, 3, 3, 3) // Adjust the border thickness
buttonCommands = stdButtonCommands
}
@ -194,7 +206,7 @@ selector("tabbedPanel.container", "pp") {
}
selector("tab.button", "pp") {
background = gradient.clone()
background = solidWhiteBackground.clone()
background.setColor(bgColor)
color = tabbuttonEnabledColor
insets = new Insets3f(4, 2, 0, 2)

View File

@ -37,6 +37,15 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
private TestWorld testWorld;
private boolean isSettingsMenuOpen = false;
private boolean inputBlocked = false;
/**
* Path to the styles script for GUI elements.
*/
private static final String STYLES_SCRIPT = "Interface/Lemur/pp-styles.groovy"; //NON-NLS
/**
* Path to the font resource used in the GUI.
*/
private static final String FONT = "Interface/Fonts/Default.fnt"; //NON-NLS
public static void main(String[] args) {
new MonopolyApp().start();
@ -73,8 +82,9 @@ public class MonopolyApp extends SimpleApplication implements MonopolyClient, Ga
@Override
public void simpleInitApp() {
GuiGlobals.initialize(this);
BaseStyles.loadGlassStyle();
GuiGlobals.getInstance().getStyles().setDefaultStyle("glass");
BaseStyles.loadStyleResources(STYLES_SCRIPT);
GuiGlobals.getInstance().getStyles().setDefaultStyle("pp"); //NON-NLS
final BitmapFont normalFont = assetManager.loadFont(FONT); //NON-NLS
setupInput();
setupGui();

View File

@ -60,14 +60,6 @@ public class StartMenu extends Dialog {
startButton.setFontSize(40); // Set the font size for the button text
startButton.setTextHAlignment(HAlignment.Center); // Center the text horizontally
// Set a custom border and background color
ColorRGBA borderColor = ColorRGBA.Orange; // Example: White border
ColorRGBA backgroundColor = ColorRGBA.LightGray; // Example: light gray background
QuadBackgroundComponent backgroundColorSp = new QuadBackgroundComponent(backgroundColor);
backgroundColorSp.setMargin(2, 2); // Optional: Adjust margin for the border
backgroundColorSp.setColor(borderColor); // Set border color
startButton.setBackground(backgroundColorSp);
startButton.addClickCommands(source -> startGame(app));
centerMenu.addChild(startButton);
@ -82,7 +74,7 @@ public class StartMenu extends Dialog {
lowerLeftMenu.setLocalTranslation(new Vector3f(100, 90, 0));
Button quitButton = new Button("Spiel beenden");
quitButton.setPreferredSize(new Vector3f(130, 40, 0)); // Increase button size slightly (width, height)
quitButton.setFontSize(20);
quitButton.setFontSize(18);
quitButton.addClickCommands(source -> quitGame());
lowerLeftMenu.addChild(quitButton);
app.getGuiNode().attachChild(lowerLeftMenu);
@ -92,7 +84,7 @@ public class StartMenu extends Dialog {
lowerRightMenu.setLocalTranslation(new Vector3f(screenWidth - 200, 90, 0));
Button settingsButton = new Button("Einstellungen");
settingsButton.setPreferredSize(new Vector3f(130, 40, 0)); // Increase button size slightly (width, height)
settingsButton.setFontSize(20); // Increase the font size for the text
settingsButton.setFontSize(18); // Increase the font size for the text
settingsButton.addClickCommands(source -> openSettings(app));
lowerRightMenu.addChild(settingsButton);
app.getGuiNode().attachChild(lowerRightMenu);