From 1bfa59edd65fd1bc9be15c6c0ae0ea1ae43e606f Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Wed, 16 Jul 2008 06:06:04 +0000 Subject: [PATCH] code cleanup and build script update --- get_key/build.sh | 2 +- get_key/main.cpp | 56 ++++++++++++++++++------------------------------ 2 files changed, 22 insertions(+), 36 deletions(-) diff --git a/get_key/build.sh b/get_key/build.sh index 2c4f69db..10fefdb5 100755 --- a/get_key/build.sh +++ b/get_key/build.sh @@ -1,2 +1,2 @@ #!/bin/sh -g++ `sdl-config --cflags --libs` main.cpp +g++ `sdl-config --cflags --libs` main.cpp -o get_fceu_key; diff --git a/get_key/main.cpp b/get_key/main.cpp index 05e6386d..c9a77845 100644 --- a/get_key/main.cpp +++ b/get_key/main.cpp @@ -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 #include -const int WIDTH = 640; -const int HEIGHT = 480; +const int WIDTH = 300; +const int HEIGHT = 300; const int BPP = 4; const int DEPTH = 32; - using namespace std; 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_Event event; @@ -33,6 +45,8 @@ int main(int argc, char* argv[]) { case SDL_QUIT: 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: cout << "BUTTC_KEYBOARD" << endl; cout << 0 << endl; @@ -52,37 +66,9 @@ int main(int argc, char* argv[]) return 1; } 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) - { -*/ - - - } - } - } + } + } + } return 0; }