Exemplo n.º 1
0
void UpdateControls()
{
	HandleMessages();

	if( _input_killswitch ) {
		b4 = b3 = b2 = b1 = right = left = down = up = false;
		return;
	}

	joy_Update();
	mouse_Update();
	UpdateKeyboard();

	byte oldb1 = b1,
		 oldb2 = b2,
	     oldb3 = b3,
		 oldb4 = b4;

	// Overkill (2006-06-25):
	// The following four ifs have been altered to allow custom directional keys.
	if (keys[k_up] || sticks[0].up) up = true; else up = false;
	if (keys[k_left] || sticks[0].left) left = true; else left = false;
	if (keys[k_down] || sticks[0].down) down = true; else down = false;
	if (keys[k_right] || sticks[0].right) right = true; else right = false;

	if (keys[k_b1] || sticks[0].button[j_b1]) b1 = true; else b1 = false;
	if (keys[k_b2] || sticks[0].button[j_b2]) b2 = true; else b2 = false;
	if (keys[k_b3] || sticks[0].button[j_b3]) b3 = true; else b3 = false;
	if (keys[k_b4] || sticks[0].button[j_b4]) b4 = true; else b4 = false;

	if (!up && kill_up) kill_up = false;
	if (!down && kill_down) kill_down = false;
	if (!left && kill_left) kill_left = false;
	if (!right && kill_right) kill_right = false;

	if (!b1 && kill_b1) kill_b1 = false;
	if (!b2 && kill_b2) kill_b2 = false;
	if (!b3 && kill_b3) kill_b3 = false;
	if (!b4 && kill_b4) kill_b4 = false;

	if (up && kill_up) up = false;
	if (down && kill_down) down = false;
	if (left && kill_left) left = false;
	if (right && kill_right) right = false;

	if (b1 && kill_b1) b1 = false;
	if (b2 && kill_b2) b2 = false;
	if (b3 && kill_b3) b3 = false;
	if (b4 && kill_b4) b4 = false;

	//mbg 9/5/05 todo removed for psp
	//TODO LUA
	if (b1 && !oldb1) se->ExecuteCallback(bindbutton[0], true);
	if (b2 && !oldb2) se->ExecuteCallback(bindbutton[1], true);
	if (b3 && !oldb3) se->ExecuteCallback(bindbutton[2], true);
	if (b4 && !oldb4) se->ExecuteCallback(bindbutton[3], true);
}
Exemplo n.º 2
0
void mouse_set(int x, int y)
{
	float _x = (float)x/(float)vid_xres;
	float _y = (float)y/(float)vid_yres;

	Uint16 xToSet = (Uint16)(_x*(float)(gameWindow->getWidth()));
	Uint16 yToSet = (Uint16)(_y*(float)(gameWindow->getHeight()));

	SDL_WarpMouse(xToSet, yToSet);

	mouse_Update();
}
Exemplo n.º 3
0
void mouse_set(int x, int y)
{
	float _x = (float)x/(float)vid_xres;
	float _y = (float)y/(float)vid_yres;

	RECT r;
	GetClientRect(hMainWnd, &r);

	POINT pt;
	pt.x = (int)(_x*(float)(r.right-r.left));
	pt.y = (int)(_y*(float)(r.bottom-r.top));
	ClientToScreen(hMainWnd,&pt);
	SetCursorPos(pt.x,pt.y);

	mouse_Update();
}