我正在为我的游戏使用 LibGDX,并且我正在尝试使用 FastUtilInt2BooleanArrayMap
来存储我的关键状态(上/下)。
不幸的是,我收到了这个奇怪的错误:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoSuchMethodError: it.unimi.dsi.fastutil.ints.Int2BooleanArrayMap.put(IZ)Ljava/lang/Boolean;
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:131)
Caused by: java.lang.NoSuchMethodError: it.unimi.dsi.fastutil.ints.Int2BooleanArrayMap.put(IZ)Ljava/lang/Boolean;
at com.acelta.Input.keyDown(Input.kt:12)
at com.badlogic.gdx.backends.lwjgl.LwjglInput.processEvents(LwjglInput.java:312)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:215)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:124)
对于我的输入处理器,代码非常简单:
package org.jire.wot
import com.badlogic.gdx.InputAdapter
import it.unimi.dsi.fastutil.ints.Int2BooleanArrayMap
import org.jire.wot.App.camera
object Input : InputAdapter() {
private val map = Int2BooleanArrayMap()
override fun keyDown(keycode: Int): Boolean {
map.put(keycode, true)
return true
}
override fun keyUp(keycode: Int): Boolean {
map.put(keycode, false)
return true
}
override fun scrolled(amount: Int): Boolean {
camera.zoom += amount / 13F
if (camera.zoom < 0.6F) camera.zoom = 0.6F
else if (camera.zoom > 1F) camera.zoom = 1F
return true
}
}
我能做些什么呢?