press and release timings
This commit is contained in:
parent
82dbbab448
commit
da0c1bc35f
2 changed files with 3 additions and 1 deletions
2
logic.c
2
logic.c
|
|
@ -76,7 +76,7 @@ int logic_copy_gamepad_status(logic_t *const logic, gamepad_status_t *const out)
|
|||
|
||||
if (logic->gamepad.center) {
|
||||
// If the center button is pressed and at least 500ms have passed
|
||||
if (elapsed_time >= 500) {
|
||||
if (elapsed_time >= PRESS_AND_RELEASE_DURATION_FOR_CENTER_BUTTON_MS) {
|
||||
printf("Releasing center button\n");
|
||||
logic->gamepad.center = 0;
|
||||
logic->gamepad.flags &= ~GAMEPAD_STATUS_FLAGS_PRESS_AND_REALEASE_CENTER;
|
||||
|
|
|
|||
2
logic.h
2
logic.h
|
|
@ -3,6 +3,8 @@
|
|||
#include "platform.h"
|
||||
#include "queue.h"
|
||||
|
||||
#define PRESS_AND_RELEASE_DURATION_FOR_CENTER_BUTTON_MS 200
|
||||
|
||||
#define GAMEPAD_STATUS_FLAGS_PRESS_AND_REALEASE_CENTER 0x00000001U
|
||||
|
||||
typedef struct gamepad_status {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue