Exemple #1
0
/*
 * Initialization routine. Note that the object system will automatically
 * invoke the initialization routines of all parent classes first.
 */
static void
Init(void *obj)
{
	Animal *animal = obj;

	animal->age = 0.0;
	animal->cellCount = 1;

	/* Event handler functions and timers are usually configured here. */
	AG_SetEvent(animal, "die", Die, NULL);
	AG_SetEvent(animal, "attached", Attached, NULL);
	AG_SetTimeout(&animal->time, Tick, NULL, 0);
}
Exemple #2
0
//
// InitializeJoystick
//
int Xbox::InitializeJoystick()
{
	SDL_InitSubSystem(SDL_INIT_JOYSTICK);

	// We will manually retrieve the states
	SDL_JoystickEventState(SDL_IGNORE);

	OpenedJoy = SDL_JoystickOpen(JOYPAD1);

	if(!SDL_JoystickOpened(JOYPAD1))
		return -1;

	AG_SetTimeout(&JoyUpdateTimeout, UpdateJoystick, NULL, 0);

	EnableJoystickUpdates(true);

	fill_n(BPressed, (size_t)JOY_BTTN_TOTAL, false);

	return 0;
}