Functions renaming for better consistency
This commit is contained in:
parent
cd08ae7b85
commit
2be8753788
2 changed files with 60 additions and 63 deletions
101
src/camera.c
101
src/camera.c
|
@ -93,15 +93,6 @@ static int cameraMode = CAMERA_CUSTOM;
|
||||||
// Module specific Functions Declaration
|
// Module specific Functions Declaration
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
static void ProcessCamera(Camera *camera, Vector3 *playerPosition);
|
static void ProcessCamera(Camera *camera, Vector3 *playerPosition);
|
||||||
/*
|
|
||||||
static void SetCameraControls(int front, int left, int back, right, up, down);
|
|
||||||
static void SetMouseSensitivity(int sensitivity);
|
|
||||||
static void SetResetPosition(Vector3 resetPosition);
|
|
||||||
static void SetResetControl(int resetKey);
|
|
||||||
static void SetPawnControl(int pawnControlKey);
|
|
||||||
static void SetFnControl(int fnControlKey);
|
|
||||||
static void SetSmoothZoomControl(int smoothZoomControlKey);
|
|
||||||
*/
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module Functions Definition
|
// Module Functions Definition
|
||||||
|
@ -153,6 +144,53 @@ Camera UpdateCamera(Vector3 *position)
|
||||||
return internalCamera;
|
return internalCamera;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SetCameraControls(int frontKey, int leftKey, int backKey, int rightKey, int upKey, int downKey)
|
||||||
|
{
|
||||||
|
cameraMovementController[0] = frontKey;
|
||||||
|
cameraMovementController[1] = leftKey;
|
||||||
|
cameraMovementController[2] = backKey;
|
||||||
|
cameraMovementController[3] = rightKey;
|
||||||
|
cameraMovementController[4] = upKey;
|
||||||
|
cameraMovementController[5] = downKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetCameraMouseSensitivity(float sensitivity)
|
||||||
|
{
|
||||||
|
mouseSensitivity = (sensitivity / 10000.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetCameraResetPosition(Vector3 resetPosition)
|
||||||
|
{
|
||||||
|
resetingPosition = resetPosition;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetCameraResetControl(int resetKey)
|
||||||
|
{
|
||||||
|
resetingKey = resetKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetCameraPawnControl(int pawnControlKey)
|
||||||
|
{
|
||||||
|
pawnControllingKey = pawnControlKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetCameraFnControl(int fnControlKey)
|
||||||
|
{
|
||||||
|
fnControllingKey = fnControlKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetCameraSmoothZoomControl(int smoothZoomControlKey)
|
||||||
|
{
|
||||||
|
smoothZoomControllingKey = smoothZoomControlKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetCameraOrbitalTarget(Vector3 target)
|
||||||
|
{
|
||||||
|
internalCamera.target = target;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Module specific Functions Definition
|
// Module specific Functions Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
@ -408,48 +446,3 @@ static void ProcessCamera(Camera *camera, Vector3 *playerPosition)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCameraControls(int frontKey, int leftKey, int backKey, int rightKey, int upKey, int downKey)
|
|
||||||
{
|
|
||||||
cameraMovementController[0] = frontKey;
|
|
||||||
cameraMovementController[1] = leftKey;
|
|
||||||
cameraMovementController[2] = backKey;
|
|
||||||
cameraMovementController[3] = rightKey;
|
|
||||||
cameraMovementController[4] = upKey;
|
|
||||||
cameraMovementController[5] = downKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetMouseSensitivity(float sensitivity)
|
|
||||||
{
|
|
||||||
mouseSensitivity = (sensitivity / 10000.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetResetPosition(Vector3 resetPosition)
|
|
||||||
{
|
|
||||||
resetingPosition = resetPosition;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetResetControl(int resetKey)
|
|
||||||
{
|
|
||||||
resetingKey = resetKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetPawnControl(int pawnControlKey)
|
|
||||||
{
|
|
||||||
pawnControllingKey = pawnControlKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetFnControl(int fnControlKey)
|
|
||||||
{
|
|
||||||
fnControllingKey = fnControlKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetSmoothZoomControl(int smoothZoomControlKey)
|
|
||||||
{
|
|
||||||
smoothZoomControllingKey = smoothZoomControlKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetOrbitalTarget(Vector3 target)
|
|
||||||
{
|
|
||||||
internalCamera.target = target;
|
|
||||||
}
|
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
**********************************************************************************************/
|
**********************************************************************************************/
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
#include "raymath.h"
|
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#include <stdlib.h> // malloc(), free()
|
#include <stdlib.h> // malloc(), free()
|
||||||
|
@ -126,6 +125,7 @@ static float pinchDelta = 0;
|
||||||
|
|
||||||
// Detected gesture
|
// Detected gesture
|
||||||
static int currentGesture = GESTURE_NONE;
|
static int currentGesture = GESTURE_NONE;
|
||||||
|
unsigned int enabledGestures = 0; // TODO: Currently not in use...
|
||||||
|
|
||||||
static Vector2 touchPosition;
|
static Vector2 touchPosition;
|
||||||
|
|
||||||
|
@ -185,40 +185,45 @@ int GetGestureType(void)
|
||||||
return currentGesture;
|
return currentGesture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetGesturesEnabled(unsigned int gestureFlags)
|
||||||
|
{
|
||||||
|
enabledGestures = gestureFlags;
|
||||||
|
}
|
||||||
|
|
||||||
// Get drag intensity (pixels per frame)
|
// Get drag intensity (pixels per frame)
|
||||||
float GetDragIntensity(void)
|
float GetGestureDragIntensity(void)
|
||||||
{
|
{
|
||||||
return intensity;
|
return intensity;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get drag angle
|
// Get drag angle
|
||||||
// NOTE: Angle in degrees, horizontal-right is 0, counterclock-wise
|
// NOTE: Angle in degrees, horizontal-right is 0, counterclock-wise
|
||||||
float GetDragAngle(void)
|
float GetGestureDragAngle(void)
|
||||||
{
|
{
|
||||||
return angle;
|
return angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get drag vector (between initial and final position)
|
// Get drag vector (between initial and final position)
|
||||||
Vector2 GetDragVector(void)
|
Vector2 GetGestureDragVector(void)
|
||||||
{
|
{
|
||||||
return dragVector;
|
return dragVector;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hold time measured in frames
|
// Hold time measured in frames
|
||||||
int GetHoldDuration(void)
|
int GetGestureHoldDuration(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get magnitude between two pinch points
|
// Get magnitude between two pinch points
|
||||||
float GetPinchDelta(void)
|
float GetGesturePinchDelta(void)
|
||||||
{
|
{
|
||||||
return pinchDelta;
|
return pinchDelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get angle beween two pinch points
|
// Get angle beween two pinch points
|
||||||
// NOTE: Angle in degrees, horizontal-right is 0, counterclock-wise
|
// NOTE: Angle in degrees, horizontal-right is 0, counterclock-wise
|
||||||
float GetPinchAngle(void)
|
float GetGesturePinchAngle(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -417,7 +422,6 @@ extern void ProcessMotionEvent(GestureEvent event)
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static float CalculateAngle(Vector2 initialPosition, Vector2 actualPosition, float magnitude)
|
static float CalculateAngle(Vector2 initialPosition, Vector2 actualPosition, float magnitude)
|
||||||
{
|
{
|
||||||
float angle;
|
float angle;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue