mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-14 18:57:07 -07:00
Add Face Buttons to ChiakiControllerState
This commit is contained in:
parent
ebcf72fb10
commit
a0567b670c
6 changed files with 28 additions and 1 deletions
|
@ -27,8 +27,21 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum chiaki_controller_button_t
|
||||
{
|
||||
CHIAKI_CONTROLLER_BUTTON_CROSS = (1 << 0),
|
||||
CHIAKI_CONTROLLER_BUTTON_MOON = (1 << 1),
|
||||
CHIAKI_CONTROLLER_BUTTON_BOX = (1 << 2),
|
||||
CHIAKI_CONTROLLER_BUTTON_PYRAMID = (1 << 3)
|
||||
} ChiakiControllerButton;
|
||||
|
||||
typedef struct chiaki_controller_state_t
|
||||
{
|
||||
/**
|
||||
* Bitmask of ChiakiControllerButton
|
||||
*/
|
||||
uint32_t buttons;
|
||||
|
||||
int16_t left_x;
|
||||
int16_t left_y;
|
||||
int16_t right_x;
|
||||
|
@ -39,7 +52,8 @@ CHIAKI_EXPORT void chiaki_controller_state_set_idle(ChiakiControllerState *state
|
|||
|
||||
static inline bool chiaki_controller_state_equals(ChiakiControllerState *a, ChiakiControllerState *b)
|
||||
{
|
||||
return a->left_x == b->left_x
|
||||
return a->buttons == b->buttons
|
||||
&& a->left_x == b->left_x
|
||||
&& a->left_y == b->left_y
|
||||
&& a->right_x == b->right_x
|
||||
&& a->right_y == b->right_y;
|
||||
|
|
|
@ -29,6 +29,7 @@ extern "C" {
|
|||
|
||||
typedef struct chiaki_feedback_state_t
|
||||
{
|
||||
uint32_t buttons;
|
||||
int16_t left_x;
|
||||
int16_t left_y;
|
||||
int16_t right_x;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
CHIAKI_EXPORT void chiaki_controller_state_set_idle(ChiakiControllerState *state)
|
||||
{
|
||||
state->buttons = 0;
|
||||
state->left_x = 0;
|
||||
state->left_y = 0;
|
||||
state->right_x = 0;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
|
||||
#include <chiaki/feedback.h>
|
||||
#include <chiaki/controller.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ CHIAKI_EXPORT ChiakiErrorCode chiaki_feedback_sender_set_controller_state(Chiaki
|
|||
static void feedback_sender_send_state(ChiakiFeedbackSender *feedback_sender)
|
||||
{
|
||||
ChiakiFeedbackState state;
|
||||
state.buttons = feedback_sender->controller_state.buttons;
|
||||
state.left_x = feedback_sender->controller_state.left_x;
|
||||
state.left_y = feedback_sender->controller_state.left_y;
|
||||
state.right_x = feedback_sender->controller_state.right_x;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue