3
// this program opens an SDL window and gets an input event from the user.
4
// it than prints the values that are needed in the fceux config
5
// this was written to be used with gfceux, the GTK frontend for gfceu
8
// Licensed under the GPL v2
14
const int WIDTH = 300;
15
const int HEIGHT = 300;
21
int main(int argc, char* argv[])
23
// the caption doesn't set on intrepid
24
// TODO: test on ubuntu 8.04
25
SDL_WM_SetCaption("Press any key. . .", 0);
31
for(int i = 0; i < SDL_NumJoysticks(); i++)
34
if (!(screen = SDL_SetVideoMode(WIDTH, HEIGHT, DEPTH, SDL_SWSURFACE)))
42
while(SDL_PollEvent(&event))
48
// this code was modified from drivers/sdl/input.cpp in fceu so
49
// that the same values will be written in the config as fceux --inputcfg
51
cout << "BUTTC_KEYBOARD" << endl;
53
cout << event.key.keysym.sym << endl;
55
case SDL_JOYBUTTONDOWN:
56
cout << "BUTTC_JOYSTICK" << endl;
57
cout << event.jbutton.which << endl;
58
cout << event.jbutton.button << endl;
60
case SDL_JOYHATMOTION:
61
if(event.jhat.value != SDL_HAT_CENTERED)
63
cout << "BUTTC_JOYSTICK" << endl;
64
cout << event.jhat.which << endl;
65
cout << (0x2000 | ((event.jhat.hat & 0x1F) << 8) |
66
event.jhat.value) << endl;