Solar System OpenGL v1.0.0
|
Handles mouse input for camera control. More...
#include <GL/glut.h>
Go to the source code of this file.
Functions | |
void | mouseMotion (int x, int y) |
Handles mouse motion events. | |
void | mouseButton (int button, int state, int x, int y) |
Handles mouse button events. | |
Variables | |
float | cameraDistance |
Distance of the camera from the target. | |
float | cameraAngleX |
Camera angle around the X-axis. | |
float | cameraAngleY |
Camera angle around the Y-axis. | |
int | lastMouseX |
X-coordinate of the last mouse position. | |
int | lastMouseY |
Y-coordinate of the last mouse position. | |
bool | leftButtonPressed |
State of the left mouse button. | |
Handles mouse input for camera control.
This file declares functions and external variables used for handling mouse input to control the camera's position and orientation in the application.
void mouseButton | ( | int | button, |
int | state, | ||
int | x, | ||
int | y ) |
Handles mouse button events.
button | The mouse button that was pressed or released. |
state | The state of the mouse button (GLUT_DOWN or GLUT_UP). |
x | The X-coordinate of the mouse cursor. |
y | The Y-coordinate of the mouse cursor. |
This function is called when a mouse button is pressed or released, allowing updates to the camera's control state.
Handles mouse button events.
button | The mouse button that was pressed or released. |
state | The state of the mouse button (GLUT_DOWN or GLUT_UP). |
x | The X-coordinate of the mouse cursor. |
y | The Y-coordinate of the mouse cursor. |
This function is called when a mouse button is pressed or released. It updates the state of the left mouse button and records the cursor position when the button is pressed.
void mouseMotion | ( | int | x, |
int | y ) |
Handles mouse motion events.
x | The X-coordinate of the mouse cursor. |
y | The Y-coordinate of the mouse cursor. |
This function is called when the mouse is moved, allowing updates to the camera's orientation based on the cursor's position.
Handles mouse motion events.
x | The X-coordinate of the mouse cursor. |
y | The Y-coordinate of the mouse cursor. |
This function is called when the mouse is moved. If the left mouse button is pressed, it updates the camera's orientation based on the cursor's position. The camera angles are clamped to prevent excessive rotation.
|
extern |
Camera angle around the X-axis.
This variable represents the rotation angle of the camera around the X-axis, affecting the vertical view direction.
This external variable represents the rotation angle of the camera around the X-axis, affecting the vertical view direction.
|
extern |
Camera angle around the Y-axis.
This variable represents the rotation angle of the camera around the Y-axis, affecting the horizontal view direction.
This external variable represents the rotation angle of the camera around the Y-axis, affecting the horizontal view direction.
|
extern |
Distance of the camera from the target.
This variable represents the distance between the camera and the point it is observing, affecting the zoom level.
This external float variable represents the distance between the camera and the point it is observing, affecting the zoom level.
This external variable represents the distance between the camera and the point it is looking at, affecting the zoom level.
|
extern |
X-coordinate of the last mouse position.
This variable stores the X-coordinate of the mouse cursor during the last mouse event, used for calculating movement delta.
This external variable stores the X-coordinate of the mouse cursor during the last mouse event, used for calculating movement delta.
|
extern |
Y-coordinate of the last mouse position.
This variable stores the Y-coordinate of the mouse cursor during the last mouse event, used for calculating movement delta.
This external variable stores the Y-coordinate of the mouse cursor during the last mouse event, used for calculating movement delta.
|
extern |
State of the left mouse button.
This boolean variable indicates whether the left mouse button is currently pressed, affecting camera control behavior.
This external boolean variable indicates whether the left mouse button is currently pressed, affecting camera control behavior.