code cleanup and build script update

This commit is contained in:
punkrockguy318 2008-07-16 06:06:04 +00:00
parent 6785d6708a
commit 1bfa59edd6
2 changed files with 22 additions and 36 deletions

View File

@ -1,2 +1,2 @@
#!/bin/sh #!/bin/sh
g++ `sdl-config --cflags --libs` main.cpp g++ `sdl-config --cflags --libs` main.cpp -o get_fceu_key;

View File

@ -1,17 +1,29 @@
// main.cpp
// get_fceu_key
// this program opens an SDL window and gets an input event from the user.
// it than prints the values that are needed in the fceux config
// this was written to be used with gfceux, the GTK frontend for gfceu
// Lukas Sabota
// Licensed under the GPL v2
// July 16, 2008
#include<iostream> #include<iostream>
#include<SDL.h> #include<SDL.h>
const int WIDTH = 640; const int WIDTH = 300;
const int HEIGHT = 480; const int HEIGHT = 300;
const int BPP = 4; const int BPP = 4;
const int DEPTH = 32; const int DEPTH = 32;
using namespace std; using namespace std;
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
SDL_WM_SetCaption("Press any key. . .", NULL); // the caption doesn't set on intrepid
// TODO: test on ubuntu 8.04
SDL_WM_SetCaption("Press any key. . .", 0);
SDL_Surface *screen; SDL_Surface *screen;
SDL_Event event; SDL_Event event;
@ -33,6 +45,8 @@ int main(int argc, char* argv[])
{ {
case SDL_QUIT: case SDL_QUIT:
return 0; return 0;
// this code was modified from drivers/sdl/input.cpp in fceu so
// that the same values will be written in the config as fceux --inputcfg
case SDL_KEYDOWN: case SDL_KEYDOWN:
cout << "BUTTC_KEYBOARD" << endl; cout << "BUTTC_KEYBOARD" << endl;
cout << 0 << endl; cout << 0 << endl;
@ -52,34 +66,6 @@ int main(int argc, char* argv[])
return 1; return 1;
} }
break; break;
/* case SDL_JOYAXISMOTION:
if(LastAx[event.jaxis.which][event.jaxis.axis] == 0x100000) {
if(abs(event.jaxis.value) < 1000) {
LastAx[event.jaxis.which][event.jaxis.axis] = event.jaxis.value;
}
} else {
if(abs(LastAx[event.jaxis.which][event.jaxis.axis] - event.jaxis.value) >= 8192) {
bc->ButtType[wb] = BUTTC_JOYSTICK;
bc->DeviceNum[wb] = event.jaxis.which;
bc->ButtonNum[wb] = (0x8000 | event.jaxis.axis |
((event.jaxis.value < 0)
? 0x4000 : 0));
return(1);
}
}
break;
case SDL_KEYDOWN:
keypress = 1;
cout << (int)event.key.keysym.sym;
break;
case SDL_JOYAXISMOTION:
if ( (event.jaxis.value < -3200 ) | | (event.jaxis.value > 3200) )
{
if (event.jaxis == 0)
{
*/
} }
} }
} }