42#define _GLFW_JOYSTICK_AXIS 1
43#define _GLFW_JOYSTICK_BUTTON 2
44#define _GLFW_JOYSTICK_HATBIT 3
103 if (!isValidElementForJoystick(mapping->
buttons + i, js))
106 "Invalid button in gamepad mapping %s (%s)",
115 if (!isValidElementForJoystick(mapping->
axes + i, js))
118 "Invalid axis in gamepad mapping %s (%s)",
133 const char* c = string;
141 {
"platform",
NULL },
165 length = strcspn(c,
",");
166 if (length != 32 || c[length] !=
',')
172 memcpy(mapping->
guid, c, length);
175 length = strcspn(c,
",");
176 if (length >=
sizeof(mapping->
name) || c[length] !=
',')
182 memcpy(mapping->
name, c, length);
188 if (*c ==
'+' || *c ==
'-')
191 for (i = 0; i <
sizeof(fields) /
sizeof(fields[0]); i++)
193 length = strlen(fields[i].name);
194 if (strncmp(c, fields[i].name, length) != 0 || c[length] !=
':')
199 if (fields[i].element)
227 const unsigned long hat = strtoul(c + 1, (
char**) &c, 10);
228 const unsigned long bit = strtoul(c + 1, (
char**) &c, 10);
256 c += strcspn(c,
",");
260 for (i = 0; i < 32; i++)
262 if (mapping->
guid[i] >=
'A' && mapping->
guid[i] <=
'F')
263 mapping->
guid[i] +=
'a' -
'A';
292 window->
keys[key] = (char) action;
310 if (codepoint < 32 || (codepoint > 126 && codepoint < 160))
398 js->
axes[axis] = value;
419 js->
hats[hat] = value;
449 js->
axes = calloc(axisCount,
sizeof(
float));
450 js->
buttons = calloc(buttonCount + (
size_t) hatCount * 4, 1);
451 js->
hats = calloc(hatCount, 1);
456 strncpy(js->
name, name,
sizeof(js->
name) - 1);
457 strncpy(js->
guid, guid,
sizeof(js->
guid) - 1);
458 js->
mapping = findValidMapping(js);
491 assert(window !=
NULL);
516 assert(window !=
NULL);
527 "Invalid cursor mode 0x%08X",
591 "Raw mouse motion is not supported on this system");
647 assert(window !=
NULL);
664 return (
int) window->
keys[key];
670 assert(window !=
NULL);
693 assert(window !=
NULL);
716 assert(window !=
NULL);
720 if (xpos != xpos || xpos < -DBL_MAX || xpos > DBL_MAX ||
721 ypos != ypos || ypos < -DBL_MAX || ypos > DBL_MAX)
724 "Invalid cursor position %f %f",
749 assert(image !=
NULL);
815 if (window->
cursor == cursor)
826 while (*prev != cursor)
827 prev = &((*prev)->next);
829 *prev = cursor->
next;
839 assert(window !=
NULL);
851 assert(window !=
NULL);
861 assert(window !=
NULL);
871 assert(window !=
NULL);
882 assert(window !=
NULL);
893 assert(window !=
NULL);
904 assert(window !=
NULL);
915 assert(window !=
NULL);
925 assert(window !=
NULL);
947 if (!initJoysticks())
963 assert(count !=
NULL);
975 if (!initJoysticks())
995 assert(count !=
NULL);
1007 if (!initJoysticks())
1031 assert(count !=
NULL);
1043 if (!initJoysticks())
1072 if (!initJoysticks())
1100 if (!initJoysticks())
1149 if (!initJoysticks())
1159 const char* c = string;
1161 assert(
string !=
NULL);
1167 if ((*c >=
'0' && *c <=
'9') ||
1168 (*c >=
'a' && *c <=
'f') ||
1169 (*c >=
'A' && *c <=
'F'))
1173 const size_t length = strcspn(c,
"\r\n");
1174 if (length <
sizeof(line))
1178 memcpy(line, c, length);
1179 line[length] =
'\0';
1181 if (parseMapping(&mapping, line))
1185 *previous = mapping;
1201 c += strcspn(c,
"\r\n");
1202 c += strspn(c,
"\r\n");
1210 js->
mapping = findValidMapping(js);
1231 if (!initJoysticks())
1259 if (!initJoysticks())
1282 assert(state !=
NULL);
1294 if (!initJoysticks())
1328 const unsigned int hat = e->
index >> 4;
1329 const unsigned int bit = e->
index & 0xf;
1330 if (js->
hats[hat] & bit)
1347 const unsigned int hat = e->
index >> 4;
1348 const unsigned int bit = e->
index & 0xf;
1349 if (js->
hats[hat] & bit)
1350 state->
axes[i] = 1.f;
1352 state->
axes[i] = -1.f;
1363 assert(
string !=
NULL);
1386 if (time != time || time < 0.0 || time > 18446744073.0)
#define _GLFW_PLATFORM_MAPPING_NAME
void _glfwPlatformTerminateJoysticks(void)
int _glfwPlatformPollJoystick(_GLFWjoystick *js, int mode)
GLFWbool _glfwPlatformInitJoysticks(void)
void _glfwPlatformUpdateGamepadGUID(char *guid)
uint64_t _glfwPlatformGetTimerValue(void)
uint64_t _glfwPlatformGetTimerFrequency(void)
void _glfwPlatformSetCursorPos(_GLFWwindow *window, double x, double y)
int _glfwPlatformCreateCursor(_GLFWcursor *cursor, const GLFWimage *image, int xhot, int yhot)
void _glfwPlatformSetCursor(_GLFWwindow *window, _GLFWcursor *cursor)
void _glfwPlatformGetWindowSize(_GLFWwindow *window, int *width, int *height)
const char * _glfwPlatformGetScancodeName(int scancode)
void _glfwPlatformDestroyCursor(_GLFWcursor *cursor)
GLFWbool _glfwPlatformRawMouseMotionSupported(void)
void _glfwPlatformSetCursorMode(_GLFWwindow *window, int mode)
void _glfwPlatformSetClipboardString(const char *string)
void _glfwPlatformSetRawMouseMotion(_GLFWwindow *window, GLFWbool enabled)
int _glfwPlatformWindowFocused(_GLFWwindow *window)
int _glfwPlatformGetKeyScancode(int key)
int _glfwPlatformCreateStandardCursor(_GLFWcursor *cursor, int shape)
const char * _glfwPlatformGetClipboardString(void)
void _glfwPlatformGetCursorPos(_GLFWwindow *window, double *xpos, double *ypos)
#define GLFW_LOCK_KEY_MODS
#define GLFW_CURSOR_DISABLED
#define GLFW_STICKY_MOUSE_BUTTONS
#define GLFW_CURSOR_HIDDEN
#define GLFW_CURSOR_NORMAL
#define GLFW_RAW_MOUSE_MOTION
#define GLFW_INVALID_ENUM
One of the arguments to the function was an invalid enum value.
#define GLFW_INVALID_VALUE
One of the arguments to the function was an invalid value.
#define GLFW_PLATFORM_ERROR
A platform-specific error occurred that does not match any of the more specific categories.
#define GLFW_GAMEPAD_AXIS_LAST
#define GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER
#define GLFW_GAMEPAD_AXIS_RIGHT_Y
#define GLFW_GAMEPAD_AXIS_LEFT_X
#define GLFW_GAMEPAD_AXIS_LEFT_Y
#define GLFW_GAMEPAD_AXIS_LEFT_TRIGGER
#define GLFW_GAMEPAD_AXIS_RIGHT_X
#define GLFW_JOYSTICK_LAST
#define GLFW_KEY_KP_EQUAL
#define GLFW_MOD_NUM_LOCK
If this bit is set the Num Lock key is enabled.
#define GLFW_MOD_CAPS_LOCK
If this bit is set the Caps Lock key is enabled.
#define GLFW_RESIZE_EW_CURSOR
The horizontal resize/move arrow shape.
#define GLFW_NOT_ALLOWED_CURSOR
The operation-not-allowed shape.
#define GLFW_IBEAM_CURSOR
The text input I-beam cursor shape.
#define GLFW_RESIZE_ALL_CURSOR
The omni-directional resize/move cursor shape.
#define GLFW_ARROW_CURSOR
The regular arrow cursor shape.
#define GLFW_CROSSHAIR_CURSOR
The crosshair cursor shape.
#define GLFW_RESIZE_NS_CURSOR
The vertical resize/move arrow shape.
#define GLFW_POINTING_HAND_CURSOR
The pointing hand cursor shape.
#define GLFW_RESIZE_NESW_CURSOR
The top-right to bottom-left diagonal resize/move arrow shape.
#define GLFW_RESIZE_NWSE_CURSOR
The top-left to bottom-right diagonal resize/move arrow shape.
struct GLFWwindow GLFWwindow
Opaque window object.
float _glfw_fmaxf(float a, float b)
void _glfwInputError(int code, const char *format,...)
float _glfw_fminf(float a, float b)
#define _GLFW_REQUIRE_INIT_OR_RETURN(x)
#define _GLFW_SWAP_POINTERS(x, y)
#define _GLFW_POLL_BUTTONS
#define _GLFW_REQUIRE_INIT()
#define _GLFW_POLL_PRESENCE
unsigned __int64 uint64_t
struct _GLFWlibrary::@26 callbacks
struct _GLFWlibrary::@24 timer
_GLFWwindow * windowListHead
_GLFWjoystick joysticks[GLFW_JOYSTICK_LAST+1]
_GLFWcursor * cursorListHead
GLFWbool joysticksInitialized
struct _GLFWlibrary::@23 hints
_GLFWmapelement buttons[15]
GLFWcursorposfun cursorPos
struct _GLFWwindow::@22 callbacks
char mouseButtons[GLFW_MOUSE_BUTTON_LAST+1]
struct _GLFWwindow * next
GLFWbool stickyMouseButtons
char keys[GLFW_KEY_LAST+1]
GLFWmousebuttonfun mouseButton
GLFWcursorenterfun cursorEnter
unsigned char buttons[15]