aboutsummaryrefslogtreecommitdiffstats
path: root/libgamepad.h
diff options
context:
space:
mode:
Diffstat (limited to 'libgamepad.h')
-rw-r--r--libgamepad.h87
1 files changed, 54 insertions, 33 deletions
diff --git a/libgamepad.h b/libgamepad.h
index a6002fe..d039082 100644
--- a/libgamepad.h
+++ b/libgamepad.h
@@ -1503,65 +1503,86 @@ int libgamepad_next_event(struct libgamepad_device *, struct libgamepad_input_ev
/**
* Get the name of a button/key
*
- * @param code The button/key
- * @return The button/key's name
+ * @param device If `NULL`, a generic name will be returned,
+ * otherwise the canonical name for the button/key
+ * on the specific device will be returned
+ * (`NULL` if not information is unavailable)
+ * @param code The button/key
+ * @return The button/key's name, `NULL` if not found
*/
-inline const char *
-libgamepad_get_button_name(uint16_t code)
-{
- return libevdev_event_code_get_name(EV_KEY, (unsigned int)code);
-}
+const char *libgamepad_get_button_name(const struct libgamepad_device *, uint16_t);
/**
* Get the name of an absolute axis
*
- * @param code The axis
- * @return The axis' name
+ * @param device If `NULL`, a generic name will be returned,
+ * otherwise the canonical name for the axis
+ * on the specific device will be returned
+ * (`NULL` if not information is unavailable)
+ * @param code The axis
+ * @return The axis' name, `NULL` if not found
*/
-inline const char *
-libgamepad_get_absolute_axis_name(uint16_t code)
-{
- return libevdev_event_code_get_name(EV_ABS, (unsigned int)code);
-}
+const char *libgamepad_get_absolute_axis_name(const struct libgamepad_device *, uint16_t);
/**
* Get the name of a relative axis
*
- * @param code The axis
- * @return The axis' name
+ * @param device If `NULL`, a generic name will be returned,
+ * otherwise the canonical name for the axis
+ * on the specific device will be returned
+ * (`NULL` if not information is unavailable)
+ * @param code The axis
+ * @return The axis' name, `NULL` if not found
*/
-inline const char *
-libgamepad_get_relative_axis_name(uint16_t code)
-{
- return libevdev_event_code_get_name(EV_REL, (unsigned int)code);
-}
+const char *libgamepad_get_relative_axis_name(const struct libgamepad_device *, uint16_t);
+
+/**
+ * Get a button/key code from it's name
+ *
+ * @param name The button/key's name or textual
+ * representation of its code number
+ * @return The button/key, -1 if not found
+ */
+int16_t libgamepad_get_button_by_name(const char *);
+
+/**
+ * Get a absolute axis code from it's name
+ *
+ * @param name The absolute axis' name or textual
+ * representation of its code number
+ * @return The absolute axis, -1 if not found
+ */
+int16_t libgamepad_get_absolute_axis_by_name(const char *);
+
+/**
+ * Get a relative axis code from it's name
+ *
+ * @param name The relative axis' name or textual
+ * representation of its code number
+ * @return The relative axis, -1 if not found
+ */
+int16_t libgamepad_get_relative_axis_by_name(const char *);
+
/**
* Get whether a button/key is pressed down or not
- *
+ *
* @param device The device to retrieve the information for
* @param code The button/key
* @return 1 if the button/key is pressed down,
* 0 otherwise
*/
-inline int
-libgamepad_get_button_is_pressed(struct libgamepad_device *device, uint16_t code)
-{
- return libevdev_get_event_value(device->dev, EV_KEY, (unsigned int)code);
-}
+int libgamepad_get_button_is_pressed(struct libgamepad_device *, uint16_t);
/**
* Get information about an absolute axis
- *
+ *
* @param device The device to retrieve the information for
* @param code The axis
* @return Information about the axis
*/
-inline const struct input_absinfo * /* `struct input_absinfo` is defined in <linux/input.h> */
-libgamepad_get_absolute_axis_info(struct libgamepad_device *device, uint16_t code)
-{
- return libevdev_get_abs_info(device->dev, (unsigned int)code);
-}
+const struct input_absinfo *libgamepad_get_absolute_axis_info(struct libgamepad_device *, uint16_t);
+/* `struct input_absinfo` is defined in <linux/input.h> */
/**