Annotation of hatari/src/gui-sdl/dlgJoystick.c, revision 1.1.1.1

1.1       root        1: /*
                      2:   Hatari - dlgJoystick.c
                      3: 
                      4:   This file is distributed under the GNU Public License, version 2 or at
                      5:   your option any later version. Read the file gpl.txt for details.
                      6: */
                      7: char DlgJoystick_rcsid[] = "Hatari $Id: dlgJoystick.c,v 1.2 2004/04/19 08:53:48 thothy Exp $";
                      8: 
                      9: #include "main.h"
                     10: #include "configuration.h"
                     11: #include "dialog.h"
                     12: #include "sdlgui.h"
                     13: 
                     14: 
                     15: #define DLGJOY_J1CURSOR    4
                     16: #define DLGJOY_J1AUTOFIRE  5
                     17: #define DLGJOY_J0CURSOR    8
                     18: #define DLGJOY_J0AUTOFIRE  9
                     19: #define DLGJOY_EXIT        10
                     20: 
                     21: 
                     22: /* The joysticks dialog: */
                     23: static SGOBJ joystickdlg[] =
                     24: {
                     25:   { SGBOX, 0, 0, 0,0, 30,19, NULL },
                     26:   { SGTEXT, 0, 0, 7,1, 15,1, "Joysticks setup" },
                     27:   { SGBOX, 0, 0, 1,3, 28,6, NULL },
                     28:   { SGTEXT, 0, 0, 2,4, 11,1, "Joystick 1:" },
                     29:   { SGCHECKBOX, 0, 0, 5,6, 22,1, "Use cursor emulation" },
                     30:   { SGCHECKBOX, 0, 0, 5,7, 17,1, "Enable autofire" },
                     31:   { SGBOX, 0, 0, 1,10, 28,6, NULL },
                     32:   { SGTEXT, 0, 0, 2,11, 11,1, "Joystick 0:" },
                     33:   { SGCHECKBOX, 0, 0, 5,13, 22,1, "Use cursor emulation" },
                     34:   { SGCHECKBOX, 0, 0, 5,14, 17,1, "Enable autofire" },
                     35:   { SGBUTTON, 0, 0, 5,17, 20,1, "Back to main menu" },
                     36:   { -1, 0, 0, 0,0, 0,0, NULL }
                     37: };
                     38: 
                     39: 
                     40: /*-----------------------------------------------------------------------*/
                     41: /*
                     42:   Show and process the joystick dialog.
                     43: */
                     44: void Dialog_JoyDlg(void)
                     45: {
                     46:   int but;
                     47: 
                     48:   SDLGui_CenterDlg(joystickdlg);
                     49: 
                     50:   /* Set up dialog from actual values: */
                     51: 
                     52:   if( DialogParams.Joysticks.Joy[1].bCursorEmulation )
                     53:     joystickdlg[DLGJOY_J1CURSOR].state |= SG_SELECTED;
                     54:   else
                     55:     joystickdlg[DLGJOY_J1CURSOR].state &= ~SG_SELECTED;
                     56: 
                     57:   if( DialogParams.Joysticks.Joy[1].bEnableAutoFire )
                     58:     joystickdlg[DLGJOY_J1AUTOFIRE].state |= SG_SELECTED;
                     59:   else
                     60:     joystickdlg[DLGJOY_J1AUTOFIRE].state &= ~SG_SELECTED;
                     61: 
                     62:   if( DialogParams.Joysticks.Joy[0].bCursorEmulation )
                     63:     joystickdlg[DLGJOY_J0CURSOR].state |= SG_SELECTED;
                     64:   else
                     65:     joystickdlg[DLGJOY_J0CURSOR].state &= ~SG_SELECTED;
                     66: 
                     67:   if( DialogParams.Joysticks.Joy[0].bEnableAutoFire )
                     68:     joystickdlg[DLGJOY_J0AUTOFIRE].state |= SG_SELECTED;
                     69:   else
                     70:     joystickdlg[DLGJOY_J0AUTOFIRE].state &= ~SG_SELECTED;
                     71: 
                     72:   do
                     73:   {
                     74:     but = SDLGui_DoDialog(joystickdlg);
                     75:   }
                     76:   while( but!=DLGJOY_EXIT && !bQuitProgram );
                     77: 
                     78:   /* Read values from dialog */
                     79:   DialogParams.Joysticks.Joy[1].bCursorEmulation = (joystickdlg[DLGJOY_J1CURSOR].state & SG_SELECTED);
                     80:   DialogParams.Joysticks.Joy[1].bEnableAutoFire = (joystickdlg[DLGJOY_J1AUTOFIRE].state & SG_SELECTED);
                     81:   DialogParams.Joysticks.Joy[0].bCursorEmulation = (joystickdlg[DLGJOY_J0CURSOR].state & SG_SELECTED);
                     82:   DialogParams.Joysticks.Joy[0].bEnableAutoFire = (joystickdlg[DLGJOY_J0AUTOFIRE].state & SG_SELECTED);
                     83: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.