mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-25 02:19:45 +01:00
eigenes GUI Styling eingeführt
This commit is contained in:
parent
5fde7451c8
commit
b74ca4e702
@ -11,14 +11,16 @@ import com.simsilica.lemur.Insets3f
|
|||||||
import com.simsilica.lemur.component.QuadBackgroundComponent
|
import com.simsilica.lemur.component.QuadBackgroundComponent
|
||||||
import com.simsilica.lemur.component.TbtQuadBackgroundComponent
|
import com.simsilica.lemur.component.TbtQuadBackgroundComponent
|
||||||
|
|
||||||
def bgColor = color(0.25, 0.5, 0.5, 1)
|
def bgColor = color(1, 1, 1, 1)
|
||||||
def buttonEnabledColor = color(0.8, 0.9, 1, 1)
|
def buttonEnabledColor = color(0, 0, 0, 1)
|
||||||
def buttonDisabledColor = color(0.8, 0.9, 1, 0.2)
|
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 sliderColor = color(0.6, 0.8, 0.8, 1)
|
||||||
def sliderBgColor = color(0.5, 0.75, 0.75, 1)
|
def sliderBgColor = color(0.5, 0.75, 0.75, 1)
|
||||||
def gradientColor = color(0.5, 0.75, 0.85, 0.5)
|
def gradientColor = color(0.5, 0.75, 0.85, 0.5)
|
||||||
def tabbuttonEnabledColor = color(0.4, 0.45, 0.5, 1)
|
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(
|
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",
|
doubleGradient.texture = texture(name: "/com/simsilica/lemur/icons/double-gradient-128.png",
|
||||||
generateMips: false)
|
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") {
|
selector("pp") {
|
||||||
font = font("Interface/Fonts/Metropolis/Metropolis-Regular-32.fnt")
|
font = font("Interface/Fonts/Metropolis/Metropolis-Regular-32.fnt")
|
||||||
}
|
}
|
||||||
@ -48,7 +57,7 @@ selector("header", "pp") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
selector("container", "pp") {
|
selector("container", "pp") {
|
||||||
background = gradient.clone()
|
background = solidWhiteBackground.clone()
|
||||||
background.setColor(bgColor)
|
background.setColor(bgColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,11 +134,14 @@ selector("title", "pp") {
|
|||||||
|
|
||||||
|
|
||||||
selector("button", "pp") {
|
selector("button", "pp") {
|
||||||
background = gradient.clone()
|
def outerBackground = new QuadBackgroundComponent(color(1, 0.5, 0, 1)) // Orange border
|
||||||
color = buttonEnabledColor
|
def innerBackground = new QuadBackgroundComponent(buttonBgColor) // Inner button background
|
||||||
background.setColor(buttonBgColor)
|
|
||||||
insets = new Insets3f(2, 2, 2, 2)
|
|
||||||
|
|
||||||
|
// 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
|
buttonCommands = stdButtonCommands
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,14 +60,6 @@ public class StartMenu extends Dialog {
|
|||||||
startButton.setFontSize(40); // Set the font size for the button text
|
startButton.setFontSize(40); // Set the font size for the button text
|
||||||
startButton.setTextHAlignment(HAlignment.Center); // Center the text horizontally
|
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));
|
startButton.addClickCommands(source -> startGame(app));
|
||||||
centerMenu.addChild(startButton);
|
centerMenu.addChild(startButton);
|
||||||
|
|
||||||
@ -82,7 +74,7 @@ public class StartMenu extends Dialog {
|
|||||||
lowerLeftMenu.setLocalTranslation(new Vector3f(100, 90, 0));
|
lowerLeftMenu.setLocalTranslation(new Vector3f(100, 90, 0));
|
||||||
Button quitButton = new Button("Spiel beenden");
|
Button quitButton = new Button("Spiel beenden");
|
||||||
quitButton.setPreferredSize(new Vector3f(130, 40, 0)); // Increase button size slightly (width, height)
|
quitButton.setPreferredSize(new Vector3f(130, 40, 0)); // Increase button size slightly (width, height)
|
||||||
quitButton.setFontSize(20);
|
quitButton.setFontSize(18);
|
||||||
quitButton.addClickCommands(source -> quitGame());
|
quitButton.addClickCommands(source -> quitGame());
|
||||||
lowerLeftMenu.addChild(quitButton);
|
lowerLeftMenu.addChild(quitButton);
|
||||||
app.getGuiNode().attachChild(lowerLeftMenu);
|
app.getGuiNode().attachChild(lowerLeftMenu);
|
||||||
@ -92,7 +84,7 @@ public class StartMenu extends Dialog {
|
|||||||
lowerRightMenu.setLocalTranslation(new Vector3f(screenWidth - 200, 90, 0));
|
lowerRightMenu.setLocalTranslation(new Vector3f(screenWidth - 200, 90, 0));
|
||||||
Button settingsButton = new Button("Einstellungen");
|
Button settingsButton = new Button("Einstellungen");
|
||||||
settingsButton.setPreferredSize(new Vector3f(130, 40, 0)); // Increase button size slightly (width, height)
|
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));
|
settingsButton.addClickCommands(source -> openSettings(app));
|
||||||
lowerRightMenu.addChild(settingsButton);
|
lowerRightMenu.addChild(settingsButton);
|
||||||
app.getGuiNode().attachChild(lowerRightMenu);
|
app.getGuiNode().attachChild(lowerRightMenu);
|
||||||
|
Loading…
Reference in New Issue
Block a user