# eventhandler.c

## Defines
#define | _KEYBOARD_
#define | _MOUSE_
#define | _BUTTONS_
#define | _SPRITES_
#define | _MAINGAME_
#define | _OPTIONS_
#define | _HOWTOPLAY_
#define | _HIGHSCORES_
#define | _PAUSE_
#define | _GAMEOVER_
#define | _RENDER_
#define | _INITS_
#define | _EVENTHANDLER_
## Functions
void * | keyhandler (String key, void *data)
| Checks for keyboard input.
void * | mousehandler (MOUSE *mouse_s, void *data)
void * | buttonhandler (BUTTONPTR button, void *data, int type)
void | execute_on_button_press (void)
void | execute_on_M_press (void)
void | return_to_main_menu (GDATAPTR game)

## Detailed Description

Handles all keyboard, mouse and button events

## Define Documentation

#define _BUTTONS_

Definition at line 49 of file eventhandler.c.

#define _EVENTHANDLER_

Definition at line 99 of file eventhandler.c.

#define _GAMEOVER_

Definition at line 84 of file eventhandler.c.

#define _HIGHSCORES_

Definition at line 74 of file eventhandler.c.

#define _HOWTOPLAY_

Definition at line 69 of file eventhandler.c.

#define _INITS_

Definition at line 94 of file eventhandler.c.

#define _KEYBOARD_

Definition at line 39 of file eventhandler.c.

#define _MAINGAME_

Definition at line 59 of file eventhandler.c.

#define _MOUSE_

Definition at line 44 of file eventhandler.c.

#define _OPTIONS_

Definition at line 64 of file eventhandler.c.

#define _PAUSE_

Definition at line 79 of file eventhandler.c.

#define _RENDER_

Definition at line 89 of file eventhandler.c.

#define _SPRITES_

Definition at line 54 of file eventhandler.c.

## Function Documentation

void* buttonhandler | ( | BUTTONPTR | button,
|  | void * | data,
|  | int | type |
| ) |  |  |

Definition at line 188 of file eventhandler.c.

void execute_on_button_press | ( | void |  | ) |

Definition at line 331 of file eventhandler.c.

void execute_on_M_press | ( | void |  | ) |

Definition at line 362 of file eventhandler.c.

void* keyhandler | ( | String | key,
|  | void * | data |
| ) |  |  |

Checks for keyboard input.

This function is called once every frame via a function pointer through keyboard.c keycheck function. All keyboard input is handled here. The void pointer points to a struct of type GDATA to set the the structure member 'quit' and 'gamestarted' to false or true depending on the situation

Parameters:

  `[in]` | key | The pointer to an array of chars which contain the details for which key has been pressed. The array of chars is processed and updated by the keyboard.c routines.
  `[out]` | *data | A pointer to type void is required to process optional additional data, specifically a pointer to type GDATA is passed to terminate or start the game on certain keystrokes.

See also:
  keycheck
  keyup
  keydown
  keyrepeat
  keyupdate
  keyclear

Returns:
  Returns a void pointer, so any data can be returned if need be.

Definition at line 110 of file eventhandler.c.

void* mousehandler | ( | MOUSE * | mouse_s,
|  | void * | data |
| ) |  |  |

Definition at line 153 of file eventhandler.c.

void return_to_main_menu | ( | GDATAPTR | game | ) |

Definition at line 394 of file eventhandler.c.