All pastes #477351 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-05-08 16:27 UTC
rendered paste body
void GetMouseInfo()
{
	static GLuint mouseX, mouseY;

	/* Get current mouse position */
	SDL_GetMouseState(&mouseX, &mouseY);

	/* Reset the mouse position */
	SDL_WarpMouse((appWidth/2), (appHeight/2));

	/* Calculate the movement of the mouse */
	float moveX = (float)((appWidth/2)  - mouseX) / 100.0;
	float moveY = (float)((appHeight/2) - mouseY) / 100.0;

	printf("moveX: %f, moveY: %f\n", moveX, moveY);

	/* Update the mouse position */
	mousePosition[0] -= moveX;
	mousePosition[1] += moveY;

	printf("mouseX: %f, mouseY: %f\n", mousePosition[0], mousePosition[1]);
}