merged with temp input update fix

This commit is contained in:
herbglitch 2024-11-30 01:16:37 -07:00
commit 7cfea02681
3 changed files with 11 additions and 5 deletions

View file

@ -7,6 +7,7 @@ extern "C" {
#include "arc/input/keyboard.h"
#include "arc/input/mouse.h"
#include "arc/std/bool.h"
/**
* @brief predefien ARC_EngineData so as not to get circular reference
@ -19,7 +20,7 @@ void ARC_Input_CreateWithEngineData(ARC_Input **input, ARC_EngineData *data);
void ARC_Input_Destroy(ARC_Input *input);
void ARC_Input_Update(ARC_Input *input);
ARC_Bool ARC_Input_Update(ARC_Input *input);
ARC_Keyboard *ARC_Input_GetKeyboard(ARC_Input *input);

View file

@ -24,11 +24,16 @@ void ARC_Input_Destroy(ARC_Input *input){
free(input);
}
void ARC_Input_Update(ARC_Input *input){
ARC_Bool ARC_Input_Update(ARC_Input *input){
SDL_PollEvent(input->event);
if(input->event->type == SDL_QUIT){
return ARC_False;
}
ARC_Keyboard_Update(input->keyboard);
ARC_Mouse_Update(input->mouse);
return ARC_True;
}
ARC_Keyboard *ARC_Input_GetKeyboard(ARC_Input *input){

View file

@ -66,7 +66,7 @@ void ARC_Engine_RunUncapped(ARC_EngineData *data){
// data->dt = currentTime - lastTime;
// lastTime = currentTime;
ARC_Input_Update(data->input);
data->running = ARC_Input_Update(data->input);
ARC_Handler_Clean(data->state);