mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
transition works as intended but ui is not tangible
This commit is contained in:
@@ -213,6 +213,8 @@ public class AppLoader implements ApplicationListener {
|
||||
public static final int minimumW = 1080;
|
||||
public static final int minimumH = 720;
|
||||
|
||||
public static final String FONT_DIR = "assets/graphics/fonts/terrarum-sans-bitmap";
|
||||
|
||||
|
||||
|
||||
private static ShaderProgram shaderBayerSkyboxFill; // ONLY to be used by the splash screen
|
||||
@@ -481,14 +483,12 @@ public class AppLoader implements ApplicationListener {
|
||||
}*/
|
||||
|
||||
|
||||
fontGame = new GameFontBase("assets/graphics/fonts/terrarum-sans-bitmap", false, true,
|
||||
fontGame = new GameFontBase(FONT_DIR, false, true,
|
||||
false, Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest, false, 256, false
|
||||
);
|
||||
Lang.invoke();
|
||||
|
||||
// make loading list
|
||||
|
||||
|
||||
CommonResourcePool.INSTANCE.loadAll();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.torvald.terrarum.ui
|
||||
|
||||
import com.jme3.math.FastMath
|
||||
import kotlin.math.absoluteValue
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
/**
|
||||
@@ -19,11 +20,7 @@ class UIItemHorizontalFadeSlide(
|
||||
) : UIItemTransitionContainer(parent, initialX, initialY, width, height, 0.15f, currentPosition, uis) {
|
||||
|
||||
fun getOffX(index: Int) = ((currentPosition - index) * width / 2f).roundToInt()
|
||||
fun getOpacity(index: Int) = 1f
|
||||
/*if (currentPosition >= index)
|
||||
1f - (currentPosition - index).coerceIn(0f, 1f)
|
||||
else
|
||||
(currentPosition - index).coerceIn(0f, 1f) - 1f*/
|
||||
fun getOpacity(index: Int) = 1f - (currentPosition - index).absoluteValue.coerceIn(0f, 1f)
|
||||
|
||||
|
||||
init {
|
||||
@@ -39,7 +36,7 @@ class UIItemHorizontalFadeSlide(
|
||||
|
||||
override fun onTransition(currentPosition: Float, uis: Array<out UICanvas>) {
|
||||
uis.forEachIndexed { index, it ->
|
||||
it.posX = it.initialX - getOffX(index)
|
||||
it.posX = -getOffX(index)
|
||||
it.posY = it.initialY
|
||||
it.opacity = getOpacity(index)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user