Gruppe-02-clone/Projekte/jme-common/src/main/resources/Interface/Lemur/pp-styles.groovy

188 lines
5.2 KiB
Groovy

// Styling of Lemur components
// For documentation, see:
// For documentation, see:
// https://github.com/jMonkeyEngine-Contributions/Lemur/wiki/Styling
import com.simsilica.lemur.*
import com.simsilica.lemur.component.QuadBackgroundComponent
import com.simsilica.lemur.Button
import com.simsilica.lemur.Button.ButtonAction
import com.simsilica.lemur.Command
import com.simsilica.lemur.HAlignment
import com.simsilica.lemur.Insets3f
import com.simsilica.lemur.component.QuadBackgroundComponent
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(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(1, 1, 1, 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(
texture(name: "/com/simsilica/lemur/icons/bordered-gradient.png", generateMips: false),
1, 1, 1, 126, 126, 1f, false)
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")
}
// Titel für "Einstellungen"
selector("settings-title", "pp") {
color = color(1, 1, 1, 1)
fontSize = 48
textHAlignment = HAlignment.Center
insets = new Insets3f(5, 5, 5, 5)
}
// Container Stil
selector("container", "pp") {
background = solidWhiteBackground.clone()
background.setColor(bgColor)
}
// Slider Stil
selector("slider", "pp") {
insets = new Insets3f(5, 10, 5, 10) // Abstand
background = new QuadBackgroundComponent(sliderBgColor)
}
def pressedCommand = new Command<Button>() {
void execute(Button source) {
if (source.isPressed())
source.move(1, -1, 0)
else
source.move(-1, 1, 0)
}
}
def enabledCommand = new Command<Button>() {
void execute(Button source) {
if (source.isEnabled())
source.setColor(buttonEnabledColor)
else
source.setColor(buttonDisabledColor)
}
}
def stdButtonCommands = [
(ButtonAction.Down) : [pressedCommand],
(ButtonAction.Up) : [pressedCommand],
(ButtonAction.Enabled) : [enabledCommand],
(ButtonAction.Disabled): [enabledCommand]
]
def sliderButtonCommands = [
(ButtonAction.Hover): [repeatCommand]
]
selector("title", "pp") {
color = color(0.8, 0.9, 1, 0.85f)
highlightColor = color(1, 0.8, 1, 0.85f)
shadowColor = color(0, 0, 0, 0.75f)
shadowOffset = vec3(2, -2, -1)
background = new QuadBackgroundComponent(color(0.5, 0.75, 0.85, 1))
background.texture = texture(name: "/com/simsilica/lemur/icons/double-gradient-128.png",
generateMips: false)
insets = new Insets3f(2, 2, 2, 2)
buttonCommands = stdButtonCommands
}
selector("button", "pp") {
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
}
selector("slider", "pp") {
insets = new Insets3f(1, 3, 1, 2)
}
selector("slider", "button", "pp") {
background = doubleGradient.clone()
//background.setColor(sliderBgColor)
insets = new Insets3f(0, 0, 0, 0)
}
selector("slider.thumb.button", "pp") {
text = "[]"
color = sliderColor
}
selector("slider.left.button", "pp") {
text = "-"
background = doubleGradient.clone()
//background.setColor(sliderBgColor)
background.setMargin(5, 0)
color = sliderColor
buttonCommands = sliderButtonCommands
}
selector("slider.right.button", "pp") {
text = "+"
background = doubleGradient.clone()
//background.setColor(sliderBgColor)
background.setMargin(4, 0)
color = sliderColor
buttonCommands = sliderButtonCommands
}
selector("slider.up.button", "pp") {
buttonCommands = sliderButtonCommands
}
selector("slider.down.button", "pp") {
buttonCommands = sliderButtonCommands
}
selector("checkbox", "pp") {
color = buttonEnabledColor
}
selector("rollup", "pp") {
background = gradient.clone()
background.setColor(bgColor)
}
selector("tabbedPanel", "pp") {
activationColor = buttonEnabledColor
}
selector("tabbedPanel.container", "pp") {
background = null
}
selector("tab.button", "pp") {
background = solidWhiteBackground.clone()
background.setColor(bgColor)
color = tabbuttonEnabledColor
insets = new Insets3f(4, 2, 0, 2)
buttonCommands = stdButtonCommands
}