コード例 #1
0
ファイル: vbl.cpp プロジェクト: MaddTheSane/alephone
void set_keyboard_controller_status(
	bool active)
{
	input_task_active= active;

	/******************************************************************************************/
	/* BT:	Added April 16, 2000 ISp: De-activate Input Sprockets while the keyboard is
			not active.  This also means that the game is currently not recieving keystrokes */
#ifdef mac
	if(active) Start_ISp();
	else Stop_ISp();
#endif

#if TARGET_API_MAC_CARBON
	if (active)
		enter_mouse(0);
	else
		exit_mouse(0);
#endif

#ifdef SDL
	// We enable/disable mouse control here
	if (active) {
		enter_mouse(input_preferences->input_device);
                enter_joystick();
        } else {
		exit_mouse(input_preferences->input_device);
                exit_joystick();
        }
#endif
	
	/******************************************************************************************/
}
コード例 #2
0
ファイル: vbl.c プロジェクト: DrItanium/moo
/* ---------- code */
void initialize_keyboard_controller(
	void)
{
	ActionQueue *queue;
	short player_index;
	
//	vassert(NUMBER_OF_KEYS == NUMBER_OF_STANDARD_KEY_DEFINITIONS,
//		csprintf(temporary, "NUMBER_OF_KEYS == %d, NUMBER_OF_KEY_DEFS = %d. Not Equal!", NUMBER_OF_KEYS, NUMBER_OF_STANDARD_KEY_DEFINITIONS));
	assert(NUMBER_OF_STANDARD_KEY_DEFINITIONS==NUMBER_OF_LEFT_HANDED_KEY_DEFINITIONS);
	assert(NUMBER_OF_LEFT_HANDED_KEY_DEFINITIONS==NUMBER_OF_POWERBOOK_KEY_DEFINITIONS);
	
	// get globals initialized
	heartbeat_count= 0;
	input_task_active= FALSE;
	memset(&replay, 0, sizeof(struct replay_private_data));

	input_task= install_timer_task(TICKS_PER_SECOND, input_controller);
	assert(input_task);
	
	atexit(remove_input_controller);
	set_keys_to_match_preferences();
	
	/* Allocate the recording queues */	
	replay.recording_queues = (ActionQueue *) malloc(MAXIMUM_NUMBER_OF_PLAYERS * sizeof(ActionQueue));
	assert(replay.recording_queues);
	if(!replay.recording_queues) alert_user(fatalError, strERRORS, outOfMemory, memory_error());
	
	/* Allocate the individual ones */
	for (player_index= 0; player_index<MAXIMUM_NUMBER_OF_PLAYERS; player_index++)
	{
		queue= get_player_recording_queue(player_index);
		queue->read_index= queue->write_index = 0;
		queue->buffer= (long *) malloc(MAXIMUM_QUEUE_SIZE*sizeof(long));
		if(!queue->buffer) alert_user(fatalError, strERRORS, outOfMemory, memory_error());
	}
	enter_mouse(0);
	
	return;
}