viz1090/sdl1090/input.c
nathan 649c7aa466 added wiringPi exit button, compiler and SDL fixed for PI (need to add defines to allow compiling on PC again
Former-commit-id: 36897ec253d2711781deb41c8a94b67274e7603e
Former-commit-id: 3ed29801dd012902e04581194b606575cf2a94dc
2017-09-05 09:41:46 +00:00

41 lines
599 B
C

#include "input.h"
#include <wiringPi.h>
void getInput()
{
if(!digitalRead(23) || !digitalRead(22)) {
exit(0);
}
SDL_Event event;
/* Loop through waiting messages and process them */
while (SDL_PollEvent(&event))
{
fprintf(stderr,"key: %d\n", event.key.keysym.sym);
switch (event.type)
{
/* Closing the Window or pressing Escape will exit the program */
case SDL_QUIT:
exit(0);
break;
case SDL_KEYDOWN:
switch (event.key.keysym.sym)
{
case SDLK_ESCAPE:
exit(0);
break;
default:
break;
}
break;
}
}
}