Remove event for input
This commit is contained in:
@@ -22,20 +22,6 @@ errorret_t inputInit(void) {
|
|||||||
INPUT.actions[i].action = (inputaction_t)i;
|
INPUT.actions[i].action = (inputaction_t)i;
|
||||||
INPUT.actions[i].lastValue = 0.0f;
|
INPUT.actions[i].lastValue = 0.0f;
|
||||||
INPUT.actions[i].currentValue = 0.0f;
|
INPUT.actions[i].currentValue = 0.0f;
|
||||||
|
|
||||||
eventInit(
|
|
||||||
&INPUT.actions[i].onPressed,
|
|
||||||
INPUT.actions[i].onPressedCallbacks,
|
|
||||||
INPUT.actions[i].onPressedUsers,
|
|
||||||
INPUT_ACTION_CALLBACK_COUNT_MAX
|
|
||||||
);
|
|
||||||
|
|
||||||
eventInit(
|
|
||||||
&INPUT.actions[i].onReleased,
|
|
||||||
INPUT.actions[i].onReleasedCallbacks,
|
|
||||||
INPUT.actions[i].onReleasedUsers,
|
|
||||||
INPUT_ACTION_CALLBACK_COUNT_MAX
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef inputInitPlatform
|
#ifdef inputInitPlatform
|
||||||
@@ -106,8 +92,6 @@ void inputUpdate(void) {
|
|||||||
inputactiondata_t *act = &INPUT.actions[i];
|
inputactiondata_t *act = &INPUT.actions[i];
|
||||||
bool_t isDown = act->currentValue > 0.0f;
|
bool_t isDown = act->currentValue > 0.0f;
|
||||||
bool_t wasDown = act->lastValue > 0.0f;
|
bool_t wasDown = act->lastValue > 0.0f;
|
||||||
if(isDown && !wasDown) eventInvoke(&act->onPressed, act);
|
|
||||||
if(!isDown && wasDown) eventInvoke(&act->onReleased, act);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,8 @@
|
|||||||
#include "inputbutton.h"
|
#include "inputbutton.h"
|
||||||
#include "inputaction.h"
|
#include "inputaction.h"
|
||||||
|
|
||||||
#define INPUT_LISTENER_PRESSED_MAX 16
|
|
||||||
#define INPUT_LISTENER_RELEASED_MAX INPUT_LISTENER_PRESSED_MAX
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
inputactiondata_t actions[INPUT_ACTION_COUNT];
|
inputactiondata_t actions[INPUT_ACTION_COUNT];
|
||||||
|
|
||||||
inputplatform_t platform;
|
inputplatform_t platform;
|
||||||
} input_t;
|
} input_t;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "time/time.h"
|
#include "time/time.h"
|
||||||
#include "input/inputactiondefs.h"
|
#include "input/inputactiondefs.h"
|
||||||
#include "event/event.h"
|
|
||||||
|
|
||||||
#define INPUT_ACTION_CALLBACK_COUNT_MAX 4
|
#define INPUT_ACTION_CALLBACK_COUNT_MAX 4
|
||||||
|
|
||||||
@@ -21,13 +20,6 @@ typedef struct {
|
|||||||
float_t lastDynamicValue;
|
float_t lastDynamicValue;
|
||||||
float_t currentDynamicValue;
|
float_t currentDynamicValue;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
eventcallback_t onPressedCallbacks[INPUT_ACTION_CALLBACK_COUNT_MAX];
|
|
||||||
void *onPressedUsers[INPUT_ACTION_CALLBACK_COUNT_MAX];
|
|
||||||
event_t onPressed;
|
|
||||||
eventcallback_t onReleasedCallbacks[INPUT_ACTION_CALLBACK_COUNT_MAX];
|
|
||||||
void *onReleasedUsers[INPUT_ACTION_CALLBACK_COUNT_MAX];
|
|
||||||
event_t onReleased;
|
|
||||||
} inputactiondata_t;
|
} inputactiondata_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user