mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-08-05 17:25:24 +02:00
Merge branch 'logic' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02 into logic
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// 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
|
||||
@@ -9,7 +10,6 @@ import com.simsilica.lemur.Command
|
||||
import com.simsilica.lemur.HAlignment
|
||||
import com.simsilica.lemur.Insets3f
|
||||
import com.simsilica.lemur.component.QuadBackgroundComponent
|
||||
import com.simsilica.lemur.component.TbtQuadBackgroundComponent
|
||||
|
||||
def bgColor = color(1, 1, 1, 1)
|
||||
def buttonEnabledColor = color(0, 0, 0, 1)
|
||||
@@ -17,17 +17,15 @@ 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(0.5, 0.75, 0.85, 0.5)
|
||||
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)
|
||||
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",
|
||||
@@ -44,26 +42,24 @@ selector("pp") {
|
||||
font = font("Interface/Fonts/Metropolis/Metropolis-Regular-32.fnt")
|
||||
}
|
||||
|
||||
selector("label", "pp") {
|
||||
insets = new Insets3f(2, 2, 2, 2)
|
||||
color = buttonEnabledColor
|
||||
}
|
||||
|
||||
selector("header", "pp") {
|
||||
font = font("Interface/Fonts/Metropolis/Metropolis-Bold-42.fnt")
|
||||
insets = new Insets3f(2, 2, 2, 2)
|
||||
color = color(1, 0.5, 0, 1)
|
||||
// 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") {
|
||||
background = gradient.clone()
|
||||
background.setColor(bgColor)
|
||||
insets = new Insets3f(5, 10, 5, 10) // Abstand
|
||||
background = new QuadBackgroundComponent(sliderBgColor)
|
||||
}
|
||||
|
||||
def pressedCommand = new Command<Button>() {
|
||||
@@ -84,30 +80,6 @@ def enabledCommand = new Command<Button>() {
|
||||
}
|
||||
}
|
||||
|
||||
def repeatCommand = new Command<Button>() {
|
||||
private long startTime
|
||||
private long lastClick
|
||||
|
||||
void execute(Button source) {
|
||||
// Only do the repeating click while the mouse is
|
||||
// over the button (and pressed of course)
|
||||
if (source.isPressed() && source.isHighlightOn()) {
|
||||
long elapsedTime = System.currentTimeMillis() - startTime
|
||||
// After half a second pause, click 8 times a second
|
||||
if (elapsedTime > 500 && elapsedTime > lastClick + 125) {
|
||||
source.click()
|
||||
|
||||
// Try to quantize the last click time to prevent drift
|
||||
lastClick = ((elapsedTime - 500) / 125) * 125 + 500
|
||||
}
|
||||
}
|
||||
else {
|
||||
startTime = System.currentTimeMillis()
|
||||
lastClick = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def stdButtonCommands = [
|
||||
(ButtonAction.Down) : [pressedCommand],
|
||||
(ButtonAction.Up) : [pressedCommand],
|
||||
|
Reference in New Issue
Block a user