Handles the camera.
More...
#include "camera.h"
#include "background.h"
#include "conf.h"
#include "gui.h"
#include "nebula.h"
#include "ntracing.h"
#include "pause.h"
#include "player.h"
#include "sound.h"
#include "space.h"
Go to the source code of this file.
|
| static void | cam_updateFly (double x, double y, double dt) |
| | Updates the camera flying to a position.
|
| static void | cam_updatePilot (Pilot *follow, double dt) |
| | Updates a camera following a pilot.
|
| static void | cam_updatePilotZoom (const Pilot *follow, const Pilot *target, double dt) |
| | Updates the camera zoom.
|
| static void | cam_updateManualZoom (double dt) |
| | Updates the manual zoom target.
|
| void | cam_zoomOverride (int enable) |
| | Overrides the zoom system.
|
| void | cam_setZoom (double zoom) |
| | Sets the camera zoom.
|
| void | cam_setZoomTarget (double zoom, double speed) |
| | Sets the camera zoom target.
|
| double | cam_getZoom (void) |
| | Gets the camera zoom.
|
| double | cam_getZoomTarget (void) |
| | Gets the camera zoom.
|
| void | cam_getPos (double *x, double *y) |
| | Gets the camera position.
|
| void | cam_getDPos (double *dx, double *dy) |
| | Gets the camera position differential (change in last frame).
|
| void | cam_getVel (double *vx, double *vy) |
| | Gets the camera velocity.
|
| void | cam_vel (double vx, double vy) |
| | Sets the camera velocity.
|
| void | cam_setTargetPilot (unsigned int follow, int soft_over) |
| | Sets the target to follow.
|
| void | cam_setTargetPos (double x, double y, int soft_over) |
| | Sets the camera target to a position.
|
| int | cam_getTarget (void) |
| | Returns the camera's current target.
|
| void | cam_update (double dt) |
| | Updates the camera.
|
Handles the camera.
Definition in file camera.c.
◆ CAMERA_DIR
| #define CAMERA_DIR ( M_PI / 2. ) |
◆ cam_getDPos()
| void cam_getDPos |
( |
double * | dx, |
|
|
double * | dy ) |
Gets the camera position differential (change in last frame).
Definition at line 131 of file camera.c.
◆ cam_getPos()
| void cam_getPos |
( |
double * | x, |
|
|
double * | y ) |
Gets the camera position.
- Parameters
-
| [out] | x | X position to get. |
| [out] | y | Y position to get. |
Definition at line 122 of file camera.c.
◆ cam_getTarget()
| int cam_getTarget |
( |
void | | ) |
|
Returns the camera's current target.
- Returns
- 0 if focused on position, else returns pilot ID.
Definition at line 222 of file camera.c.
◆ cam_getVel()
| void cam_getVel |
( |
double * | vx, |
|
|
double * | vy ) |
Gets the camera velocity.
Definition at line 140 of file camera.c.
◆ cam_getZoom()
| double cam_getZoom |
( |
void | | ) |
|
Gets the camera zoom.
- Returns
- The camera's zoom.
Definition at line 101 of file camera.c.
◆ cam_getZoomTarget()
| double cam_getZoomTarget |
( |
void | | ) |
|
Gets the camera zoom.
- Returns
- The camera's zoom.
Definition at line 111 of file camera.c.
◆ cam_setTargetPilot()
| void cam_setTargetPilot |
( |
unsigned int | follow, |
|
|
int | soft_over ) |
Sets the target to follow.
Definition at line 158 of file camera.c.
◆ cam_setTargetPos()
| void cam_setTargetPos |
( |
double | x, |
|
|
double | y, |
|
|
int | soft_over ) |
Sets the camera target to a position.
Definition at line 194 of file camera.c.
◆ cam_setZoom()
| void cam_setZoom |
( |
double | zoom | ) |
|
Sets the camera zoom.
This is the zoom used in game coordinates.
- Parameters
-
Definition at line 77 of file camera.c.
◆ cam_setZoomTarget()
| void cam_setZoomTarget |
( |
double | zoom, |
|
|
double | speed ) |
Sets the camera zoom target.
This should be used in conjunction with manual zoom.
- Parameters
-
| zoom | Zoom to try to set camera to. |
| speed | Speed of change to use. |
Definition at line 90 of file camera.c.
◆ cam_update()
| void cam_update |
( |
double | dt | ) |
|
Updates the camera.
- Parameters
-
Definition at line 232 of file camera.c.
◆ cam_updateFly()
| void cam_updateFly |
( |
double | x, |
|
|
double | y, |
|
|
double | dt ) |
|
static |
Updates the camera flying to a position.
Definition at line 299 of file camera.c.
◆ cam_updateManualZoom()
| void cam_updateManualZoom |
( |
double | dt | ) |
|
|
static |
Updates the manual zoom target.
Speed up if needed.
Definition at line 409 of file camera.c.
◆ cam_updatePilot()
| void cam_updatePilot |
( |
Pilot * | follow, |
|
|
double | dt ) |
|
static |
Updates a camera following a pilot.
Definition at line 329 of file camera.c.
◆ cam_updatePilotZoom()
| void cam_updatePilotZoom |
( |
const Pilot * | follow, |
|
|
const Pilot * | target, |
|
|
double | dt ) |
|
static |
Updates the camera zoom.
Speed up if needed.
Definition at line 427 of file camera.c.
◆ cam_vel()
| void cam_vel |
( |
double | vx, |
|
|
double | vy ) |
Sets the camera velocity.
Definition at line 149 of file camera.c.
◆ cam_zoomOverride()
| void cam_zoomOverride |
( |
int | enable | ) |
|
Overrides the zoom system.
- Parameters
-
| enable | Whether or not to override the zoom system. |
Definition at line 65 of file camera.c.
◆ camera_DX
Initial value:Derivative of X position (velocity) of the camera.
Definition at line 34 of file camera.c.
◆ camera_DY
Initial value:Derivative of Y position (velocity) of the camera.
Definition at line 36 of file camera.c.
◆ camera_fly
Camera is flying to target.
Definition at line 47 of file camera.c.
◆ camera_flyspeed
| double camera_flyspeed = 0. |
|
static |
Speed when flying.
Definition at line 48 of file camera.c.
◆ camera_followpilot
| unsigned int camera_followpilot = 0 |
|
static |
◆ camera_VX
◆ camera_VY
◆ camera_X
X position of camera.
Definition at line 32 of file camera.c.
◆ camera_Y
Y position of camera.
Definition at line 33 of file camera.c.
◆ camera_Z
Current in-game zoom.
Definition at line 31 of file camera.c.
◆ camera_zoomspeed
| double camera_zoomspeed = 0. |
|
static |
Speed when zooming.
Definition at line 49 of file camera.c.
◆ old_X
Old X positiion.
Definition at line 41 of file camera.c.
◆ old_Y
Old Y position.
Definition at line 42 of file camera.c.
◆ target_X
◆ target_Y
◆ target_Z
◆ zoom_override
Whether or not to override the zoom.
Definition at line 29 of file camera.c.