glfwGetMouseButton function

int glfwGetMouseButton(
  1. Pointer<GLFWwindow> window,
  2. int button
)

! @brief Returns the last reported state of a mouse button for the specified window.

This function returns the last state reported for the specified mouse button to the specified window. The returned state is one of GLFW_PRESS or GLFW_RELEASE.

If the @ref GLFW_STICKY_MOUSE_BUTTONS input mode is enabled, this function returns GLFW_PRESS the first time you call it for a mouse button that was pressed, even if that mouse button has already been released.

@paramin window The desired window. @paramin button The desired mouse button(@ref buttons). @return One of GLFW_PRESS or GLFW_RELEASE.

@errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref GLFW_INVALID_ENUM.

@thread_safety This function must only be called from the main thread.

@sa @ref input_mouse_button

@since Added in version 1.0. @glfw3 Added window handle parameter.

@ingroup input

GLFWAPI int glfwGetMouseButton(GLFWwindow* window, int button)

Implementation

int glfwGetMouseButton(Pointer<GLFWwindow> window, int button) {
  final glfwGetMouseButtonLookupFunction = libglfw.lookupFunction<
      Int32 Function(Pointer<GLFWwindow> window, Int32 button),
      int Function(
          Pointer<GLFWwindow> window, int button)>('glfwGetMouseButton');
  return glfwGetMouseButtonLookupFunction(window, button);
}