/* #FN# Called when the user clicks the OK button */ void /* #AS# Nothing */ CJoystickDlg:: OnOK() { BOOL bChanged = FALSE; if( m_ulInputState != g_Input.ulState ) { g_Input.ulState = m_ulInputState; WriteRegDWORD( NULL, REG_INPUT_STATE, g_Input.ulState ); } if( m_nAutoMode != g_Input.Joy.nAutoMode ) { g_Input.Joy.nAutoMode = m_nAutoMode; WriteRegDWORD( NULL, REG_AUTOFIRE_MODE, g_Input.Joy.nAutoMode ); /* Update main window's indicator */ UpdateIndicator( ID_INDICATOR_JOY ); } if( m_ulAutoSticks != g_Input.Joy.ulAutoSticks ) { g_Input.Joy.ulAutoSticks = m_ulAutoSticks; WriteRegDWORD( NULL, REG_AUTOFIRE_STICKS, g_Input.Joy.ulAutoSticks ); } if( m_nBlockOpposite != INPUT_joy_block_opposite_directions ) { INPUT_joy_block_opposite_directions = m_nBlockOpposite; WriteRegDWORD( NULL, REG_BLOCK_OPPOSITE, INPUT_joy_block_opposite_directions ); } if( m_nMultiJoy != INPUT_joy_multijoy ) { INPUT_joy_multijoy = m_nMultiJoy; WriteRegDWORD( NULL, REG_MULTI_JOY, INPUT_joy_multijoy ); } for( int i = 0; i < MAX_ATARI_JOYPORTS; i++ ) { if( m_anDevSelected[ i ] != g_Input.anDevSelected[ i ] ) bChanged = TRUE; } if( bChanged ) { g_Input.Joy.ulSelected = (ULONG)((UBYTE)m_anDevSelected[ 3 ]) << 24; g_Input.Joy.ulSelected |= (ULONG)((UBYTE)m_anDevSelected[ 2 ]) << 16; g_Input.Joy.ulSelected |= (ULONG)((UBYTE)m_anDevSelected[ 1 ]) << 8; g_Input.Joy.ulSelected |= (ULONG)((UBYTE)m_anDevSelected[ 0 ]); WriteRegDWORD( NULL, REG_JOYSTICKS, g_Input.Joy.ulSelected ); } Input_Initialise( bChanged ); CCommonDlg::OnOK(); } /* #OF# CJoystickDlg::OnOK */
int main( int argc, char *argv[] ) { printf( APP_NAME"\n" ); common.running = true; common.path = argv[0]; {//Strip the file name + extension to get the current working directory int i = strlen( common.path )-1; while ( common.path[i] && i > 0 ) { if ( common.path[i] == '/' || common.path[i] == '\\' ) { common.path[i] = '\0'; break; } i--; } } printf( "Path is %s\n\n", common.path ); srand( (unsigned int)time( NULL ) ); R_Initialise(); Game_Initialise(); Input_Initialise(); while ( common.running ) { Input_Poll(); if ( common.running ) {//If the input handler picked up an exit, don't bother with the game R_ClearScreen(); Game_Render(); SDL_GL_SwapBuffers(); } } R_Shutdown(); Game_Shutdown(); printf( "Thanks for playing!\n" ); return 0; }