Solar System OpenGL v1.0.0
Loading...
Searching...
No Matches
keyboard_handler.h File Reference

Handles keyboard input for controlling the application. More...

#include <GL/glut.h>
#include <iostream>

Go to the source code of this file.

Functions

void keyPressed (unsigned char key, int x, int y)
 Handles keyboard input for controlling the application.
 

Variables

bool showOrbits
 Flag to toggle orbital visibility.
 
float cameraDistance
 Distance of the camera from the target.
 
float zoomExcess
 Additional zoom factor beyond the default.
 
int selectedElement
 Index of the currently selected celestial body.
 
bool paused
 Flag to toggle simulation pause state.
 

Detailed Description

Handles keyboard input for controlling the application.

This file declares functions and external variables used for handling keyboard input to control various aspects of the application, such as camera zoom, orbital visibility, and simulation state.

Function Documentation

◆ keyPressed()

void keyPressed ( unsigned char key,
int x,
int y )

Handles keyboard input for controlling the application.

Parameters
keyThe ASCII code of the pressed key.
xThe X-coordinate of the mouse cursor.
yThe Y-coordinate of the mouse cursor.

This function is called when a key is pressed. It updates various aspects of the application based on the key input, such as toggling orbital visibility, adjusting camera zoom, selecting celestial bodies, and pausing or resuming the simulation.

Handles keyboard input for controlling the application.

Parameters
keyThe ASCII code of the pressed key.
xThe X-coordinate of the mouse cursor.
yThe 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.

Variable Documentation

◆ cameraDistance

float cameraDistance
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.

◆ paused

bool paused
extern

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.

◆ selectedElement

int selectedElement
extern

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.

◆ showOrbits

bool showOrbits
extern

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.

◆ zoomExcess

float zoomExcess
extern

Additional zoom factor beyond the default.

This external float variable represents the amount of additional zoom applied to the camera view, beyond the default zoom level.