Example #1
0
void Gamepad_processEvents() {
	unsigned int eventIndex;
	static bool inProcessEvents;
	
	if (!inited || inProcessEvents) {
		return;
	}
	
	inProcessEvents = true;
	pthread_mutex_lock(&eventQueueMutex);
	for (eventIndex = 0; eventIndex < eventCount; eventIndex++) {
		processQueuedEvent(eventQueue[eventIndex]);
		if (eventQueue[eventIndex].eventType == GAMEPAD_EVENT_DEVICE_REMOVED) {
			disposeDevice(eventQueue[eventIndex].eventData);
			
		} else if (eventQueue[eventIndex].eventType == GAMEPAD_EVENT_BUTTON_DOWN ||
		           eventQueue[eventIndex].eventType == GAMEPAD_EVENT_BUTTON_UP ||
		           eventQueue[eventIndex].eventType == GAMEPAD_EVENT_AXIS_MOVED) {
			free(eventQueue[eventIndex].eventData);
		}
	}
	eventCount = 0;
	pthread_mutex_unlock(&eventQueueMutex);
	inProcessEvents = false;
}
void Gamepad_detectDevices() {
	unsigned int eventIndex;
	
	if (hidManager == NULL) {
		return;
	}
	
	for (eventIndex = 0; eventIndex < deviceEventCount; eventIndex++) {
		processQueuedEvent(deviceEventQueue[eventIndex]);
	}
	deviceEventCount = 0;
}
void Gamepad_detectDevices() {
  unsigned int eventIndex;
	
  if (hidManager == NULL) {
    return;
  }
	
  CFRunLoopRunInMode(GAMEPAD_RUN_LOOP_MODE, 0, true);
  for (eventIndex = 0; eventIndex < deviceEventCount; eventIndex++) {
    processQueuedEvent(deviceEventQueue[eventIndex]);
  }
  deviceEventCount = 0;
}
void Gamepad_processEvents() {
	unsigned int eventIndex;
	static bool inProcessEvents;
	
	if (hidManager == NULL || inProcessEvents) {
		return;
	}
	
	inProcessEvents = true;
	for (eventIndex = 0; eventIndex < inputEventCount; eventIndex++) {
		processQueuedEvent(inputEventQueue[eventIndex]);
		free(inputEventQueue[eventIndex].eventData);
	}
	inputEventCount = 0;
	inProcessEvents = false;
}
void Gamepad_processEvents() {
  unsigned int eventIndex;
  static bool inProcessEvents;
	
  if (hidManager == NULL || inProcessEvents) {
    return;
  }
	
  inProcessEvents = true;
  CFRunLoopRunInMode(GAMEPAD_RUN_LOOP_MODE, 0, true);
  for (eventIndex = 0; eventIndex < inputEventCount; eventIndex++) {
    processQueuedEvent(inputEventQueue[eventIndex]);
    free(inputEventQueue[eventIndex].eventData);
  }
  inputEventCount = 0;
  inProcessEvents = false;
}