transition works as intended but ui is not tangible

This commit is contained in:
minjaesong
2020-09-14 15:19:34 +09:00
parent eb2e47e2a5
commit b2ad541355
2 changed files with 6 additions and 9 deletions

View File

@@ -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();
}

View File

@@ -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)
}