嗨,我正在尝试用 java 制作一个游戏,让用户可以选择操纵杆或游戏手柄来控制运动。所以我发现了一个叫做“JInput”的东西,它可以很容易地检测到所有连接的游戏控制器。问题是当我在 Eclipse 中运行它时出现以下错误:“java.lang.UnsatisfiedLinkError: no jinput-dx8 in java.library.path”。
我的代码如下:
import net.java.games.input.*;
public class ListControllers
{
public static void main(String[] args)
{
System.out.println("JInput version: " + Version.getVersion());
ControllerEnvironment ce =
ControllerEnvironment.getDefaultEnvironment();
Controller[] cs = ce.getControllers();
if (cs.length == 0) {
System.out.println("No controllers found");
System.exit(0);
}
// print the name and type for each controller
for (int i = 0; i < cs.length; i++)
System.out.println(i + ". " +
cs[i].getName() + ", " + cs[i].getType() );
} // end of main()
} // end of ListControllers class
我目前正在 Windows 7 环境中开发。任何帮助将非常感激。