GrooveStomp's 3D Software Renderer  0.1.0
Classes | Functions | Variables
input.c File Reference
#include "SDL2/SDL.h"
#include "math.h"
Include dependency graph for input.c:

Classes

struct  input
 Keypress state. Unexported. More...
 

Functions

struct inputInputInit ()
 Creates and initializes a new input object. More...
 
void InputDeinit (struct input *i)
 De-initializes and frees memory for the given input object. More...
 
int InputIsQuitPressed (SDL_Event *event)
 Check if the user has tried to quit the program. More...
 
void InputProcess (struct input *i)
 Handle input. More...
 

Variables

struct vec3 camera
 global camera state
 
struct vec3 lookDir
 global look direction state
 
struct vec3 up
 global up vector state
 
float yaw
 global view direction state
 
double elapsedTime
 global time state
 

Function Documentation

◆ InputDeinit()

void InputDeinit ( struct input input)

De-initializes and frees memory for the given input object.

Parameters
[in,out]inputThe initialized input object to be cleaned and reclaimed

◆ InputInit()

struct input* InputInit ( )

Creates and initializes a new input object.

Returns
The initialized input object

◆ InputIsQuitPressed()

int InputIsQuitPressed ( SDL_Event *  event)

Check if the user has tried to quit the program.

Parameters
[in]eventthe event object to query
Returns
1 if quit has been pressed, otherwise zero

◆ InputProcess()

void InputProcess ( struct input input)

Handle input.

This function reaches into global state and changes it based on user input, doing things like changing the view direction.

This interface is a prime candidate to be reworked into something far less intrusive, like a callback mechanism.

Parameters
[in,out]inputInput state to be updated