本文整理汇总了Java中org.lwjgl.glfw.GLFWJoystickCallback类的典型用法代码示例。如果您正苦于以下问题:Java GLFWJoystickCallback类的具体用法?Java GLFWJoystickCallback怎么用?Java GLFWJoystickCallback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GLFWJoystickCallback类属于org.lwjgl.glfw包,在下文中一共展示了GLFWJoystickCallback类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.lwjgl.glfw.GLFWJoystickCallback; //导入依赖的package包/类
/**
* Initializes the GLFW3 library. If you are not using the built-in Game class of the SilenceEngine, you should call
* this method as soon as you can after loading the LWJGL3 natives.
*
* @return True if initialised successful, or else False.
*/
public static boolean init()
{
if (isInitialized())
return true;
boolean state = glfwInit();
// Return immediately in case of error
if (!state)
return initialized = false;
// Error callback that does nothing
setErrorCallback(null);
glfwErrorCallback = GLFWErrorCallback.create((error, description) ->
errorCallback.invoke(error, MemoryUtil.memUTF8(description)));
// Joystick callback that does nothing
setJoystickCallback(null);
glfwJoystickCallback = GLFWJoystickCallback.create((joy, event) ->
joystickCallback.invoke(joy, event == GLFW_CONNECTED));
// Register the callback
glfwSetErrorCallback(glfwErrorCallback);
return initialized = true;
}