#include "input.h"
Functions | |
void | KeyDownFunc (unsigned char key, int x, int y) |
Brief description of KeyDownFunc. | |
void | SpecDownFunc (int key, int x, int y) |
Brief description of SpecDownFunc. | |
void | KeyUpFunc (unsigned char key, int x, int y) |
Brief description of KeyUpFunc. | |
void | SpecUpFunc (int key, int x, int y) |
Brief description of SpecUpFunc. | |
void | UpdateInput () |
Brief description of UpdateInput. |
Contains the source code for keyboard inputs. Whenever a button used to control the camera movements is pressed, the code tells the camera to to update it's position and zooming etc. Especially, if 'F1' or 'escape' is pressed the program shows the help menu or quit the application, respectively.
void KeyDownFunc | ( | unsigned char | key, | |
int | x, | |||
int | y | |||
) |
Brief description of KeyDownFunc.
This function triggers whenever a "non-special-button" is pressed, which for this application means any button on the num pad or the escape button. Whenever a button that controls the camera i pressed a flag will be set. This flag is used by the function UpdateInput() to let the camera know in which direction it should move.
key | The actual key that was pressed. | |
x | The x coordinate for the mouse pointer (not needed here). | |
y | The y coordinate for the mouse pointer (not needed here). |
void KeyUpFunc | ( | unsigned char | key, | |
int | x, | |||
int | y | |||
) |
Brief description of KeyUpFunc.
This function triggers whenever a "non-special-button" is released. Whenever a button on the num pad is released, the function clears that buttons flag. This flag is used by the function UpdateInput() to let the camera know when to stop it's movements etc.
key | The actual key that was pressed. | |
x | The x coordinate for the mouse pointer (not needed here). | |
y | The y coordinate for the mouse pointer (not needed here). |
void SpecDownFunc | ( | int | key, | |
int | x, | |||
int | y | |||
) |
Brief description of SpecDownFunc.
This function triggers whenever a "special" button is pressed. For this application, the only special button is 'F1'. When this button is pressed a help menu appears on the screen. If the button is pressed once again, the help menu disappears.
key | The actual key that was pressed. | |
x | The x coordinate for the mouse pointer (not needed here). | |
y | The y coordinate for the mouse pointer (not needed here). |
void SpecUpFunc | ( | int | key, | |
int | x, | |||
int | y | |||
) |
Brief description of SpecUpFunc.
This function triggers whenever a "special" button is released.
key | The actual key that was pressed. | |
x | The x coordinate for the mouse pointer (not needed here). | |
y | The y coordinate for the mouse pointer (not needed here). |
void UpdateInput | ( | ) |
Brief description of UpdateInput.
This is the function that tells the camera in which way to move. It uses global flags to determine which buttons that has been pressed by the user. It handles movements such as forward, backward, strafe, zoom, yaw, pitch, roll and a special move to look at the cameras frustum.