Loading...
Searching...
No Matches
input.c File Reference
`#include "arc/input/input.h"`
`#include "input.h"`
`#include "arc/input/mouse.h"`
`#include "arc/input/keyboard.h"`
`#include <SDL.h>`
`#include <stdlib.h>`

Go to the source code of this file.

## Functions

void | ARC_Input_CreateWithEngineData (ARC_Input **input, ARC_EngineData *data)
void | ARC_Input_Destroy (ARC_Input *input)
ARC_Bool | ARC_Input_Update (ARC_Input *input)
ARC_Keyboard * | ARC_Input_GetKeyboard (ARC_Input *input)
ARC_Mouse * | ARC_Input_GetMouse (ARC_Input *input)

## Function Documentation

## ARC_Input_CreateWithEngineData()

void ARC_Input_CreateWithEngineData | ( | ARC_Input ** | input,
|  | ARC_EngineData * | data )

Definition at line 10 of file input.c.

{
*input = (ARC_Input *)malloc(sizeof(ARC_Input));
(*input)->event = (SDL_Event *)malloc(sizeof(SDL_Event));
ARC_Keyboard_CreateWithInput(&((*input)->keyboard), *input);
ARC_Mouse_CreateWithInput(&((*input)->mouse), *input);
}
ARC_Keyboard_CreateWithInput
void ARC_Keyboard_CreateWithInput(ARC_Keyboard **keyboard, ARC_Input *input)
Definition keyboard.c:11
ARC_Mouse_CreateWithInput
void ARC_Mouse_CreateWithInput(ARC_Mouse **mouse, ARC_Input *input)
Definition mouse.c:12
ARC_Input
Definition input.h:8
ARC_Input::event
SDL_Event * event
Definition input.h:12

## ARC_Input_Destroy()

void ARC_Input_Destroy | ( | ARC_Input * | input | ) |

Definition at line 19 of file input.c.

{
ARC_Keyboard_Destroy(input->keyboard);
ARC_Mouse_Destroy(input->mouse);
free(input->event);
free(input);
}
ARC_Keyboard_Destroy
void ARC_Keyboard_Destroy(ARC_Keyboard *keyboard)
Definition keyboard.c:23
ARC_Mouse_Destroy
void ARC_Mouse_Destroy(ARC_Mouse *mouse)
Definition mouse.c:31
ARC_Input::keyboard
ARC_Keyboard * keyboard
Definition input.h:9
ARC_Input::mouse
ARC_Mouse * mouse
Definition input.h:10

## ARC_Input_GetKeyboard()

ARC_Keyboard * ARC_Input_GetKeyboard | ( | ARC_Input * | input | ) |

Definition at line 39 of file input.c.

{
return input->keyboard;
}

## ARC_Input_GetMouse()

ARC_Mouse * ARC_Input_GetMouse | ( | ARC_Input * | input | ) |

Definition at line 43 of file input.c.

{
return input->mouse;
}

## ARC_Input_Update()

ARC_Bool ARC_Input_Update | ( | ARC_Input * | input | ) |

Definition at line 27 of file input.c.

{
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_False
#define ARC_False
Definition bool.h:12
ARC_True
#define ARC_True
Definition bool.h:11
ARC_Keyboard_Update
void ARC_Keyboard_Update(ARC_Keyboard *keyboard)
Definition keyboard.c:29
ARC_Mouse_Update
void ARC_Mouse_Update(ARC_Mouse *mouse)
Definition mouse.c:61