mirror of
https://github.com/Genymobile/scrcpy.git
synced 2026-04-21 01:33:36 +00:00
Use two separate event structs for gamepad device added and gamepad device removed. In theory, some data (like vendorId and productId) could be added specifically to "device added" events.
59 lines
1.3 KiB
C
59 lines
1.3 KiB
C
#ifndef SC_GAMEPAD_PROCESSOR_H
|
|
#define SC_GAMEPAD_PROCESSOR_H
|
|
|
|
#include "common.h"
|
|
|
|
#include <assert.h>
|
|
#include <stdbool.h>
|
|
|
|
#include "input_events.h"
|
|
|
|
/**
|
|
* Gamepad processor trait.
|
|
*
|
|
* Component able to handle gamepads devices and inject buttons and axis events.
|
|
*/
|
|
struct sc_gamepad_processor {
|
|
const struct sc_gamepad_processor_ops *ops;
|
|
};
|
|
|
|
struct sc_gamepad_processor_ops {
|
|
|
|
/**
|
|
* Process a gamepad device added
|
|
*
|
|
* This function is mandatory.
|
|
*/
|
|
void
|
|
(*process_gamepad_added)(struct sc_gamepad_processor *gp,
|
|
const struct sc_gamepad_added_event *event);
|
|
|
|
/**
|
|
* Process a gamepad device removed
|
|
*
|
|
* This function is mandatory.
|
|
*/
|
|
void
|
|
(*process_gamepad_removed)(struct sc_gamepad_processor *gp,
|
|
const struct sc_gamepad_removed_event *event);
|
|
|
|
/**
|
|
* Process a gamepad axis event
|
|
*
|
|
* This function is mandatory.
|
|
*/
|
|
void
|
|
(*process_gamepad_axis)(struct sc_gamepad_processor *gp,
|
|
const struct sc_gamepad_axis_event *event);
|
|
|
|
/**
|
|
* Process a gamepad button event
|
|
*
|
|
* This function is mandatory.
|
|
*/
|
|
void
|
|
(*process_gamepad_button)(struct sc_gamepad_processor *gp,
|
|
const struct sc_gamepad_button_event *event);
|
|
};
|
|
|
|
#endif
|