Loading...
Searching...
No Matches
input.c
Go to the documentation of this file.
#ifdef ARC_GLFW_INPUT
#include "arc/input/input.h"
#include "arc/input/mouse.h"
#include "arc/input/keyboard.h"
#include <GLFW/glfw3.h>
#include <stdlib.h>
struct ARC_Input {
ARC_Keyboard *keyboard;
ARC_Mouse *mouse;
GLFWwindow *window;
};
void ARC_Input_CreateWithEngineData(ARC_Input **input, ARC_EngineData *data){
*input = (ARC_Input *)malloc(sizeof(ARC_Input));
(*input)->event = (SDL_Event *)malloc(sizeof(SDL_Event));
ARC_Keyboard_CreateWithEngineData(&(*input)->keyboard, data);
ARC_Keyboard_CreateWithEngineData(&(*input)->mouse, data);
}
void ARC_Input_Destroy(ARC_Input *input){
ARC_Keyboard_Destroy(input->keyboard);
ARC_Mouse_Destroy(input->mouse);
free(input->event);
free(input);
}
ARC_Keyboard *ARC_Input_GetKeyboard(ARC_Input *input){
return input->keyboard;
}
ARC_Mouse *ARC_Input_GetMouse(ARC_Input *input){
return input->mouse;
}
#endif // ARC_SDL2_INPUT
input.h
ARC_Input_GetKeyboard
ARC_Keyboard * ARC_Input_GetKeyboard(ARC_Input *input)
Definition input.c:39
ARC_Input_Destroy
void ARC_Input_Destroy(ARC_Input *input)
Definition input.c:19
ARC_Input_GetMouse
ARC_Mouse * ARC_Input_GetMouse(ARC_Input *input)
Definition input.c:43
ARC_Input_CreateWithEngineData
void ARC_Input_CreateWithEngineData(ARC_Input **input, ARC_EngineData *data)
Definition input.c:10
keyboard.h
ARC_Keyboard_Destroy
void ARC_Keyboard_Destroy(ARC_Keyboard *keyboard)
Definition keyboard.c:23
mouse.h
ARC_Mouse_Destroy
void ARC_Mouse_Destroy(ARC_Mouse *mouse)
Definition mouse.c:31
ARC_EngineData
Definition engine.h:17
ARC_Input
Definition input.h:8
ARC_Input::event
SDL_Event * event
Definition input.h:12
ARC_Input::keyboard
ARC_Keyboard * keyboard
Definition input.h:9
ARC_Input::mouse
ARC_Mouse * mouse
Definition input.h:10
ARC_Keyboard
Definition keyboard.h:7
ARC_Mouse
Definition mouse.h:8