aboutsummaryrefslogtreecommitdiff
path: root/src/camera.h
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2015-08-27 16:32:06 +0200
committerraysan5 <raysan5@gmail.com>2015-08-27 16:32:06 +0200
commit3a9ed0e8462570e30d92e2aa8c0ff3cf655ef863 (patch)
tree9e2593de39f6daab0dc283837e325937cbf41f1c /src/camera.h
parent8b3a82688e82922819d24494c08e24570c03bdc4 (diff)
parent997170a317bb8077cb96d3fc757c6cde0c0ea466 (diff)
downloadraylib-3a9ed0e8462570e30d92e2aa8c0ff3cf655ef863.tar.gz
raylib-3a9ed0e8462570e30d92e2aa8c0ff3cf655ef863.zip
Merged master fixed conflict.
Diffstat (limited to 'src/camera.h')
-rw-r--r--src/camera.h51
1 files changed, 39 insertions, 12 deletions
diff --git a/src/camera.h b/src/camera.h
index cb5f2bde..63d8f786 100644
--- a/src/camera.h
+++ b/src/camera.h
@@ -24,7 +24,12 @@
#ifndef CAMERA_H
#define CAMERA_H
-#include "raylib.h"
+#ifndef PI
+ #define PI 3.14159265358979323846
+#endif
+
+#define DEG2RAD (PI / 180.0f)
+#define RAD2DEG (180.0f / PI)
//----------------------------------------------------------------------------------
// Defines and Macros
@@ -33,10 +38,30 @@
//----------------------------------------------------------------------------------
// Types and Structures Definition
+// NOTE: Below types are required for CAMERA_STANDALONE usage
//----------------------------------------------------------------------------------
// Camera modes
typedef enum { CAMERA_CUSTOM = 0, CAMERA_FREE, CAMERA_ORBITAL, CAMERA_FIRST_PERSON, CAMERA_THIRD_PERSON } CameraMode;
+// Vector2 type
+typedef struct Vector2 {
+ float x;
+ float y;
+} Vector2;
+
+// Vector3 type
+typedef struct Vector3 {
+ float x;
+ float y;
+ float z;
+} Vector3;
+
+// Camera type, defines a camera position/orientation in 3d space
+typedef struct Camera {
+ Vector3 position;
+ Vector3 target;
+ Vector3 up;
+} Camera;
#ifdef __cplusplus
extern "C" { // Prevents name mangling of functions
@@ -50,17 +75,19 @@ extern "C" { // Prevents name mangling of functions
//----------------------------------------------------------------------------------
// Module Functions Declaration
//----------------------------------------------------------------------------------
-void SetCameraMode(int mode); // Select camera mode (multiple camera modes available)
-Camera UpdateCamera(Vector3 *position); // Update camera with position
-
-void SetCameraControls(int front, int left, int back, int right, int up, int down);
-void SetCameraMouseSensitivity(float sensitivity);
-void SetCameraResetPosition(Vector3 resetPosition);
-void SetCameraResetControl(int resetKey);
-void SetCameraPawnControl(int pawnControlKey);
-void SetCameraFnControl(int fnControlKey);
-void SetCameraSmoothZoomControl(int smoothZoomControlKey);
-void SetCameraOrbitalTarget(Vector3 target);
+void SetCameraMode(int mode); // Set camera mode (multiple camera modes available)
+Camera UpdateCamera(Vector3 *playerPosition); // Update camera and player position (1st person and 3rd person cameras)
+
+void SetCameraMoveControls(int frontKey, int backKey,
+ int leftKey, int rightKey,
+ int upKey, int downKey); // Set camera move controls (1st person and 3rd person cameras)
+
+void SetCameraPanControl(int panKey); // Set camera pan key to combine with mouse movement (free camera)
+void SetCameraAltControl(int altKey); // Set camera alt key to combine with mouse movement (free camera)
+void SetCameraSmoothZoomControl(int szKey); // Set camera smooth zoom key to combine with mouse (free camera)
+
+void SetCameraMouseSensitivity(float sensitivity); // Set camera mouse sensitivity (1st person and 3rd person cameras)
+void SetCameraTarget(Vector3 target); // Set internal camera target
#ifdef __cplusplus
}