added wiringPi exit button, compiler and SDL fixed for PI (need to add defines to allow compiling on PC again
Former-commit-id: 70c389508541a37a398075674b042204cd9037cb Former-commit-id: e2b2550c65c66b5053e83c4f61d36eb369ce424f
This commit is contained in:
parent
ffeccc295e
commit
7449d7b066
|
@ -10,8 +10,8 @@ SHAREDIR=$(PREFIX)/share/$(PROGNAME)
|
||||||
EXTRACFLAGS=-DHTMLPATH=\"$(SHAREDIR)\"
|
EXTRACFLAGS=-DHTMLPATH=\"$(SHAREDIR)\"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS=-O2 -g -Wall -W `pkg-config --cflags librtlsdr`
|
CFLAGS=-O2 -g -Wall -W `pkg-config --cflags librtlsdr` -std=c99
|
||||||
LIBS=`pkg-config --libs librtlsdr` -lpthread -lm `sdl-config --libs` -lSDL -lSDL_ttf -lSDL_gfx
|
LIBS=`pkg-config --libs librtlsdr` -lpthread -lm `sdl-config --libs` -lSDL -lSDL_ttf -lSDL_gfx -lwiringPi
|
||||||
CC=gcc
|
CC=gcc
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,22 @@
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
|
#include "SDL/SDL_getenv.h"
|
||||||
|
#include <wiringPi.h>
|
||||||
|
|
||||||
extern void closeFont(TTF_Font *);
|
extern void closeFont(TTF_Font *);
|
||||||
|
|
||||||
|
|
||||||
void init(char *title)
|
void init(char *title)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
wiringPiSetupGpio() ;
|
||||||
|
|
||||||
|
pinMode(23, INPUT);
|
||||||
|
pullUpDnControl (23, PUD_UP);
|
||||||
|
pinMode(22, INPUT);
|
||||||
|
pullUpDnControl (22, PUD_UP);
|
||||||
|
|
||||||
|
putenv((char*)"FRAMEBUFFER=/dev/fb1");
|
||||||
|
putenv((char*)"SDL_FBDEV=/dev/fb1");
|
||||||
/* Initialise SDL */
|
/* Initialise SDL */
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_VIDEO) < 0)
|
if (SDL_Init(SDL_INIT_VIDEO) < 0)
|
||||||
|
@ -22,9 +34,10 @@ void init(char *title)
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
game.screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 0, SDL_HWPALETTE|SDL_DOUBLEBUF);
|
SDL_ShowCursor(SDL_DISABLE);
|
||||||
|
|
||||||
|
game.screen = SDL_SetVideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 16, SDL_HWPALETTE|SDL_DOUBLEBUF);
|
||||||
|
|
||||||
if (game.screen == NULL)
|
if (game.screen == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,13 +1,21 @@
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
#include <wiringPi.h>
|
||||||
|
|
||||||
void getInput()
|
void getInput()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(!digitalRead(23) || !digitalRead(22)) {
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
||||||
/* Loop through waiting messages and process them */
|
/* Loop through waiting messages and process them */
|
||||||
|
|
||||||
while (SDL_PollEvent(&event))
|
while (SDL_PollEvent(&event))
|
||||||
{
|
{
|
||||||
|
fprintf(stderr,"key: %d\n", event.key.keysym.sym);
|
||||||
|
|
||||||
switch (event.type)
|
switch (event.type)
|
||||||
{
|
{
|
||||||
/* Closing the Window or pressing Escape will exit the program */
|
/* Closing the Window or pressing Escape will exit the program */
|
||||||
|
@ -29,4 +37,4 @@ void getInput()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
dd9da3d4441175ab67ca8209c4dc330f48cf6590
|
07b6d82450c0a8be87c3ff832b90537a06e9cb20
|
Loading…
Reference in a new issue