當前位置: 首頁>>代碼示例>>Java>>正文


Java GLFWJoystickCallback類代碼示例

本文整理匯總了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;
}
 
開發者ID:sriharshachilakapati,項目名稱:SilenceEngine,代碼行數:33,代碼來源:GLFW3.java


注:本文中的org.lwjgl.glfw.GLFWJoystickCallback類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。