void input_mouseMove (int xPos, int yPos) { float halfWinWidth, halfWinHeight, dx, dy; halfWinWidth = (float)WINDOW_WIDTH / 2.0; halfWinHeight = (float)WINDOW_HEIGHT / 2.0; dx = ((float)xPos) - halfWinWidth; dy = yPos - halfWinHeight; // Update direction. camera_rotateX( dy * 0.5f); camera_rotateZ(-dx * 0.5f); // Reset cursor to center SDL_WarpMouse(halfWinWidth, halfWinHeight); }
/* * input_mouseMove */ void input_mouseMove(int dx, int dy) { float halfWinWidth, halfWinHeight; halfWinWidth = (float)WINDOW_WIDTH / 2.0; halfWinHeight = (float)WINDOW_HEIGHT / 2.0; dx -= halfWinWidth; dy -= halfWinHeight; //Feed the deltas to the camera camera_rotateX(-dy/2.0); camera_rotateY(-dx/2.0); //Reset cursor to center SDL_WarpMouse(halfWinWidth, halfWinHeight); }