games.rednblack.editor.renderer.utils.InterpolationMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of runtime-libgdx Show documentation
Show all versions of runtime-libgdx Show documentation
HyperLap2D libGDX runtime to render exported scenes
The newest version!
package games.rednblack.editor.renderer.utils;
import com.badlogic.gdx.math.Interpolation;
import com.badlogic.gdx.utils.reflect.ClassReflection;
import com.badlogic.gdx.utils.reflect.Field;
import com.badlogic.gdx.utils.reflect.ReflectionException;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
public class InterpolationMap {
public static final Map map = new HashMap<>();
static {
Field[] interpolationFields = ClassReflection.getFields(Interpolation.class);
for (Field field : interpolationFields) {
try {
map.put(field.getName(), (Interpolation) field.get(null));
} catch (ReflectionException e) {
e.printStackTrace();
}
}
}
public static String getName(Interpolation interpolation) {
for (Map.Entry entry : map.entrySet()) {
if (Objects.equals(interpolation, entry.getValue())) {
return entry.getKey();
}
}
return "linear";
}
}