Beispiel #1
0
void XBOX_PumpEvents(_THIS)
{
	XInput_GetEvents();

	mouse_update();
	keyboard_update();
}
Beispiel #2
0
/*:::::*/
FBCALL int fb_GfxGetJoystick(int id, int *buttons, float *a1, float *a2, float *a3, float *a4, float *a5, float *a6, float *a7, float *a8)
{
	static int inited = 0;

	*buttons = -1;
	*a1 = *a2 = *a3 = *a4 = *a5 = *a6 = *a7 = *a8 = -1000.0;

	if ((id < 0) || (id >= 4) || (!g_Pads[id].hPresent))
		return fb_ErrorSetNum(FB_RTERROR_ILLEGALFUNCTIONCALL);

	if (!inited) {
		inited = 1;
		XInput_Init();
	}

	XInput_GetEvents();

	*buttons = !!g_Pads[id].CurrentButtons.ucAnalogButtons[XPAD_A] |
	           (!!g_Pads[id].CurrentButtons.ucAnalogButtons[XPAD_B] << 1) |
	           (!!g_Pads[id].CurrentButtons.ucAnalogButtons[XPAD_X] << 2) |
	           (!!g_Pads[id].CurrentButtons.ucAnalogButtons[XPAD_Y] << 3) |
	           (!!g_Pads[id].CurrentButtons.ucAnalogButtons[XPAD_BLACK] << 4) |
	           (!!g_Pads[id].CurrentButtons.ucAnalogButtons[XPAD_WHITE] << 5) |
	           (!!(g_Pads[id].CurrentButtons.usDigitalButtons & XPAD_START) << 6) |
	           (!!(g_Pads[id].CurrentButtons.usDigitalButtons & XPAD_BACK) << 7) |
	           (!!(g_Pads[id].CurrentButtons.usDigitalButtons & XPAD_LEFT_THUMB) << 8) |
	           (!!(g_Pads[id].CurrentButtons.usDigitalButtons & XPAD_RIGHT_THUMB) << 9);

	*a1 = JOYPOS(g_Pads[id].sLThumbX, -32768, 32767);
	*a2 = -JOYPOS(g_Pads[id].sLThumbY, -32768, 32767);
	*a3 = JOYPOS(g_Pads[id].sRThumbX, -32768, 32767);
	*a4 = -JOYPOS(g_Pads[id].sRThumbY, -32768, 32767);
	*a5 = (JOYPOS(g_Pads[id].CurrentButtons.ucAnalogButtons[XPAD_LEFT_TRIGGER], 0, 255) + 1.0) / 2.0;
	*a6 = (JOYPOS(g_Pads[id].CurrentButtons.ucAnalogButtons[XPAD_RIGHT_TRIGGER], 0, 255) + 1.0) / 2.0;

	if (g_Pads[id].CurrentButtons.usDigitalButtons & XPAD_DPAD_RIGHT)
		*a7 = 1.0;
	else if (g_Pads[id].CurrentButtons.usDigitalButtons & XPAD_DPAD_LEFT)
		*a7 = -1.0;
	else
		*a7 = 0.0;

	if (g_Pads[id].CurrentButtons.usDigitalButtons & XPAD_DPAD_DOWN)
		*a8 = 1.0;
	else if (g_Pads[id].CurrentButtons.usDigitalButtons & XPAD_DPAD_UP)
		*a8 = -1.0;
	else
		*a8 = 0.0;

	return fb_ErrorSetNum( FB_RTERROR_OK );
}