Пример #1
0
void CWinsys::Quit () {
	CloseJoystick ();
	Score.SaveHighScore ();
	SaveMessages ();
	Audio.Close ();		// frees music and sound as well
	FT.Clear ();
	if (g_game.argument < 1) Players.SavePlayers ();
	SDL_Quit ();
}
Пример #2
0
bool CApplication::ChangeJoystick(const JoystickDevice &newJoystick)
{
    if ( (newJoystick.index < 0) || (newJoystick.index >= SDL_NumJoysticks()) )
        return false;

    if (m_private->joystick != nullptr)
        CloseJoystick();

    return OpenJoystick();
}
Пример #3
0
Файл: joyd.c Проект: mmitch/joyd
int main (int argc, char **argv)
/* simple main program */
{
	/* don't tell me that this condition looks ugly... */
	if (    (argc > 2)
	     || (
                   (argc == 2)
                && (
                      (strcmp(argv[1],PRINT_VERSION)      == 0)
		   || (strcmp(argv[1],PRINT_VERSION_LONG) == 0)
		   )
                 )
           ) {
		printf(PROGRAM_VERSION "\n");
		printf(PROGRAM_INFOTEXT "\n");
		exit(0);
	};

	SetDefaultValues();

	if (config.debug > 1) {
		Print(stdout,PROGRAM_VERSION," starting up");
	}

	InstallSignalHandler();

	if (argc > 1) {
		free(config.config_file);
		config.config_file = AllocString(argv[1]);
	}
	
	ReadConfigFile();

	if (config.daemon) {
		ForkToBackground();
	}
	
	OpenJoystick();

	AddMissingCalibrations();

	ActionLoop();

	CloseJoystick();

	Print(stdout,PROGRAM_VERSION," quits now (should've never come around here!?)");

	return 0;
}
Пример #4
0
void CApplication::SetJoystickEnabled(bool enable)
{
    m_joystickEnabled = enable;

    if (m_joystickEnabled)
    {
        if (! OpenJoystick())
        {
            m_joystickEnabled = false;
        }
    }
    else
    {
        CloseJoystick();
    }
}
Пример #5
0
void JoystickExitFunction(void)
{
	CloseJoystick();
	SDL_Quit();
}