Input: refactoring, platform agnostic key configuration.

Update input usage across project. Minor queue usage fixes and tick timings. (#330)
This commit is contained in:
あく
2021-02-10 11:56:05 +03:00
committed by GitHub
parent 5dbe2983aa
commit 8b94eff7f9
36 changed files with 347 additions and 334 deletions

View File

@@ -38,7 +38,7 @@ static void input_callback(InputEvent* input_event, void* ctx) {
}
void template_app(void* p) {
osMessageQueueId_t event_queue = osMessageQueueNew(1, sizeof(Event), NULL);
osMessageQueueId_t event_queue = osMessageQueueNew(8, sizeof(Event), NULL);
State _state;
/* init state here */
@@ -72,22 +72,22 @@ void template_app(void* p) {
if(event_status == osOK) {
if(event.type == EventTypeKey) {
// press events
if(event.value.input.state && event.value.input.input == InputBack) {
if(event.value.input.type == InputTypeShort && event.value.input.key == InputKeyBack) {
}
if(event.value.input.state && event.value.input.input == InputUp) {
if(event.value.input.type == InputTypeShort && event.value.input.key == InputKeyUp) {
}
if(event.value.input.state && event.value.input.input == InputDown) {
if(event.value.input.type == InputTypeShort && event.value.input.key == InputKeyDown) {
}
if(event.value.input.state && event.value.input.input == InputLeft) {
if(event.value.input.type == InputTypeShort && event.value.input.key == InputKeyLeft) {
}
if(event.value.input.state && event.value.input.input == InputRight) {
if(event.value.input.type == InputTypeShort && event.value.input.key == InputKeyRight) {
}
if(event.value.input.input == InputOk) {
if(event.value.input.key == InputKeyOk) {
}
}
} else {