本文整理匯總了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;
}