Solar System OpenGL v1.0.0
|
Implements keyboard input handling for controlling the application. More...
#include "keyboard_handler.h"
Go to the source code of this file.
Functions | |
void | zoom (bool out) |
Adjusts the camera zoom level. | |
void | keyPressed (unsigned char key, int x, int y) |
Handles keyboard input to control application features. | |
Variables | |
bool | showOrbits = false |
Flag to toggle orbital visibility. | |
float | cameraDistance = 50.0 |
Distance of the camera from the target. | |
int | selectedElement = -1 |
Index of the currently selected celestial body. | |
bool | paused = false |
Flag to toggle simulation pause state. | |
Implements keyboard input handling for controlling the application.
This file provides the implementation of functions for handling keyboard input to control various aspects of the application, such as camera zoom, orbital visibility, and simulation state.
void keyPressed | ( | unsigned char | key, |
int | x, | ||
int | y ) |
Handles keyboard input to control application features.
Handles keyboard input for controlling the application.
key | The ASCII code of the pressed key. |
x | The X-coordinate of the mouse cursor. |
y | The Y-coordinate of the mouse cursor. |
This function is called when a key is pressed. It processes the key input to perform actions such as zooming the camera, toggling orbital visibility, selecting celestial bodies, and pausing or resuming the simulation.
void zoom | ( | bool | out | ) |
Adjusts the camera zoom level.
out | If true, zooms out; otherwise, zooms in. |
This function adjusts the camera distance based on the zoom direction. The distance is clamped between 5.0 and 100.0 units.
float cameraDistance = 50.0 |
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.
bool paused = false |
Flag to toggle simulation pause state.
This variable indicates whether the simulation is currently paused or running.
This external boolean variable indicates whether the simulation is currently paused or running.
int selectedElement = -1 |
Index of the currently selected celestial body.
This variable represents the index of the currently selected planet or celestial body, used for highlighting or focusing. A value of -1 indicates no selection.
This external integer variable represents the index of the currently selected planet or celestial body, used for highlighting or focusing.
bool showOrbits = false |
Flag to toggle orbital visibility.
This variable indicates whether the orbital paths of celestial bodies are visible or hidden.
This external boolean variable indicates whether the orbital paths of celestial bodies are visible or hidden.